pa.h (LEGITIMIZE_RELOAD_ADDRESS): Handle addresses created by LEGITIMIZE_RELOAD_ADDRESS.
authorJeffrey A Law <law@cygnus.com>
Wed, 8 Jul 1998 22:05:40 +0000 (22:05 +0000)
committerJeff Law <law@gcc.gnu.org>
Wed, 8 Jul 1998 22:05:40 +0000 (16:05 -0600)
        * pa.h (LEGITIMIZE_RELOAD_ADDRESS): Handle addresses created by
        LEGITIMIZE_RELOAD_ADDRESS.
        * tm.texi (LEGITIMIZE_RELOAD_ADDRESS): Note that this macro must be
        able to handle addresses created by previous invocations of the macro.

From-SVN: r21014

gcc/ChangeLog
gcc/config/pa/pa.h
gcc/tm.texi

index ced4434fdd4589e0f36b313e25cb16088fe546bd..964f026d0d9352553f123f537061af9966048d35 100644 (file)
@@ -1,5 +1,10 @@
 Wed Jul  8 21:43:14 1998  Jeffrey A Law  (law@cygnus.com)
 
+       * pa.h (LEGITIMIZE_RELOAD_ADDRESS): Handle addresses created by
+       LEGITIMIZE_RELOAD_ADDRESS.
+       * tm.texi (LEGITIMIZE_RELOAD_ADDRESS): Note that this macro must be
+       able to handle addresses created by previous invocations of the macro.
+
        * flow.c (find_auto_inc): Remove most recent change.  Real bug was
        elsewhere.
 
index 21d817d483db7ad23c79b50ea738e2115951c333..fb65b403fcb5ddfc984685b0c3b28cde57c06a9d 100644 (file)
@@ -1638,14 +1638,22 @@ extern struct rtx_def *hppa_builtin_saveregs ();
 #define LEGITIMIZE_RELOAD_ADDRESS(AD, MODE, OPNUM, TYPE, IND, WIN)     \
 do {                                                                   \
   int offset, newoffset, mask;                                         \
+  rtx new, temp = NULL_RTX;                                            \
   mask = GET_MODE_CLASS (MODE) == MODE_FLOAT ? 0x1f : 0x3fff;          \
                                                                        \
   if (optimize                                                         \
-      && GET_CODE (AD) == PLUS                                         \
-      && GET_CODE (XEXP (AD, 0)) == REG                                        \
-      && GET_CODE (XEXP (AD, 1)) == CONST_INT)                         \
+      && GET_CODE (AD) == PLUS)                                                \
+    temp = simplify_binary_operation (PLUS, Pmode,                     \
+                                     XEXP (AD, 0), XEXP (AD, 1));      \
+                                                                       \
+  new = temp ? temp : AD;                                              \
+                                                                       \
+  if (optimize                                                         \
+      && GET_CODE (new) == PLUS                                                \
+      && GET_CODE (XEXP (new, 0)) == REG                               \
+      && GET_CODE (XEXP (new, 1)) == CONST_INT)                                \
     {                                                                  \
-      offset = INTVAL (XEXP ((AD), 1));                                        \
+      offset = INTVAL (XEXP ((new), 1));                               \
                                                                        \
       /* Choose rounding direction.  Round up if we are >= halfway.  */        \
       if ((offset & mask) >= ((mask + 1) / 2))                         \
@@ -1656,11 +1664,8 @@ do {                                                                     \
       if (newoffset != 0                                               \
          && VAL_14_BITS_P (newoffset))                                 \
        {                                                               \
-         rtx temp;                                                     \
                                                                        \
-         /* Unshare the sum as well.  */                               \
-         AD = copy_rtx (AD);                                           \
-         temp = gen_rtx_PLUS (Pmode, XEXP (AD, 0),                     \
+         temp = gen_rtx_PLUS (Pmode, XEXP (new, 0),                    \
                               GEN_INT (newoffset));                    \
          AD = gen_rtx_PLUS (Pmode, temp, GEN_INT (offset - newoffset));\
          push_reload (XEXP (AD, 0), 0, &XEXP (AD, 0), 0,               \
index cfff3a0e63c31dcd3b0fd6690ce42e7355fdbfe6..32c5a75d053a5f0dbb1ec74304274e90ea661053 100644 (file)
@@ -4310,6 +4310,10 @@ to know something of how reload works in order to effectively use this,
 and it is quite easy to produce macros that build in too much knowledge
 of reload internals.
 
+@emph{Note}: This macro must be able to reload an address created by a
+previous invocation of this macro.  If it fails to handle such addresses
+then the compiler may generate incorrect code or abort.
+
 @findex push_reload
 The macro definition should use @code{push_reload} to indicate parts that
 need reloading; @var{opnum}, @var{type} and @var{ind_levels} are usually