This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Constant folding for builtins
- To: Richard Henderson <rth at cygnus dot com>
- Subject: Re: Constant folding for builtins
- From: Bernd Schmidt <bernds at redhat dot co dot uk>
- Date: Wed, 1 Nov 2000 17:03:00 +0000 (GMT)
- cc: gcc-patches at gcc dot gnu dot org
On Sun, 29 Oct 2000, Richard Henderson wrote:
> On Sun, Oct 29, 2000 at 01:55:44PM +0000, Bernd Schmidt wrote:
> > cp/ChangeLog:
> > * call.c (build_over_call): Call fold on the CALL_EXPR.
>
> You'll have to get someone else to approve this.
Mark Mitchell has approved it in an off-list mail.
> > * builtins.c (fold_builtin_constant_p, fold_builtin): New functions.
> > (expand_builtin_constant_p): Move parts of the code into
> > fold_builtin_constant_p.
> > (expand_builtin_strlen): Move parts of the code into fold_builtin.
> > * expr.h (fold_builtin): Declare.
> > * fold-const.c (fold): Handle builtin calls.
> >
> > * c-typeck.c (build_function_call): Call fold on the CALL_EXPR.
>
> Generally good. I'd prefer that you choose a no-op
> return value for fold_builtin and stick to it. You
> use both NULL and expr from fold_builtin_constant_p
> and fold_builtin respectively.
I've fixed fold_builtin to return 0 to indicate failure and checked the
patch in.
Bernd