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: [PATCH] Move printf and fprintf builtins to middle-end.


 > 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


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