optimization and register allocation

sastry@GODEL.MIEL.MOT.COM (Venkateshwara Sastry)
Fri, 24 Feb 1995 07:58:06 GMT

          From comp.compilers

Related articles
optimization and register allocation sastry@GODEL.MIEL.MOT.COM (1995-02-24)
Re: optimization and register allocation davidm@Rational.COM (1995-02-28)
Re: optimization and register allocation sethml@puree.ugcs.caltech.edu (1995-03-04)
Re: optimization and register allocation preston@tera.com (1995-03-06)
| List of all articles for this month |

Newsgroups: comp.compilers
From: sastry@GODEL.MIEL.MOT.COM (Venkateshwara Sastry)
Keywords: optimize, registers
Organization: Compilers Central
Date: Fri, 24 Feb 1995 07:58:06 GMT

Consider the following piece of code :




while(1)
y = (-a) +f2 ;
... many uses of a here.






An optimizing compiler probably find that (-a) is loop invariant and
replace the code by


t= -a


while(1)
y= t+f2
.... many uses of a here.


Now consider the case when GRA doesn't allocates register to t but
allocates a register to a. As a result code generator has to pick t
every time from memory which might be costiler than just negating a.
So we have essentially slowed down the genarated code. On the other
hand, had the GRA allocated a register to t it would have really
improved the generated code.


How can one determine whether to perform such optimizations( whose
behavior depend on register allocator) or not?


thanks,
sastry
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.