From ee1c2d2437a0918b17bf39b92296cb43c0394eb3 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Tue, 16 Aug 2011 20:42:52 +0000 Subject: Add getFirstInsertionPt() method. getFirstInsertionPt() returns an iterator to the first insertion point in a basic block. This is after all PHIs and any other instruction which is required to be at the top of the basic block (like LandingPadInst). llvm-svn: 137744 --- llvm/lib/VMCore/BasicBlock.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'llvm/lib/VMCore/BasicBlock.cpp') diff --git a/llvm/lib/VMCore/BasicBlock.cpp b/llvm/lib/VMCore/BasicBlock.cpp index 3e29f05d51d..d0aa275c8fe 100644 --- a/llvm/lib/VMCore/BasicBlock.cpp +++ b/llvm/lib/VMCore/BasicBlock.cpp @@ -167,6 +167,12 @@ Instruction* BasicBlock::getFirstNonPHIOrDbgOrLifetime() { return &*i; } +BasicBlock::iterator BasicBlock::getFirstInsertionPt() { + iterator InsertPt = getFirstNonPHI(); + if (isa(InsertPt)) ++InsertPt; + return InsertPt; +} + void BasicBlock::dropAllReferences() { for(iterator I = begin(), E = end(); I != E; ++I) I->dropAllReferences(); -- cgit v1.2.3