public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <richard.sandiford@arm.com>
To: Jeff Law <law@redhat.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [1/9] Simplify the implementation of HARD_REG_SET
Date: Mon, 09 Sep 2019 18:05:00 -0000	[thread overview]
Message-ID: <mptv9u15or8.fsf@arm.com> (raw)
In-Reply-To: <15887a75-8c04-892d-6054-a7782f13350f@redhat.com> (Jeff Law's	message of "Mon, 9 Sep 2019 11:35:09 -0600")

Jeff Law <law@redhat.com> writes:
> On 9/9/19 9:53 AM, Richard Sandiford wrote:
>> We have two styles of HARD_REG_SET: a single integer based on
>> HOST_WIDEST_FAST_INT (used when FIRST_PSEUDO_REGISTER is small enough)
>> or an array of integers.  One of the nice properties of this arrangement
>> is that:
>> 
>>   void foo (const HARD_REG_SET);
>> 
>> is passed by value as an integer when the set is small enough and
>> by reference otherwise.
> True, but I suspect that few, if any, important targets are able to use
> the simple integer version.
>
>
>> 
>> However, one of the disadvantages of using an array is that simple
>> assignment doesn't work.  We need to use COPY_HARD_REG_SET instead.
> RIght.  Clear historical wart.
>
>> 
>> This patch uses a structure wrapper around the array, and preserves
>> the above "nice property" using a new const_hard_reg_set typedef.
>> The patch also removes the manual unrolling for small array sizes;
>> I think these days we can rely on the compiler to do that for us.
> Certainly makes sense to me.  Most of this was designed in the "early
> days" when most targets had small register files.
>
>> 
>> This meant fixing two port-specific quirks:
>> 
>> - epiphany passed NULL as a HARD_REG_SET whose value doesn't matter.
>>   The patch passes the NO_REGS set instead.
>> 
>> - ia64 reused TEST_HARD_REG_BIT and SET_HARD_REG_BIT for arrays that
>>   are bigger than HARD_REG_SET.  The patch just open-codes them.
>> 
>> The patch is probably being too conservative.  Very few places actually
>> take advantage of the "nice property" above, and we could have a
>> cleaner interface if we used a structure wrapper for all cases.
> I wouldn't object to dropping the "nice property".  I doubt it matters
> anymore and if the result is cleaner and easier to work with, then it's
> a net win.

Yeah.  I might come back to this later and look at a fuller transition
to C++ (or at least to try to get rid of CLEAR_HARD_REG_SET).

Thanks,
Richard

  reply	other threads:[~2019-09-09 18:05 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-09 15:52 [0/9] Make HARD_REG_SETs easier to use Richard Sandiford
2019-09-09 15:54 ` [1/9] Simplify the implementation of HARD_REG_SET Richard Sandiford
2019-09-09 17:35   ` Jeff Law
2019-09-09 18:05     ` Richard Sandiford [this message]
2019-09-10  9:16       ` Oleg Endo
2019-09-09 15:58 ` [2/9] Remove COPY_HARD_REG_SET Richard Sandiford
2019-09-09 17:36   ` Jeff Law
2019-09-09 15:59 ` [3/9] Remove COMPL_HARD_REG_SET Richard Sandiford
2019-09-09 17:37   ` Jeff Law
2019-09-09 16:00 ` [4/9] Remove AND_HARD_REG_SET Richard Sandiford
2019-09-09 17:38   ` Jeff Law
2019-09-09 16:00 ` [5/9] Remove IOR_HARD_REG_SET Richard Sandiford
2019-09-09 17:39   ` Jeff Law
2019-09-09 16:01 ` [7/9] Remove IOR_COMPL_HARD_REG_SET Richard Sandiford
2019-09-09 17:41   ` Jeff Law
2019-09-09 16:01 ` [6/9] Remove AND_COMPL_HARD_REG_SET Richard Sandiford
2019-09-09 17:40   ` Jeff Law
2019-09-09 16:02 ` [8/9] Remove hard_reg_set_equal_p Richard Sandiford
2019-09-09 17:41   ` Jeff Law
2019-09-09 16:03 ` [9/9] Tweak interface to ira-build.c:ior_hard_reg_conflicts Richard Sandiford
2019-09-09 17:42   ` Jeff Law

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=mptv9u15or8.fsf@arm.com \
    --to=richard.sandiford@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=law@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).