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/StackColoring.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/StackColoring.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/StackColoring.cpp | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/llvm/lib/CodeGen/StackColoring.cpp b/llvm/lib/CodeGen/StackColoring.cpp index fc38f9cc7b8..2e8070f4c1b 100644 --- a/llvm/lib/CodeGen/StackColoring.cpp +++ b/llvm/lib/CodeGen/StackColoring.cpp @@ -125,20 +125,6 @@ class StackColoring : public MachineFunctionPass { /// once the coloring is done. SmallVector<MachineInstr*, 8> Markers; - /// SlotSizeSorter - A Sort utility for arranging stack slots according - /// to their size. - struct SlotSizeSorter { - MachineFrameInfo *MFI; - SlotSizeSorter(MachineFrameInfo *mfi) : MFI(mfi) { } - bool operator()(int LHS, int RHS) { - // We use -1 to denote a uninteresting slot. Place these slots at the end. - if (LHS == -1) return false; - if (RHS == -1) return true; - // Sort according to size. - return MFI->getObjectSize(LHS) > MFI->getObjectSize(RHS); - } -}; - public: static char ID; StackColoring() : MachineFunctionPass(ID) { @@ -767,7 +753,13 @@ bool StackColoring::runOnMachineFunction(MachineFunction &Func) { // Sort the slots according to their size. Place unused slots at the end. // Use stable sort to guarantee deterministic code generation. std::stable_sort(SortedSlots.begin(), SortedSlots.end(), - SlotSizeSorter(MFI)); + [this](int LHS, int RHS) { + // We use -1 to denote a uninteresting slot. Place these slots at the end. + if (LHS == -1) return false; + if (RHS == -1) return true; + // Sort according to size. + return MFI->getObjectSize(LHS) > MFI->getObjectSize(RHS); + }); bool Changed = true; while (Changed) { |

