This is the mail archive of the 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]

Re: Number of registers on x86

> 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.


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