This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Move printf and fprintf builtins to middle-end.
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- To: roger at eyesopen dot com
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sun, 20 Jul 2003 10:39:31 -0400 (EDT)
- Subject: Re: [PATCH] Move printf and fprintf builtins to middle-end.
- References: <Pine.LNX.4.44.0307200635030.418-100000@www.eyesopen.com>
> The following patch changes the printf and fprintf GCC builtins (and
> their _unlocked variants) from being "front-end" builtins that are
> expanded in c-common.c, into "normal" builtins that are handled in
> builtins.c.
These changes look good to me. Some comments:
It looks like there's a subtle change in behavior to missing fn_*
functions in that we only return 0 if the function we're interested in
is not available. (Whereas previously if any were missing it would
return 0.) This new behavior is useful if individual targets are
missing some but not others. If I've understood this correctly, I
think it's an improvement and I like it.
You may want to consider changing "unlocked" to a bool, but I wouldn't
hold up the patch for that.
On the issue of validating the printf arglist, I had hoped that
someday we could optimize more cases where we had format specifiers
with constant args. E.g. printf("%d %d %d\n",1,2,3) could become
puts("1 2 3"). This would have required using the frontend code to
validate the arglist but these opts never materialized. I guess we
could make it a langhook if such a thing was ever written, so I don't
mind losing this ability.
Thanks for the patch.
--Kaveh
--
Kaveh R. Ghazi ghazi@caip.rutgers.edu