[LLVMdev] How to partition registers into different RegisterClass?

Tzu-Chien Chiu
Sat, 23 Jul 2005 01:36:20 -0000

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();

--
Tzu-Chien Chiu,
3D Graphics Hardware Enginner,
<URL:http://www.csie.nctu.edu.tw/~jwchiu>