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. Fernando
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
Fernando Magno Quintao Pereira wrote:> 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.You can never have an empty basic block. All BBs must have a TerminatorInst. Nick
>> 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. > > You can never have an empty basic block. All BBs must have a TerminatorInst. >I've built a pass to split critical edges of machine functions, and I have to insert new basic blocks. Some of them will have MBB->begin() == MBB->end(). Fernando