OLD | NEW |
1 //===- subzero/src/IceLiveness.cpp - Liveness analysis implementation -----===// | 1 //===- subzero/src/IceLiveness.cpp - Liveness analysis implementation -----===// |
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 /// \file | 10 /// \file |
(...skipping 88 matching lines...) Loading... |
99 | 99 |
100 // Fix up RangeMask for variables before FirstVar. | 100 // Fix up RangeMask for variables before FirstVar. |
101 for (auto I = Func->getVariables().begin(); I != FirstVar; ++I) { | 101 for (auto I = Func->getVariables().begin(); I != FirstVar; ++I) { |
102 Variable *Var = *I; | 102 Variable *Var = *I; |
103 SizeT VarIndex = Var->getIndex(); | 103 SizeT VarIndex = Var->getIndex(); |
104 if (Var->getIgnoreLiveness() || | 104 if (Var->getIgnoreLiveness() || |
105 (!IsFullInit && !Var->hasReg() && !Var->mustHaveReg())) | 105 (!IsFullInit && !Var->hasReg() && !Var->mustHaveReg())) |
106 RangeMask[VarIndex] = false; | 106 RangeMask[VarIndex] = false; |
107 } | 107 } |
108 | 108 |
109 SizeT MaxLocals = 0; | |
110 // Process each node. | 109 // Process each node. |
| 110 MaxLocals = 0; |
111 for (auto I = FirstNode, E = Func->getNodes().end(); I != E; ++I) { | 111 for (auto I = FirstNode, E = Func->getNodes().end(); I != E; ++I) { |
112 LivenessNode &Node = Nodes[(*I)->getIndex()]; | 112 LivenessNode &Node = Nodes[(*I)->getIndex()]; |
113 // NumLocals, LiveToVarMap already initialized | 113 // NumLocals, LiveToVarMap already initialized |
114 Node.LiveIn.resize(NumGlobals); | 114 Node.LiveIn.resize(NumGlobals); |
115 Node.LiveOut.resize(NumGlobals); | 115 Node.LiveOut.resize(NumGlobals); |
116 // LiveBegin and LiveEnd are reinitialized before each pass over the block. | 116 // LiveBegin and LiveEnd are reinitialized before each pass over the block. |
117 MaxLocals = std::max(MaxLocals, Node.NumLocals); | 117 MaxLocals = std::max(MaxLocals, Node.NumLocals); |
118 } | 118 } |
119 ScratchBV.reserve(NumGlobals + MaxLocals); | 119 ScratchBV.reserve(NumGlobals + MaxLocals); |
120 } | 120 } |
(...skipping 12 matching lines...) Loading... |
133 } | 133 } |
134 | 134 |
135 Variable *Liveness::getVariable(SizeT LiveIndex, const CfgNode *Node) const { | 135 Variable *Liveness::getVariable(SizeT LiveIndex, const CfgNode *Node) const { |
136 if (LiveIndex < NumGlobals) | 136 if (LiveIndex < NumGlobals) |
137 return LiveToVarMap[LiveIndex]; | 137 return LiveToVarMap[LiveIndex]; |
138 SizeT NodeIndex = Node->getIndex(); | 138 SizeT NodeIndex = Node->getIndex(); |
139 return Nodes[NodeIndex].LiveToVarMap[LiveIndex - NumGlobals]; | 139 return Nodes[NodeIndex].LiveToVarMap[LiveIndex - NumGlobals]; |
140 } | 140 } |
141 | 141 |
142 } // end of namespace Ice | 142 } // end of namespace Ice |
OLD | NEW |