reload.c (find_reloads): Mark new USE insns with QImode.
authorAlexandre Oliva <aoliva@redhat.com>
Sat, 29 Sep 2001 21:52:12 +0000 (21:52 +0000)
committerAlexandre Oliva <aoliva@gcc.gnu.org>
Sat, 29 Sep 2001 21:52:12 +0000 (21:52 +0000)
* reload.c (find_reloads): Mark new USE insns with QImode.
(find_reloads_toplev, find_reloads_address, subst_reg_equivs,
find_reloads_subreg_address): Likewise.
* regrename.c (note_sets, clear_dead_regs): Abort if pseudos are
encountered.
* reload1.c (reload_combine_note_use): Likewise, inside USEs and
CLOBBERs.
(reload): Make sure there are no USEs with mode other than
VOIDmode.  At the end, remove those marked with QImode.

From-SVN: r45889

gcc/ChangeLog
gcc/regrename.c
gcc/reload.c
gcc/reload1.c

index 15c1e610be0a5588e188378b7d01adb7e5fecf64..8e5d1827c60d248b6d10580cd0eaebb006a059bf 100644 (file)
@@ -1,3 +1,15 @@
+2001-09-29  Alexandre Oliva  <aoliva@redhat.com>
+
+       * reload.c (find_reloads): Mark new USE insns with QImode.
+       (find_reloads_toplev, find_reloads_address, subst_reg_equivs,
+       find_reloads_subreg_address): Likewise.
+       * regrename.c (note_sets, clear_dead_regs): Abort if pseudos are
+       encountered.
+       * reload1.c (reload_combine_note_use): Likewise, inside USEs and
+       CLOBBERs.
+       (reload): Make sure there are no USEs with mode other than
+       VOIDmode.  At the end, remove those marked with QImode.
+
 2001-09-29  Per Bothner  <per@bothner.com>
 
        * cppdefault.c (cpp_include_defaults):  Also search PREFIX_INCLUDE_DIR.
index afee0d79ec9b745364cbc858c9a77f9fb582d06a..c0cf2326360d74de1803ff99b1112ad833a181d4 100644 (file)
@@ -112,6 +112,11 @@ note_sets (x, set, data)
     return;
   regno = REGNO (x);
   nregs = HARD_REGNO_NREGS (regno, GET_MODE (x));
+
+  /* There must not be pseudos at this point.  */
+  if (regno + nregs > FIRST_PSEUDO_REGISTER)
+    abort ();
+
   while (nregs-- > 0)
     SET_HARD_REG_BIT (*pset, regno + nregs);
 }
@@ -132,6 +137,11 @@ clear_dead_regs (pset, kind, notes)
        rtx reg = XEXP (note, 0);
        unsigned int regno = REGNO (reg);
        int nregs = HARD_REGNO_NREGS (regno, GET_MODE (reg));
+
+       /* There must not be pseudos at this point.  */
+       if (regno + nregs > FIRST_PSEUDO_REGISTER)
+         abort ();
+
        while (nregs-- > 0)
          CLEAR_HARD_REG_BIT (*pset, regno + nregs);
       }
index 8e6d2b3afbf491acd29052f9ae881449bf4d88f8..cde346091274a315b6a73cb42d2b2c7be48f90fd 100644 (file)
@@ -3816,7 +3816,11 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p)
            if (GET_CODE (operand) == REG)
              {
                if (modified[i] != RELOAD_WRITE)
-                 emit_insn_before (gen_rtx_USE (VOIDmode, operand), insn);
+                 /* We mark the USE with QImode so that we recognize
+                    it as one that can be safely deleted at the end
+                    of reload.  */
+                 PUT_MODE (emit_insn_before (gen_rtx_USE (VOIDmode, operand),
+                                             insn), QImode);
                if (modified[i] != RELOAD_READ)
                  emit_insn_after (gen_rtx_CLOBBER (VOIDmode, operand), insn);
              }
@@ -4302,7 +4306,11 @@ find_reloads_toplev (x, opnum, type, ind_levels, is_set_dest, insn,
                 this substitution.  We have to emit a USE of the pseudo so
                 that delete_output_reload can see it.  */
              if (replace_reloads && recog_data.operand[opnum] != x)
-               emit_insn_before (gen_rtx_USE (VOIDmode, x), insn);
+               /* We mark the USE with QImode so that we recognize it
+                  as one that can be safely deleted at the end of
+                  reload.  */
+               PUT_MODE (emit_insn_before (gen_rtx_USE (VOIDmode, x), insn),
+                         QImode);
              x = mem;
              i = find_reloads_address (GET_MODE (x), &x, XEXP (x, 0), &XEXP (x, 0),
                                        opnum, type, ind_levels, insn);
@@ -4561,7 +4569,12 @@ find_reloads_address (mode, memrefloc, ad, loc, opnum, type, ind_levels, insn)
                      && ! rtx_equal_p (tem, reg_equiv_mem[regno]))
                    {
                      *loc = tem;
-                     emit_insn_before (gen_rtx_USE (VOIDmode, ad), insn);
+                     /* We mark the USE with QImode so that we
+                        recognize it as one that can be safely
+                        deleted at the end of reload.  */
+                     PUT_MODE (emit_insn_before (gen_rtx_USE (VOIDmode, ad),
+                                                 insn), QImode);
+
                      /* This doesn't really count as replacing the address
                         as a whole, since it is still a memory access.  */
                    }
@@ -4892,7 +4905,11 @@ subst_reg_equivs (ad, insn)
            if (! rtx_equal_p (mem, reg_equiv_mem[regno]))
              {
                subst_reg_equivs_changed = 1;
-               emit_insn_before (gen_rtx_USE (VOIDmode, ad), insn);
+               /* We mark the USE with QImode so that we recognize it
+                  as one that can be safely deleted at the end of
+                  reload.  */
+               PUT_MODE (emit_insn_before (gen_rtx_USE (VOIDmode, ad), insn),
+                         QImode);
                return mem;
              }
          }
@@ -5724,7 +5741,12 @@ find_reloads_subreg_address (x, force_replace, opnum, type,
                 this substitution.  We have to emit a USE of the pseudo so
                 that delete_output_reload can see it.  */
              if (replace_reloads && recog_data.operand[opnum] != x)
-               emit_insn_before (gen_rtx_USE (VOIDmode, SUBREG_REG (x)), insn);
+               /* We mark the USE with QImode so that we recognize it
+                  as one that can be safely deleted at the end of
+                  reload.  */
+               PUT_MODE (emit_insn_before (gen_rtx_USE (VOIDmode,
+                                                        SUBREG_REG (x)),
+                                           insn), QImode);
              x = tem;
            }
        }
index 820843257a28dc07caa02b6f4a838a45bfec24ee..bc3456f931cb17df19f6c7425fdee5d3948ba1da 100644 (file)
@@ -758,6 +758,13 @@ reload (first, global)
     {
       rtx set = single_set (insn);
 
+      /* We may introduce USEs that we want to remove at the end, so
+        we'll mark them with QImode.  Make sure there are no
+        previously-marked insns left by say regmove.  */
+      if (INSN_P (insn) && GET_CODE (PATTERN (insn)) == USE
+         && GET_MODE (insn) != VOIDmode)
+       PUT_MODE (insn, VOIDmode);
+
       if (GET_CODE (insn) == CALL_INSN
          && find_reg_note (insn, REG_SETJMP, NULL))
        for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
@@ -1183,7 +1190,9 @@ reload (first, global)
                                         CALL_INSN_FUNCTION_USAGE (insn));
 
        if ((GET_CODE (PATTERN (insn)) == USE
-            && find_reg_note (insn, REG_EQUAL, NULL_RTX))
+            /* We mark with QImode USEs introduced by reload itself.  */
+            && (GET_MODE (insn) == QImode
+                || find_reg_note (insn, REG_EQUAL, NULL_RTX)))
            || (GET_CODE (PATTERN (insn)) == CLOBBER
                && (GET_CODE (XEXP (PATTERN (insn), 0)) != REG
                    || ! REG_FUNCTION_VALUE_P (XEXP (PATTERN (insn), 0)))))
@@ -8929,7 +8938,12 @@ reload_combine_note_use (xp, insn)
 
     case CLOBBER:
       if (GET_CODE (SET_DEST (x)) == REG)
-       return;
+       {
+         /* No spurious CLOBBERs of pseudo registers may remain.  */
+         if (REGNO (SET_DEST (x)) >= FIRST_PSEUDO_REGISTER)
+           abort ();
+         return;
+       }
       break;
 
     case PLUS:
@@ -8946,10 +8960,9 @@ reload_combine_note_use (xp, insn)
        int use_index;
        int nregs;
 
-       /* Some spurious USEs of pseudo registers might remain.
-          Just ignore them.  */
+       /* No spurious USEs of pseudo registers may remain.  */
        if (regno >= FIRST_PSEUDO_REGISTER)
-         return;
+         abort ();
 
        nregs = HARD_REGNO_NREGS (regno, GET_MODE (x));