diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-11-13 16:45:18 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-11-13 16:45:18 +0000 |
commit | bf42c62d563e07d9742288cf34dd937591335103 (patch) | |
tree | d66cd731e9536db2b2295ea3338e767b3dac7a71 /gcc/emit-rtl.c | |
parent | bd276a5ad2656aa694e0e0161a2123cd37e7404b (diff) | |
download | gcc-bf42c62d563e07d9742288cf34dd937591335103.tar.gz |
* emit-rtl.c (adjust_address_1): Add ADJUST argument.
(adjust_automodify_address_1): New.
* expr.h (adjust_address, adjust_address_nv): Adjust.
(adjust_automodify_address, adjust_automodify_address_nv): Define.
(adjust_address_1): Update prototype.
(adjust_automodify_address_1): Add prototype.
* expr.c (move_by_pieces_1): Use adjust_automodify_address.
(store_by_pieces_2): Likewise.
* gcc.c-torture/execute/20011113-1.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@46988 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/emit-rtl.c')
-rw-r--r-- | gcc/emit-rtl.c | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index 6460a947e5f..3729233ff99 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -1870,14 +1870,16 @@ change_address (memref, mode, addr) /* Return a memory reference like MEMREF, but with its mode changed to MODE and its address offset by OFFSET bytes. If VALIDATE is - nonzero, the memory address is forced to be valid. */ + nonzero, the memory address is forced to be valid. + If ADJUST is zero, OFFSET is only used to update MEM_ATTRS + and caller is responsible for adjusting MEMREF base register. */ rtx -adjust_address_1 (memref, mode, offset, validate) +adjust_address_1 (memref, mode, offset, validate, adjust) rtx memref; enum machine_mode mode; HOST_WIDE_INT offset; - int validate; + int validate, adjust; { rtx addr = XEXP (memref, 0); rtx new; @@ -1885,17 +1887,17 @@ adjust_address_1 (memref, mode, offset, validate) rtx size = 0; unsigned int memalign = MEM_ALIGN (memref); + if (adjust == 0 || offset == 0) + /* ??? Prefer to create garbage instead of creating shared rtl. */ + addr = copy_rtx (addr); /* If MEMREF is a LO_SUM and the offset is within the alignment of the object, we can merge it into the LO_SUM. */ - if (GET_MODE (memref) != BLKmode && GET_CODE (addr) == LO_SUM - && offset >= 0 - && (unsigned HOST_WIDE_INT) offset - < GET_MODE_ALIGNMENT (GET_MODE (memref)) / BITS_PER_UNIT) + else if (GET_MODE (memref) != BLKmode && GET_CODE (addr) == LO_SUM + && offset >= 0 + && (unsigned HOST_WIDE_INT) offset + < GET_MODE_ALIGNMENT (GET_MODE (memref)) / BITS_PER_UNIT) addr = gen_rtx_LO_SUM (Pmode, XEXP (addr, 0), plus_constant (XEXP (addr, 1), offset)); - else if (offset == 0) - /* ??? Prefer to create garbage instead of creating shared rtl. */ - addr = copy_rtx (addr); else addr = plus_constant (addr, offset); @@ -1926,6 +1928,23 @@ adjust_address_1 (memref, mode, offset, validate) return new; } +/* Return a memory reference like MEMREF, but with its mode changed + to MODE and its address changed to ADDR, which is assumed to be + MEMREF offseted by OFFSET bytes. If VALIDATE is + nonzero, the memory address is forced to be valid. */ + +rtx +adjust_automodify_address_1 (memref, mode, addr, offset, validate) + rtx memref; + enum machine_mode mode; + rtx addr; + HOST_WIDE_INT offset; + int validate; +{ + memref = change_address_1 (memref, VOIDmode, addr, validate); + return adjust_address_1 (memref, mode, offset, validate, 0); +} + /* Return a memory reference like MEMREF, but whose address is changed by adding OFFSET, an RTX, to it. POW2 is the highest power of two factor known to be in OFFSET (possibly 1). */ |