summaryrefslogtreecommitdiff
path: root/gcc/stupid.c
diff options
context:
space:
mode:
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1996-03-20 13:04:28 +0000
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1996-03-20 13:04:28 +0000
commit89b000f34e3843ba71e8d80aa0934188c2a49602 (patch)
tree9ba21bcb4d67ed212b4f70d9c075a93a80b0e31b /gcc/stupid.c
parenta342a09c6d9e625137c62770e81f4ccc37de3adf (diff)
downloadgcc-89b000f34e3843ba71e8d80aa0934188c2a49602.tar.gz
(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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@11573 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/stupid.c')
-rw-r--r--gcc/stupid.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/gcc/stupid.c b/gcc/stupid.c
index 6034b818fba..f8fc9d9d605 100644
--- a/gcc/stupid.c
+++ b/gcc/stupid.c
@@ -65,6 +65,11 @@ static int *uid_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 is 0 if register N has not been seen yet on backward scan. */
@@ -88,6 +93,10 @@ static char *regs_live;
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. */
static HARD_REG_SET *after_insn_hard_regs;
@@ -148,6 +157,7 @@ stupid_life_analysis (f, nregs, file)
}
last_call_suid = i + 1;
+ last_setjmp_suid = i + 1;
max_suid = i + 1;
max_regno = nregs;
@@ -166,6 +176,9 @@ stupid_life_analysis (f, nregs, file)
regs_change_size = (char *) alloca (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));
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
reg_renumber[i] = i;
@@ -215,6 +228,10 @@ stupid_life_analysis (f, nregs, file)
if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
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
so that a pseudo whose life span includes this insn
will not go in one of them.
@@ -253,8 +270,9 @@ stupid_life_analysis (f, nregs, file)
{
register int r = reg_order[i];
- /* Some regnos disappear from the rtl. Ignore them to avoid crash. */
- if (regno_reg_rtx[r] == 0)
+ /* Some regnos disappear from the rtl. Ignore them to avoid crash.
+ Also don't allocate registers that cross a setjmp. */
+ if (regno_reg_rtx[r] == 0 || regs_crosses_setjmp[r])
continue;
/* Now find the best hard-register class for this pseudo register */
@@ -494,6 +512,9 @@ stupid_mark_refs (x, insn)
if (last_call_suid < reg_where_dead[regno])
reg_n_calls_crossed[regno] += 1;
+
+ if (last_setjmp_suid < reg_where_dead[regno])
+ regs_crosses_setjmp[regno] = 1;
}
}