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

Side by Side Diff: src/IceOperand.cpp

Issue 652633002: Subzero: Improve performance of liveness analysis and live range construction. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix non-debug build Created 6 years, 2 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/IceOperand.cpp - High-level operand implementation -----===// 1 //===- subzero/src/IceOperand.cpp - High-level operand 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 Operand class and its target-independent 10 // This file implements the Operand class and its target-independent
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 // Note: This returns a Variable, even if the "this" object is a 177 // Note: This returns a Variable, even if the "this" object is a
178 // subclass of Variable. 178 // subclass of Variable.
179 Variable V(kVariable, Ty, Number, Name); 179 Variable V(kVariable, Ty, Number, Name);
180 V.RegNum = RegNum; 180 V.RegNum = RegNum;
181 V.StackOffset = StackOffset; 181 V.StackOffset = StackOffset;
182 return V; 182 return V;
183 } 183 }
184 184
185 void VariableTracking::markUse(const Inst *Instr, const CfgNode *Node, 185 void VariableTracking::markUse(const Inst *Instr, const CfgNode *Node,
186 bool IsFromDef, bool IsImplicit) { 186 bool IsFromDef, bool IsImplicit) {
187 if (MultiBlock == MBS_MultiBlock)
188 return;
187 // TODO(stichnot): If the use occurs as a source operand in the 189 // TODO(stichnot): If the use occurs as a source operand in the
188 // first instruction of the block, and its definition is in this 190 // first instruction of the block, and its definition is in this
189 // block's only predecessor, we might consider not marking this as a 191 // block's only predecessor, we might consider not marking this as a
190 // separate use. This may also apply if it's the first instruction 192 // separate use. This may also apply if it's the first instruction
191 // of the block that actually uses a Variable. 193 // of the block that actually uses a Variable.
192 assert(Node); 194 assert(Node);
193 bool MakeMulti = false; 195 bool MakeMulti = false;
194 if (IsImplicit) 196 if (IsImplicit)
195 MakeMulti = true; 197 MakeMulti = true;
196 // A phi source variable conservatively needs to be marked as 198 // A phi source variable conservatively needs to be marked as
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 296
295 // Mark implicit args as being used in the entry node. 297 // Mark implicit args as being used in the entry node.
296 for (Variable *Var : Func->getImplicitArgs()) { 298 for (Variable *Var : Func->getImplicitArgs()) {
297 const Inst *NoInst = NULL; 299 const Inst *NoInst = NULL;
298 const CfgNode *EntryNode = Func->getEntryNode(); 300 const CfgNode *EntryNode = Func->getEntryNode();
299 const bool IsFromDef = false; 301 const bool IsFromDef = false;
300 const bool IsImplicit = true; 302 const bool IsImplicit = true;
301 Metadata[Var->getIndex()].markUse(NoInst, EntryNode, IsFromDef, IsImplicit); 303 Metadata[Var->getIndex()].markUse(NoInst, EntryNode, IsFromDef, IsImplicit);
302 } 304 }
303 305
304 SizeT NumNodes = Func->getNumNodes(); 306 for (CfgNode *Node : Func->getNodes()) {
305 for (SizeT N = 0; N < NumNodes; ++N) {
306 CfgNode *Node = Func->getNodes()[N];
307 for (Inst *I : Node->getInsts()) { 307 for (Inst *I : Node->getInsts()) {
308 if (I->isDeleted()) 308 if (I->isDeleted())
309 continue; 309 continue;
310 if (InstFakeKill *Kill = llvm::dyn_cast<InstFakeKill>(I)) { 310 if (InstFakeKill *Kill = llvm::dyn_cast<InstFakeKill>(I)) {
311 // A FakeKill instruction indicates certain Variables (usually 311 // A FakeKill instruction indicates certain Variables (usually
312 // physical scratch registers) are redefined, so we register 312 // physical scratch registers) are redefined, so we register
313 // them as defs. 313 // them as defs.
314 for (SizeT SrcNum = 0; SrcNum < I->getSrcSize(); ++SrcNum) { 314 for (SizeT SrcNum = 0; SrcNum < I->getSrcSize(); ++SrcNum) {
315 Variable *Var = llvm::cast<Variable>(I->getSrc(SrcNum)); 315 Variable *Var = llvm::cast<Variable>(I->getSrc(SrcNum));
316 SizeT VarNum = Var->getIndex(); 316 SizeT VarNum = Var->getIndex();
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 461
462 Ostream &operator<<(Ostream &Str, const RegWeight &W) { 462 Ostream &operator<<(Ostream &Str, const RegWeight &W) {
463 if (W.getWeight() == RegWeight::Inf) 463 if (W.getWeight() == RegWeight::Inf)
464 Str << "Inf"; 464 Str << "Inf";
465 else 465 else
466 Str << W.getWeight(); 466 Str << W.getWeight();
467 return Str; 467 return Str;
468 } 468 }
469 469
470 } // end of namespace Ice 470 } // end of namespace Ice
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698