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/Target/Mips/MipsDelaySlotFiller.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/Target/Mips/MipsDelaySlotFiller.cpp')
| -rw-r--r-- | llvm/lib/Target/Mips/MipsDelaySlotFiller.cpp | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/llvm/lib/Target/Mips/MipsDelaySlotFiller.cpp b/llvm/lib/Target/Mips/MipsDelaySlotFiller.cpp index ffbd83b1bbb..6c5ea4c810a 100644 --- a/llvm/lib/Target/Mips/MipsDelaySlotFiller.cpp +++ b/llvm/lib/Target/Mips/MipsDelaySlotFiller.cpp @@ -65,20 +65,6 @@ namespace { typedef MachineBasicBlock::reverse_iterator ReverseIter; typedef SmallDenseMap<MachineBasicBlock*, MachineInstr*, 2> BB2BrMap; - /// \brief A functor comparing edge weight of two blocks. - struct CmpWeight { - CmpWeight(const MachineBasicBlock &S, - const MachineBranchProbabilityInfo &P) : Src(S), Prob(P) {} - - bool operator()(const MachineBasicBlock *Dst0, - const MachineBasicBlock *Dst1) const { - return Prob.getEdgeWeight(&Src, Dst0) < Prob.getEdgeWeight(&Src, Dst1); - } - - const MachineBasicBlock &Src; - const MachineBranchProbabilityInfo &Prob; - }; - class RegDefsUses { public: RegDefsUses(TargetMachine &TM); @@ -640,8 +626,12 @@ MachineBasicBlock *Filler::selectSuccBB(MachineBasicBlock &B) const { return NULL; // Select the successor with the larget edge weight. - CmpWeight Cmp(B, getAnalysis<MachineBranchProbabilityInfo>()); - MachineBasicBlock *S = *std::max_element(B.succ_begin(), B.succ_end(), Cmp); + auto &Prob = getAnalysis<MachineBranchProbabilityInfo>(); + MachineBasicBlock *S = *std::max_element(B.succ_begin(), B.succ_end(), + [&](const MachineBasicBlock *Dst0, + const MachineBasicBlock *Dst1) { + return Prob.getEdgeWeight(&B, Dst0) < Prob.getEdgeWeight(&B, Dst1); + }); return S->isLandingPad() ? NULL : S; } |

