+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):
/* 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. */
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);
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;