OLD | NEW |
1 //===- subzero/src/IceLiveness.h - Liveness analysis ------------*- C++ -*-===// | 1 //===- subzero/src/IceLiveness.h - Liveness analysis ------------*- 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 Liveness and LivenessNode classes, | 10 // This file declares the Liveness and LivenessNode classes, |
11 // which are used for liveness analysis. The node-specific | 11 // which are used for liveness analysis. The node-specific |
12 // information tracked for each Variable includes whether it is | 12 // information tracked for each Variable includes whether it is |
13 // live on entry, whether it is live on exit, the instruction number | 13 // live on entry, whether it is live on exit, the instruction number |
14 // that starts its live range, and the instruction number that ends | 14 // that starts its live range, and the instruction number that ends |
15 // its live range. At the Cfg level, the actual live intervals are | 15 // its live range. At the Cfg level, the actual live intervals are |
16 // recorded. | 16 // recorded. |
17 // | 17 // |
18 //===----------------------------------------------------------------------===// | 18 //===----------------------------------------------------------------------===// |
19 | 19 |
20 #ifndef SUBZERO_SRC_ICELIVENESS_H | 20 #ifndef SUBZERO_SRC_ICELIVENESS_H |
21 #define SUBZERO_SRC_ICELIVENESS_H | 21 #define SUBZERO_SRC_ICELIVENESS_H |
22 | 22 |
23 #include "IceDefs.h" | 23 #include "IceDefs.h" |
24 #include "IceTypes.h" | 24 #include "IceTypes.h" |
25 | 25 |
26 namespace Ice { | 26 namespace Ice { |
27 | 27 |
28 class LivenessNode { | 28 class LivenessNode { |
| 29 // TODO: Disable these constructors when Liveness::Nodes is no |
| 30 // longer an STL container. |
| 31 // LivenessNode(const LivenessNode &) = delete; |
| 32 // LivenessNode &operator=(const LivenessNode &) = delete; |
| 33 |
29 public: | 34 public: |
30 LivenessNode() : NumLocals(0) {} | 35 LivenessNode() : NumLocals(0) {} |
31 // NumLocals is the number of Variables local to this block. | 36 // NumLocals is the number of Variables local to this block. |
32 SizeT NumLocals; | 37 SizeT NumLocals; |
33 // LiveToVarMap maps a liveness bitvector index to a Variable. This | 38 // LiveToVarMap maps a liveness bitvector index to a Variable. This |
34 // is generally just for printing/dumping. The index should be less | 39 // is generally just for printing/dumping. The index should be less |
35 // than NumLocals + Liveness::NumGlobals. | 40 // than NumLocals + Liveness::NumGlobals. |
36 std::vector<Variable *> LiveToVarMap; | 41 std::vector<Variable *> LiveToVarMap; |
37 // LiveIn and LiveOut track the in- and out-liveness of the global | 42 // LiveIn and LiveOut track the in- and out-liveness of the global |
38 // variables. The size of each vector is | 43 // variables. The size of each vector is |
39 // LivenessNode::NumGlobals. | 44 // LivenessNode::NumGlobals. |
40 LivenessBV LiveIn, LiveOut; | 45 LivenessBV LiveIn, LiveOut; |
41 // LiveBegin and LiveEnd track the instruction numbers of the start | 46 // LiveBegin and LiveEnd track the instruction numbers of the start |
42 // and end of each variable's live range within this block. The | 47 // and end of each variable's live range within this block. The |
43 // index/key of each element is less than NumLocals + | 48 // index/key of each element is less than NumLocals + |
44 // Liveness::NumGlobals. | 49 // Liveness::NumGlobals. |
45 LiveBeginEndMap LiveBegin, LiveEnd; | 50 LiveBeginEndMap LiveBegin, LiveEnd; |
46 | |
47 private: | |
48 // TODO: Disable these constructors when Liveness::Nodes is no | |
49 // longer an STL container. | |
50 // LivenessNode(const LivenessNode &) = delete; | |
51 // LivenessNode &operator=(const LivenessNode &) = delete; | |
52 }; | 51 }; |
53 | 52 |
54 class Liveness { | 53 class Liveness { |
55 Liveness(const Liveness &) = delete; | 54 Liveness(const Liveness &) = delete; |
56 Liveness &operator=(const Liveness &) = delete; | 55 Liveness &operator=(const Liveness &) = delete; |
57 | 56 |
58 public: | 57 public: |
59 Liveness(Cfg *Func, LivenessMode Mode) | 58 Liveness(Cfg *Func, LivenessMode Mode) |
60 : Func(Func), Mode(Mode), NumGlobals(0) {} | 59 : Func(Func), Mode(Mode), NumGlobals(0) {} |
61 void init(); | 60 void init(); |
(...skipping 28 matching lines...) Expand all Loading... |
90 // within its basic block. | 89 // within its basic block. |
91 std::vector<SizeT> VarToLiveMap; | 90 std::vector<SizeT> VarToLiveMap; |
92 // LiveToVarMap is analogous to LivenessNode::LiveToVarMap, but for | 91 // LiveToVarMap is analogous to LivenessNode::LiveToVarMap, but for |
93 // non-local variables. | 92 // non-local variables. |
94 std::vector<Variable *> LiveToVarMap; | 93 std::vector<Variable *> LiveToVarMap; |
95 }; | 94 }; |
96 | 95 |
97 } // end of namespace Ice | 96 } // end of namespace Ice |
98 | 97 |
99 #endif // SUBZERO_SRC_ICELIVENESS_H | 98 #endif // SUBZERO_SRC_ICELIVENESS_H |
OLD | NEW |