OLD | NEW |
---|---|
1 //===- subzero/src/IceOperand.h - High-level operands -----------*- C++ -*-===// | 1 //===- subzero/src/IceOperand.h - High-level operands -----------*- C++ -*-===// |
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 declares the Operand class and its target-independent | 10 // This file declares the Operand class and its target-independent |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
291 bool operator==(const RegWeight &A, const RegWeight &B); | 291 bool operator==(const RegWeight &A, const RegWeight &B); |
292 | 292 |
293 // LiveRange is a set of instruction number intervals representing | 293 // LiveRange is a set of instruction number intervals representing |
294 // a variable's live range. Generally there is one interval per basic | 294 // a variable's live range. Generally there is one interval per basic |
295 // block where the variable is live, but adjacent intervals get | 295 // block where the variable is live, but adjacent intervals get |
296 // coalesced into a single interval. LiveRange also includes a | 296 // coalesced into a single interval. LiveRange also includes a |
297 // weight, in case e.g. we want a live range to have higher weight | 297 // weight, in case e.g. we want a live range to have higher weight |
298 // inside a loop. | 298 // inside a loop. |
299 class LiveRange { | 299 class LiveRange { |
300 public: | 300 public: |
301 LiveRange() : Weight(0) {} | 301 LiveRange() : Weight(0), IsNonpoints(false) {} |
302 | 302 |
303 void reset() { | 303 void reset() { |
304 Range.clear(); | 304 Range.clear(); |
305 Weight.setWeight(0); | 305 Weight.setWeight(0); |
jvoung (off chromium)
2014/10/04 05:06:34
Seems like reset() should reset IsNonpoints ?
Jim Stichnoth
2014/10/04 12:44:08
Done.
| |
306 } | 306 } |
307 void addSegment(InstNumberT Start, InstNumberT End); | 307 void addSegment(InstNumberT Start, InstNumberT End); |
308 | 308 |
309 bool endsBefore(const LiveRange &Other) const; | 309 bool endsBefore(const LiveRange &Other) const; |
310 bool overlaps(const LiveRange &Other) const; | 310 bool overlaps(const LiveRange &Other) const; |
311 bool overlaps(InstNumberT OtherBegin) const; | 311 bool overlaps(InstNumberT OtherBegin) const; |
312 bool containsValue(InstNumberT Value) const; | 312 bool containsValue(InstNumberT Value) const; |
313 bool isEmpty() const { return Range.empty(); } | 313 bool isEmpty() const { return Range.empty(); } |
314 InstNumberT getStart() const { | 314 InstNumberT getStart() const { |
315 return Range.empty() ? -1 : Range.begin()->first; | 315 return Range.empty() ? -1 : Range.begin()->first; |
(...skipping 12 matching lines...) Expand all Loading... | |
328 | 328 |
329 private: | 329 private: |
330 typedef std::pair<InstNumberT, InstNumberT> RangeElementType; | 330 typedef std::pair<InstNumberT, InstNumberT> RangeElementType; |
331 #ifdef USE_SET | 331 #ifdef USE_SET |
332 typedef std::set<RangeElementType> RangeType; | 332 typedef std::set<RangeElementType> RangeType; |
333 #else | 333 #else |
334 typedef std::list<RangeElementType> RangeType; | 334 typedef std::list<RangeElementType> RangeType; |
335 #endif | 335 #endif |
336 RangeType Range; | 336 RangeType Range; |
337 RegWeight Weight; | 337 RegWeight Weight; |
338 // IsNonpoints keeps track of whether the live range contains at | |
339 // least one interval where Start!=End. If it is empty or has the | |
340 // form [x,x),[y,y),...,[z,z), then overlaps(InstNumberT) is | |
341 // trivially false. | |
342 bool IsNonpoints; | |
338 }; | 343 }; |
339 | 344 |
340 Ostream &operator<<(Ostream &Str, const LiveRange &L); | 345 Ostream &operator<<(Ostream &Str, const LiveRange &L); |
341 | 346 |
342 // Variable represents an operand that is register-allocated or | 347 // Variable represents an operand that is register-allocated or |
343 // stack-allocated. If it is register-allocated, it will ultimately | 348 // stack-allocated. If it is register-allocated, it will ultimately |
344 // have a non-negative RegNum field. | 349 // have a non-negative RegNum field. |
345 class Variable : public Operand { | 350 class Variable : public Operand { |
346 Variable(const Variable &) = delete; | 351 Variable(const Variable &) = delete; |
347 Variable &operator=(const Variable &) = delete; | 352 Variable &operator=(const Variable &) = delete; |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
559 const Cfg *Func; | 564 const Cfg *Func; |
560 std::vector<VariableTracking> Metadata; | 565 std::vector<VariableTracking> Metadata; |
561 const static InstDefList NoDefinitions; | 566 const static InstDefList NoDefinitions; |
562 VariablesMetadata(const VariablesMetadata &) = delete; | 567 VariablesMetadata(const VariablesMetadata &) = delete; |
563 VariablesMetadata &operator=(const VariablesMetadata &) = delete; | 568 VariablesMetadata &operator=(const VariablesMetadata &) = delete; |
564 }; | 569 }; |
565 | 570 |
566 } // end of namespace Ice | 571 } // end of namespace Ice |
567 | 572 |
568 #endif // SUBZERO_SRC_ICEOPERAND_H | 573 #endif // SUBZERO_SRC_ICEOPERAND_H |
OLD | NEW |