[LLVMdev] Determining Register Class of an Operand

dag at cray.com dag at cray.com
Thu Jun 6 09:48:44 PDT 2013


If I have two physical registers, A and B, how do I know whether I may
replace A with B in a machine instruction?  My concern is that A may be
in a restricted register class of which B is not a member.  An example
is trying to replace the x86 CL register in a shift operation.

It seems like the only way to get a register class for a physical
register is via TargetRegisterInfo::getMinimalPhysRegClass but that is
far too conservative in general.

Is there any way, given an instruction and a register operand, to find
out which exact register class models the semantics/restrictions of that
operand position in the instruction?

                           -David



More information about the llvm-dev mailing list