This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PING: [PATCH] Add SUBREG_REG_P predicate and change REG_SUBREG_P to be global
Richard Guenther wrote:
> I think that in this case the code is way easier to read if you not
> have to grok all these new predicates. What is so hard about
>
> SUBREG_P (reg)
> && REG_P (SUBREG_REG (reg))
>
> ?
While I agree it's very readable alone, I still find it convenient to
have a shortcut handy and think it helps readability in the context of
more complex expressions, for instance when you have, say, two or
three such tests to perform in a nest of other things, with possible
need for extra parens etc.
It's a balance over several factors; how complex the expressions, how
often does the pattern show up, would the predicate help sync between
different pieces of the compiler that need to agree, ...
In the particular case of the suggested change at hand, I'm not super
convinced one way or the other. Now, if the choice of an extra predicate
is eventually taken, I do believe that having SUBREG_REG_P for one
and REG_SUBREG_P for the other is asking for trouble.
Thanks for your feedback,
Olivier