(form_sum): Change the way that form_sum canonicalizes addresses...
authorJim Wilson <wilson@gcc.gnu.org>
Tue, 28 Sep 1993 22:22:08 +0000 (15:22 -0700)
committerJim Wilson <wilson@gcc.gnu.org>
Tue, 28 Sep 1993 22:22:08 +0000 (15:22 -0700)
(form_sum): Change the way that form_sum canonicalizes
addresses, so that it never creates (PLUS (PLUS MEM CONST_INT) REG)
but instead canonicallizes this to (PLUS (PLUS REG CONST_INT) MEM).

From-SVN: r5506

gcc/reload.c

index a4558d6fea7d47ea8eb7282a00aa68fb1516159f..609414c8803867b20291d04cde4ec0091b52fa59 100644 (file)
@@ -4324,7 +4324,10 @@ form_sum (x, y)
 
   /* Note that if the operands of Y are specified in the opposite
      order in the recursive calls below, infinite recursion will occur.  */
-  if (GET_CODE (y) == PLUS && CONSTANT_P (XEXP (y, 1)))
+  if (GET_CODE (y) == PLUS && CONSTANT_P (XEXP (y, 1))
+      /* Moving the constant in with the MEM yields rtl that reload may not
+        be able to handle when this is an address calculation.  */
+      && GET_CODE (x) != MEM)
     return form_sum (form_sum (x, XEXP (y, 0)), XEXP (y, 1));
 
   /* If both constant, encapsulate sum.  Otherwise, just form sum.  A