Add MachineBasicBlock::isPredecessor().
A->isPredecessor(B) is the same as B->isSuccessor(A), but it can tolerate a B that is null or dangling. This shouldn't happen normally, but it it useful for verification code. llvm-svn: 160968
This commit is contained in:
parent
088e37c77a
commit
fee94ca15b
|
@ -379,6 +379,10 @@ public:
|
||||||
/// which refer to fromMBB to refer to this.
|
/// which refer to fromMBB to refer to this.
|
||||||
void transferSuccessorsAndUpdatePHIs(MachineBasicBlock *fromMBB);
|
void transferSuccessorsAndUpdatePHIs(MachineBasicBlock *fromMBB);
|
||||||
|
|
||||||
|
/// isPredecessor - Return true if the specified MBB is a predecessor of this
|
||||||
|
/// block.
|
||||||
|
bool isPredecessor(const MachineBasicBlock *MBB) const;
|
||||||
|
|
||||||
/// isSuccessor - Return true if the specified MBB is a successor of this
|
/// isSuccessor - Return true if the specified MBB is a successor of this
|
||||||
/// block.
|
/// block.
|
||||||
bool isSuccessor(const MachineBasicBlock *MBB) const;
|
bool isSuccessor(const MachineBasicBlock *MBB) const;
|
||||||
|
|
|
@ -540,9 +540,12 @@ MachineBasicBlock::transferSuccessorsAndUpdatePHIs(MachineBasicBlock *fromMBB) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MachineBasicBlock::isPredecessor(const MachineBasicBlock *MBB) const {
|
||||||
|
return std::find(pred_begin(), pred_end(), MBB) != pred_end();
|
||||||
|
}
|
||||||
|
|
||||||
bool MachineBasicBlock::isSuccessor(const MachineBasicBlock *MBB) const {
|
bool MachineBasicBlock::isSuccessor(const MachineBasicBlock *MBB) const {
|
||||||
const_succ_iterator I = std::find(Successors.begin(), Successors.end(), MBB);
|
return std::find(succ_begin(), succ_end(), MBB) != succ_end();
|
||||||
return I != Successors.end();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MachineBasicBlock::isLayoutSuccessor(const MachineBasicBlock *MBB) const {
|
bool MachineBasicBlock::isLayoutSuccessor(const MachineBasicBlock *MBB) const {
|
||||||
|
|
Loading…
Reference in New Issue