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

Side by Side Diff: src/IceRegAlloc.cpp

Issue 1844713004: Subzero: Ignore variables with no actual uses. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Also ignore rematerializable variables Created 4 years, 8 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/IceOperand.cpp ('k') | no next file » | 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 /// \file 10 /// \file
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 // Iterate across all instructions and record the begin and end of the live 212 // Iterate across all instructions and record the begin and end of the live
213 // range for each variable that is pre-colored or infinite weight. 213 // range for each variable that is pre-colored or infinite weight.
214 CfgVector<InstNumberT> LRBegin(Vars.size(), Inst::NumberSentinel); 214 CfgVector<InstNumberT> LRBegin(Vars.size(), Inst::NumberSentinel);
215 CfgVector<InstNumberT> LREnd(Vars.size(), Inst::NumberSentinel); 215 CfgVector<InstNumberT> LREnd(Vars.size(), Inst::NumberSentinel);
216 DefUseErrorList DefsWithoutUses, UsesBeforeDefs; 216 DefUseErrorList DefsWithoutUses, UsesBeforeDefs;
217 for (CfgNode *Node : Func->getNodes()) { 217 for (CfgNode *Node : Func->getNodes()) {
218 for (Inst &Instr : Node->getInsts()) { 218 for (Inst &Instr : Node->getInsts()) {
219 if (Instr.isDeleted()) 219 if (Instr.isDeleted())
220 continue; 220 continue;
221 FOREACH_VAR_IN_INST(Var, Instr) { 221 FOREACH_VAR_IN_INST(Var, Instr) {
222 if (Var->isRematerializable())
223 continue;
224 if (Var->getIgnoreLiveness()) 222 if (Var->getIgnoreLiveness())
225 continue; 223 continue;
226 if (Var->hasReg() || Var->mustHaveReg()) { 224 if (Var->hasReg() || Var->mustHaveReg()) {
227 SizeT VarNum = Var->getIndex(); 225 SizeT VarNum = Var->getIndex();
228 LREnd[VarNum] = Instr.getNumber(); 226 LREnd[VarNum] = Instr.getNumber();
229 if (!Var->getIsArg() && LRBegin[VarNum] == Inst::NumberSentinel) 227 if (!Var->getIsArg() && LRBegin[VarNum] == Inst::NumberSentinel)
230 UsesBeforeDefs.push_back(VarNum); 228 UsesBeforeDefs.push_back(VarNum);
231 } 229 }
232 } 230 }
233 if (const Variable *Var = Instr.getDest()) { 231 if (const Variable *Var = Instr.getDest()) {
234 if (!Var->isRematerializable() && !Var->getIgnoreLiveness() && 232 if (!Var->getIgnoreLiveness() &&
235 (Var->hasReg() || Var->mustHaveReg())) { 233 (Var->hasReg() || Var->mustHaveReg())) {
236 if (LRBegin[Var->getIndex()] == Inst::NumberSentinel) { 234 if (LRBegin[Var->getIndex()] == Inst::NumberSentinel) {
237 LRBegin[Var->getIndex()] = Instr.getNumber(); 235 LRBegin[Var->getIndex()] = Instr.getNumber();
238 ++NumVars; 236 ++NumVars;
239 } 237 }
240 } 238 }
241 } 239 }
242 } 240 }
243 } 241 }
244 242
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 Str << "\n"; 1009 Str << "\n";
1012 } 1010 }
1013 Str << "++++++ Inactive:\n"; 1011 Str << "++++++ Inactive:\n";
1014 for (const Variable *Item : Inactive) { 1012 for (const Variable *Item : Inactive) {
1015 dumpLiveRange(Item, Func); 1013 dumpLiveRange(Item, Func);
1016 Str << "\n"; 1014 Str << "\n";
1017 } 1015 }
1018 } 1016 }
1019 1017
1020 } // end of namespace Ice 1018 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceOperand.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698