]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Handle multiword hard regs properly in find_equiv_reg
authorBernd Schmidt <bernds@redhat.co.uk>
Wed, 20 Dec 2000 13:47:24 +0000 (13:47 +0000)
committerBernd Schmidt <bernds@gcc.gnu.org>
Wed, 20 Dec 2000 13:47:24 +0000 (13:47 +0000)
From-SVN: r38396

gcc/ChangeLog
gcc/reload.c

index 09a5fad232179e2163cf450ef25bbfd50586ed8a..49b0610895a2e1c9221593f9a682317ec070aad9 100644 (file)
@@ -1,3 +1,17 @@
+2000-12-20  Bernd Schmidt  <bernds@redhat.co.uk>
+
+       Thu Nov  2 19:20:12 2000  J"orn Rennecke <amylaar@redhat.com>
+       * reload.c (find_equiv_reg): Test all hard registers for membership
+       in the requested class.
+
+       Sun Apr 23 16:24:35 2000  Denis Chertykov  <denisc@overta.ru>
+       * reload.c (find_equiv_reg): Checks all valueno regs
+       as a reload_reg_p regs.
+
+       Fri Apr 21 14:58:29 2000  Denis Chertykov  <denisc@overta.ru>
+       * reload.c (find_equiv_reg): Checks all valueno and regno regs
+       as a call-clobbered regs.
+
 2000-12-18  Bernd Schmidt  <bernds@redhat.co.uk>
 
        2000-09-15  Bernd Schmidt  <bernds@redhat.co.uk>
index 7aa297150e80039bde1009b011a7bcf15a0510ce..5b828670df2f18d9579c734187d3212ec91fd2a9 100644 (file)
@@ -6274,16 +6274,29 @@ find_equiv_reg (goal, insn, class, other, reload_reg_p, goalreg, mode)
                      && (valtry
                          = operand_subword (SET_DEST (pat), 1, 0, VOIDmode))
                      && (valueno = true_regnum (valtry)) >= 0)))
-           if (other >= 0
-               ? valueno == other
-               : ((unsigned) valueno < FIRST_PSEUDO_REGISTER
-                  && TEST_HARD_REG_BIT (reg_class_contents[(int) class],
-                                        valueno)))
-             {
-               value = valtry;
-               where = p;
-               break;
-             }
+           {
+             if (other >= 0)
+               {
+                 if (valueno != other)
+                   continue;
+               }
+             else if ((unsigned) valueno >= FIRST_PSEUDO_REGISTER)
+               continue;
+             else
+               {
+                 int i;
+
+                 for (i = HARD_REGNO_NREGS (valueno, mode) - 1; i >= 0; i--)
+                   if (! TEST_HARD_REG_BIT (reg_class_contents[(int) class],
+                                            valueno + i))
+                     break;
+                 if (i >= 0)
+                   continue;
+               }
+             value = valtry;
+             where = p;
+             break;
+           }
        }
     }
 
@@ -6326,15 +6339,22 @@ find_equiv_reg (goal, insn, class, other, reload_reg_p, goalreg, mode)
       && regno < valueno + HARD_REGNO_NREGS (valueno, mode))
     return 0;
 
+  nregs = HARD_REGNO_NREGS (regno, mode);
+  valuenregs = HARD_REGNO_NREGS (valueno, mode);
+
   /* Reject VALUE if it is one of the regs reserved for reloads.
      Reload1 knows how to reuse them anyway, and it would get
      confused if we allocated one without its knowledge.
      (Now that insns introduced by reload are ignored above,
      this case shouldn't happen, but I'm not positive.)  */
 
-  if (reload_reg_p != 0 && reload_reg_p != (short *) (HOST_WIDE_INT) 1
-      && reload_reg_p[valueno] >= 0)
-    return 0;
+  if (reload_reg_p != 0 && reload_reg_p != (short *) (HOST_WIDE_INT) 1)
+    {
+      int i;
+      for (i = 0; i < valuenregs; ++i)
+       if (reload_reg_p[valueno + i] >= 0)
+         return 0;
+    }
 
   /* On some machines, certain regs must always be rejected
      because they don't behave the way ordinary registers do.  */
@@ -6344,9 +6364,6 @@ find_equiv_reg (goal, insn, class, other, reload_reg_p, goalreg, mode)
     return 0;
 #endif      
 
-  nregs = HARD_REGNO_NREGS (regno, mode);
-  valuenregs = HARD_REGNO_NREGS (valueno, mode);
-
   /* Reject VALUE if it is a register being used for an input reload
      even if it is not one of those reserved.  */
 
@@ -6382,16 +6399,23 @@ find_equiv_reg (goal, insn, class, other, reload_reg_p, goalreg, mode)
 
       /* Don't trust the conversion past a function call
         if either of the two is in a call-clobbered register, or memory.  */
-      if (GET_CODE (p) == CALL_INSN
-         && ((regno >= 0 && regno < FIRST_PSEUDO_REGISTER
-              && call_used_regs[regno])
-             ||
-             (valueno >= 0 && valueno < FIRST_PSEUDO_REGISTER
-              && call_used_regs[valueno])
-             ||
-             goal_mem
-             || need_stable_sp))
-       return 0;
+      if (GET_CODE (p) == CALL_INSN)
+       {
+         int i;
+
+         if (goal_mem || need_stable_sp)
+           return 0;
+
+         if (regno >= 0 && regno < FIRST_PSEUDO_REGISTER)
+           for (i = 0; i < nregs; ++i)
+             if (call_used_regs[regno + i])
+               return 0;
+
+         if (valueno >= 0 && valueno < FIRST_PSEUDO_REGISTER)
+           for (i = 0; i < valuenregs; ++i)
+             if (call_used_regs[valueno + i])
+               return 0;
+       }
 
 #ifdef NON_SAVING_SETJMP 
       if (NON_SAVING_SETJMP && GET_CODE (p) == NOTE