m68k-elf local register allocation

Ray Pimm r.pimm@uq.net.au
Wed Oct 23 20:39:00 GMT 2002


I am noticing suboptimal register allocation produced by gcc built for the 
m68k-elf target.

In some functions the compiler uses registers other than d0/d1/a0/a1, and 
goes to the trouble of saving and restoring them to/from the stack, while 
leaving unused one or more of d0/d1/a0/a1, when it could have achieved the 
same result using only registers from the d0/d1/a0/a1 set.

Then in other functions, it will use d0/d1/a0/a1 only. I cannot see any 
pattern to the register allocation.

I am using primarily gcc-2.95.3, but I notice that the same phenomenon 
occurs on gcc-3.2. I generally use optimization level -O2, but higher 
optimization levels do not seem to affect the result.

My compiler options are as follows:

CXXFLAGS =  -O2                 \
             -mcpu32             \
             -fno-exceptions     \
             -fno-for-scope      \
             -fshort-enums       \
             -Wall               \
             -Wno-uninitialized  \
             -Wno-switch         \

BTW, all of my code is C++, if this is relevant.

Thanks - Ray Pimm


------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com



More information about the crossgcc mailing list