diff options
author | J"orn Rennecke <joern.rennecke@superh.com> | 2004-02-25 12:42:26 +0000 |
---|---|---|
committer | Joern Rennecke <amylaar@gcc.gnu.org> | 2004-02-25 12:42:26 +0000 |
commit | 4ab51fb500e802efac59c1eb79f2ddb5029a9e69 (patch) | |
tree | 015eca1b742786bb55b1a0c3a590560746745b08 | |
parent | e1471c91b8215ed17e1f4dde075eee0e9f0f804b (diff) | |
download | gcc-4ab51fb500e802efac59c1eb79f2ddb5029a9e69.zip gcc-4ab51fb500e802efac59c1eb79f2ddb5029a9e69.tar.gz gcc-4ab51fb500e802efac59c1eb79f2ddb5029a9e69.tar.bz2 |
reload1.c (reload): Only spill eliminable register with multiple adjacent elimination alternatives...
* reload1.c (reload): Only spill eliminable register with multiple
adjacent elimination alternatives if all alternatives fail.
From-SVN: r78430
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/reload1.c | 19 |
2 files changed, 21 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ec2d741..4405cd9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2004-02-25 J"orn Rennecke <joern.rennecke@superh.com> + + * reload1.c (reload): Only spill eliminable register with multiple + adjacent elimination alternatives if all alternatives fail. + 2004-02-25 Richard Earnshaw <rearnsha@arm.com> * arm.c (arm_legitimate_index_p): For QImode the range of an offset diff --git a/gcc/reload1.c b/gcc/reload1.c index 1f21e48..12451db 100644 --- a/gcc/reload1.c +++ b/gcc/reload1.c @@ -849,9 +849,22 @@ reload (rtx first, int global) /* Spill any hard regs that we know we can't eliminate. */ CLEAR_HARD_REG_SET (used_spill_regs); - for (ep = reg_eliminate; ep < ®_eliminate[NUM_ELIMINABLE_REGS]; ep++) - if (! ep->can_eliminate) - spill_hard_reg (ep->from, 1); + /* There can be multiple ways to eliminate a register; + they should be listed adjacently. + Elimination for any register fails only if all possible ways fail. */ + for (ep = reg_eliminate; ep < ®_eliminate[NUM_ELIMINABLE_REGS]; ) + { + int from = ep->from; + int can_eliminate = 0; + do + { + can_eliminate |= ep->can_eliminate; + ep++; + } + while (ep < ®_eliminate[NUM_ELIMINABLE_REGS] && ep->from == from); + if (! can_eliminate) + spill_hard_reg (from, 1); + } #if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM if (frame_pointer_needed) |