[LLVMdev] How to partition registers into different RegisterClass?

Chris Lattner sabre at nondot.org
Sat Jul 23 09:26:19 PDT 2005


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

-- 
http://nondot.org/sabre/
http://llvm.org/




More information about the llvm-dev mailing list