This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: builtin_constant_p
On Mon, Jun 29, 1998 at 09:53:13PM -0700, Jim Wilson wrote:
> This patch looks OK to me.
>
> + /* Only emit CONSTANT_P_RTX if CSE will be run. Moreover, we
> + don't want to expand trees that have side effects, as we want
> + this to be a non-intrusive function a-la sizeof. */
>
> Just to be pedantic, I must say that I still find this argument unsatisfying.
Hmm. While I believe it would be possible to implement __b_c_p as an
integral constant expression after inlining is done at the tree level,
I don't think we could do that before then. Nor do I think it is an
especially useful thing to want unless
__b_c_p(i) ? i : 0
is also an integral constant expression even when i isn't. But since
I don't think
0 ? i : 0
for i not constant is an integral constant expression, I'm not sure
us making an exception for __b_c_p makes much sense either.
How about the following rewording of the offending sentence:
Moreover, we don't want to expand trees that have side effects,
as the original __builtin_constant_p did not evaluate its
argument at all, and we would break existing usage by changing
this. This quirk was generally useful, eliminating a bit of hair
in the writing of the macros that use this function. Now the
same thing can be better accomplished in an inline function.
r~