How to "disable" register allocation?

Mike Stump mrs@apple.com
Thu Apr 7 20:47:00 GMT 2005


On Thursday, April 7, 2005, at 09:12  AM, Øyvind Harboe wrote:
> Is there an option(compile/build time?) to tell GCC to use as few
> registers as possible?

There's always the manual:

@item -ffixed-@var{reg}
@opindex ffixed
Treat the register named @var{reg} as a fixed register; generated code
should never refer to it (except perhaps as a stack pointer, frame
pointer or in some other fixed role).

@var{reg} must be the name of a register.  The register names accepted
are machine-specific and are defined in the @code{REGISTER_NAMES}
macro in the machine description macro file.

This flag does not have a negative form, because it specifies a
three-way choice.


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!



More information about the Gcc mailing list