This is the mail archive of the
gcc-patches@gcc.gnu.org
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 <law@cygnus.com>
>
> In message <200009072106.RAA08081@caip.rutgers.edu>you write:
> > > From: Jason Merrill <jason@redhat.com>
> > >
> > > 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
>testsuite
> > regressions. Okay to install?
> >
> >
> >
> > 2000-09-06 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
> >
> > * 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
>fputc/fputs.
> >
> > * tree.h (built_in_decls): New array.
>
> I might have missed something -- you appear to be registering a
>builtin
> 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:
http://gcc.gnu.org/ml/gcc-patches/2000-09/msg00134.html
http://gcc.gnu.org/ml/gcc-patches/2000-09/msg00175.html
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.
> jeff
Ok, will do.
Okay to install?
--
Kaveh R. Ghazi Engagement Manager / Project Services
ghazi@caip.rutgers.edu Qwest Internet Solutions