summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2001-11-07 06:24:46 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2001-11-07 06:24:46 +0000
commitdea91d925696474a2f1c46be32cf807fa663a2b8 (patch)
treec5fddc0c80d6ba84addceb45d48bd84d3fa42ce7
parentf52859eafaac404d3e0089c3f8b11795f2f2193d (diff)
downloadppe42-gcc-dea91d925696474a2f1c46be32cf807fa663a2b8.tar.gz
ppe42-gcc-dea91d925696474a2f1c46be32cf807fa663a2b8.zip
* loop.c (loop_regs_scan): Don't invalidate PIC register.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@46817 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/loop.c17
2 files changed, 16 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3d76402fec9..ab7b2fad794 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2001-11-06 Steve Christiansen <smc@us.ibm.com>
+
+ * loop.c (loop_regs_scan): Don't invalidate PIC register.
+
2001-11-06 Eric Christopher <echristo@redhat.com>
* config/mips/mips.md(movdf_internal2): Add constraints for float
diff --git a/gcc/loop.c b/gcc/loop.c
index 8b2f8daf013..bc2285238ec 100644
--- a/gcc/loop.c
+++ b/gcc/loop.c
@@ -8819,11 +8819,18 @@ loop_regs_scan (loop, extra_size)
memset (last_set, 0, regs->num * sizeof (rtx));
}
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- {
- regs->array[i].may_not_optimize = 1;
- regs->array[i].set_in_loop = 1;
- }
+ /* Invalidate all hard registers clobbered by calls. With one exception:
+ a call-clobbered PIC register is still function-invariant for our
+ purposes, since we can hoist any PIC calculations out of the loop.
+ Thus the call to rtx_varies_p. */
+ if (LOOP_INFO (loop)->has_call)
+ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
+ if (TEST_HARD_REG_BIT (regs_invalidated_by_call, i)
+ && rtx_varies_p (gen_rtx_REG (Pmode, i), /*for_alias=*/1))
+ {
+ regs->array[i].may_not_optimize = 1;
+ regs->array[i].set_in_loop = 1;
+ }
#ifdef AVOID_CCMODE_COPIES
/* Don't try to move insns which set CC registers if we should not
OpenPOWER on IntegriCloud