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

Side by Side Diff: src/IceLiveness.cpp

Issue 1312433004: Weight variables by their number of uses for register allocation. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 years, 3 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
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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 if (Var->getIgnoreLiveness()) 95 if (Var->getIgnoreLiveness())
96 RangeMask[VarIndex] = false; 96 RangeMask[VarIndex] = false;
97 } 97 }
98 assert(TmpNumGlobals == (IsFullInit ? NumGlobals : 0)); 98 assert(TmpNumGlobals == (IsFullInit ? NumGlobals : 0));
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->getWeight().isInf())) 105 (!IsFullInit && !Var->hasReg() && !Var->mustHaveReg()))
106 RangeMask[VarIndex] = false; 106 RangeMask[VarIndex] = false;
107 } 107 }
108 108
109 // Process each node. 109 // Process each node.
110 for (auto I = FirstNode, E = Func->getNodes().end(); I != E; ++I) { 110 for (auto I = FirstNode, E = Func->getNodes().end(); I != E; ++I) {
111 LivenessNode &Node = Nodes[(*I)->getIndex()]; 111 LivenessNode &Node = Nodes[(*I)->getIndex()];
112 // NumLocals, LiveToVarMap already initialized 112 // NumLocals, LiveToVarMap already initialized
113 Node.LiveIn.resize(NumGlobals); 113 Node.LiveIn.resize(NumGlobals);
114 Node.LiveOut.resize(NumGlobals); 114 Node.LiveOut.resize(NumGlobals);
115 // LiveBegin and LiveEnd are reinitialized before each pass over 115 // LiveBegin and LiveEnd are reinitialized before each pass over
(...skipping 15 matching lines...) Expand all
131 } 131 }
132 132
133 Variable *Liveness::getVariable(SizeT LiveIndex, const CfgNode *Node) const { 133 Variable *Liveness::getVariable(SizeT LiveIndex, const CfgNode *Node) const {
134 if (LiveIndex < NumGlobals) 134 if (LiveIndex < NumGlobals)
135 return LiveToVarMap[LiveIndex]; 135 return LiveToVarMap[LiveIndex];
136 SizeT NodeIndex = Node->getIndex(); 136 SizeT NodeIndex = Node->getIndex();
137 return Nodes[NodeIndex].LiveToVarMap[LiveIndex - NumGlobals]; 137 return Nodes[NodeIndex].LiveToVarMap[LiveIndex - NumGlobals];
138 } 138 }
139 139
140 } // end of namespace Ice 140 } // end of namespace Ice
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698