[llvm-dev] [X86 MIR] Get memory address read in PUSH64rmm (original) (raw)

Yuanfeng Peng via llvm-dev llvm-dev at lists.llvm.org
Sun Feb 24 11:50:58 PST 2019


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,rbx, 1, rbx,1,noreg, 32, noreg,implicit−defnoreg, implicit-def noreg,implicitdefrsp, 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190224/06d12bd1/attachment.html>



More information about the llvm-dev mailing list