Verify class is ok when allocating reload reg in push_reload
authorBernd Schmidt <bernds@cygnus.co.uk>
Mon, 29 Nov 1999 12:09:54 +0000 (12:09 +0000)
committerBernd Schmidt <crux@gcc.gnu.org>
Mon, 29 Nov 1999 12:09:54 +0000 (12:09 +0000)
From-SVN: r30702

gcc/ChangeLog
gcc/reload.c

index 03127a89e5b6c0154fe7b2f98bdffde2ca921c22..a1a0e3980c472b2373aba9d339d2641217ef85b5 100644 (file)
@@ -1,5 +1,9 @@
 1999-11-29  Bernd Schmidt  <bernds@cygnus.co.uk>
 
+       * reload.c (push_reload): When looking for a register to put into
+       reg_rtx, make sure all hard regs in a multi-reg register are in the
+       right class and nonfixed.
+
        * haifa-sched.c (reg_last_uses, reg_last_sets, reg_last_clobbers,
        pending_read_insns, pending_write_insns, pending_read_mems,
        pending_write_mems, pending_list_length, last_pending_memory_flush,
index 46f29a069c77dafbeae8aa0f01e0634a44e74a96..3ad2a7f0b45930c22fef3adacf0d50207901d766 100644 (file)
@@ -1460,12 +1460,21 @@ push_reload (in, out, inloc, outloc, class,
            && GET_MODE_SIZE (inmode) <= GET_MODE_SIZE (GET_MODE (XEXP (note, 0)))
            && HARD_REGNO_MODE_OK (regno, inmode)
            && GET_MODE_SIZE (outmode) <= GET_MODE_SIZE (GET_MODE (XEXP (note, 0)))
-           && HARD_REGNO_MODE_OK (regno, outmode)
-           && TEST_HARD_REG_BIT (reg_class_contents[(int) class], regno)
-           && !fixed_regs[regno])
+           && HARD_REGNO_MODE_OK (regno, outmode))
          {
-           rld[i].reg_rtx = gen_rtx_REG (inmode, regno);
-           break;
+           int offs;
+           int nregs = HARD_REGNO_NREGS (regno, inmode);
+           for (offs = 0; offs < nregs; offs++)
+             if (fixed_regs[regno + offs]
+                 || ! TEST_HARD_REG_BIT (reg_class_contents[(int) class],
+                                         regno + offs))
+               break;
+
+           if (offs == nregs)
+             {
+               rld[i].reg_rtx = gen_rtx_REG (inmode, regno);
+               break;
+             }
          }
     }