Use a particular register for a variable in LLVM

2019-08-20 02:55发布

问题:

I am writing an LLVM pass which modifies the LLVM bitcode. For one variable, I want it to use a register, say R15 on x86. How can I instruct LLVM to use this register when generating machine code? Can this be instructed at the bitcode level?

回答1:

You can use inline assembler to model this requirement. There is no way to "tie" specific variable to register.