mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-05 12:31:46 +00:00
Make OptimizeBlock take a MachineFunction::iterator instead of a
MachineBasicBlock* as a parameter so that nxext() and prior() helper functions can work naturally on it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15376 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7f74340733
commit
f978a1db51
@ -28,8 +28,8 @@ namespace {
|
|||||||
virtual bool runOnMachineFunction(MachineFunction &MF);
|
virtual bool runOnMachineFunction(MachineFunction &MF);
|
||||||
virtual const char *getPassName() const { return "Branch Folder"; }
|
virtual const char *getPassName() const { return "Branch Folder"; }
|
||||||
private:
|
private:
|
||||||
bool OptimizeBlock(MachineBasicBlock *MBB, const TargetInstrInfo &TII);
|
bool OptimizeBlock(MachineFunction::iterator MBB,
|
||||||
|
const TargetInstrInfo &TII);
|
||||||
|
|
||||||
bool isUncondBranch(const MachineInstr *MI, const TargetInstrInfo &TII) {
|
bool isUncondBranch(const MachineInstr *MI, const TargetInstrInfo &TII) {
|
||||||
return TII.isBarrier(MI->getOpcode()) && TII.isBranch(MI->getOpcode());
|
return TII.isBarrier(MI->getOpcode()) && TII.isBranch(MI->getOpcode());
|
||||||
@ -108,13 +108,13 @@ static void ReplaceUsesOfBlockWith(MachineBasicBlock *BB,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool BranchFolder::OptimizeBlock(MachineBasicBlock *MBB,
|
bool BranchFolder::OptimizeBlock(MachineFunction::iterator MBB,
|
||||||
const TargetInstrInfo &TII) {
|
const TargetInstrInfo &TII) {
|
||||||
// If this block is empty, make everyone use it's fall-through, not the block
|
// If this block is empty, make everyone use it's fall-through, not the block
|
||||||
// explicitly.
|
// explicitly.
|
||||||
if (MBB->empty()) {
|
if (MBB->empty()) {
|
||||||
if (MBB->pred_empty()) return false;
|
if (MBB->pred_empty()) return false;
|
||||||
MachineFunction::iterator FallThrough =next(MachineFunction::iterator(MBB));
|
MachineFunction::iterator FallThrough =next(MBB);
|
||||||
assert(FallThrough != MBB->getParent()->end() &&
|
assert(FallThrough != MBB->getParent()->end() &&
|
||||||
"Fell off the end of the function!");
|
"Fell off the end of the function!");
|
||||||
while (!MBB->pred_empty()) {
|
while (!MBB->pred_empty()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user