This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] printf optimization
- From: law at redhat dot com
- To: Mark Dettinger <mdetting at yahoo dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 04 Jun 2002 11:59:11 -0600
- Subject: Re: [PATCH] printf optimization
- Reply-to: law at redhat dot com
In message <20020604132233.90188.qmail@web13608.mail.yahoo.com>, Mark Dettinger
writes:
> This is a patch for GCC 3.1 that introduces a printf optimization:
>
> If possible, then constant arguments are integrated into the format string
> at compile-time.
>
> Example: printf("%d+%d=%d",1,2,x)
> turns into
> printf("1+2=%d",x)
>
> The optimization works on the abstract syntax tree and runs directly before
> RTL
> generation.
>
>
> -Mark Dettinger
>
>
> 2002-06-03 Mark Dettinger (mdetting@yahoo.com)
>
> 2 Modified Files:
>
> * toplev.c: add new switches
> * c-decl.c: insert call to printf optimizer
>
> 5 New Files:
>
> * md-optimize-printf.h
> * md-optimize-printf.c printf optimizer
> * md-print-tree.h
> * md-print-tree.c outputs trees (for debugging)
> * md-utilities.c useful functions
>
> The functions contained in the 5 new files are included from c-decl.c.
> They could also be put directly into c-decl.c, of course.
In addition to the comments you've already received, this patch is large
enough that you will need to file a copyright assignment and possibly an
employer disclaimer with the FSF before we can accept any of the code.
jeff