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

Side by Side Diff: src/IceLiveness.cpp

Issue 1838973005: Subzero. Liveness memory management. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Addresses comments. Created 4 years, 8 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/IceLiveness.h ('k') | src/IceMemory.h » ('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 /// \file 10 /// \file
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
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...) Expand all
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
OLDNEW
« no previous file with comments | « src/IceLiveness.h ('k') | src/IceMemory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698