This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFD, draft patch: IRA costs for reg_equiv_invariant regs
- From: Steven Bosscher <stevenb dot gcc at gmail dot com>
- To: Bernd Schmidt <bernds at codesourcery dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, "Vladimir N. Makarov" <vmakarov at redhat dot com>
- Date: Fri, 7 May 2010 22:21:48 +0200
- Subject: Re: RFD, draft patch: IRA costs for reg_equiv_invariant regs
- References: <4BE46C12.6090206@codesourcery.com>
On Fri, May 7, 2010 at 9:37 PM, Bernd Schmidt <bernds@codesourcery.com> wrote:
> Bootstrapped and tested on i686-linux (the tested version was slightly
> earlier, before I fixed warnings that broke bootstrap). ?I've also
> backported this to CodeSourcery's 4.4 compiler and run SPECint2000 on
> Cortex-A9, where the overall result tied the best result I'd previously
> got from that compiler.
Have you also looked at compile time impact? (Although, doesn't look
like it could cost all that much, I suppose).
Some things I noticed while reading this patch (it looks interesting
-- not that I understand any of it...):
> +calculate_elim_costs_all_insns (void)
> +{
(...)
> + if (LABEL_P (insn) || JUMP_P (insn)
> + || (INSN_P (insn) && REG_NOTES (insn) != 0))
> + set_label_offsets (insn, insn, 0);
> +
> + if (INSN_P (insn))
> + {
I think you want NONDEBUG_INSN_P instead of INSN_P in both cases.
> +static int
> +note_reg_elim_costly (rtx *px, void *data)
> +{
(...)
> + if (REG_P (x)
> + && REGNO (x) >= FIRST_PSEUDO_REGISTER
Could use !HARD_REGISTER_P or !HARD_REGISTER_NUM_P here and in a few
other places, but we don't seem to have a convention for one or the
other, or just a direct compare with FIRST_PSEUDO_REGISTER. Just
something I noticed, anyway...
> +static void
> +elimination_costs_in_insn (rtx insn)
> +{
(...)
> + for (links = REG_NOTES (insn); links; links = XEXP (links, 1))
> + {
> + if ((REG_NOTE_KIND (links) == REG_EQUAL
> + || REG_NOTE_KIND (links) == REG_EQUIV)
> + && GET_CODE (XEXP (links, 0)) == PLUS
> + && CONST_INT_P (XEXP (XEXP (links, 0), 1)))
> + {
> + plus_cst_src = XEXP (links, 0);
> + break;
> + }
Should use find_reg_equal_equiv_note?
> +static void
> +init_eliminable_invariants (rtx first, bool do_subregs)
(...)
> +/* Look for REG_EQUIV notes; record what each pseudo is equivalent
> + to. If DO_SUBREGS is true, also find all paradoxical subregs and
> + find largest such for each pseudo. FIRST is the head of the insn
> + list. */
Looks wrongly indented.
Nice to see there's even a test case!
Ciao!
Steven