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

Side by Side Diff: src/IceRegAlloc.cpp

Issue 952953002: Subzero: Improve class definition hygiene. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix typo Created 5 years, 10 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
« no previous file with comments | « src/IceRegAlloc.h ('k') | src/IceTargetLowering.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 FindPreference = true; 88 FindPreference = true;
89 FindOverlap = true; 89 FindOverlap = true;
90 const VarList &Vars = Func->getVariables(); 90 const VarList &Vars = Func->getVariables();
91 Unhandled.reserve(Vars.size()); 91 Unhandled.reserve(Vars.size());
92 UnhandledPrecolored.reserve(Vars.size()); 92 UnhandledPrecolored.reserve(Vars.size());
93 // Gather the live ranges of all variables and add them to the 93 // Gather the live ranges of all variables and add them to the
94 // Unhandled set. 94 // Unhandled set.
95 for (Variable *Var : Vars) { 95 for (Variable *Var : Vars) {
96 // Explicitly don't consider zero-weight variables, which are 96 // Explicitly don't consider zero-weight variables, which are
97 // meant to be spill slots. 97 // meant to be spill slots.
98 if (Var->getWeight() == RegWeight::Zero) 98 if (Var->getWeight().isZero())
99 continue; 99 continue;
100 // Don't bother if the variable has a null live range, which means 100 // Don't bother if the variable has a null live range, which means
101 // it was never referenced. 101 // it was never referenced.
102 if (Var->getLiveRange().isEmpty()) 102 if (Var->getLiveRange().isEmpty())
103 continue; 103 continue;
104 Var->untrimLiveRange(); 104 Var->untrimLiveRange();
105 Unhandled.push_back(Var); 105 Unhandled.push_back(Var);
106 if (Var->hasReg()) { 106 if (Var->hasReg()) {
107 Var->setRegNumTmp(Var->getRegNum()); 107 Var->setRegNumTmp(Var->getRegNum());
108 Var->setLiveRangeInfiniteWeight(); 108 Var->setLiveRangeInfiniteWeight();
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 // Iterate across all instructions and record the begin and end of 160 // Iterate across all instructions and record the begin and end of
161 // the live range for each variable that is pre-colored or infinite 161 // the live range for each variable that is pre-colored or infinite
162 // weight. 162 // weight.
163 std::vector<InstNumberT> LRBegin(Vars.size(), Inst::NumberSentinel); 163 std::vector<InstNumberT> LRBegin(Vars.size(), Inst::NumberSentinel);
164 std::vector<InstNumberT> LREnd(Vars.size(), Inst::NumberSentinel); 164 std::vector<InstNumberT> LREnd(Vars.size(), Inst::NumberSentinel);
165 for (CfgNode *Node : Func->getNodes()) { 165 for (CfgNode *Node : Func->getNodes()) {
166 for (Inst &Inst : Node->getInsts()) { 166 for (Inst &Inst : Node->getInsts()) {
167 if (Inst.isDeleted()) 167 if (Inst.isDeleted())
168 continue; 168 continue;
169 if (const Variable *Var = Inst.getDest()) { 169 if (const Variable *Var = Inst.getDest()) {
170 if (Var->hasReg() || Var->getWeight() == RegWeight::Inf) { 170 if (Var->hasReg() || Var->getWeight().isInf()) {
171 if (LRBegin[Var->getIndex()] == Inst::NumberSentinel) { 171 if (LRBegin[Var->getIndex()] == Inst::NumberSentinel) {
172 LRBegin[Var->getIndex()] = Inst.getNumber(); 172 LRBegin[Var->getIndex()] = Inst.getNumber();
173 ++NumVars; 173 ++NumVars;
174 } 174 }
175 } 175 }
176 } 176 }
177 for (SizeT I = 0; I < Inst.getSrcSize(); ++I) { 177 for (SizeT I = 0; I < Inst.getSrcSize(); ++I) {
178 Operand *Src = Inst.getSrc(I); 178 Operand *Src = Inst.getSrc(I);
179 SizeT NumVars = Src->getNumVars(); 179 SizeT NumVars = Src->getNumVars();
180 for (SizeT J = 0; J < NumVars; ++J) { 180 for (SizeT J = 0; J < NumVars; ++J) {
181 const Variable *Var = Src->getVar(J); 181 const Variable *Var = Src->getVar(J);
182 if (Var->hasReg() || Var->getWeight() == RegWeight::Inf) 182 if (Var->hasReg() || Var->getWeight().isInf())
183 LREnd[Var->getIndex()] = Inst.getNumber(); 183 LREnd[Var->getIndex()] = Inst.getNumber();
184 } 184 }
185 } 185 }
186 } 186 }
187 } 187 }
188 188
189 Unhandled.reserve(NumVars); 189 Unhandled.reserve(NumVars);
190 UnhandledPrecolored.reserve(NumVars); 190 UnhandledPrecolored.reserve(NumVars);
191 for (SizeT i = 0; i < Vars.size(); ++i) { 191 for (SizeT i = 0; i < Vars.size(); ++i) {
192 Variable *Var = Vars[i]; 192 Variable *Var = Vars[i];
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 Str << "\n"; 758 Str << "\n";
759 } 759 }
760 Str << "++++++ Inactive:\n"; 760 Str << "++++++ Inactive:\n";
761 for (const Variable *Item : Inactive) { 761 for (const Variable *Item : Inactive) {
762 dumpLiveRange(Item, Func); 762 dumpLiveRange(Item, Func);
763 Str << "\n"; 763 Str << "\n";
764 } 764 }
765 } 765 }
766 766
767 } // end of namespace Ice 767 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceRegAlloc.h ('k') | src/IceTargetLowering.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698