[LLVMdev] Problem in X86 backend

Rinaldini Julien julien.rinaldini at heig-vd.ch
Tue Oct 28 01:32:35 PDT 2014


Thx for your answer...
I think I begin to understand better how the backend works...

And thx for that command, I was looking for something like that!

Cheers
__________________________________
De : Tim Northover <t.p.northover at gmail.com>
Envoyé : lundi 27 octobre 2014 15:54
À : Rinaldini Julien
Cc : llvmdev at cs.uiuc.edu
Objet : Re: [LLVMdev] Problem in X86 backend

>> I want to add this instruction in one of my machine basic block: mov [rdi], 0
>> How can I achieve that with the LLVM api? I tried several stuff, but none works :(

Just realised I didn't actually answer your question after that
explanation. Something like this should work:

BuildMI(MBB, MBBI, dl, TII.get(X86::MOV32mi))
    .addReg(X86::RDI).addImm(1).addReg(0).addImm(0).addReg(0)
    .addImm(0);

All the operands are outside the BuildMI because the register operand
you often put inside is actually one the function defines, but this
store doesn't actually change RDI itself.

(You may want to add a RegState::Kill if that's the last use of RDI).

Cheers.

Tim.




More information about the llvm-dev mailing list