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
MachineOperandinstances - Some flags that can be set or queried – for instance, the
fast-mathflags attached to this instruction, whether it’s an instruction used for setting up the call frame, and so on (see theMachineInstr::getFlag/setFlagfamily of methods). - Properties that allow the target independent passes to figure out the effects the instruction may have – for instance, the
MachineInstr::mayLoadmethod returnstruefor instructions that can read from memory and theMachineInstr::isCommutablemethod returnstrueif...