This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Number of registers on x86
- To: dan at www dot cgsoftware dot com (Daniel Berlin)
- Subject: Re: Number of registers on x86
- From: Toshi Morita <tm2 at best dot com>
- Date: Mon, 29 Jan 2001 14:41:28 -0800 (PST)
- Cc: gcc at gcc dot gnu dot org
> Can we please lie and say we have 32 GP registers on x86?
> Why, you ask?
>
> Well, there are 40 universal temporaries that are used by the hardware
> register renaming.
> Everything but floating status word, and floating point control word, can
> be renamed.
>
> Intel's compiler (IIRC), and SML/NJ do this (I'm positive about this one),
> and it improves performance, and helps to eliminate a lot of worthless
> spills.
> They just map them back into the 8 registers right before emitting.
>
>
> --Dan
I think you're misunderstanding the concept of register renaming.
The register renaming is done in hardware dynamically at runtime.
For example, in the code:
mov (%esi),eax
movl eax,(%edi)
movl 4(%esi),eax
mov.l eax,4(%edi)
...the processor can use two different virtual registers for
%eax because there are no conflicts. This prevents the processor
from stalling.
Register renaming only makes the processor more tolerant to
suboptimal instruction scheduling. It doesn't give the compiler
any more registers to use per se.
Toshi