Working with X86 registers in MachineInstr

I believe that the enum values X86:: correspond to the integers that you’re seeing. For example, X86::RAX is %rax, X86::RBX is %rbx, etc.

Those numbers are virtual or physical registers. You can tell by using TargetRegisterInfo::isPhyscalRegister.

Walk through the operands, and check:

  • If the operand is a register.

  • If it is a use or def.

Some operands are also register masks, those give you the set of registers that are preserved through that instruction, i.e., the complement gives you a bunch of new “definitions”.

Anyway, look into the AArch64CollectLOH pass, you’ll see all of that in action. The register allocator code on the other hand is of little use for you, as the liveness information is only for virtual registers and the infrastructure does not work with allocated code.

Thanks! This sounds like exactly what I’m looking for. I’ll give it a look.

Ethan Johnson