This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GIMPLE temporary variables
- From: Joe Buck <Joe dot Buck at synopsys dot COM>
- To: "J.C. Pizarro" <jcpiza at gmail dot com>
- Cc: "Andrea Callia D'Iddio" <andrea dot calliadiddio at gmail dot com>, gcc at gcc dot gnu dot org
- Date: Tue, 8 May 2007 14:48:46 -0700
- Subject: Re: GIMPLE temporary variables
- References: <998d0e4a0705081243j4b17f4b6x1eaac9b0e944af42@mail.gmail.com>
On Tue, May 08, 2007 at 09:43:58PM +0200, J.C. Pizarro wrote:
> Andrea Callia D'Iddio <andrea.calliadiddio@gmail.com> wrote:
> >Hi all,
> >
> >I'm writing a new compilation pass in gcc, and I'm working on GIMPLE
> >code. When gcc produce GIMPLE code, it creates new temporary
> >variables, in order to simplify expressions and statements. For
> >example, if source C file contains
> >a=a+b+19;
> >then GIMPLE code is
> >D.1295 = a + b;
> >a = D.1295 + 19;
> >how can I recognize temporary variables, such as D.1295?
> >Thanks for support! bye!!
> >
> >
> >Andrea Callia D'Iddio
>
> This GIMPLE code is bad.
>
> It's better without a new temporary variable D.xxxx:
> a = a + b;
> a = a + 19;
No, it isn't; since you don't understand what the goal is, your notion of
what is good or bad is seriously confused.
Your proposed rewrite hides the distinction between generated tempories
and assignments written by the user (probably making -O0 code worse, if
the compiler thinks every write to a has to be flushed to memory), and
your idea that avoiding introducing temporaries is good ignores the fact
that the gimple code is fed to an SSA pass, where every distinct
assignment will create a new symbol.