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); |
| 306 IsNonpoints = false; |
306 } | 307 } |
307 void addSegment(InstNumberT Start, InstNumberT End); | 308 void addSegment(InstNumberT Start, InstNumberT End); |
308 | 309 |
309 bool endsBefore(const LiveRange &Other) const; | 310 bool endsBefore(const LiveRange &Other) const; |
310 bool overlaps(const LiveRange &Other) const; | 311 bool overlaps(const LiveRange &Other) const; |
311 bool overlaps(InstNumberT OtherBegin) const; | 312 bool overlaps(InstNumberT OtherBegin) const; |
312 bool containsValue(InstNumberT Value) const; | 313 bool containsValue(InstNumberT Value) const; |
313 bool isEmpty() const { return Range.empty(); } | 314 bool isEmpty() const { return Range.empty(); } |
314 InstNumberT getStart() const { | 315 InstNumberT getStart() const { |
315 return Range.empty() ? -1 : Range.begin()->first; | 316 return Range.empty() ? -1 : Range.begin()->first; |
(...skipping 12 matching lines...) Expand all Loading... |
328 | 329 |
329 private: | 330 private: |
330 typedef std::pair<InstNumberT, InstNumberT> RangeElementType; | 331 typedef std::pair<InstNumberT, InstNumberT> RangeElementType; |
331 #ifdef USE_SET | 332 #ifdef USE_SET |
332 typedef std::set<RangeElementType> RangeType; | 333 typedef std::set<RangeElementType> RangeType; |
333 #else | 334 #else |
334 typedef std::list<RangeElementType> RangeType; | 335 typedef std::list<RangeElementType> RangeType; |
335 #endif | 336 #endif |
336 RangeType Range; | 337 RangeType Range; |
337 RegWeight Weight; | 338 RegWeight Weight; |
| 339 // IsNonpoints keeps track of whether the live range contains at |
| 340 // least one interval where Start!=End. If it is empty or has the |
| 341 // form [x,x),[y,y),...,[z,z), then overlaps(InstNumberT) is |
| 342 // trivially false. |
| 343 bool IsNonpoints; |
338 }; | 344 }; |
339 | 345 |
340 Ostream &operator<<(Ostream &Str, const LiveRange &L); | 346 Ostream &operator<<(Ostream &Str, const LiveRange &L); |
341 | 347 |
342 // Variable represents an operand that is register-allocated or | 348 // Variable represents an operand that is register-allocated or |
343 // stack-allocated. If it is register-allocated, it will ultimately | 349 // stack-allocated. If it is register-allocated, it will ultimately |
344 // have a non-negative RegNum field. | 350 // have a non-negative RegNum field. |
345 class Variable : public Operand { | 351 class Variable : public Operand { |
346 Variable(const Variable &) = delete; | 352 Variable(const Variable &) = delete; |
347 Variable &operator=(const Variable &) = delete; | 353 Variable &operator=(const Variable &) = delete; |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 const Cfg *Func; | 565 const Cfg *Func; |
560 std::vector<VariableTracking> Metadata; | 566 std::vector<VariableTracking> Metadata; |
561 const static InstDefList NoDefinitions; | 567 const static InstDefList NoDefinitions; |
562 VariablesMetadata(const VariablesMetadata &) = delete; | 568 VariablesMetadata(const VariablesMetadata &) = delete; |
563 VariablesMetadata &operator=(const VariablesMetadata &) = delete; | 569 VariablesMetadata &operator=(const VariablesMetadata &) = delete; |
564 }; | 570 }; |
565 | 571 |
566 } // end of namespace Ice | 572 } // end of namespace Ice |
567 | 573 |
568 #endif // SUBZERO_SRC_ICEOPERAND_H | 574 #endif // SUBZERO_SRC_ICEOPERAND_H |
OLD | NEW |