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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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) |
59 NumGlobals = TmpNumGlobals; | 59 NumGlobals = TmpNumGlobals; |
60 else | 60 else { |
| 61 if (TmpNumGlobals != 0) { |
| 62 Ostream &Str = Func->getContext()->getStrDump(); |
| 63 for (auto I = FirstVar, E = Func->getVariables().end(); I != E; ++I) { |
| 64 Variable *Var = *I; |
| 65 if (VMetadata->isMultiBlock(Var)) { |
| 66 Str << " Multiblock: "; |
| 67 } else { |
| 68 Str << "!Multiblock: "; |
| 69 } |
| 70 Var->dump(Str); |
| 71 Str << "\n"; |
| 72 } |
| 73 Func->dump(); |
| 74 } |
61 assert(TmpNumGlobals == 0); | 75 assert(TmpNumGlobals == 0); |
62 | 76 } |
63 // Resize each LivenessNode::LiveToVarMap, and the global LiveToVarMap. Reset | 77 // Resize each LivenessNode::LiveToVarMap, and the global LiveToVarMap. Reset |
64 // the counts to 0. | 78 // the counts to 0. |
65 for (auto I = FirstNode, E = Func->getNodes().end(); I != E; ++I) { | 79 for (auto I = FirstNode, E = Func->getNodes().end(); I != E; ++I) { |
66 LivenessNode &N = Nodes[(*I)->getIndex()]; | 80 LivenessNode &N = Nodes[(*I)->getIndex()]; |
67 N.LiveToVarMap.assign(N.NumLocals, nullptr); | 81 N.LiveToVarMap.assign(N.NumLocals, nullptr); |
68 N.NumLocals = 0; | 82 N.NumLocals = 0; |
69 N.NumNonDeadPhis = 0; | 83 N.NumNonDeadPhis = 0; |
70 } | 84 } |
71 if (IsFullInit) | 85 if (IsFullInit) |
72 LiveToVarMap.assign(NumGlobals, nullptr); | 86 LiveToVarMap.assign(NumGlobals, nullptr); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 } | 144 } |
131 | 145 |
132 Variable *Liveness::getVariable(SizeT LiveIndex, const CfgNode *Node) const { | 146 Variable *Liveness::getVariable(SizeT LiveIndex, const CfgNode *Node) const { |
133 if (LiveIndex < NumGlobals) | 147 if (LiveIndex < NumGlobals) |
134 return LiveToVarMap[LiveIndex]; | 148 return LiveToVarMap[LiveIndex]; |
135 SizeT NodeIndex = Node->getIndex(); | 149 SizeT NodeIndex = Node->getIndex(); |
136 return Nodes[NodeIndex].LiveToVarMap[LiveIndex - NumGlobals]; | 150 return Nodes[NodeIndex].LiveToVarMap[LiveIndex - NumGlobals]; |
137 } | 151 } |
138 | 152 |
139 } // end of namespace Ice | 153 } // end of namespace Ice |
OLD | NEW |