[llvm-dev] How to create a proper MachineMemOperand?

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Tue Apr 17 02:49:58 PDT 2018


On 17 April 2018 at 03:49, Will Lester via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> The problem is not to create a MachineMemOperand, but to create a
> MachineMemOperand with certain address. This scene does not exist in the
> original code.

MachineMemOperands are used to tell compiler optimizations where a
memory instruction will access. It's not the actual representation
used to tell the CPU where to load or store. So you can conservatively
create a dummy one that essentially tells LLVM "this may write
anywhere" and your program will compile correctly.

To do that you'd write something like
"MF->getMachineMemOperand(MachinePointerInfo(),
MachineMemOperand::MOStore, 0, 1)". I've not tested this in code, so
you may have to tweak it.

Cheers.

Tim.


More information about the llvm-dev mailing list