MachineInstr *MI = ...; // some instruction unsigned OperandIndex = ...; // index of operand in instruction MachineOperand &MO = MI->getOperand(OperandIndex); MachineBasicBlock *MBB = MO.getParent();
MachineInstr *MI = ...; // some instruction unsigned OperandIndex = ...; // index of operand in instruction MachineOperand &MO = MI->getOperand(OperandIndex); MachineInstr *ParentMI = MO.getParentInstr();
MachineInstr *MI = ...; // some instruction unsigned OperandIndex = ...; // index of operand in instruction MachineOperand &MO = MI->getOperand(OperandIndex); if (MO.isReg() && MO.isDef()) { // operand is a definition }In this example, the code checks if a given operand in an instruction is a definition. Package/library: LLVM (https://llvm.org/docs/GettingStarted.html) As mentioned before, these code examples use the LLVM C++ library. Therefore, the package/library is LLVM.