Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(334)

Side by Side Diff: src/IceLiveness.cpp

Issue 673783002: Subzero: Improve debugging controls, plus minor refactoring. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/IceInstX8632.cpp ('k') | src/IceOperand.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 SizeT NodeIndex = VMetadata->getLocalUseNode(Var)->getIndex(); 70 SizeT NodeIndex = VMetadata->getLocalUseNode(Var)->getIndex();
71 LiveIndex = Nodes[NodeIndex].NumLocals++; 71 LiveIndex = Nodes[NodeIndex].NumLocals++;
72 Nodes[NodeIndex].LiveToVarMap[LiveIndex] = Var; 72 Nodes[NodeIndex].LiveToVarMap[LiveIndex] = Var;
73 LiveIndex += NumGlobals; 73 LiveIndex += NumGlobals;
74 } 74 }
75 VarToLiveMap[VarIndex] = LiveIndex; 75 VarToLiveMap[VarIndex] = LiveIndex;
76 } 76 }
77 assert(NumGlobals == TmpNumGlobals); 77 assert(NumGlobals == TmpNumGlobals);
78 78
79 // Process each node. 79 // Process each node.
80 const NodeList &LNodes = Func->getNodes(); 80 for (const CfgNode *LNode : Func->getNodes()) {
81 SizeT NumLNodes = LNodes.size(); 81 LivenessNode &Node = Nodes[LNode->getIndex()];
82 for (SizeT i = 0; i < NumLNodes; ++i) {
83 LivenessNode &Node = Nodes[LNodes[i]->getIndex()];
84 // NumLocals, LiveToVarMap already initialized 82 // NumLocals, LiveToVarMap already initialized
85 Node.LiveIn.resize(NumGlobals); 83 Node.LiveIn.resize(NumGlobals);
86 Node.LiveOut.resize(NumGlobals); 84 Node.LiveOut.resize(NumGlobals);
87 // LiveBegin and LiveEnd are reinitialized before each pass over 85 // LiveBegin and LiveEnd are reinitialized before each pass over
88 // the block. 86 // the block.
89 } 87 }
90 } 88 }
91 89
92 Variable *Liveness::getVariable(SizeT LiveIndex, const CfgNode *Node) const { 90 Variable *Liveness::getVariable(SizeT LiveIndex, const CfgNode *Node) const {
93 if (LiveIndex < NumGlobals) 91 if (LiveIndex < NumGlobals)
94 return LiveToVarMap[LiveIndex]; 92 return LiveToVarMap[LiveIndex];
95 SizeT NodeIndex = Node->getIndex(); 93 SizeT NodeIndex = Node->getIndex();
96 return Nodes[NodeIndex].LiveToVarMap[LiveIndex - NumGlobals]; 94 return Nodes[NodeIndex].LiveToVarMap[LiveIndex - NumGlobals];
97 } 95 }
98 96
99 } // end of namespace Ice 97 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceInstX8632.cpp ('k') | src/IceOperand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698