register allocation in gcc for mcore elf

Michael Meissner gcc-help@the-meissners.org
Thu Jul 10 02:59:00 GMT 2003


On Wed, Jul 09, 2003 at 08:45:12PM +0000, Sumesh UdayaKumaran wrote:
> 
> Hi
>    My question was abt how register allocation affected induction
> variables which
> are globals. My question is based on what I found with even small
> programs. The induction variable value seemed to be always loaded from
> memory. This was with a gcc cross compiler for MCORE. Can any body explain 
> why this was so ? Is it that some register promotion pass  is needed to 
> rectify the problem ?

The basic problem is references to memory is a 2nd class citizen within GCC.
The compiler is more setup to handle pseudo registers and optimize them, but
references to statics are seen as normal memory references.

It sounds like you are compiling the auto and network benchmarks in the EEMBC
benchmark suite, which for reasons unknown use static variables for for loops.
One of the last things I did when working at Red Hat, was look at optimizing
the EEMBC suite on a Red Hat internal branch for a particular chip vendor.

In the course of the EEMBC optimization, one of the other engineers on the
project added a pass to convert statics into a copy in a pseudo register, and
then a store out it out if there were no calls in the function.  However, my
impression was that it was designed to optimize for the benchmark and that for
normal code, it wouldn't produce the same benefits, and I lost track of it as I
was moved to a different project, and ultimately laid off.

-- 
Michael Meissner
email: gnu@the-meissners.org
http://www.the-meissners.org



More information about the Gcc-help mailing list