emit-rtl.c (adjust_address, [...]): Handle an address that is a LO_SUM specially.
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>
Mon, 9 Jul 2001 18:56:00 +0000 (18:56 +0000)
committerRichard Kenner <kenner@gcc.gnu.org>
Mon, 9 Jul 2001 18:56:00 +0000 (14:56 -0400)
* 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.

From-SVN: r43866

gcc/ChangeLog
gcc/emit-rtl.c
gcc/explow.c

index 6a0bbc4..18539e6 100644 (file)
@@ -1,5 +1,9 @@
 Mon Jul  9 06:41:07 2001  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
 
+       * 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.
index 3a96906..4187468 100644 (file)
@@ -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
index f7e00be..cafbf2e 100644 (file)
@@ -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;
     }