New method BasicBlock::getFirstNonPHI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28724 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Vladimir Prus
2006-06-08 15:46:18 +00:00
parent 7f3ac4108d
commit dd49dbfe44
2 changed files with 19 additions and 1 deletions

View File

@@ -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();