Now that we have C++11, turn simple functors into lambdas and remove a ton of boilerplate.

No intended functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202588 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer
2014-03-01 11:47:00 +00:00
parent 73bbab9d75
commit ee5e607355
20 changed files with 114 additions and 312 deletions

View File

@@ -98,16 +98,6 @@ namespace {
bool PerformTrivialForwardCoalescing(MachineInstr *MI,
MachineBasicBlock *MBB);
};
// SuccessorSorter - Sort Successors according to their loop depth.
struct SuccessorSorter {
SuccessorSorter(MachineLoopInfo *LoopInfo) : LI(LoopInfo) {}
bool operator()(const MachineBasicBlock *LHS,
const MachineBasicBlock *RHS) const {
return LI->getLoopDepth(LHS) < LI->getLoopDepth(RHS);
}
MachineLoopInfo *LI;
};
} // end anonymous namespace
char MachineSinking::ID = 0;
@@ -553,7 +543,12 @@ MachineBasicBlock *MachineSinking::FindSuccToSinkTo(MachineInstr *MI,
// we should sink to.
// We give successors with smaller loop depth higher priority.
SmallVector<MachineBasicBlock*, 4> Succs(MBB->succ_begin(), MBB->succ_end());
std::stable_sort(Succs.begin(), Succs.end(), SuccessorSorter(LI));
// Sort Successors according to their loop depth.
std::stable_sort(
Succs.begin(), Succs.end(),
[this](const MachineBasicBlock *LHS, const MachineBasicBlock *RHS) {
return LI->getLoopDepth(LHS) < LI->getLoopDepth(RHS);
});
for (SmallVectorImpl<MachineBasicBlock *>::iterator SI = Succs.begin(),
E = Succs.end(); SI != E; ++SI) {
MachineBasicBlock *SuccBlock = *SI;