How to Allocate a Variable to a Specific register

Hi,

Im trying to allocate registers for given code…,and my requirement is to allocate a specific register to a given variable( ex: int a ; // I want to allocate register R1 to a).

I think one way to do this is by writing an llvm pass as described here. But im not sure it will work…,Another way i thought of is to change Allocation order in “AltOrder” in “xxxRegisterInfo.td”. This worked for 1 variable…,but if i have two or more variables and more registers.,i cant get the exact register i want for the exact variable.

Please suggest me a way to do this.

Also…,Is there a way to check contents of each “bit” in a register?

Thanks,

Avinash

Hi Avinash,

Could you give more details on what you are trying to achieve?

Cheers,
-Quentin