mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-09 10:31:14 +00:00
turn this conditional into something humans might actually
be able to understand ;-) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79311 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2c785880ea
commit
a006d4e60d
@ -128,14 +128,31 @@ MachineBasicBlock::iterator MachineBasicBlock::getFirstTerminator() {
|
|||||||
return I;
|
return I;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool MachineBasicBlock::isOnlyReachableByFallthrough() const {
|
||||||
MachineBasicBlock::isOnlyReachableByFallthrough() const {
|
// If this is a landing pad, it isn't a fall through. If it has no preds,
|
||||||
return !isLandingPad() &&
|
// then nothing falls through to it.
|
||||||
!pred_empty() &&
|
if (isLandingPad() || pred_empty())
|
||||||
next(pred_begin()) == pred_end() &&
|
return false;
|
||||||
(*pred_begin())->isLayoutSuccessor(this) &&
|
|
||||||
((*pred_begin())->empty() ||
|
// If there isn't exactly one predecessor, it can't be a fall through.
|
||||||
!(*pred_begin())->back().getDesc().isBarrier());
|
const_pred_iterator PI = pred_begin(), PI2 = PI;
|
||||||
|
++PI;
|
||||||
|
if (PI != pred_end())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// The predecessor has to be immediately before this block.
|
||||||
|
const MachineBasicBlock *Pred = *PI;
|
||||||
|
|
||||||
|
if (!Pred->isLayoutSuccessor(this))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// If the block is completely empty, then it definitely does fall through.
|
||||||
|
if (Pred->empty())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// Otherwise, check the last instruction.
|
||||||
|
const MachineInstr &LastInst = Pred->back();
|
||||||
|
return LastInst.getDesc().isBarrier();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MachineBasicBlock::dump() const {
|
void MachineBasicBlock::dump() const {
|
||||||
|
Loading…
Reference in New Issue
Block a user