summaryrefslogtreecommitdiff
path: root/gcc/regclass.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/regclass.c')
-rw-r--r--gcc/regclass.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/gcc/regclass.c b/gcc/regclass.c
index 84bf97f21db..08051cdb642 100644
--- a/gcc/regclass.c
+++ b/gcc/regclass.c
@@ -1317,7 +1317,7 @@ regclass (f, nregs, dump)
/* In non-optimizing compilation REG_N_REFS is not initialized
yet. */
- if (optimize && !REG_N_REFS (i))
+ if (optimize && !REG_N_REFS (i) && !REG_N_SETS (i))
continue;
for (class = (int) ALL_REGS - 1; class > 0; class--)
@@ -2397,6 +2397,8 @@ reg_scan_mark_refs (x, insn, note_flag, min_regno)
rtx dest;
rtx note;
+ if (!x)
+ return;
code = GET_CODE (x);
switch (code)
{
@@ -2423,6 +2425,10 @@ reg_scan_mark_refs (x, insn, note_flag, min_regno)
REGNO_LAST_UID (regno) = INSN_UID (insn);
if (REGNO_FIRST_UID (regno) == 0)
REGNO_FIRST_UID (regno) = INSN_UID (insn);
+ /* If we are called by reg_scan_update() (indicated by min_regno
+ being set), we also need to update the reference count. */
+ if (min_regno)
+ REG_N_REFS (regno)++;
}
}
break;
@@ -2439,6 +2445,18 @@ reg_scan_mark_refs (x, insn, note_flag, min_regno)
reg_scan_mark_refs (XEXP (x, 1), insn, note_flag, min_regno);
break;
+ case CLOBBER:
+ {
+ rtx reg = XEXP (x, 0);
+ if (REG_P (reg)
+ && REGNO (reg) >= min_regno)
+ {
+ REG_N_SETS (REGNO (reg))++;
+ REG_N_REFS (REGNO (reg))++;
+ }
+ }
+ break;
+
case SET:
/* Count a set of the destination if it is a register. */
for (dest = SET_DEST (x);