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

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: Code review changes 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 /// \file 10 /// \file
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 if (const Variable *Var = Inst.getDest()) { 171 if (const Variable *Var = Inst.getDest()) {
172 if (Var->hasReg() || Var->getWeight().isInf()) { 172 if (Var->hasReg() || Var->getWeight().isInf()) {
173 if (LRBegin[Var->getIndex()] == Inst::NumberSentinel) { 173 if (LRBegin[Var->getIndex()] == Inst::NumberSentinel) {
174 LRBegin[Var->getIndex()] = Inst.getNumber(); 174 LRBegin[Var->getIndex()] = Inst.getNumber();
175 ++NumVars; 175 ++NumVars;
176 } 176 }
177 } 177 }
178 } 178 }
179 for (SizeT I = 0; I < Inst.getSrcSize(); ++I) { 179 for (SizeT I = 0; I < Inst.getSrcSize(); ++I) {
180 Operand *Src = Inst.getSrc(I); 180 Operand *Src = Inst.getSrc(I);
181 SizeT NumVars = Src->getNumVars(); 181 SizeT NVars = Src->getNumVars();
182 for (SizeT J = 0; J < NumVars; ++J) { 182 for (SizeT J = 0; J < NVars; ++J) {
183 const Variable *Var = Src->getVar(J); 183 const Variable *Var = Src->getVar(J);
184 if (Var->hasReg() || Var->getWeight().isInf()) 184 if (Var->hasReg() || Var->getWeight().isInf())
185 LREnd[Var->getIndex()] = Inst.getNumber(); 185 LREnd[Var->getIndex()] = Inst.getNumber();
186 } 186 }
187 } 187 }
188 } 188 }
189 } 189 }
190 190
191 Unhandled.reserve(NumVars); 191 Unhandled.reserve(NumVars);
192 UnhandledPrecolored.reserve(NumVars); 192 UnhandledPrecolored.reserve(NumVars);
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 ++RegUses[MinWeightIndex]; 668 ++RegUses[MinWeightIndex];
669 Active.push_back(Cur); 669 Active.push_back(Cur);
670 if (Verbose) { 670 if (Verbose) {
671 Ostream &Str = Ctx->getStrDump(); 671 Ostream &Str = Ctx->getStrDump();
672 Str << "Allocating "; 672 Str << "Allocating ";
673 dumpLiveRange(Cur, Func); 673 dumpLiveRange(Cur, Func);
674 Str << "\n"; 674 Str << "\n";
675 } 675 }
676 } 676 }
677 } 677 }
678 dump(Func); 678 dump();
679 } 679 }
680 // Move anything Active or Inactive to Handled for easier handling. 680 // Move anything Active or Inactive to Handled for easier handling.
681 for (Variable *I : Active) 681 for (Variable *I : Active)
682 Handled.push_back(I); 682 Handled.push_back(I);
683 Active.clear(); 683 Active.clear();
684 for (Variable *I : Inactive) 684 for (Variable *I : Inactive)
685 Handled.push_back(I); 685 Handled.push_back(I);
686 Inactive.clear(); 686 Inactive.clear();
687 dump(Func); 687 dump();
688 688
689 llvm::SmallVector<int32_t, REGS_SIZE> Permutation(NumRegisters); 689 llvm::SmallVector<int32_t, REGS_SIZE> Permutation(NumRegisters);
690 if (Randomized) { 690 if (Randomized) {
691 Func->getTarget()->makeRandomRegisterPermutation( 691 Func->getTarget()->makeRandomRegisterPermutation(
692 Permutation, PreDefinedRegisters | ~RegMaskFull); 692 Permutation, PreDefinedRegisters | ~RegMaskFull);
693 } 693 }
694 694
695 // Finish up by assigning RegNumTmp->RegNum (or a random permutation 695 // Finish up by assigning RegNumTmp->RegNum (or a random permutation
696 // thereof) for each Variable. 696 // thereof) for each Variable.
697 for (Variable *Item : Handled) { 697 for (Variable *Item : Handled) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 // Another idea for coalescing stack slots is to initialize the 729 // Another idea for coalescing stack slots is to initialize the
730 // Unhandled list with just the unallocated variables, saving time 730 // Unhandled list with just the unallocated variables, saving time
731 // but not offering second-chance opportunities. 731 // but not offering second-chance opportunities.
732 732
733 if (Verbose) 733 if (Verbose)
734 Ctx->unlockStr(); 734 Ctx->unlockStr();
735 } 735 }
736 736
737 // ======================== Dump routines ======================== // 737 // ======================== Dump routines ======================== //
738 738
739 void LinearScan::dump(Cfg *Func) const { 739 void LinearScan::dump() const {
740 if (!BuildDefs::dump()) 740 if (!BuildDefs::dump())
741 return; 741 return;
742 if (!Func->isVerbose(IceV_LinearScan)) 742 if (!Func->isVerbose(IceV_LinearScan))
743 return; 743 return;
744 Ostream &Str = Func->getContext()->getStrDump(); 744 Ostream &Str = Func->getContext()->getStrDump();
745 Func->resetCurrentNode(); 745 Func->resetCurrentNode();
746 Str << "**** Current regalloc state:\n"; 746 Str << "**** Current regalloc state:\n";
747 Str << "++++++ Handled:\n"; 747 Str << "++++++ Handled:\n";
748 for (const Variable *Item : Handled) { 748 for (const Variable *Item : Handled) {
749 dumpLiveRange(Item, Func); 749 dumpLiveRange(Item, Func);
(...skipping 10 matching lines...) Expand all
760 Str << "\n"; 760 Str << "\n";
761 } 761 }
762 Str << "++++++ Inactive:\n"; 762 Str << "++++++ Inactive:\n";
763 for (const Variable *Item : Inactive) { 763 for (const Variable *Item : Inactive) {
764 dumpLiveRange(Item, Func); 764 dumpLiveRange(Item, Func);
765 Str << "\n"; 765 Str << "\n";
766 } 766 }
767 } 767 }
768 768
769 } // end of namespace Ice 769 } // end of namespace Ice
OLDNEW
« src/IceInst.h ('K') | « src/IceRegAlloc.h ('k') | src/IceRegistersX8632.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698