Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 //===- subzero/src/IceRegAlloc.cpp - Linear-scan implementation -----------===// | 1 //===- subzero/src/IceRegAlloc.cpp - Linear-scan implementation -----------===// |
| 2 // | 2 // |
| 3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 /// | 9 /// |
| 10 /// \file | 10 /// \file |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 243 case RAK_Global: | 243 case RAK_Global: |
| 244 case RAK_Phi: | 244 case RAK_Phi: |
| 245 initForGlobal(); | 245 initForGlobal(); |
| 246 break; | 246 break; |
| 247 case RAK_InfOnly: | 247 case RAK_InfOnly: |
| 248 initForInfOnly(); | 248 initForInfOnly(); |
| 249 break; | 249 break; |
| 250 } | 250 } |
| 251 | 251 |
| 252 auto CompareRanges = [](const Variable *L, const Variable *R) { | 252 auto CompareRanges = [](const Variable *L, const Variable *R) { |
| 253 InstNumberT Lstart = L->getLiveRange().getStart(); | 253 InstNumberT Lstart = L->getLiveRange().getStart(); |
| 254 InstNumberT Rstart = R->getLiveRange().getStart(); | 254 InstNumberT Rstart = R->getLiveRange().getStart(); |
| 255 if (Lstart == Rstart) | 255 if (Lstart == Rstart) |
| 256 return L->getIndex() < R->getIndex(); | 256 return L->getIndex() < R->getIndex(); |
| 257 return Lstart < Rstart; | 257 return Lstart < Rstart; |
| 258 }; | 258 }; |
| 259 // Do a reverse sort so that erasing elements (from the end) is fast. | 259 // Do a reverse sort so that erasing elements (from the end) is fast. |
| 260 std::sort(Unhandled.rbegin(), Unhandled.rend(), CompareRanges); | 260 std::sort(Unhandled.rbegin(), Unhandled.rend(), CompareRanges); |
| 261 std::sort(UnhandledPrecolored.rbegin(), UnhandledPrecolored.rend(), | 261 std::sort(UnhandledPrecolored.rbegin(), UnhandledPrecolored.rend(), |
| 262 CompareRanges); | 262 CompareRanges); |
| 263 | 263 |
| 264 Handled.reserve(Unhandled.size()); | 264 Handled.reserve(Unhandled.size()); |
| 265 Inactive.reserve(Unhandled.size()); | 265 Inactive.reserve(Unhandled.size()); |
| 266 Active.reserve(Unhandled.size()); | 266 Active.reserve(Unhandled.size()); |
| 267 } | 267 } |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 769 for (Variable *I : Active) | 769 for (Variable *I : Active) |
| 770 Handled.push_back(I); | 770 Handled.push_back(I); |
| 771 Active.clear(); | 771 Active.clear(); |
| 772 for (Variable *I : Inactive) | 772 for (Variable *I : Inactive) |
| 773 Handled.push_back(I); | 773 Handled.push_back(I); |
| 774 Inactive.clear(); | 774 Inactive.clear(); |
| 775 dump(Func); | 775 dump(Func); |
| 776 | 776 |
| 777 llvm::SmallVector<int32_t, REGS_SIZE> Permutation(NumRegisters); | 777 llvm::SmallVector<int32_t, REGS_SIZE> Permutation(NumRegisters); |
| 778 if (Randomized) { | 778 if (Randomized) { |
| 779 Func->getTarget()->makeRandomRegisterPermutation( | 779 Func->getTarget()->makeRandomRegisterPermutation( |
|
Jim Stichnoth
2015/08/19 19:03:04
Can you make it so that the RNG is initialized usi
qining
2015/08/19 23:25:49
Done. The salt will be calculated here and then pa
| |
| 780 Permutation, PreDefinedRegisters | ~RegMaskFull); | 780 Permutation, PreDefinedRegisters | ~RegMaskFull); |
| 781 } | 781 } |
| 782 | 782 |
| 783 // Finish up by assigning RegNumTmp->RegNum (or a random permutation | 783 // Finish up by assigning RegNumTmp->RegNum (or a random permutation |
| 784 // thereof) for each Variable. | 784 // thereof) for each Variable. |
| 785 for (Variable *Item : Handled) { | 785 for (Variable *Item : Handled) { |
| 786 int32_t RegNum = Item->getRegNumTmp(); | 786 int32_t RegNum = Item->getRegNumTmp(); |
| 787 int32_t AssignedRegNum = RegNum; | 787 int32_t AssignedRegNum = RegNum; |
| 788 | 788 |
| 789 if (Randomized && Item->hasRegTmp() && !Item->hasReg()) { | 789 if (Randomized && Item->hasRegTmp() && !Item->hasReg()) { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 848 Str << "\n"; | 848 Str << "\n"; |
| 849 } | 849 } |
| 850 Str << "++++++ Inactive:\n"; | 850 Str << "++++++ Inactive:\n"; |
| 851 for (const Variable *Item : Inactive) { | 851 for (const Variable *Item : Inactive) { |
| 852 dumpLiveRange(Item, Func); | 852 dumpLiveRange(Item, Func); |
| 853 Str << "\n"; | 853 Str << "\n"; |
| 854 } | 854 } |
| 855 } | 855 } |
| 856 | 856 |
| 857 } // end of namespace Ice | 857 } // end of namespace Ice |
| OLD | NEW |