The anatomy of a MachineInstr instance
While working in the backend, you’ll mainly be manipulating MachineInstr
instances. As such, it’s important to have a good understanding of what they represent and how to make sure what you’re doing with them is legal since what you do preserves the semantics of the program.
At a high level, a MachineInstr
object is a combination of three things:
- An array of
MachineOperand
instances - Some flags that can be set or queried – for instance, the
fast-math
flags attached to this instruction, whether it’s an instruction used for setting up the call frame, and so on (see theMachineInstr::getFlag
/setFlag
family of methods). - Properties that allow the target independent passes to figure out the effects the instruction may have – for instance, the
MachineInstr::mayLoad
method returnstrue
for instructions that can read from memory and theMachineInstr::isCommutable
method returnstrue
if...