reload.c (find_reloads): Do not use the mode specified in the insn pattern as reload...
authorUlrich Weigand <uweigand@de.ibm.com>
Tue, 4 Feb 2003 22:47:23 +0000 (22:47 +0000)
committerUlrich Weigand <uweigand@gcc.gnu.org>
Tue, 4 Feb 2003 22:47:23 +0000 (22:47 +0000)
* reload.c (find_reloads): Do not use the mode specified in the insn
pattern as reload mode for address operands.  Do not generate optional
reloads for operands where a mandatory reload was already pushed.

From-SVN: r62410

gcc/ChangeLog
gcc/reload.c

index 411627d7a706bac086194f092d25332344a52f00..dfafdec874aa44d5f82bdac464e3d35a47881a45 100644 (file)
@@ -1,3 +1,9 @@
+2003-02-04  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       * reload.c (find_reloads): Do not use the mode specified in the insn
+       pattern as reload mode for address operands.  Do not generate optional 
+       reloads for operands where a mandatory reload was already pushed.
+
 2003-02-04  Richard Henderson  <rth@redhat.com>
 
        * longlong.h [alpha] (count_leading_zeros, count_trailing_zeros): Use
index 46d0d6417df02b41b73bb22c36dbaa8c3ac30b96..a2642aa7349973d080ff19a37fa9f5329de1cd52 100644 (file)
@@ -2476,6 +2476,8 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p)
   char pref_or_nothing[MAX_RECOG_OPERANDS];
   /* Nonzero for a MEM operand whose entire address needs a reload.  */
   int address_reloaded[MAX_RECOG_OPERANDS];
+  /* Nonzero for an address operand that needs to be completely reloaded.  */
+  int address_operand_reloaded[MAX_RECOG_OPERANDS];
   /* Value of enum reload_type to use for operand.  */
   enum reload_type operand_type[MAX_RECOG_OPERANDS];
   /* Value of enum reload_type to use within address of operand.  */
@@ -2655,6 +2657,7 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p)
       RTX_CODE code = GET_CODE (recog_data.operand[i]);
 
       address_reloaded[i] = 0;
+      address_operand_reloaded[i] = 0;
       operand_type[i] = (modified[i] == RELOAD_READ ? RELOAD_FOR_INPUT
                         : modified[i] == RELOAD_WRITE ? RELOAD_FOR_OUTPUT
                         : RELOAD_OTHER);
@@ -2669,10 +2672,11 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p)
       else if (constraints[i][0] == 'p'
               || EXTRA_ADDRESS_CONSTRAINT (constraints[i][0], constraints[i]))
        {
-         find_reloads_address (recog_data.operand_mode[i], (rtx*) 0,
-                               recog_data.operand[i],
-                               recog_data.operand_loc[i],
-                               i, operand_type[i], ind_levels, insn);
+         address_operand_reloaded[i]
+           = find_reloads_address (recog_data.operand_mode[i], (rtx*) 0,
+                                   recog_data.operand[i],
+                                   recog_data.operand_loc[i],
+                                   i, operand_type[i], ind_levels, insn);
 
          /* If we now have a simple operand where we used to have a
             PLUS or MULT, re-recognize and try again.  */
@@ -2689,6 +2693,10 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p)
 
          recog_data.operand[i] = *recog_data.operand_loc[i];
          substed_operand[i] = recog_data.operand[i];
+
+         /* Address operands are reloaded in their existing mode,
+            no matter what is specified in the machine description.  */
+         operand_mode[i] = GET_MODE (recog_data.operand[i]);
        }
       else if (code == MEM)
        {
@@ -3302,10 +3310,6 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p)
                           the address into a base register.  */
                        this_alternative[i] = (int) MODE_BASE_REG_CLASS (VOIDmode);
                        badop = 0;
-
-                       /* Address constraints are reloaded in Pmode, no matter
-                          what mode is given in the machine description.  */
-                       operand_mode[i] = Pmode;
                        break;
                      }
 
@@ -3878,6 +3882,7 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p)
       }
     else if (goal_alternative_matched[i] < 0
             && goal_alternative_matches[i] < 0
+            && !address_operand_reloaded[i]
             && optimize)
       {
        /* For each non-matching operand that's a MEM or a pseudo-register