summaryrefslogtreecommitdiff
path: root/lib/VMCore
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2011-08-16 20:42:52 +0000
committerBill Wendling <isanbard@gmail.com>2011-08-16 20:42:52 +0000
commitd2e103daf8a093e0e25ddbaa7549c083887196e8 (patch)
tree00c12a4a051f81761d059f373a9f46747a812629 /lib/VMCore
parent23b49ba6d55972fdffdfd4ed37edcf067bb60f3c (diff)
downloadllvm-d2e103daf8a093e0e25ddbaa7549c083887196e8.tar.gz
llvm-d2e103daf8a093e0e25ddbaa7549c083887196e8.tar.bz2
llvm-d2e103daf8a093e0e25ddbaa7549c083887196e8.tar.xz
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). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137744 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/BasicBlock.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/VMCore/BasicBlock.cpp b/lib/VMCore/BasicBlock.cpp
index 3e29f05d51..d0aa275c8f 100644
--- a/lib/VMCore/BasicBlock.cpp
+++ b/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();