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 LinearScan data structure used during | 10 // This file declares the LinearScan data structure used during |
11 // linear-scan register allocation, which holds the various work | 11 // linear-scan register allocation, which holds the various work |
12 // queues for the linear-scan algorithm. | 12 // queues for the linear-scan algorithm. |
13 // | 13 // |
14 //===----------------------------------------------------------------------===// | 14 //===----------------------------------------------------------------------===// |
15 | 15 |
16 #ifndef SUBZERO_SRC_ICEREGALLOC_H | 16 #ifndef SUBZERO_SRC_ICEREGALLOC_H |
17 #define SUBZERO_SRC_ICEREGALLOC_H | 17 #define SUBZERO_SRC_ICEREGALLOC_H |
18 | 18 |
19 #include "IceDefs.h" | 19 #include "IceDefs.h" |
20 #include "IceTypes.h" | 20 #include "IceTypes.h" |
21 | 21 |
22 namespace Ice { | 22 namespace Ice { |
23 | 23 |
24 class LinearScan { | 24 class LinearScan { |
25 LinearScan(const LinearScan &) = delete; | 25 LinearScan(const LinearScan &) = delete; |
26 LinearScan &operator=(const LinearScan &) = delete; | 26 LinearScan &operator=(const LinearScan &) = delete; |
27 | 27 |
28 public: | 28 public: |
29 LinearScan(Cfg *Func) : Func(Func) {} | 29 LinearScan(Cfg *Func) |
30 void initForGlobalAlloc(); | 30 : Func(Func), FindPreference(false), FindOverlap(false) {} |
| 31 void init(RegAllocKind Kind); |
31 void scan(const llvm::SmallBitVector &RegMask); | 32 void scan(const llvm::SmallBitVector &RegMask); |
32 void dump(Cfg *Func) const; | 33 void dump(Cfg *Func) const; |
33 | 34 |
34 private: | 35 private: |
| 36 void initForGlobal(); |
| 37 void initForInfOnly(); |
| 38 |
35 Cfg *const Func; | 39 Cfg *const Func; |
36 typedef std::vector<Variable *> OrderedRanges; | 40 typedef std::vector<Variable *> OrderedRanges; |
37 typedef std::list<Variable *> UnorderedRanges; | 41 typedef std::list<Variable *> UnorderedRanges; |
38 OrderedRanges Unhandled; | 42 OrderedRanges Unhandled; |
39 // UnhandledPrecolored is a subset of Unhandled, specially collected | 43 // UnhandledPrecolored is a subset of Unhandled, specially collected |
40 // for faster processing. | 44 // for faster processing. |
41 OrderedRanges UnhandledPrecolored; | 45 OrderedRanges UnhandledPrecolored; |
42 UnorderedRanges Active, Inactive, Handled; | 46 UnorderedRanges Active, Inactive, Handled; |
43 std::vector<InstNumberT> Kills; | 47 std::vector<InstNumberT> Kills; |
| 48 bool FindPreference; |
| 49 bool FindOverlap; |
| 50 // TODO(stichnot): We're not really using FindOverlap yet, but we |
| 51 // may want a flavor of register allocation where FindPreference is |
| 52 // useful but we didn't want to initialize VMetadata with VMK_All |
| 53 // and therefore we can't safely allow overlap. |
44 }; | 54 }; |
45 | 55 |
46 } // end of namespace Ice | 56 } // end of namespace Ice |
47 | 57 |
48 #endif // SUBZERO_SRC_ICEREGALLOC_H | 58 #endif // SUBZERO_SRC_ICEREGALLOC_H |
OLD | NEW |