This is the mail archive of the
mailing list for the GCC project.
Re: Patch for builtin fputs (first stdio opt ready for install)
- To: law at cygnus dot com
- Subject: Re: Patch for builtin fputs (first stdio opt ready for install)
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Date: Fri, 8 Sep 2000 11:18:02 -0400 (EDT)
- Cc: gcc-patches at gcc dot gnu dot org, jason at redhat dot com
> From: Jeffrey A Law <email@example.com>
> In message <200009072106.RAA08081@caip.rutgers.edu>you write:
> > > From: Jason Merrill <firstname.lastname@example.org>
> > >
> > > You could save a pointer to the _DECL for __builtin_fputc in
> > > c_common_nodes_and_builtins.
> > > Jason
> > Here's what I came up with. Bootstrapped on solaris2.7, no
> > regressions. Okay to install?
> > 2000-09-06 Kaveh R. Ghazi <email@example.com>
> > * builtins.c (built_in_decls): New array.
> > (expand_builtin_fputs): New function.
> > (expand_builtin): Handle BUILT_IN_FPUTC and BUILT_IN_FPUTS.
> > * builtins.def (BUILT_IN_FPUTC, BUILT_IN_FPUTS): New members.
> > * c-common.c (c_common_nodes_and_builtins): Handle
> > * tree.h (built_in_decls): New array.
> I might have missed something -- you appear to be registering a
> fputc too, but no expander for it. What's the point behind that?
In my original version, I wrote a mechanism for looking up random
_DECLs. However Jason felt it better to cache the _DECL when
declaring the builtin function. See:
So in order to write the fputs expander, I have to declare an empty
fputc builtin so I can cache its _DECL and use it to replace fputs.
Note, this caching mechanism only works if the expansion is another
builtin function. I've already written at least one opt
(fputc->putc_macro) which requires expanding into an inline function
wrapped around the putc macro, but that one can wait.
> I also think you should kill the debugging #ifdefs.
Ok, will do.
Okay to install?
Kaveh R. Ghazi Engagement Manager / Project Services
firstname.lastname@example.org Qwest Internet Solutions