Commit d6076cee by Richard Sandiford Committed by Richard Sandiford

mips.c (machine_function): Add initialized_mips16_gp_pseudo_p.

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.

From-SVN: r126919
parent a57193e8
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):
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment