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: How to "disable" register allocation?


> If you fix all but 4 registers, then the compiler will only use the 
> remaining 4.  Extra credit if your code compiles with just 2 registers 
> left!

Fixing registers causes the compiler to fight for its life to put those
values into the remaining registers => code bloat, and I guess you are
referring to reload failing if too many registers are marked as fixed.

I threw in a #if 0 in local-alloc.c + global.c and now it appears as if
registers are not allocated, except as needed by reload. Code appears to
compile & execute correctly.

It did reduce code size significantly in one case(10% ish).

However, it seems like -fomit-frame-pointer stopped working as well as
it used to, so many references to pseudo registers are via the frame
pointer instead of the stack pointer, which causes code bloat(+20% ish
in one case). 

Here is somewhat dated, but interesting discussion on omitting frame
pointers:

http://gcc.gnu.org/ml/gcc/2002-04/msg00009.html

Another factor is that pseudo variables seem to be allocated before the
frame(is this correct? I just looked at the machinecode), so the
distance between the SP and the pseudo variables is quite big. Here is
an interesting article on this issue:

http://gcc.fyxm.net/summit/2003/Optimal%20Stack%20Slot%20Assignment.pdf

The 10% code saving is interesting, but obviously with a system as
complex(necessarily so) as GCC it would be rather optimistic to expect
turning off register allocation to give a net saving in the general
case.

-- 
Øyvind Harboe
http://www.zylin.com


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