| 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 // This file provides some of the support for the Liveness class. In | 10 // This file provides some of the support for the Liveness class. In |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 ++NumGlobals; | 44 ++NumGlobals; |
| 45 } else { | 45 } else { |
| 46 SizeT Index = VMetadata->getLocalUseNode(Var)->getIndex(); | 46 SizeT Index = VMetadata->getLocalUseNode(Var)->getIndex(); |
| 47 ++Nodes[Index].NumLocals; | 47 ++Nodes[Index].NumLocals; |
| 48 } | 48 } |
| 49 } | 49 } |
| 50 | 50 |
| 51 // Resize each LivenessNode::LiveToVarMap, and the global | 51 // Resize each LivenessNode::LiveToVarMap, and the global |
| 52 // LiveToVarMap. Reset the counts to 0. | 52 // LiveToVarMap. Reset the counts to 0. |
| 53 for (SizeT i = 0; i < NumNodes; ++i) { | 53 for (SizeT i = 0; i < NumNodes; ++i) { |
| 54 Nodes[i].LiveToVarMap.assign(Nodes[i].NumLocals, NULL); | 54 Nodes[i].LiveToVarMap.assign(Nodes[i].NumLocals, nullptr); |
| 55 Nodes[i].NumLocals = 0; | 55 Nodes[i].NumLocals = 0; |
| 56 Nodes[i].NumNonDeadPhis = 0; | 56 Nodes[i].NumNonDeadPhis = 0; |
| 57 } | 57 } |
| 58 LiveToVarMap.assign(NumGlobals, NULL); | 58 LiveToVarMap.assign(NumGlobals, nullptr); |
| 59 | 59 |
| 60 // Sort each variable into the appropriate LiveToVarMap. Also set | 60 // Sort each variable into the appropriate LiveToVarMap. Also set |
| 61 // VarToLiveMap. | 61 // VarToLiveMap. |
| 62 SizeT TmpNumGlobals = 0; | 62 SizeT TmpNumGlobals = 0; |
| 63 for (SizeT i = 0; i < NumVars; ++i) { | 63 for (SizeT i = 0; i < NumVars; ++i) { |
| 64 Variable *Var = Func->getVariables()[i]; | 64 Variable *Var = Func->getVariables()[i]; |
| 65 SizeT VarIndex = Var->getIndex(); | 65 SizeT VarIndex = Var->getIndex(); |
| 66 SizeT LiveIndex; | 66 SizeT LiveIndex; |
| 67 if (VMetadata->isMultiBlock(Var)) { | 67 if (VMetadata->isMultiBlock(Var)) { |
| 68 LiveIndex = TmpNumGlobals++; | 68 LiveIndex = TmpNumGlobals++; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 89 } | 89 } |
| 90 | 90 |
| 91 Variable *Liveness::getVariable(SizeT LiveIndex, const CfgNode *Node) const { | 91 Variable *Liveness::getVariable(SizeT LiveIndex, const CfgNode *Node) const { |
| 92 if (LiveIndex < NumGlobals) | 92 if (LiveIndex < NumGlobals) |
| 93 return LiveToVarMap[LiveIndex]; | 93 return LiveToVarMap[LiveIndex]; |
| 94 SizeT NodeIndex = Node->getIndex(); | 94 SizeT NodeIndex = Node->getIndex(); |
| 95 return Nodes[NodeIndex].LiveToVarMap[LiveIndex - NumGlobals]; | 95 return Nodes[NodeIndex].LiveToVarMap[LiveIndex - NumGlobals]; |
| 96 } | 96 } |
| 97 | 97 |
| 98 } // end of namespace Ice | 98 } // end of namespace Ice |
| OLD | NEW |