aboutsummaryrefslogtreecommitdiff
path: root/gcc/reload1.c
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2010-05-28 16:19:22 -0600
committerJeff Law <law@gcc.gnu.org>2010-05-28 16:19:22 -0600
commit0896cc668adddc0be62f009679e1e7236ecec0e6 (patch)
tree9dc1cb58dbd6084f4583c0e45cae66cdd60ca456 /gcc/reload1.c
parentbdf0eb066733a11e3d1aa6fc34d3c8724b743247 (diff)
downloadgcc-0896cc668adddc0be62f009679e1e7236ecec0e6.zip
gcc-0896cc668adddc0be62f009679e1e7236ecec0e6.tar.gz
gcc-0896cc668adddc0be62f009679e1e7236ecec0e6.tar.bz2
ira.c (ira_bad_reload_regno, [...]): New functions.
* ira.c (ira_bad_reload_regno, ira_build_reload_regno_1): New functions. * ira.h (ira_bad_reload_regno): Declare * reload1.c (allocate_reload_reg): Use ira_bad_reload_regno. From-SVN: r160001
Diffstat (limited to 'gcc/reload1.c')
-rw-r--r--gcc/reload1.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/gcc/reload1.c b/gcc/reload1.c
index 85880f8..f385fbb 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -5793,15 +5793,17 @@ allocate_reload_reg (struct insn_chain *chain ATTRIBUTE_UNUSED, int r,
take any reg in the right class and not in use.
If we want a consecutive group, here is where we look for it.
- We use two passes so we can first look for reload regs to
+ We use three passes so we can first look for reload regs to
reuse, which are already in use for other reloads in this insn,
- and only then use additional registers.
+ and only then use additional registers which are not "bad", then
+ finally any register.
+
I think that maximizing reuse is needed to make sure we don't
run out of reload regs. Suppose we have three reloads, and
reloads A and B can share regs. These need two regs.
Suppose A and B are given different regs.
That leaves none for C. */
- for (pass = 0; pass < 2; pass++)
+ for (pass = 0; pass < 3; pass++)
{
/* I is the index in spill_regs.
We advance it round-robin between insns to use all spill regs
@@ -5841,6 +5843,13 @@ allocate_reload_reg (struct insn_chain *chain ATTRIBUTE_UNUSED, int r,
regnum))))
{
int nr = hard_regno_nregs[regnum][rld[r].mode];
+
+ /* During the second pass we want to avoid reload registers
+ which are "bad" for this reload. */
+ if (pass == 1
+ && ira_bad_reload_regno (regnum, rld[r].in, rld[r].out))
+ continue;
+
/* Avoid the problem where spilling a GENERAL_OR_FP_REG
(on 68000) got us two FP regs. If NR is 1,
we would reject both of them. */
@@ -5871,7 +5880,7 @@ allocate_reload_reg (struct insn_chain *chain ATTRIBUTE_UNUSED, int r,
}
}
- /* If we found something on pass 1, omit pass 2. */
+ /* If we found something on the current pass, omit later passes. */
if (count < n_spills)
break;
}