forked from OSchip/llvm-project
CodeGen: Use range-based for in PostRAScheduler, NFC
llvm-svn: 249901
This commit is contained in:
parent
638b98d3ed
commit
1ff409802d
|
@ -302,8 +302,7 @@ bool PostRAScheduler::runOnMachineFunction(MachineFunction &Fn) {
|
|||
CriticalPathRCs);
|
||||
|
||||
// Loop over all of the basic blocks
|
||||
for (MachineFunction::iterator MBB = Fn.begin(), MBBe = Fn.end();
|
||||
MBB != MBBe; ++MBB) {
|
||||
for (auto &MBB : Fn) {
|
||||
#ifndef NDEBUG
|
||||
// If DebugDiv > 0 then only schedule MBB with (ID % DebugDiv) == DebugMod
|
||||
if (DebugDiv > 0) {
|
||||
|
@ -311,25 +310,25 @@ bool PostRAScheduler::runOnMachineFunction(MachineFunction &Fn) {
|
|||
if (bbcnt++ % DebugDiv != DebugMod)
|
||||
continue;
|
||||
dbgs() << "*** DEBUG scheduling " << Fn.getName()
|
||||
<< ":BB#" << MBB->getNumber() << " ***\n";
|
||||
<< ":BB#" << MBB.getNumber() << " ***\n";
|
||||
}
|
||||
#endif
|
||||
|
||||
// Initialize register live-range state for scheduling in this block.
|
||||
Scheduler.startBlock(MBB);
|
||||
Scheduler.startBlock(&MBB);
|
||||
|
||||
// Schedule each sequence of instructions not interrupted by a label
|
||||
// or anything else that effectively needs to shut down scheduling.
|
||||
MachineBasicBlock::iterator Current = MBB->end();
|
||||
unsigned Count = MBB->size(), CurrentCount = Count;
|
||||
for (MachineBasicBlock::iterator I = Current; I != MBB->begin(); ) {
|
||||
MachineBasicBlock::iterator Current = MBB.end();
|
||||
unsigned Count = MBB.size(), CurrentCount = Count;
|
||||
for (MachineBasicBlock::iterator I = Current; I != MBB.begin();) {
|
||||
MachineInstr *MI = std::prev(I);
|
||||
--Count;
|
||||
// Calls are not scheduling boundaries before register allocation, but
|
||||
// post-ra we don't gain anything by scheduling across calls since we
|
||||
// don't need to worry about register pressure.
|
||||
if (MI->isCall() || TII->isSchedulingBoundary(MI, MBB, Fn)) {
|
||||
Scheduler.enterRegion(MBB, I, Current, CurrentCount - Count);
|
||||
if (MI->isCall() || TII->isSchedulingBoundary(MI, &MBB, Fn)) {
|
||||
Scheduler.enterRegion(&MBB, I, Current, CurrentCount - Count);
|
||||
Scheduler.setEndIndex(CurrentCount);
|
||||
Scheduler.schedule();
|
||||
Scheduler.exitRegion();
|
||||
|
@ -343,9 +342,9 @@ bool PostRAScheduler::runOnMachineFunction(MachineFunction &Fn) {
|
|||
Count -= MI->getBundleSize();
|
||||
}
|
||||
assert(Count == 0 && "Instruction count mismatch!");
|
||||
assert((MBB->begin() == Current || CurrentCount != 0) &&
|
||||
assert((MBB.begin() == Current || CurrentCount != 0) &&
|
||||
"Instruction count mismatch!");
|
||||
Scheduler.enterRegion(MBB, MBB->begin(), Current, CurrentCount);
|
||||
Scheduler.enterRegion(&MBB, MBB.begin(), Current, CurrentCount);
|
||||
Scheduler.setEndIndex(CurrentCount);
|
||||
Scheduler.schedule();
|
||||
Scheduler.exitRegion();
|
||||
|
@ -355,7 +354,7 @@ bool PostRAScheduler::runOnMachineFunction(MachineFunction &Fn) {
|
|||
Scheduler.finishBlock();
|
||||
|
||||
// Update register kills
|
||||
Scheduler.fixupKills(MBB);
|
||||
Scheduler.fixupKills(&MBB);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue