mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
Remove isAccessable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34497 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a4e7cd947e
commit
033c9715d9
@ -165,10 +165,6 @@ public:
|
||||
/// this basic block is entered via an exception handler.
|
||||
void setIsLandingPad() { IsLandingPad = true; }
|
||||
|
||||
/// isAccessable - Returns true if the block is alive. That is, if it has
|
||||
/// predecessors or is an eh landing pad.
|
||||
bool isAccessable() const { return !pred_empty() || isLandingPad(); }
|
||||
|
||||
// Code Layout methods.
|
||||
|
||||
/// moveBefore/moveAfter - move 'this' block before or after the specified
|
||||
|
@ -67,7 +67,7 @@ FunctionPass *llvm::createBranchFoldingPass() { return new BranchFolder(); }
|
||||
/// RemoveDeadBlock - Remove the specified dead machine basic block from the
|
||||
/// function, updating the CFG.
|
||||
void BranchFolder::RemoveDeadBlock(MachineBasicBlock *MBB) {
|
||||
assert(!MBB->isAccessable() && "MBB must be dead!");
|
||||
assert(MBB->pred_empty() && "MBB must be dead!");
|
||||
DOUT << "\nRemoving MBB: " << *MBB;
|
||||
|
||||
MachineFunction *MF = MBB->getParent();
|
||||
@ -440,7 +440,7 @@ bool BranchFolder::OptimizeBranches(MachineFunction &MF) {
|
||||
OptimizeBlock(MBB);
|
||||
|
||||
// If it is dead, remove it.
|
||||
if (!MBB->isAccessable()) {
|
||||
if (MBB->pred_empty()) {
|
||||
RemoveDeadBlock(MBB);
|
||||
MadeChange = true;
|
||||
++NumDeadBlocks;
|
||||
@ -618,14 +618,14 @@ void BranchFolder::OptimizeBlock(MachineBasicBlock *MBB) {
|
||||
// explicitly.
|
||||
if (MBB->empty()) {
|
||||
// Dead block? Leave for cleanup later.
|
||||
if (!MBB->isAccessable()) return;
|
||||
if (MBB->pred_empty()) return;
|
||||
|
||||
if (FallThrough == MBB->getParent()->end()) {
|
||||
// TODO: Simplify preds to not branch here if possible!
|
||||
} else {
|
||||
// Rewrite all predecessors of the old block to go to the fallthrough
|
||||
// instead.
|
||||
while (MBB->isAccessable()) {
|
||||
while (!MBB->pred_empty()) {
|
||||
MachineBasicBlock *Pred = *(MBB->pred_end()-1);
|
||||
ReplaceUsesOfBlockWith(Pred, MBB, FallThrough, TII);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user