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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
48 SizeT TmpNumGlobals = 0; | 48 SizeT TmpNumGlobals = 0; |
49 for (auto I = FirstVar, E = Func->getVariables().end(); I != E; ++I) { | 49 for (auto I = FirstVar, E = Func->getVariables().end(); I != E; ++I) { |
50 Variable *Var = *I; | 50 Variable *Var = *I; |
51 if (VMetadata->isMultiBlock(Var)) { | 51 if (VMetadata->isMultiBlock(Var)) { |
52 ++TmpNumGlobals; | 52 ++TmpNumGlobals; |
53 } else { | 53 } else { |
54 SizeT Index = VMetadata->getLocalUseNode(Var)->getIndex(); | 54 SizeT Index = VMetadata->getLocalUseNode(Var)->getIndex(); |
55 ++Nodes[Index].NumLocals; | 55 ++Nodes[Index].NumLocals; |
56 } | 56 } |
57 } | 57 } |
58 if (IsFullInit) | 58 if (IsFullInit) { |
Jim Stichnoth
2016/01/14 00:09:52
I would just revert this change completely in this
John
2016/01/14 23:18:25
This was on the spirit of last afternoon's discuss
| |
59 NumGlobals = TmpNumGlobals; | 59 NumGlobals = TmpNumGlobals; |
60 else | 60 } else { |
61 assert(TmpNumGlobals == 0); | 61 assert(TmpNumGlobals == 0); |
62 | 62 } |
63 // Resize each LivenessNode::LiveToVarMap, and the global LiveToVarMap. Reset | 63 // Resize each LivenessNode::LiveToVarMap, and the global LiveToVarMap. Reset |
64 // the counts to 0. | 64 // the counts to 0. |
65 for (auto I = FirstNode, E = Func->getNodes().end(); I != E; ++I) { | 65 for (auto I = FirstNode, E = Func->getNodes().end(); I != E; ++I) { |
66 LivenessNode &N = Nodes[(*I)->getIndex()]; | 66 LivenessNode &N = Nodes[(*I)->getIndex()]; |
67 N.LiveToVarMap.assign(N.NumLocals, nullptr); | 67 N.LiveToVarMap.assign(N.NumLocals, nullptr); |
68 N.NumLocals = 0; | 68 N.NumLocals = 0; |
69 N.NumNonDeadPhis = 0; | 69 N.NumNonDeadPhis = 0; |
70 } | 70 } |
71 if (IsFullInit) | 71 if (IsFullInit) |
72 LiveToVarMap.assign(NumGlobals, nullptr); | 72 LiveToVarMap.assign(NumGlobals, nullptr); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
130 } | 130 } |
131 | 131 |
132 Variable *Liveness::getVariable(SizeT LiveIndex, const CfgNode *Node) const { | 132 Variable *Liveness::getVariable(SizeT LiveIndex, const CfgNode *Node) const { |
133 if (LiveIndex < NumGlobals) | 133 if (LiveIndex < NumGlobals) |
134 return LiveToVarMap[LiveIndex]; | 134 return LiveToVarMap[LiveIndex]; |
135 SizeT NodeIndex = Node->getIndex(); | 135 SizeT NodeIndex = Node->getIndex(); |
136 return Nodes[NodeIndex].LiveToVarMap[LiveIndex - NumGlobals]; | 136 return Nodes[NodeIndex].LiveToVarMap[LiveIndex - NumGlobals]; |
137 } | 137 } |
138 | 138 |
139 } // end of namespace Ice | 139 } // end of namespace Ice |
OLD | NEW |