| 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, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 Liveness() = delete; | 30 Liveness() = delete; |
| 31 Liveness(const Liveness &) = delete; | 31 Liveness(const Liveness &) = delete; |
| 32 Liveness &operator=(const Liveness &) = delete; | 32 Liveness &operator=(const Liveness &) = delete; |
| 33 | 33 |
| 34 class LivenessNode { | 34 class LivenessNode { |
| 35 LivenessNode &operator=(const LivenessNode &) = delete; | 35 LivenessNode &operator=(const LivenessNode &) = delete; |
| 36 | 36 |
| 37 public: | 37 public: |
| 38 LivenessNode() = default; | 38 LivenessNode() = default; |
| 39 LivenessNode(const LivenessNode &) = default; | 39 LivenessNode(const LivenessNode &) = default; |
| 40 // NumLocals is the number of Variables local to this block. | 40 /// NumLocals is the number of Variables local to this block. |
| 41 SizeT NumLocals = 0; | 41 SizeT NumLocals = 0; |
| 42 // NumNonDeadPhis tracks the number of Phi instructions that | 42 /// NumNonDeadPhis tracks the number of Phi instructions that |
| 43 // Inst::liveness() identified as tentatively live. If | 43 /// Inst::liveness() identified as tentatively live. If |
| 44 // NumNonDeadPhis changes from the last liveness pass, then liveness | 44 /// NumNonDeadPhis changes from the last liveness pass, then liveness |
| 45 // has not yet converged. | 45 /// has not yet converged. |
| 46 SizeT NumNonDeadPhis = 0; | 46 SizeT NumNonDeadPhis = 0; |
| 47 // LiveToVarMap maps a liveness bitvector index to a Variable. This | 47 // LiveToVarMap maps a liveness bitvector index to a Variable. This |
| 48 // is generally just for printing/dumping. The index should be less | 48 // is generally just for printing/dumping. The index should be less |
| 49 // than NumLocals + Liveness::NumGlobals. | 49 // than NumLocals + Liveness::NumGlobals. |
| 50 std::vector<Variable *> LiveToVarMap; | 50 std::vector<Variable *> LiveToVarMap; |
| 51 // LiveIn and LiveOut track the in- and out-liveness of the global | 51 // LiveIn and LiveOut track the in- and out-liveness of the global |
| 52 // variables. The size of each vector is | 52 // variables. The size of each vector is |
| 53 // LivenessNode::NumGlobals. | 53 // LivenessNode::NumGlobals. |
| 54 LivenessBV LiveIn, LiveOut; | 54 LivenessBV LiveIn, LiveOut; |
| 55 // LiveBegin and LiveEnd track the instruction numbers of the start | 55 // LiveBegin and LiveEnd track the instruction numbers of the start |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 resize(Index); | 88 resize(Index); |
| 89 return &Nodes[Index].LiveBegin; | 89 return &Nodes[Index].LiveBegin; |
| 90 } | 90 } |
| 91 LiveBeginEndMap *getLiveEnd(const CfgNode *Node) { | 91 LiveBeginEndMap *getLiveEnd(const CfgNode *Node) { |
| 92 SizeT Index = Node->getIndex(); | 92 SizeT Index = Node->getIndex(); |
| 93 resize(Index); | 93 resize(Index); |
| 94 return &Nodes[Index].LiveEnd; | 94 return &Nodes[Index].LiveEnd; |
| 95 } | 95 } |
| 96 | 96 |
| 97 private: | 97 private: |
| 98 // Resize Nodes so that Nodes[Index] is valid. | 98 /// Resize Nodes so that Nodes[Index] is valid. |
| 99 void resize(SizeT Index) { | 99 void resize(SizeT Index) { |
| 100 if (Index >= Nodes.size()) | 100 if (Index >= Nodes.size()) |
| 101 Nodes.resize(Index + 1); | 101 Nodes.resize(Index + 1); |
| 102 } | 102 } |
| 103 Cfg *Func; | 103 Cfg *Func; |
| 104 LivenessMode Mode; | 104 LivenessMode Mode; |
| 105 SizeT NumGlobals = 0; | 105 SizeT NumGlobals = 0; |
| 106 // Size of Nodes is Cfg::Nodes.size(). | 106 /// Size of Nodes is Cfg::Nodes.size(). |
| 107 std::vector<LivenessNode> Nodes; | 107 std::vector<LivenessNode> Nodes; |
| 108 // VarToLiveMap maps a Variable's Variable::Number to its live index | 108 /// VarToLiveMap maps a Variable's Variable::Number to its live index |
| 109 // within its basic block. | 109 /// within its basic block. |
| 110 std::vector<SizeT> VarToLiveMap; | 110 std::vector<SizeT> VarToLiveMap; |
| 111 // LiveToVarMap is analogous to LivenessNode::LiveToVarMap, but for | 111 /// LiveToVarMap is analogous to LivenessNode::LiveToVarMap, but for |
| 112 // non-local variables. | 112 /// non-local variables. |
| 113 std::vector<Variable *> LiveToVarMap; | 113 std::vector<Variable *> LiveToVarMap; |
| 114 }; | 114 }; |
| 115 | 115 |
| 116 } // end of namespace Ice | 116 } // end of namespace Ice |
| 117 | 117 |
| 118 #endif // SUBZERO_SRC_ICELIVENESS_H | 118 #endif // SUBZERO_SRC_ICELIVENESS_H |
| OLD | NEW |