This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GCC's new register allocator
Rajkishore Barik <rajbarik@in.ibm.com> writes:
> Looking at the i386.h file, I find set of GENERAL_REGS class can use
> %eax,%ebx,%ecx,%edx,%esi, %edi,%ebp,%esp and %r8-%r15.
> As per my understanding %ebx, %ecx, %edx, %esi, and %edi are used for
> register allocation and others are used for special purpose stack and base
> pointers and %r8-15 are not usable due to the contraint in
> FIXED_REGISTERS.
>
> Does this mean we can not use more than 5 registers for integer variables
> ? If not, then how can I modify the i386.h file to increase the number of
> usable regsiters for integer variables?
It sounds like you are compiling for a plain old i386. That hardware
has, yes, only six generally-useful registers (seven with
-fomit-frame-pointer). %eax is being used for something other than an
xNN variable; probably for 'i' or 'a'.
%r8-%r15 are only available to an x86-64 chip. You saw them being put
in FIXED_REGISTERS - that's how GCC internally represents 'can't use
this register on this subarchitecture'. If you compile this code for
x86-64 you will see more registers being used. (To do that you will
need a version of GCC which was configured to generate code for x86-64.)
zw