Commit 68f02135 by Richard Kenner

(last_setjmp_suid, regs_crosses_setjmp): New variables.

(stupid_life_analysis, stupid_mark_refs): Use them to track which
regs are live over a setjmp; don't allocate such regs.

From-SVN: r11573
parent ba9d9bfa
...@@ -65,6 +65,11 @@ static int *uid_suid; ...@@ -65,6 +65,11 @@ static int *uid_suid;
static int last_call_suid; static int last_call_suid;
/* Record the suid of the last NOTE_INSN_SETJMP
so we can tell whether a pseudo reg crosses any setjmp. */
static int last_setjmp_suid;
/* Element N is suid of insn where life span of pseudo reg N ends. /* Element N is suid of insn where life span of pseudo reg N ends.
Element is 0 if register N has not been seen yet on backward scan. */ Element is 0 if register N has not been seen yet on backward scan. */
...@@ -88,6 +93,10 @@ static char *regs_live; ...@@ -88,6 +93,10 @@ static char *regs_live;
static char *regs_change_size; static char *regs_change_size;
/* Indexed by reg number, nonzero if reg crosses a setjmp. */
static char *regs_crosses_setjmp;
/* Indexed by insn's suid, the set of hard regs live after that insn. */ /* Indexed by insn's suid, the set of hard regs live after that insn. */
static HARD_REG_SET *after_insn_hard_regs; static HARD_REG_SET *after_insn_hard_regs;
...@@ -148,6 +157,7 @@ stupid_life_analysis (f, nregs, file) ...@@ -148,6 +157,7 @@ stupid_life_analysis (f, nregs, file)
} }
last_call_suid = i + 1; last_call_suid = i + 1;
last_setjmp_suid = i + 1;
max_suid = i + 1; max_suid = i + 1;
max_regno = nregs; max_regno = nregs;
...@@ -166,6 +176,9 @@ stupid_life_analysis (f, nregs, file) ...@@ -166,6 +176,9 @@ stupid_life_analysis (f, nregs, file)
regs_change_size = (char *) alloca (nregs * sizeof (char)); regs_change_size = (char *) alloca (nregs * sizeof (char));
bzero ((char *) regs_change_size, nregs * sizeof (char)); bzero ((char *) regs_change_size, nregs * sizeof (char));
regs_crosses_setjmp = (char *) alloca (nregs * sizeof (char));
bzero ((char *) regs_crosses_setjmp, nregs * sizeof (char));
reg_renumber = (short *) oballoc (nregs * sizeof (short)); reg_renumber = (short *) oballoc (nregs * sizeof (short));
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
reg_renumber[i] = i; reg_renumber[i] = i;
...@@ -215,6 +228,10 @@ stupid_life_analysis (f, nregs, file) ...@@ -215,6 +228,10 @@ stupid_life_analysis (f, nregs, file)
if (GET_RTX_CLASS (GET_CODE (insn)) == 'i') if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
stupid_mark_refs (PATTERN (insn), insn); stupid_mark_refs (PATTERN (insn), insn);
if (GET_CODE (insn) == NOTE
&& NOTE_LINE_NUMBER (insn) == NOTE_INSN_SETJMP)
last_setjmp_suid = INSN_SUID (insn);
/* Mark all call-clobbered regs as live after each call insn /* Mark all call-clobbered regs as live after each call insn
so that a pseudo whose life span includes this insn so that a pseudo whose life span includes this insn
will not go in one of them. will not go in one of them.
...@@ -253,8 +270,9 @@ stupid_life_analysis (f, nregs, file) ...@@ -253,8 +270,9 @@ stupid_life_analysis (f, nregs, file)
{ {
register int r = reg_order[i]; register int r = reg_order[i];
/* Some regnos disappear from the rtl. Ignore them to avoid crash. */ /* Some regnos disappear from the rtl. Ignore them to avoid crash.
if (regno_reg_rtx[r] == 0) Also don't allocate registers that cross a setjmp. */
if (regno_reg_rtx[r] == 0 || regs_crosses_setjmp[r])
continue; continue;
/* Now find the best hard-register class for this pseudo register */ /* Now find the best hard-register class for this pseudo register */
...@@ -494,6 +512,9 @@ stupid_mark_refs (x, insn) ...@@ -494,6 +512,9 @@ stupid_mark_refs (x, insn)
if (last_call_suid < reg_where_dead[regno]) if (last_call_suid < reg_where_dead[regno])
reg_n_calls_crossed[regno] += 1; reg_n_calls_crossed[regno] += 1;
if (last_setjmp_suid < reg_where_dead[regno])
regs_crosses_setjmp[regno] = 1;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment