diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2014-03-01 11:47:00 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2014-03-01 11:47:00 +0000 |
commit | 3a377bce4e134406920a3ee744e2ef9edd21762f (patch) | |
tree | 7242f0b2d56078d18ded3c7927059b85a8f2d201 /llvm/lib/CodeGen/MachineSink.cpp | |
parent | f4cde83d3a284a53869baa12d9eabe0342678e93 (diff) | |
download | bcm5719-llvm-3a377bce4e134406920a3ee744e2ef9edd21762f.tar.gz bcm5719-llvm-3a377bce4e134406920a3ee744e2ef9edd21762f.zip |
Now that we have C++11, turn simple functors into lambdas and remove a ton of boilerplate.
No intended functionality change.
llvm-svn: 202588
Diffstat (limited to 'llvm/lib/CodeGen/MachineSink.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineSink.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/llvm/lib/CodeGen/MachineSink.cpp b/llvm/lib/CodeGen/MachineSink.cpp index 105d7c2cde5..df38dfcbce9 100644 --- a/llvm/lib/CodeGen/MachineSink.cpp +++ b/llvm/lib/CodeGen/MachineSink.cpp @@ -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; |