This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GIMPLE temporary variables


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.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]