From 3d17d93d9fe5c1141c319158e756f6b9b6300f86 Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Sat, 29 Sep 2001 21:52:12 +0000 Subject: [PATCH] reload.c (find_reloads): Mark new USE insns with QImode. * 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 | 12 ++++++++++++ gcc/regrename.c | 10 ++++++++++ gcc/reload.c | 32 +++++++++++++++++++++++++++----- gcc/reload1.c | 23 ++++++++++++++++++----- 4 files changed, 67 insertions(+), 10 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 15c1e610be0a..8e5d1827c60d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2001-09-29 Alexandre Oliva + + * 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 * cppdefault.c (cpp_include_defaults): Also search PREFIX_INCLUDE_DIR. diff --git a/gcc/regrename.c b/gcc/regrename.c index afee0d79ec9b..c0cf2326360d 100644 --- a/gcc/regrename.c +++ b/gcc/regrename.c @@ -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); } diff --git a/gcc/reload.c b/gcc/reload.c index 8e6d2b3afbf4..cde346091274 100644 --- a/gcc/reload.c +++ b/gcc/reload.c @@ -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; } } diff --git a/gcc/reload1.c b/gcc/reload1.c index 820843257a28..bc3456f931cb 100644 --- a/gcc/reload1.c +++ b/gcc/reload1.c @@ -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));