diff options
author | Bill Wendling <isanbard@gmail.com> | 2011-08-16 20:42:52 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2011-08-16 20:42:52 +0000 |
commit | ee1c2d2437a0918b17bf39b92296cb43c0394eb3 (patch) | |
tree | 8451cdf3c2fd3b289a5c7452516ab81d3332fcee /llvm/lib/VMCore/BasicBlock.cpp | |
parent | 55d875fa1c1903ab9292c84f188e2028fb7a6469 (diff) | |
download | bcm5719-llvm-ee1c2d2437a0918b17bf39b92296cb43c0394eb3.tar.gz bcm5719-llvm-ee1c2d2437a0918b17bf39b92296cb43c0394eb3.zip |
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
Diffstat (limited to 'llvm/lib/VMCore/BasicBlock.cpp')
-rw-r--r-- | llvm/lib/VMCore/BasicBlock.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
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<LandingPadInst>(InsertPt)) ++InsertPt; + return InsertPt; +} + void BasicBlock::dropAllReferences() { for(iterator I = begin(), E = end(); I != E; ++I) I->dropAllReferences(); |