| OLD | NEW |
| 1 //===- subzero/src/IceRegAlloc.h - Linear-scan reg. allocation --*- C++ -*-===// | 1 //===- subzero/src/IceRegAlloc.h - Linear-scan reg. allocation --*- 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 data structures used during linear-scan | 10 // This file declares the data structures used during linear-scan |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 void dump(const Cfg *Func) const; | 43 void dump(const Cfg *Func) const; |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 // LiveRangeWrapper(const LiveRangeWrapper &) LLVM_DELETED_FUNCTION; | 46 // LiveRangeWrapper(const LiveRangeWrapper &) LLVM_DELETED_FUNCTION; |
| 47 LiveRangeWrapper &operator=(const LiveRangeWrapper &) LLVM_DELETED_FUNCTION; | 47 LiveRangeWrapper &operator=(const LiveRangeWrapper &) LLVM_DELETED_FUNCTION; |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 class LinearScan { | 50 class LinearScan { |
| 51 public: | 51 public: |
| 52 LinearScan(Cfg *Func) : Func(Func) {} | 52 LinearScan(Cfg *Func) : Func(Func) {} |
| 53 void scan(const llvm::SmallBitVector &RegMask); | 53 void scan(const llvm::SmallBitVector &RegMask, bool Randomized); |
| 54 void dump(Cfg *Func) const; | 54 void dump(Cfg *Func) const; |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 Cfg *const Func; | 57 Cfg *const Func; |
| 58 // RangeCompare is the comparator for sorting an LiveRangeWrapper | 58 // RangeCompare is the comparator for sorting an LiveRangeWrapper |
| 59 // by starting point in a std::set<>. Ties are broken by variable | 59 // by starting point in a std::set<>. Ties are broken by variable |
| 60 // number so that sorting is stable. | 60 // number so that sorting is stable. |
| 61 struct RangeCompare { | 61 struct RangeCompare { |
| 62 bool operator()(const LiveRangeWrapper &L, | 62 bool operator()(const LiveRangeWrapper &L, |
| 63 const LiveRangeWrapper &R) const { | 63 const LiveRangeWrapper &R) const { |
| 64 InstNumberT Lstart = L.Var->getLiveRange().getStart(); | 64 InstNumberT Lstart = L.Var->getLiveRange().getStart(); |
| 65 InstNumberT Rstart = R.Var->getLiveRange().getStart(); | 65 InstNumberT Rstart = R.Var->getLiveRange().getStart(); |
| 66 if (Lstart == Rstart) | 66 if (Lstart == Rstart) |
| 67 return L.Var->getIndex() < R.Var->getIndex(); | 67 return L.Var->getIndex() < R.Var->getIndex(); |
| 68 return Lstart < Rstart; | 68 return Lstart < Rstart; |
| 69 } | 69 } |
| 70 }; | 70 }; |
| 71 typedef std::set<LiveRangeWrapper, RangeCompare> OrderedRanges; | 71 typedef std::set<LiveRangeWrapper, RangeCompare> OrderedRanges; |
| 72 typedef std::list<LiveRangeWrapper> UnorderedRanges; | 72 typedef std::list<LiveRangeWrapper> UnorderedRanges; |
| 73 OrderedRanges Unhandled; | 73 OrderedRanges Unhandled; |
| 74 UnorderedRanges Active, Inactive, Handled; | 74 UnorderedRanges Active, Inactive, Handled; |
| 75 LinearScan(const LinearScan &) LLVM_DELETED_FUNCTION; | 75 LinearScan(const LinearScan &) LLVM_DELETED_FUNCTION; |
| 76 LinearScan &operator=(const LinearScan &) LLVM_DELETED_FUNCTION; | 76 LinearScan &operator=(const LinearScan &) LLVM_DELETED_FUNCTION; |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 } // end of namespace Ice | 79 } // end of namespace Ice |
| 80 | 80 |
| 81 #endif // SUBZERO_SRC_ICEREGALLOC_H | 81 #endif // SUBZERO_SRC_ICEREGALLOC_H |
| OLD | NEW |