diff options
author | Vladimir Prus <ghost@cs.msu.su> | 2006-06-08 15:46:18 +0000 |
---|---|---|
committer | Vladimir Prus <ghost@cs.msu.su> | 2006-06-08 15:46:18 +0000 |
commit | b5b6dc49e2ea63d9cbf1991f7ff20d296dda41d2 (patch) | |
tree | 977ccab5aaae55608d6e4453b53b97ef4361839d /llvm/lib/VMCore/BasicBlock.cpp | |
parent | c944417749519c998c467285c663aaab782e837a (diff) | |
download | bcm5719-llvm-b5b6dc49e2ea63d9cbf1991f7ff20d296dda41d2.tar.gz bcm5719-llvm-b5b6dc49e2ea63d9cbf1991f7ff20d296dda41d2.zip |
New method BasicBlock::getFirstNonPHI.
llvm-svn: 28724
Diffstat (limited to 'llvm/lib/VMCore/BasicBlock.cpp')
-rw-r--r-- | llvm/lib/VMCore/BasicBlock.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/BasicBlock.cpp b/llvm/lib/VMCore/BasicBlock.cpp index ab7798c3866..c93f5584d27 100644 --- a/llvm/lib/VMCore/BasicBlock.cpp +++ b/llvm/lib/VMCore/BasicBlock.cpp @@ -121,6 +121,17 @@ const TerminatorInst *const BasicBlock::getTerminator() const { return dyn_cast<TerminatorInst>(&InstList.back()); } +Instruction* BasicBlock::getFirstNonPHI() +{ + BasicBlock::iterator i = begin(), e = end(); + // All valid basic blocks should have a terminator, + // which is not a PHINode. If we have invalid basic + // block we'll get assert when dereferencing past-the-end + // iterator. + while (isa<PHINode>(i)) ++i; + return &*i; +} + void BasicBlock::dropAllReferences() { for(iterator I = begin(), E = end(); I != E; ++I) I->dropAllReferences(); |