This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: How to "disable" register allocation?
- From: Øyvind Harboe <oyvind dot harboe at zylin dot com>
- To: Mike Stump <mrs at apple dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 07 Apr 2005 23:37:36 +0200
- Subject: Re: How to "disable" register allocation?
- References: <3EDCDE19-A7A6-11D9-9722-003065BDF310@apple.com>
> 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