[LLVMdev] How to partition registers into different RegisterClass?

Chris Lattner
Sat, 23 Jul 2005 16:26:19 -0000

On Sat, 23 Jul 2005, Tzu-Chien Chiu wrote:
> 2005/7/23, Chris Lattner <sabre at nondot.org>:
>> What does a 'read only' register mean?  Is it a constant (e.g.
returns
>> 1.0)?  Otherwise, how can it be a useful value?
>
> Yes, it's a constant register.
>
> Because the instruction cannot contain an immediate value, a constant
> value may be stored in a constant register, and it's defined _before_
> the program starts by API. For example:
>
>  SetConstantValue( 5, Vector4( 1, 2, 3, 4 ); // C5 = <1,2,3,4>
>  HANDLE handle = LoadCodeFromFile( filename );
>  SetCode( handle );  // C5 is referenced here
>  Execute();

Ah, ok. In that case, you want to put all of the registers in one register
file, and not make the constant register allocatable (e.g. see
X86RegisterInfo.td, and note how the register classes include EBP and ESP,
but do not register allocate them (through the definition of
allocation_order_end()).

-Chris

--