Hi there,
I’m working on an MIR transformation for X86, and I need to get all memory addresses accessed by any X86 instruction. I’ve been using MachineInstr::memoperands() to iterate over all MachineMemOperands and using X86II::getMemoryOperandNo() and X86II::getOperandBias() to get the index of the base_reg MachineOperand. This seems to work fine for most instructions, until I saw the following instruction:
X86: pushq 0x20(%rbx)
MIR: PUSH64rmm renamable $rbx, 1, $noreg, 32, $noreg, implicit-def $rsp, implicit $rsp
For the above MachineInstr, MachineInstr::getNumMemOperands() returns 0: there’s no MachineMemOperands. However, this instruction clearly accesses the memory address specified by [%rbx + 0x20]. I wonder how I can get the memory addresses for instructions like this?
Thanks!
Yuanfeng Peng