diff options
author | Juergen Ributzka <juergen@apple.com> | 2015-07-09 17:11:15 +0000 |
---|---|---|
committer | Juergen Ributzka <juergen@apple.com> | 2015-07-09 17:11:15 +0000 |
commit | 216ed03ebb1c8434062687dd990cd4b487257fce (patch) | |
tree | d4c91b0ab8c19584237ac93f1259a3f27f0eedff /llvm/lib/CodeGen/StackMaps.cpp | |
parent | aef76cafa0e5c8391d16930c328b54b07c5c6e91 (diff) | |
download | bcm5719-llvm-216ed03ebb1c8434062687dd990cd4b487257fce.tar.gz bcm5719-llvm-216ed03ebb1c8434062687dd990cd4b487257fce.zip |
[StackMap] Use lambdas to specify the sort and erase conditions. NFC.
llvm-svn: 241823
Diffstat (limited to 'llvm/lib/CodeGen/StackMaps.cpp')
-rw-r--r-- | llvm/lib/CodeGen/StackMaps.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/StackMaps.cpp b/llvm/lib/CodeGen/StackMaps.cpp index 5fe17a1889b..116eef66c58 100644 --- a/llvm/lib/CodeGen/StackMaps.cpp +++ b/llvm/lib/CodeGen/StackMaps.cpp @@ -248,10 +248,15 @@ StackMaps::parseRegisterLiveOutMask(const uint32_t *Mask) const { // We don't need to keep track of a register if its super-register is already // in the list. Merge entries that refer to the same dwarf register and use // the maximum size that needs to be spilled. - std::sort(LiveOuts.begin(), LiveOuts.end()); - for (LiveOutVec::iterator I = LiveOuts.begin(), E = LiveOuts.end(); I != E; - ++I) { - for (LiveOutVec::iterator II = std::next(I); II != E; ++II) { + + std::sort(LiveOuts.begin(), LiveOuts.end(), + [](const LiveOutReg &LHS, const LiveOutReg &RHS) { + // Only sort by the dwarf register number. + return LHS.DwarfRegNum < RHS.DwarfRegNum; + }); + + for (auto I = LiveOuts.begin(), E = LiveOuts.end(); I != E; ++I) { + for (auto II = std::next(I); II != E; ++II) { if (I->DwarfRegNum != II->DwarfRegNum) { // Skip all the now invalid entries. I = --II; @@ -260,12 +265,15 @@ StackMaps::parseRegisterLiveOutMask(const uint32_t *Mask) const { I->Size = std::max(I->Size, II->Size); if (TRI->isSuperRegister(I->Reg, II->Reg)) I->Reg = II->Reg; - II->MarkInvalid(); + II->Reg = 0; // mark for deletion. } } + LiveOuts.erase( - std::remove_if(LiveOuts.begin(), LiveOuts.end(), LiveOutReg::IsInvalid), + std::remove_if(LiveOuts.begin(), LiveOuts.end(), + [](const LiveOutReg &LO) { return LO.Reg == 0; }), LiveOuts.end()); + return LiveOuts; } |