MCInst Inst; // assume Inst is a valid MCInst object unsigned Opcode = Inst.getOpcode(); // retrieve opcode if (Opcode == X86::MOV16mr || Opcode == X86::MOV32mr || Opcode == X86::MOV64mr) { // instruction is a memory move }
MCInst Inst; // assume Inst is a valid MCInst object unsigned Opcode = Inst.getOpcode(); // retrieve opcode if (Opcode == ARM::B || Opcode == ARM::BL || Opcode == ARM::BX || Opcode == ARM::BLX) { // instruction is a branch }In this example, we check if the instruction is a branch by comparing its opcode to the ones defined for B, BL, BX, and BLX in the ARM namespace. Package library: LLVM (Low Level Virtual Machine)