diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6a0bbc41780..18539e6cc27 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ Mon Jul 9 06:41:07 2001 Richard Kenner + * emit-rtl.c (adjust_address, adjust_address_nv): Handle an + address that is a LO_SUM specially. + * explow.c (plus_constant_wide, case LO_SUM): Deleted. + * c-lang.c (start_cdtor): Remove extra parameter from start_function. * emit-rtl.c (adjust_address_nv, replace_equiv_address_nv): New fcns. diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index 3a96906424e..4187468538d 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -1612,8 +1612,18 @@ adjust_address (memref, mode, offset) { /* For now, this is just a wrapper for change_address, but eventually will do memref tracking. */ - return - change_address (memref, mode, plus_constant (XEXP (memref, 0), offset)); + rtx addr = XEXP (memref, 0); + + /* If MEMREF is a LO_SUM and the offset is within the size of the + object, we can merge it into the LO_SUM. */ + if (GET_MODE (memref) != BLKmode && GET_CODE (addr) == LO_SUM + && offset >= 0 && offset < GET_MODE_SIZE (GET_MODE (memref))) + addr = gen_rtx_LO_SUM (mode, XEXP (addr, 0), + plus_constant (XEXP (addr, 1), offset)); + else + addr = plus_constant (addr, offset); + + return change_address (memref, mode, addr); } /* Likewise, but the reference is not required to be valid. */ @@ -1626,8 +1636,18 @@ adjust_address_nv (memref, mode, offset) { /* For now, this is just a wrapper for change_address, but eventually will do memref tracking. */ - return change_address_1 (memref, mode, - plus_constant (XEXP (memref, 0), offset), 0); + rtx addr = XEXP (memref, 0); + + /* If MEMREF is a LO_SUM and the offset is within the size of the + object, we can merge it into the LO_SUM. */ + if (GET_MODE (memref) != BLKmode && GET_CODE (addr) == LO_SUM + && offset >= 0 && offset < GET_MODE_SIZE (GET_MODE (memref))) + addr = gen_rtx_LO_SUM (mode, XEXP (addr, 0), + plus_constant (XEXP (addr, 1), offset)); + else + addr = plus_constant (addr, offset); + + return change_address_1 (memref, mode, addr, 0); } /* Return a memory reference like MEMREF, but with its address changed to diff --git a/gcc/explow.c b/gcc/explow.c index f7e00be1ce9..cafbf2e2afa 100644 --- a/gcc/explow.c +++ b/gcc/explow.c @@ -180,11 +180,6 @@ plus_constant_wide (x, c) } break; - case LO_SUM: - return gen_rtx_LO_SUM (mode, XEXP (x, 0), - plus_constant (XEXP (x, 1), c)); - - default: break; }