OSDN Git Service

gcc/
[pf3gnuchains/gcc-fork.git] / gcc / reload.c
index 50af5d5..aa22671 100644 (file)
@@ -1717,7 +1717,7 @@ combine_reloads (void)
     return;
 
   /* If there is a reload for part of the address of this operand, we would
-     need to chnage it to RELOAD_FOR_OTHER_ADDRESS.  But that would extend
+     need to change it to RELOAD_FOR_OTHER_ADDRESS.  But that would extend
      its life to the point where doing this combine would not lower the
      number of spill registers needed.  */
   for (i = 0; i < n_reloads; i++)
@@ -4570,7 +4570,7 @@ find_reloads_toplev (rtx x, int opnum, enum reload_type type,
              x = mem;
              i = find_reloads_address (GET_MODE (x), &x, XEXP (x, 0), &XEXP (x, 0),
                                        opnum, type, ind_levels, insn);
-             if (x != mem)
+             if (!rtx_equal_p (x, mem))
                push_reg_equiv_alt_mem (regno, x);
              if (address_reloaded)
                *address_reloaded = i;
@@ -4785,7 +4785,7 @@ find_reloads_address (enum machine_mode mode, rtx *memrefloc, rtx ad,
                  find_reloads_address (GET_MODE (tem), &tem, XEXP (tem, 0),
                                        &XEXP (tem, 0), opnum,
                                        ADDR_TYPE (type), ind_levels, insn);
-                 if (tem != orig)
+                 if (!rtx_equal_p (tem, orig))
                    push_reg_equiv_alt_mem (regno, tem);
                }
              /* We can avoid a reload if the register's equivalent memory
@@ -5543,16 +5543,20 @@ find_reloads_address_1 (enum machine_mode mode, rtx x, int context,
           auto-modify by a constant then we could try replacing a pseudo
           register with its equivalent constant where applicable.
 
+          We also handle the case where the register was eliminated
+          resulting in a PLUS subexpression.
+
           If we later decide to reload the whole PRE_MODIFY or
           POST_MODIFY, inc_for_reload might clobber the reload register
           before reading the index.  The index register might therefore
           need to live longer than a TYPE reload normally would, so be
           conservative and class it as RELOAD_OTHER.  */
-       if (REG_P (XEXP (op1, 1)))
-         if (!REGNO_OK_FOR_INDEX_P (REGNO (XEXP (op1, 1))))
-           find_reloads_address_1 (mode, XEXP (op1, 1), 1, code, SCRATCH,
-                                   &XEXP (op1, 1), opnum, RELOAD_OTHER,
-                                   ind_levels, insn);
+       if ((REG_P (XEXP (op1, 1))
+            && !REGNO_OK_FOR_INDEX_P (REGNO (XEXP (op1, 1))))
+           || GET_CODE (XEXP (op1, 1)) == PLUS)
+         find_reloads_address_1 (mode, XEXP (op1, 1), 1, code, SCRATCH,
+                                 &XEXP (op1, 1), opnum, RELOAD_OTHER,
+                                 ind_levels, insn);
 
        gcc_assert (REG_P (XEXP (op1, 0)));
 
@@ -5585,7 +5589,7 @@ find_reloads_address_1 (enum machine_mode mode, rtx x, int context,
                                      RELOAD_OTHER,
                                      ind_levels, insn);
 
-               if (tem != orig)
+               if (!rtx_equal_p (tem, orig))
                  push_reg_equiv_alt_mem (regno, tem);
 
                /* Then reload the memory location into a base
@@ -5652,7 +5656,7 @@ find_reloads_address_1 (enum machine_mode mode, rtx x, int context,
                  find_reloads_address (GET_MODE (tem), &tem, XEXP (tem, 0),
                                        &XEXP (tem, 0), opnum, type,
                                        ind_levels, insn);
-                 if (tem != orig)
+                 if (!rtx_equal_p (tem, orig))
                    push_reg_equiv_alt_mem (regno, tem);
                  /* Put this inside a new increment-expression.  */
                  x = gen_rtx_fmt_e (GET_CODE (x), GET_MODE (x), tem);
@@ -5733,43 +5737,6 @@ find_reloads_address_1 (enum machine_mode mode, rtx x, int context,
            }
          return value;
        }
-
-      else if (MEM_P (XEXP (x, 0)))
-       {
-         /* This is probably the result of a substitution, by eliminate_regs,
-            of an equivalent address for a pseudo that was not allocated to a
-            hard register.  Verify that the specified address is valid and
-            reload it into a register.  */
-         /* Variable `tem' might or might not be used in FIND_REG_INC_NOTE.  */
-         rtx tem ATTRIBUTE_UNUSED = XEXP (x, 0);
-         rtx link;
-         int reloadnum;
-
-         /* Since we know we are going to reload this item, don't decrement
-            for the indirection level.
-
-            Note that this is actually conservative:  it would be slightly
-            more efficient to use the value of SPILL_INDIRECT_LEVELS from
-            reload1.c here.  */
-         /* We can't use ADDR_TYPE (type) here, because we need to
-            write back the value after reading it, hence we actually
-            need two registers.  */
-         find_reloads_address (GET_MODE (x), &XEXP (x, 0),
-                               XEXP (XEXP (x, 0), 0), &XEXP (XEXP (x, 0), 0),
-                               opnum, type, ind_levels, insn);
-
-         reloadnum = push_reload (x, NULL_RTX, loc, (rtx*) 0,
-                                  context_reg_class,
-                                  GET_MODE (x), VOIDmode, 0, 0, opnum, type);
-         rld[reloadnum].inc
-           = find_inc_amount (PATTERN (this_insn), XEXP (x, 0));
-
-         link = FIND_REG_INC_NOTE (this_insn, tem);
-         if (link != 0)
-           push_replacement (&XEXP (link, 0), reloadnum, VOIDmode);
-
-         return 1;
-       }
       return 0;
 
     case TRUNCATE:
@@ -5844,7 +5811,7 @@ find_reloads_address_1 (enum machine_mode mode, rtx x, int context,
                find_reloads_address (GET_MODE (x), &x, XEXP (x, 0),
                                      &XEXP (x, 0), opnum, ADDR_TYPE (type),
                                      ind_levels, insn);
-               if (x != tem)
+               if (!rtx_equal_p (x, tem))
                  push_reg_equiv_alt_mem (regno, x);
              }
          }
@@ -6070,7 +6037,7 @@ find_reloads_subreg_address (rtx x, int force_replace, int opnum,
                                    &XEXP (tem, 0), opnum, type,
                                    ind_levels, insn);
              /* ??? Do we need to handle nonzero offsets somehow?  */
-             if (!offset && tem != orig)
+             if (!offset && !rtx_equal_p (tem, orig))
                push_reg_equiv_alt_mem (regno, tem);
 
              /* If this is not a toplevel operand, find_reloads doesn't see