RFD, draft patch: IRA costs for reg_equiv_invariant regs

Bernd Schmidt bernds@codesourcery.com
Fri May 7 20:47:00 GMT 2010


On 05/07/2010 10:21 PM, Steven Bosscher wrote:
> Have you also looked at compile time impact?

No.

> (Although, doesn't look like it could cost all that much, I suppose).

It should cost a fraction of a normal pass through reload's main loop.

>> +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.

Changed.  It's the same way in calculate_needs_all_insns though.

>> +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...

Compare with FIRST_PSEUDO_REGISTER is more idiomatic IMO.

>> +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?

Could do, although that seems to have some unnecessary tests in it.
Again, same code as in eliminate_regs_in_insn.

>> +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.

Fixed locally.


Bernd



More information about the Gcc-patches mailing list