Use predicates for RTL objects

Arvind Sankar nivedita@alum.mit.edu
Fri Aug 2 19:22:00 GMT 2019


On Fri, Aug 02, 2019 at 01:53:11PM -0500, Segher Boessenkool wrote:
> On Fri, Aug 02, 2019 at 01:55:04PM -0400, Arvind Sankar wrote:
> > On Fri, Aug 02, 2019 at 12:49:56PM -0500, Segher Boessenkool wrote:
> > > On Fri, Aug 02, 2019 at 01:38:21PM -0400, Arvind Sankar wrote:
> > > > Hi, I have taken a crack at the beginner GCC project mentioned at
> > > > https://gcc.gnu.org/projects/beginner.html to replace uses of GET_CODE
> > > > to check rtx_code with the appropriate predicate macros.
> > > > 
> > > > Would someone be able to review/actually apply the changes if they look
> > > > acceptable?
> > > > 
> > > > Most of the change is auto-generated using the enclosed script [1]. In
> > > > addition I have added 3 new predicates to rtl.h: CONST_VECTOR_P,
> > > > CONST_STRING_P and CONST_P. After the autogenned patch there is a small
> > > > cleanup for a couple instances where the existing comparison is split
> > > > across source lines and wasn't picked up by the script.
> > > 
> > > Thank you for doing this!
> > > 
> > > I don't think there should be a CONST_P like this, the name suggests
> > > too much that the macro returns true for constants, which isn't what it
> > > does (not in either direction; neither more or less than it).
> > > 
> > > It's worse than SET_P or PLUS_P would be even, imo.
> > 
> > Yes, I agree CONST_P is a little confusing. There are about 60
> > occurences of GET_CODE (..) being compared to CONST in generic code.
> > Should I just leave it out of the conversion
> 
> That's shat I would do.
> 
> > or perhaps rename it to
> > RTL_CONST_P? Though none of the other macros is namespaced, unfortunately.
> 
> But please get other people's opinion.  Like, people who can actually
> approve your patch in the first place ;-)
> 
> 
> Segher

Thanks. Anyway, attaching a version that leaves out CONST_P.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-CONST_VECTOR_P-and-CONST_STRING_P.patch
Type: text/x-diff
Size: 1138 bytes
Desc: rtl.h
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20190802/b3325952/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Use-rtx_code-predicates-instead-of-GET_CODE.patch
Type: text/x-diff
Size: 234340 bytes
Desc: autogen
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20190802/b3325952/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Use-rtx_code-predicates-instead-of-GET_CODE.patch
Type: text/x-diff
Size: 2074 bytes
Desc: touchup
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20190802/b3325952/attachment-0002.bin>


More information about the Gcc-patches mailing list