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

Side by Side Diff: src/IceLiveness.cpp

Issue 1271923002: Subzero: Slight improvement to phi lowering. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Add a TODO Created 5 years, 4 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/IceRegAlloc.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 /// \file 10 /// \file
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 93
94 // Process each node. 94 // Process each node.
95 for (auto I = FirstNode, E = Func->getNodes().end(); I != E; ++I) { 95 for (auto I = FirstNode, E = Func->getNodes().end(); I != E; ++I) {
96 LivenessNode &Node = Nodes[(*I)->getIndex()]; 96 LivenessNode &Node = Nodes[(*I)->getIndex()];
97 // NumLocals, LiveToVarMap already initialized 97 // NumLocals, LiveToVarMap already initialized
98 Node.LiveIn.resize(NumGlobals); 98 Node.LiveIn.resize(NumGlobals);
99 Node.LiveOut.resize(NumGlobals); 99 Node.LiveOut.resize(NumGlobals);
100 // LiveBegin and LiveEnd are reinitialized before each pass over 100 // LiveBegin and LiveEnd are reinitialized before each pass over
101 // the block. 101 // the block.
102 } 102 }
103
104 // Initialize the bitmask of which variables to track.
105 RangeMask.resize(NumVars);
106 RangeMask.set(0, NumVars);
107 if (!IsFullInit) {
108 // Reset initial variables that are not pre-colored or infinite-weight.
109 for (auto I = Func->getVariables().begin(); I != FirstVar; ++I) {
110 Variable *Var = *I;
111 RangeMask[Var->getIndex()] = (Var->hasReg() || Var->getWeight().isInf());
112 }
113 }
103 } 114 }
104 115
105 void Liveness::init() { 116 void Liveness::init() {
106 constexpr bool IsFullInit = true; 117 constexpr bool IsFullInit = true;
107 NodeList::const_iterator FirstNode = Func->getNodes().begin(); 118 NodeList::const_iterator FirstNode = Func->getNodes().begin();
108 VarList::const_iterator FirstVar = Func->getVariables().begin(); 119 VarList::const_iterator FirstVar = Func->getVariables().begin();
109 initInternal(FirstNode, FirstVar, IsFullInit); 120 initInternal(FirstNode, FirstVar, IsFullInit);
110 } 121 }
111 122
112 void Liveness::initPhiEdgeSplits(NodeList::const_iterator FirstNode, 123 void Liveness::initPhiEdgeSplits(NodeList::const_iterator FirstNode,
113 VarList::const_iterator FirstVar) { 124 VarList::const_iterator FirstVar) {
114 constexpr bool IsFullInit = false; 125 constexpr bool IsFullInit = false;
115 initInternal(FirstNode, FirstVar, IsFullInit); 126 initInternal(FirstNode, FirstVar, IsFullInit);
116 } 127 }
117 128
118 Variable *Liveness::getVariable(SizeT LiveIndex, const CfgNode *Node) const { 129 Variable *Liveness::getVariable(SizeT LiveIndex, const CfgNode *Node) const {
119 if (LiveIndex < NumGlobals) 130 if (LiveIndex < NumGlobals)
120 return LiveToVarMap[LiveIndex]; 131 return LiveToVarMap[LiveIndex];
121 SizeT NodeIndex = Node->getIndex(); 132 SizeT NodeIndex = Node->getIndex();
122 return Nodes[NodeIndex].LiveToVarMap[LiveIndex - NumGlobals]; 133 return Nodes[NodeIndex].LiveToVarMap[LiveIndex - NumGlobals];
123 } 134 }
124 135
125 } // end of namespace Ice 136 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceLiveness.h ('k') | src/IceRegAlloc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698