[LLVMdev] [PATCH] BasicBlock::getFirstNonPHI

Chris Lattner sabre at nondot.org
Sun Jun 4 09:52:32 PDT 2006


On Sun, 4 Jun 2006, Vladimir Prus wrote:
> everytime one has to add instruction at the beginning of a basic block, one
> has to skip past PHI nodes that are already there. How about adding a new
> method to BasicBlock, to get that first non-PHI instruction? So, adding an
> instruction will be as simple as:
>
>      new SomeInstruction(............., BB->getFirstNonPHI())

Sure, sounds good.  A couple requests:

1. Please add a const version that returns a const Instruction* also.
2. There is no need to check for running off the end of the basic block, 
you are guaranteed that a block has a terminator, which is not a PHI.

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/



More information about the llvm-dev mailing list