[LLVMdev] NO-OP

Reid Spencer rspencer at reidspencer.com
Fri Jul 13 03:12:12 PDT 2007


Hi Fernando,

On Fri, 2007-07-13 at 00:41 -0700, Fernando Magno Quintao Pereira wrote:
> Guys,
> 
>      I am in need of a no-op instruction: an instruction that does not do 
> anything, and has no operands. Does LLVM predefine such an instruction? I 
> want to transform the program so that there is  no empty basic block.

While there's no direct "no-op" instruction, there is an equivalent you
can use:

bitcast i8 0 to i8

- or -

 EntryInsertionPoint =
    new BitCastInst(Constant::getNullValue(Type::Int32Ty),Type::Int32Ty,
        "entry_point", TheEntryBlock);

Both hlvm and the llvm-gcc4 front end use this to create an insertion
point instruction in the function's entry block where new alloca's are
inserted.

Reid

> Fernando
> _______________________________________________
> 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