[LLVMdev] insert nop instruction

David Chisnall David.Chisnall at cl.cam.ac.uk
Thu Jul 9 01:41:27 PDT 2015


Hi,

What are you trying to achieve?  Inserting NOPs into LLVM IR is likely to be pointless, as optimisations (in the IR or SelectionDAG) will remove them before machine code generation.  If you want to insert NOPs into the generated machine code, then this will not help you (you could insert inline assembly containing nops into the IR).

David

> On 9 Jul 2015, at 09:25, Zahra Marj <zahrafatehimarj at gmail.com> wrote:
> 
> Hi.
> I need to write a function pass that insert nop instruction in function. Examples of these instructions are: %nop = add i1 0, 0 or %nop = alloca i1, i1 0. This link couldn't help me: http://llvm.org/docs/ProgrammersManual.html#creating-and-inserting-new-instructions
> I need a clear example about inserting new instruction. Anyone can help me?
> Thanks.
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev





More information about the llvm-dev mailing list