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

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: Bug fixes and performance improvements 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 } 114 }
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 {
Jim Stichnoth 2014/09/28 14:26:39 This is called quite a bit, so provide a better im
125 for (RangeType::const_iterator I = Range.begin(), E = Range.end(); I != E;
126 ++I) {
127 if (OtherBegin >= I->second)
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 TimerMarker T("vmetadata", Func->getContext());
262 Metadata.clear(); 273 Metadata.clear();
263 Metadata.resize(Func->getNumVariables()); 274 Metadata.resize(Func->getNumVariables());
264 275
265 // Mark implicit args as being used in the entry node. 276 // Mark implicit args as being used in the entry node.
266 const VarList &ImplicitArgList = Func->getImplicitArgs(); 277 const VarList &ImplicitArgList = Func->getImplicitArgs();
267 for (VarList::const_iterator I = ImplicitArgList.begin(), 278 for (VarList::const_iterator I = ImplicitArgList.begin(),
268 E = ImplicitArgList.end(); 279 E = ImplicitArgList.end();
269 I != E; ++I) { 280 I != E; ++I) {
270 const Variable *Var = *I; 281 const Variable *Var = *I;
271 const Inst *NoInst = NULL; 282 const Inst *NoInst = NULL;
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 447
437 Ostream &operator<<(Ostream &Str, const RegWeight &W) { 448 Ostream &operator<<(Ostream &Str, const RegWeight &W) {
438 if (W.getWeight() == RegWeight::Inf) 449 if (W.getWeight() == RegWeight::Inf)
439 Str << "Inf"; 450 Str << "Inf";
440 else 451 else
441 Str << W.getWeight(); 452 Str << W.getWeight();
442 return Str; 453 return Str;
443 } 454 }
444 455
445 } // end of namespace Ice 456 } // end of namespace Ice
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698