This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch to add __builtin_printf("string\n") -> puts("string")
- To: mark at codesourcery dot com
- Subject: Re: Patch to add __builtin_printf("string\n") -> puts("string")
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Date: Fri, 22 Sep 2000 12:39:56 -0400 (EDT)
- Cc: gcc-patches at gcc dot gnu dot org, gdr at codesourcery dot com, harinath at cs dot umn dot edu
> From: Mark Mitchell <mark@codesourcery.com>
>
> >>>>> "Kaveh" == Kaveh R Ghazi <ghazi@caip.rutgers.edu> writes:
>
> Kaveh> I suppose you could argue that the second string would
> Kaveh> waste space but so far, in the sample code I manually
> Kaveh> checked, these duplicates don't occur. In fact code size
> Kaveh> went down due to all the string size reductions. So should
> Kaveh> some pathological case arise, it will be mitigated by the
> Kaveh> many more string space reductions.
>
> That would be my expectation as well.
Good, I'm glad you agree that this transformation is worthwhile and
safe.
> Note that doing this stuff in tree-land should be very, very easy.
> Look at cp/optimize.c. Now, just call walk_tree, looking for
> CALL_EXPRs calling `::printf' with a STRING_CST, and mutate the tree.
> All done.
I fully intend to do some tree based stuff, but when pertaining to
multiple calls. E.g. merging several sequential calls to printf into
one call, or when doing inlining of stdout.
If you're speaking of "ease", its easiest IMHO for me to continue
using builtins.c because I already wrote the code and it works just
fine. :-)
So I'd like to finish this line of work using the mechanism I've
started with and then use tree-based style for places where it is
necessary and more helpful.
My remaining tasks are to get approval for:
http://gcc.gnu.org/ml/gcc-patches/2000-09/msg00921.html
then implement fprintf->fputs,
then move on to tree based opts.
Are you okay if I use this approach?
--Kaveh
PS: I'll be away for a few days so I'll pick this up next week.
--
Kaveh R. Ghazi Engagement Manager / Project Services
ghazi@caip.rutgers.edu Qwest Internet Solutions