public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <rdsandiford@googlemail.com>
To: Vladimir Makarov <vmakarov@redhat.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: RFC: LRA for x86/x86-64 [7/9] -- continuation
Date: Wed, 10 Oct 2012 19:53:00 -0000	[thread overview]
Message-ID: <874nm2m7ir.fsf@talisman.home> (raw)
In-Reply-To: <87vceie42n.fsf@sandifor-thinkpad.stglab.manchester.uk.ibm.com>	(Richard Sandiford's message of "Wed, 10 Oct 2012 16:31:44 +0100")

Sorry, reading back in different surroundings made me notice a couple
of silly errors:

Richard Sandiford <rdsandiford@googlemail.com> writes:
> E.g.:
>
>   if ((*loc = get_equiv_substitution (reg)) != reg)
>     ...as above...
>   if (*loc != reg || !in_class_p (reg, cl, &new_class))
>     ...as above...
>   else if (new_class != NO_REGS && rclass != new_class)
>     change_class (regno, new_class, "	   Change", true);
>   return change_p;
>
> (assuming change to in_class_p suggested earlier) seems like it
> covers the same cases.

...but that same in_class_p change means that the "rclass != new_class"
condition isn't needed.  I.e.

  if ((*loc = get_equiv_substitution (reg)) != reg)
    ...as above...
  if (*loc != reg || !in_class_p (reg, cl, &new_class))
    ...as above...
  else if (new_class != NO_REGS)
    change_class (regno, new_class, "	   Change", true);
  return change_p;

>> +	      if (operand_reg[nop] != NULL_RTX)
>> +		{
>> +		  int last_reload = (lra_reg_info[ORIGINAL_REGNO
>> +						  (operand_reg[nop])]
>> +				     .last_reload);
>> +
>> +		  if (last_reload > bb_reload_num)
>> +		    reload_sum += last_reload;
>> +		  else
>> +		    reload_sum += bb_reload_num;
>
> The comment for reload_sum says:
>
>> +/* Overall number reflecting distances of previous reloading the same
>> +   value.  It is used to improve inheritance chances.  */
>> +static int best_reload_sum;
>
> which made me think of distance from the current instruction.  I see
> it's actually something else, effectively a sum of instruction numbers.
>
> I assumed the idea was to prefer registers that were reloaded more
> recently (closer the current instruction).  In that case I thought that,
> for a distance-based best_reload_sum, smaller would be better,
> while for an instruction-number-based best_reload_sum, larger would
> be better.  It looks like we use instruction-number based best_reload_sums
> but prefer smaller sums:
>
>> +			      && (reload_nregs < best_reload_nregs
>> +				  || (reload_nregs == best_reload_nregs
>> +				      && best_reload_sum < reload_sum))))))))
>
> Is that intentional?

Clearly I can't read.  The code _does_ prefer higher numbers.  I still
think "distance" is a bit misleading though. :-)

Just for the record, the rest of my question:

> Also, is this value meaningful for output reloads, which aren't really
> going to be able to inherit a value as such?  We seem to apply the cost
> regardless of whether it's an input or an output, so probably deserves
> a comment.
>
> Same for matched input operands, which as you say elsewhere aren't
> inherited.

still applies.

Richard

  reply	other threads:[~2012-10-10 19:50 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-27 23:41 Vladimir Makarov
2012-10-03 11:12 ` Richard Sandiford
2012-10-11  1:04   ` Vladimir Makarov
2012-10-04 15:51 ` Richard Sandiford
2012-10-12  3:53   ` Vladimir Makarov
2012-10-12 16:19     ` Richard Sandiford
2012-10-10 15:36 ` Richard Sandiford
2012-10-10 19:53   ` Richard Sandiford [this message]
2012-10-14 17:44   ` Vladimir Makarov
2012-10-15 12:41     ` Richard Sandiford
2012-10-19  6:46       ` Vladimir Makarov
2012-10-12 14:44 ` Richard Sandiford
2012-10-13  8:52   ` Richard Sandiford
2012-10-17  1:18   ` Vladimir Makarov
2012-10-17 11:42     ` Richard Sandiford
2012-10-19  6:13       ` Vladimir Makarov
2012-10-15 17:06 ` Richard Sandiford
2012-10-17 19:59   ` Vladimir Makarov
2012-10-17 20:30     ` Steven Bosscher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874nm2m7ir.fsf@talisman.home \
    --to=rdsandiford@googlemail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=vmakarov@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).