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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 void untrim() { TrimmedBegin = Range.begin(); } | 355 void untrim() { TrimmedBegin = Range.begin(); } |
356 void trim(InstNumberT Lower); | 356 void trim(InstNumberT Lower); |
357 | 357 |
358 RegWeight getWeight() const { return Weight; } | 358 RegWeight getWeight() const { return Weight; } |
359 void setWeight(const RegWeight &NewWeight) { Weight = NewWeight; } | 359 void setWeight(const RegWeight &NewWeight) { Weight = NewWeight; } |
360 void addWeight(uint32_t Delta) { Weight.addWeight(Delta); } | 360 void addWeight(uint32_t Delta) { Weight.addWeight(Delta); } |
361 void dump(Ostream &Str) const; | 361 void dump(Ostream &Str) const; |
362 | 362 |
363 private: | 363 private: |
364 typedef std::pair<InstNumberT, InstNumberT> RangeElementType; | 364 typedef std::pair<InstNumberT, InstNumberT> RangeElementType; |
365 typedef std::vector<RangeElementType> RangeType; | 365 // Assume a common case of 2 or fewer segments per live range. |
| 366 typedef llvm::SmallVector<RangeElementType, 2> RangeType; |
366 RangeType Range; | 367 RangeType Range; |
367 RegWeight Weight; | 368 RegWeight Weight; |
368 // TrimmedBegin is an optimization for the overlaps() computation. | 369 // TrimmedBegin is an optimization for the overlaps() computation. |
369 // Since the linear-scan algorithm always calls it as overlaps(Cur) | 370 // Since the linear-scan algorithm always calls it as overlaps(Cur) |
370 // and Cur advances monotonically according to live range start, we | 371 // and Cur advances monotonically according to live range start, we |
371 // can optimize overlaps() by ignoring all segments that end before | 372 // can optimize overlaps() by ignoring all segments that end before |
372 // the start of Cur's range. The linear-scan code enables this by | 373 // the start of Cur's range. The linear-scan code enables this by |
373 // calling trim() on the ranges of interest as Cur advances. Note | 374 // calling trim() on the ranges of interest as Cur advances. Note |
374 // that linear-scan also has to initialize TrimmedBegin at the | 375 // that linear-scan also has to initialize TrimmedBegin at the |
375 // beginning by calling untrim(). | 376 // beginning by calling untrim(). |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 private: | 633 private: |
633 const Cfg *Func; | 634 const Cfg *Func; |
634 MetadataKind Kind; | 635 MetadataKind Kind; |
635 std::vector<VariableTracking> Metadata; | 636 std::vector<VariableTracking> Metadata; |
636 const static InstDefList NoDefinitions; | 637 const static InstDefList NoDefinitions; |
637 }; | 638 }; |
638 | 639 |
639 } // end of namespace Ice | 640 } // end of namespace Ice |
640 | 641 |
641 #endif // SUBZERO_SRC_ICEOPERAND_H | 642 #endif // SUBZERO_SRC_ICEOPERAND_H |
OLD | NEW |