This is the mail archive of the
mailing list for the GCC project.
Re: Use predicates for RTL objects
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 . 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.
> Maybe you can put a script like this in contrib/ ?
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 or perhaps rename it to
RTL_CONST_P? Though none of the other macros is namespaced, unfortunately.