regclass.c (record_reg_classes): '?' increases cost by two.
authorJ"orn Rennecke <amylaar@cygnus.co.uk>
Thu, 26 Mar 1998 10:44:22 +0000 (10:44 +0000)
committerJoern Rennecke <amylaar@gcc.gnu.org>
Thu, 26 Mar 1998 10:44:22 +0000 (10:44 +0000)
* regclass.c (record_reg_classes): '?' increases cost by two.
* reload.c (find_reloads): Double previous costs.  Output
reloads cost one unit extra.
* reload1.c (eliminate_regs): Delete LOAD_EXTENDED_OP code that
boiled down to && ! 0.
* reload.c (find_equiv_reg): Also consider a goal offset from the
frame pointer to be constant.

From-SVN: r18842

gcc/ChangeLog
gcc/regclass.c
gcc/reload.c
gcc/reload1.c

index 9087de5..7ed217f 100644 (file)
@@ -1,3 +1,16 @@
+Thu Mar 26 18:34:13 1998  J"orn Rennecke <amylaar@cygnus.co.uk>
+
+       * regclass.c (record_reg_classes): '?' increases cost by two.
+
+       * reload.c (find_reloads): Double previous costs.  Output
+       reloads cost one unit extra.
+
+       * reload1.c (eliminate_regs): Delete LOAD_EXTENDED_OP code that
+       boiled down to && ! 0.
+
+       * reload.c (find_equiv_reg): Also consider a goal offset from the
+       frame pointer to be constant.
+
 Thu Mar 26 17:34:46 1998  J"orn Rennecke <amylaar@cygnus.co.uk>
 
        * sh.h (OPTIMIZATION_OPTIONS): Define.
index 1114ba7..396222b 100644 (file)
@@ -1189,8 +1189,10 @@ record_reg_classes (n_alts, n_ops, ops, modes, constraints, insn)
                p++;
                break;
 
+             case '?':
+               alt_cost += 2;
              case '%':
-             case '?':  case '!':  case '#':
+             case '!':  case '#':
              case '&':
              case '0':  case '1':  case '2':  case '3':  case '4':
              case 'p':
index 2783686..e89c251 100644 (file)
@@ -2670,7 +2670,7 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p)
      or got the wrong kind of hard reg.  For this, we must consider
      all the operands together against the register constraints.  */
 
-  best = MAX_RECOG_OPERANDS + 300;
+  best = MAX_RECOG_OPERANDS * 2 + 600;
 
   swapped = 0;
   goal_alternative_swapped = 0;
@@ -2836,11 +2836,11 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p)
                break;
 
              case '?':
-               reject += 3;
+               reject += 6;
                break;
 
              case '!':
-               reject = 300;
+               reject = 600;
                break;
 
              case '#':
@@ -3227,6 +3227,11 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p)
                     && REGNO (operand) >= FIRST_PSEUDO_REGISTER)
                  && GET_CODE (operand) != SCRATCH
                  && ! (const_to_mem && constmemok))
+               reject += 2;
+
+             /* Input reloads can be inherited more often than output
+                reloads can be removed, so penalize output reloads.  */
+             if (operand_type[i] != RELOAD_FOR_INPUT)
                reject++;
            }
 
@@ -3267,7 +3272,7 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p)
                                          this_alternative[i]))
                    this_alternative[i] = (int) preferred_class[i];
                  else
-                   reject += (1 + pref_or_nothing[i]);
+                   reject += (2 + 2 * pref_or_nothing[i]);
                }
            }
        }
@@ -3374,9 +3379,9 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p)
 
       /* REJECT, set by the ! and ? constraint characters and when a register
         would be reloaded into a non-preferred class, discourages the use of
-        this alternative for a reload goal.  REJECT is incremented by three
-        for each ? and one for each non-preferred class.  */
-      losers = losers * 3 + reject;
+        this alternative for a reload goal.  REJECT is incremented by six
+        for each ? and two for each non-preferred class.  */
+      losers = losers * 6 + reject;
 
       /* If this alternative can be made to work by reloading,
         and it needs less reloading than the others checked so far,
@@ -5705,6 +5710,10 @@ find_equiv_reg (goal, insn, class, other, reload_reg_p, goalreg, mode)
           && XEXP (goal, 0) == stack_pointer_rtx
           && CONSTANT_P (XEXP (goal, 1)))
     goal_const = need_stable_sp = 1;
+  else if (GET_CODE (goal) == PLUS
+          && XEXP (goal, 0) == frame_pointer_rtx
+          && CONSTANT_P (XEXP (goal, 1)))
+    goal_const = 1;
   else
     return 0;
 
index 6b2720a..aeb2a62 100644 (file)
@@ -3133,18 +3133,6 @@ eliminate_regs (x, mem_mode, insn)
 #endif
                   )
                  || (x_size == new_size))
-#ifdef LOAD_EXTEND_OP
-             /* On these machines we will be reloading what is
-                inside the SUBREG if it originally was a pseudo and
-                the inner and outer modes are both a word or
-                smaller.  So leave the SUBREG then.  */
-             && ! (GET_CODE (SUBREG_REG (x)) == REG
-                   && x_size <= UNITS_PER_WORD
-                   && new_size <= UNITS_PER_WORD
-                   && x_size > new_size
-                   && INTEGRAL_MODE_P (GET_MODE (new))
-                   && LOAD_EXTEND_OP (GET_MODE (new)) != NIL)
-#endif
              )
            {
              int offset = SUBREG_WORD (x) * UNITS_PER_WORD;