From: Richard Sandiford Date: Wed, 25 Jul 2007 18:12:15 +0000 (+0000) Subject: mips.c (machine_function): Add initialized_mips16_gp_pseudo_p. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d6076cee31d17b12ff898b4084a4184e646dbfc3;p=platform%2Fupstream%2Fgcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index aee6233..20bcc69 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2007-07-25 Richard Sandiford + + * 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 * 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 f42fe77..e9e79ee 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;