mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-24 08:18:33 +00:00
add a new method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20293 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -107,7 +107,12 @@ public:
|
|||||||
///
|
///
|
||||||
void eraseFromParent();
|
void eraseFromParent();
|
||||||
|
|
||||||
|
/// getSinglePredecessor - If this basic block has a single predecessor block,
|
||||||
|
/// return the block, otherwise return a null pointer.
|
||||||
|
BasicBlock *getSinglePredecessor();
|
||||||
|
const BasicBlock *getSinglePredecessor() const {
|
||||||
|
return const_cast<BasicBlock*>(this)->getSinglePredecessor();
|
||||||
|
}
|
||||||
|
|
||||||
//===--------------------------------------------------------------------===//
|
//===--------------------------------------------------------------------===//
|
||||||
/// Instruction iterator methods
|
/// Instruction iterator methods
|
||||||
|
|||||||
@@ -129,6 +129,16 @@ void BasicBlock::dropAllReferences() {
|
|||||||
I->dropAllReferences();
|
I->dropAllReferences();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// getSinglePredecessor - If this basic block has a single predecessor block,
|
||||||
|
/// return the block, otherwise return a null pointer.
|
||||||
|
BasicBlock *BasicBlock::getSinglePredecessor() {
|
||||||
|
pred_iterator PI = pred_begin(this), E = pred_end(this);
|
||||||
|
if (PI == E) return 0; // No preds.
|
||||||
|
BasicBlock *ThePred = *PI;
|
||||||
|
++PI;
|
||||||
|
return (PI == E) ? ThePred : 0 /*multiple preds*/;
|
||||||
|
}
|
||||||
|
|
||||||
// removePredecessor - This method is used to notify a BasicBlock that the
|
// removePredecessor - This method is used to notify a BasicBlock that the
|
||||||
// specified Predecessor of the block is no longer able to reach it. This is
|
// specified Predecessor of the block is no longer able to reach it. This is
|
||||||
// actually not used to update the Predecessor list, but is actually used to
|
// actually not used to update the Predecessor list, but is actually used to
|
||||||
|
|||||||
Reference in New Issue
Block a user