Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Side by Side Diff: src/IceRegAlloc.cpp

Issue 1221643012: Subzero: Add -Wshadow to the build. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Change the previous underscore naming style Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // This file implements the LinearScan class, which performs the 10 // This file implements the LinearScan class, which performs the
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 if (const Variable *Var = Inst.getDest()) { 170 if (const Variable *Var = Inst.getDest()) {
171 if (Var->hasReg() || Var->getWeight().isInf()) { 171 if (Var->hasReg() || Var->getWeight().isInf()) {
172 if (LRBegin[Var->getIndex()] == Inst::NumberSentinel) { 172 if (LRBegin[Var->getIndex()] == Inst::NumberSentinel) {
173 LRBegin[Var->getIndex()] = Inst.getNumber(); 173 LRBegin[Var->getIndex()] = Inst.getNumber();
174 ++NumVars; 174 ++NumVars;
175 } 175 }
176 } 176 }
177 } 177 }
178 for (SizeT I = 0; I < Inst.getSrcSize(); ++I) { 178 for (SizeT I = 0; I < Inst.getSrcSize(); ++I) {
179 Operand *Src = Inst.getSrc(I); 179 Operand *Src = Inst.getSrc(I);
180 SizeT NumVars = Src->getNumVars(); 180 SizeT NVars = Src->getNumVars();
181 for (SizeT J = 0; J < NumVars; ++J) { 181 for (SizeT J = 0; J < NVars; ++J) {
182 const Variable *Var = Src->getVar(J); 182 const Variable *Var = Src->getVar(J);
183 if (Var->hasReg() || Var->getWeight().isInf()) 183 if (Var->hasReg() || Var->getWeight().isInf())
184 LREnd[Var->getIndex()] = Inst.getNumber(); 184 LREnd[Var->getIndex()] = Inst.getNumber();
185 } 185 }
186 } 186 }
187 } 187 }
188 } 188 }
189 189
190 Unhandled.reserve(NumVars); 190 Unhandled.reserve(NumVars);
191 UnhandledPrecolored.reserve(NumVars); 191 UnhandledPrecolored.reserve(NumVars);
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 ++RegUses[MinWeightIndex]; 667 ++RegUses[MinWeightIndex];
668 Active.push_back(Cur); 668 Active.push_back(Cur);
669 if (Verbose) { 669 if (Verbose) {
670 Ostream &Str = Ctx->getStrDump(); 670 Ostream &Str = Ctx->getStrDump();
671 Str << "Allocating "; 671 Str << "Allocating ";
672 dumpLiveRange(Cur, Func); 672 dumpLiveRange(Cur, Func);
673 Str << "\n"; 673 Str << "\n";
674 } 674 }
675 } 675 }
676 } 676 }
677 dump(Func); 677 dump();
678 } 678 }
679 // Move anything Active or Inactive to Handled for easier handling. 679 // Move anything Active or Inactive to Handled for easier handling.
680 for (Variable *I : Active) 680 for (Variable *I : Active)
681 Handled.push_back(I); 681 Handled.push_back(I);
682 Active.clear(); 682 Active.clear();
683 for (Variable *I : Inactive) 683 for (Variable *I : Inactive)
684 Handled.push_back(I); 684 Handled.push_back(I);
685 Inactive.clear(); 685 Inactive.clear();
686 dump(Func); 686 dump();
687 687
688 llvm::SmallVector<int32_t, REGS_SIZE> Permutation(NumRegisters); 688 llvm::SmallVector<int32_t, REGS_SIZE> Permutation(NumRegisters);
689 if (Randomized) { 689 if (Randomized) {
690 Func->getTarget()->makeRandomRegisterPermutation( 690 Func->getTarget()->makeRandomRegisterPermutation(
691 Permutation, PreDefinedRegisters | ~RegMaskFull); 691 Permutation, PreDefinedRegisters | ~RegMaskFull);
692 } 692 }
693 693
694 // Finish up by assigning RegNumTmp->RegNum (or a random permutation 694 // Finish up by assigning RegNumTmp->RegNum (or a random permutation
695 // thereof) for each Variable. 695 // thereof) for each Variable.
696 for (Variable *Item : Handled) { 696 for (Variable *Item : Handled) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 // Another idea for coalescing stack slots is to initialize the 728 // Another idea for coalescing stack slots is to initialize the
729 // Unhandled list with just the unallocated variables, saving time 729 // Unhandled list with just the unallocated variables, saving time
730 // but not offering second-chance opportunities. 730 // but not offering second-chance opportunities.
731 731
732 if (Verbose) 732 if (Verbose)
733 Ctx->unlockStr(); 733 Ctx->unlockStr();
734 } 734 }
735 735
736 // ======================== Dump routines ======================== // 736 // ======================== Dump routines ======================== //
737 737
738 void LinearScan::dump(Cfg *Func) const { 738 void LinearScan::dump() const {
739 if (!BuildDefs::dump()) 739 if (!BuildDefs::dump())
740 return; 740 return;
741 if (!Func->isVerbose(IceV_LinearScan)) 741 if (!Func->isVerbose(IceV_LinearScan))
742 return; 742 return;
743 Ostream &Str = Func->getContext()->getStrDump(); 743 Ostream &Str = Func->getContext()->getStrDump();
744 Func->resetCurrentNode(); 744 Func->resetCurrentNode();
745 Str << "**** Current regalloc state:\n"; 745 Str << "**** Current regalloc state:\n";
746 Str << "++++++ Handled:\n"; 746 Str << "++++++ Handled:\n";
747 for (const Variable *Item : Handled) { 747 for (const Variable *Item : Handled) {
748 dumpLiveRange(Item, Func); 748 dumpLiveRange(Item, Func);
(...skipping 10 matching lines...) Expand all
759 Str << "\n"; 759 Str << "\n";
760 } 760 }
761 Str << "++++++ Inactive:\n"; 761 Str << "++++++ Inactive:\n";
762 for (const Variable *Item : Inactive) { 762 for (const Variable *Item : Inactive) {
763 dumpLiveRange(Item, Func); 763 dumpLiveRange(Item, Func);
764 Str << "\n"; 764 Str << "\n";
765 } 765 }
766 } 766 }
767 767
768 } // end of namespace Ice 768 } // end of namespace Ice
OLDNEW
« src/IceInstARM32.h ('K') | « src/IceRegAlloc.h ('k') | src/IceTargetLowering.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698