mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-12 01:25:10 +00:00
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:
@@ -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) {
|
||||
|
Reference in New Issue
Block a user