summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2007-07-25 18:12:15 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2007-07-25 18:12:15 +0000
commit6c1ca223e9018b57e04f59b7d55fd477d83d7974 (patch)
tree633bc5490187a8c6bddbd460292b9b87ba0c21e3
parent0c16c31bf1b11ad55a190abc6a003ce55f0d93e3 (diff)
downloadgcc-6c1ca223e9018b57e04f59b7d55fd477d83d7974.tar.gz
gcc/
* config/mips/mips.c (machine_function): Add initialized_mips16_gp_pseudo_p. (mips16_gp_pseudo_reg): Do not emit the initialization of mips16_gp_pseudo_rtx when being called from the gimple cost- calculation routines; emit it on the first use outside those routines. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@126919 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/config/mips/mips.c14
2 files changed, 21 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index aee62339d47..20bcc6988b7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2007-07-25 Richard Sandiford <richard@codesourcery.com>
+
+ * config/mips/mips.c (machine_function): Add
+ initialized_mips16_gp_pseudo_p.
+ (mips16_gp_pseudo_reg): Do not emit the initialization of
+ mips16_gp_pseudo_rtx when being called from the gimple cost-
+ calculation routines; emit it on the first use outside those
+ routines.
+
2007-07-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* coretypes.h (const_bitmap, const_rtx, const_rtvec, const_tree):
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index f42fe77eaf1..e9e79ee4e1e 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -477,6 +477,10 @@ struct machine_function GTY(()) {
/* True if the function is known to have an instruction that needs $gp. */
bool has_gp_insn_p;
+
+ /* True if we have emitted an instruction to initialize
+ mips16_gp_pseudo_rtx. */
+ bool initialized_mips16_gp_pseudo_p;
};
/* Information about a single argument. */
@@ -8774,11 +8778,15 @@ static rtx
mips16_gp_pseudo_reg (void)
{
if (cfun->machine->mips16_gp_pseudo_rtx == NULL_RTX)
+ cfun->machine->mips16_gp_pseudo_rtx = gen_reg_rtx (Pmode);
+
+ /* Don't initialize the pseudo register if we are being called from
+ the tree optimizers' cost-calculation routines. */
+ if (!cfun->machine->initialized_mips16_gp_pseudo_p
+ && current_ir_type () != IR_GIMPLE)
{
rtx insn, scan;
- cfun->machine->mips16_gp_pseudo_rtx = gen_reg_rtx (Pmode);
-
/* We want to initialize this to a value which gcc will believe
is constant. */
insn = gen_load_const_gp (cfun->machine->mips16_gp_pseudo_rtx);
@@ -8794,6 +8802,8 @@ mips16_gp_pseudo_reg (void)
scan = get_insns ();
insn = emit_insn_after (insn, scan);
pop_topmost_sequence ();
+
+ cfun->machine->initialized_mips16_gp_pseudo_p = true;
}
return cfun->machine->mips16_gp_pseudo_rtx;