This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Various gp-related mips optimisations
- From: Richard Sandiford <rsandifo at redhat dot com>
- To: Eric Christopher <echristo at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: 29 May 2003 07:45:36 +0100
- Subject: Re: Various gp-related mips optimisations
- References: <wvnbrxoaywv.fsf@talisman.cambridge.redhat.com><1054165032.1070.32.camel@ghostwheel.sfbay.redhat.com>
Eric Christopher <echristo@redhat.com> writes:
> > ! /* compute_frame_size assumes that any function which uses the
> > ! constant pool will need a gp. However, all constant
> > ! pool references could be eliminated, in which case
> > ! it is OK for flow to delete the gp load as well. */
> > ! insn = get_last_insn ();
> > ! for (i = 0; i < 3; i++)
> > ! {
> > ! REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_MAYBE_DEAD, const0_rtx,
> > ! REG_NOTES (insn));
> > ! insn = PREV_INSN (insn);
> > ! }
> > ! }
> > }
>
> Definitely don't like this block, but I think that we need it since we
> can't accurately (or at all afaict) determine ahead of time whether or
> not we're going to be deleting all of the constant pool references.
> Anyone else see a way around this?
Do we need a way around it? I think the block is correct in terms of
what it's doing. (i.e. I don't see it as a hack.)
i386 for one does a similar thing:
/* Even with accurate pre-reload life analysis, we can wind up
deleting all references to the pic register after reload.
Consider if cross-jumping unifies two sides of a branch
controlled by a comparison vs the only read from a global.
In which case, allow the set_got to be deleted, though we're
too late to do anything about the ebx save in the prologue. */
Note that that comment was written before ix86_save_reg started
checking current_function_uses_const_pool. I think the problem
described in my comment would now apply to i386 as well.
I agree that the code isn't pretty. I'd like to be able to write
it in a way that doesn't use a loop like the above. But however
it's written, I still think we need the notes.
Richard