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

Side by Side Diff: src/IceOperand.cpp

Issue 610813002: Subzero: Rewrite the pass timing infrastructure. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix the problem timing parse() 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 if (I2->second <= I1->first) { 115 if (I2->second <= I1->first) {
116 ++I2; 116 ++I2;
117 continue; 117 continue;
118 } 118 }
119 return true; 119 return true;
120 } 120 }
121 return false; 121 return false;
122 } 122 }
123 123
124 bool LiveRange::overlaps(InstNumberT OtherBegin) const { 124 bool LiveRange::overlaps(InstNumberT OtherBegin) const {
125 for (RangeType::const_iterator I = Range.begin(), E = Range.end(); I != E;
126 ++I) {
127 if (OtherBegin >= I->second)
jvoung (off chromium) 2014/09/30 23:38:44 So the issue was that the ranges are sorted the ot
Jim Stichnoth 2014/09/30 23:49:16 No, the segments of the live range must be sorted,
128 return false;
129 if (I->first <= OtherBegin)
130 return true;
131 }
132 return false;
133 #if 0 // An equivalent but less inefficient implementation:
125 LiveRange Temp; 134 LiveRange Temp;
126 Temp.addSegment(OtherBegin, OtherBegin + 1); 135 Temp.addSegment(OtherBegin, OtherBegin + 1);
127 return overlaps(Temp); 136 return overlaps(Temp);
137 #endif
128 } 138 }
129 139
130 // Returns true if the live range contains the given instruction 140 // Returns true if the live range contains the given instruction
131 // number. This is only used for validating the live range 141 // number. This is only used for validating the live range
132 // calculation. 142 // calculation.
133 bool LiveRange::containsValue(InstNumberT Value) const { 143 bool LiveRange::containsValue(InstNumberT Value) const {
134 for (RangeType::const_iterator I = Range.begin(), E = Range.end(); I != E; 144 for (RangeType::const_iterator I = Range.begin(), E = Range.end(); I != E;
135 ++I) { 145 ++I) {
136 if (I->first <= Value && Value <= I->second) 146 if (I->first <= Value && Value <= I->second)
137 return true; 147 return true;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 case MDS_MultiDefMultiBlock: 262 case MDS_MultiDefMultiBlock:
253 case MDS_MultiDefSingleBlock: 263 case MDS_MultiDefSingleBlock:
254 return NULL; 264 return NULL;
255 case MDS_SingleDef: 265 case MDS_SingleDef:
256 assert(!Definitions.empty()); 266 assert(!Definitions.empty());
257 return Definitions[0]; 267 return Definitions[0];
258 } 268 }
259 } 269 }
260 270
261 void VariablesMetadata::init() { 271 void VariablesMetadata::init() {
272 static TimerIdT IDvmetadata = GlobalContext::getTimerID("vmetadata");
273 TimerMarker T(IDvmetadata, Func->getContext());
262 Metadata.clear(); 274 Metadata.clear();
263 Metadata.resize(Func->getNumVariables()); 275 Metadata.resize(Func->getNumVariables());
264 276
265 // Mark implicit args as being used in the entry node. 277 // Mark implicit args as being used in the entry node.
266 const VarList &ImplicitArgList = Func->getImplicitArgs(); 278 const VarList &ImplicitArgList = Func->getImplicitArgs();
267 for (VarList::const_iterator I = ImplicitArgList.begin(), 279 for (VarList::const_iterator I = ImplicitArgList.begin(),
268 E = ImplicitArgList.end(); 280 E = ImplicitArgList.end();
269 I != E; ++I) { 281 I != E; ++I) {
270 const Variable *Var = *I; 282 const Variable *Var = *I;
271 const Inst *NoInst = NULL; 283 const Inst *NoInst = NULL;
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 448
437 Ostream &operator<<(Ostream &Str, const RegWeight &W) { 449 Ostream &operator<<(Ostream &Str, const RegWeight &W) {
438 if (W.getWeight() == RegWeight::Inf) 450 if (W.getWeight() == RegWeight::Inf)
439 Str << "Inf"; 451 Str << "Inf";
440 else 452 else
441 Str << W.getWeight(); 453 Str << W.getWeight();
442 return Str; 454 return Str;
443 } 455 }
444 456
445 } // end of namespace Ice 457 } // end of namespace Ice
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698