aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1993-05-30 23:41:55 +0000
committerRichard Stallman <rms@gnu.org>1993-05-30 23:41:55 +0000
commit9a6cde3a01859dacb3fc2bf5ba8df1919678a751 (patch)
tree77f239a505dc8b5c21f6eb489f16db7ce58c8071 /gcc
parent5cf460ff62e48be48b6d624ed45446a98dbed7da (diff)
downloadgcc-9a6cde3a01859dacb3fc2bf5ba8df1919678a751.zip
gcc-9a6cde3a01859dacb3fc2bf5ba8df1919678a751.tar.gz
gcc-9a6cde3a01859dacb3fc2bf5ba8df1919678a751.tar.bz2
(reload): If only non-group need is unfilled, see if
regs spilled for earlier classes can satisfy it. From-SVN: r4597
Diffstat (limited to 'gcc')
-rw-r--r--gcc/reload1.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/reload1.c b/gcc/reload1.c
index 8d3dd85..0881342 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -1785,6 +1785,35 @@ reload (first, global, dumpfile)
while (max_needs[class] > 0 || max_nongroups[class] > 0)
{
+#ifdef SMALL_REGISTER_CLASSES
+ /* This should be right for all machines, but only the 386
+ is known to need it, so this conditional plays safe.
+ ??? For 2.5, try making this unconditional. */
+ /* If we spilled enough regs, but they weren't counted
+ against the non-group need, see if we can count them now.
+ If so, we can avoid some actual spilling. */
+ if (max_needs[class] <= 0 && max_nongroups[class] > 0)
+ for (i = 0; i < n_spills; i++)
+ if (TEST_HARD_REG_BIT (reg_class_contents[class],
+ spill_regs[i])
+ && !TEST_HARD_REG_BIT (counted_for_groups,
+ spill_regs[i])
+ && !TEST_HARD_REG_BIT (counted_for_nongroups,
+ spill_regs[i])
+ && max_nongroups[class] > 0)
+ {
+ register enum reg_class *p;
+
+ SET_HARD_REG_BIT (counted_for_nongroups, spill_regs[i]);
+ max_nongroups[class]--;
+ p = reg_class_superclasses[class];
+ while (*p != LIM_REG_CLASSES)
+ max_nongroups[(int) *p++]--;
+ }
+ if (max_needs[class] <= 0 && max_nongroups[class] <= 0)
+ break;
+#endif
+
/* Consider the potential reload regs that aren't
yet in use as reload regs, in order of preference.
Find the most preferred one that's in this class. */