This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Use predicates for RTL objects


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]