From: Jeff Law <law@redhat.com>
To: Segher Boessenkool <segher@kernel.crashing.org>,
Arvind Sankar <nivedita@alum.mit.edu>
Cc: gcc@gcc.gnu.org
Subject: Re: Use predicates for RTL objects
Date: Thu, 08 Aug 2019 14:31:00 -0000 [thread overview]
Message-ID: <7479412a-6c0f-2346-bb99-2c18dd984159@redhat.com> (raw)
In-Reply-To: <20190807180551.GX31406@gate.crashing.org>
On 8/7/19 12:05 PM, Segher Boessenkool wrote:
> On Wed, Aug 07, 2019 at 01:39:53PM -0400, Arvind Sankar wrote:
>> On Wed, Aug 07, 2019 at 12:33:53PM -0500, Segher Boessenkool wrote:
>>> On Wed, Aug 07, 2019 at 12:15:29PM -0400, Arvind Sankar wrote:
>>>> I would also like to get some comments on the following idea to make the
>>>> code checks more readable: I am thinking of adding
>>>> bool rtx_def::is_a (enum rtx_code) const
>>>> This would allow us to make all the rtx_code comparisons more readable
>>>> without having to define individual macros for each.
>>>> i.e.,
>>>> REG_P (x) => x->is_a (REG)
>>>> GET_CODE (x) == PLUS => x->is_a (PLUS)
>>>> GET_CODE (PATTERN (x)) == SEQUENCE => PATTERN (x)->is_a (SEQUENCE)
>>>
>>> That makes things much worse. Not only is it less readable (IMO), but
>>> the "is_a" idiom is used to check if something is of a certain class,
>>> which is not the case here.
>>
>> Well, the rtx_code *is* kind of a class. It determines what fields of
>> the rtx are valid and what they contain etc.
>
> It is not a class in the C++ sense. Confusing this is not useful for
> anyone.
True, but they could be. When David was working in this space a few
years ago I concluded that the main value in sub-classing the various
RTL operators just wansn't worth the effort. Instead we focused on
starting to tear apart things like the toplevel objects into rtx_insn
and the like. THere's little value in treating those as simple RTXs.
INSN_LIST and the like were also ripe for this treatment.
The biggest value in making a real class for the operators things would
be to move the runtime RTL checking into a compile-time check. But I
couldn't really green light something like that without first completing
the rtx_insn changes.
>
>
> If you really want to convert RTL to C++, you should start with getting
> rid of rtx_format and rtx_class, and make REG_P etc. work just as they
> have always done.
Yup. And continue pushing the rtx_insn bits deeper, tackling INSN_LIST,
etc.
jeff
next prev parent reply other threads:[~2019-08-08 14:31 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-07 16:15 Arvind Sankar
2019-08-07 17:33 ` Segher Boessenkool
2019-08-07 17:40 ` Arvind Sankar
2019-08-07 18:05 ` Segher Boessenkool
2019-08-07 18:58 ` Arvind Sankar
2019-08-08 15:04 ` Segher Boessenkool
2019-08-08 17:42 ` Arvind Sankar
2019-08-08 18:26 ` Segher Boessenkool
2019-08-08 18:53 ` Arvind Sankar
2019-08-08 20:28 ` Jeff Law
2019-08-08 9:10 ` Richard Sandiford
2019-08-08 15:28 ` Segher Boessenkool
2019-08-08 14:31 ` Jeff Law [this message]
2019-08-08 15:36 ` Segher Boessenkool
2019-08-08 17:07 ` Arvind Sankar
2019-08-08 20:11 ` Jeff Law
2019-08-09 8:06 ` Richard Biener
2019-08-08 15:04 ` Michael Matz
2019-08-08 17:12 ` Arvind Sankar
2019-08-08 18:14 ` Jakub Jelinek
2019-08-08 18:35 ` Arvind Sankar
2019-08-08 18:46 ` Jakub Jelinek
2019-08-08 20:32 ` Jeff Law
-- strict thread matches above, loose matches on Subject: below --
2006-02-03 4:23 nathan bullock
2006-02-03 5:46 ` Ben Elliston
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=7479412a-6c0f-2346-bb99-2c18dd984159@redhat.com \
--to=law@redhat.com \
--cc=gcc@gcc.gnu.org \
--cc=nivedita@alum.mit.edu \
--cc=segher@kernel.crashing.org \
/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).