This is the mail archive of the 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]

Re: Patch to add __builtin_printf("string\n") -> puts("string")

 > From: Mark Mitchell <>
 > >>>>> "Kaveh" == Kaveh R Ghazi <> 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

 > 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:

then implement fprintf->fputs,
then move on to tree based opts.

Are you okay if I use this approach?


PS:  I'll be away for a few days so I'll pick this up next week.
Kaveh R. Ghazi			Engagement Manager / Project Services		Qwest Internet Solutions

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