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

Side by Side Diff: src/IceCfgNode.cpp

Issue 1318553003: Compute the loop nest depth of each CfgNode and weight Variables by it. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: calculate -> compute (consistency) 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/IceCfgNode.cpp - Basic block (node) implementation -----===// 1 //===- subzero/src/IceCfgNode.cpp - Basic block (node) 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 210
211 // Splits the edge from Pred to this node by creating a new node and 211 // Splits the edge from Pred to this node by creating a new node and
212 // hooking up the in and out edges appropriately. (The EdgeIndex 212 // hooking up the in and out edges appropriately. (The EdgeIndex
213 // parameter is only used to make the new node's name unique when 213 // parameter is only used to make the new node's name unique when
214 // there are multiple edges between the same pair of nodes.) The new 214 // there are multiple edges between the same pair of nodes.) The new
215 // node's instruction list is initialized to the empty list, with no 215 // node's instruction list is initialized to the empty list, with no
216 // terminator instruction. There must not be multiple edges from Pred 216 // terminator instruction. There must not be multiple edges from Pred
217 // to this node so all Inst::getTerminatorEdges implementations must 217 // to this node so all Inst::getTerminatorEdges implementations must
218 // not contain duplicates. 218 // not contain duplicates.
219 CfgNode *CfgNode::splitIncomingEdge(CfgNode *Pred, SizeT EdgeIndex) { 219 CfgNode *CfgNode::splitIncomingEdge(CfgNode *Pred, SizeT EdgeIndex) {
220 CfgNode *NewNode = Func->makeNode(); 220 CfgNode *NewNode = Func->makeNode();
Jim Stichnoth 2015/09/01 22:17:37 Here I think you could set NewNode->LoopNestDepth
ascull 2015/09/03 19:52:37 Done.
221 if (BuildDefs::dump()) 221 if (BuildDefs::dump())
222 NewNode->setName("split_" + Pred->getName() + "_" + getName() + "_" + 222 NewNode->setName("split_" + Pred->getName() + "_" + getName() + "_" +
223 std::to_string(EdgeIndex)); 223 std::to_string(EdgeIndex));
224 // The new node is added to the end of the node list, and will later 224 // The new node is added to the end of the node list, and will later
225 // need to be sorted into a reasonable topological order. 225 // need to be sorted into a reasonable topological order.
226 NewNode->setNeedsPlacement(true); 226 NewNode->setNeedsPlacement(true);
227 // Repoint Pred's out-edge. 227 // Repoint Pred's out-edge.
228 bool Found = false; 228 bool Found = false;
229 for (CfgNode *&I : Pred->OutEdges) { 229 for (CfgNode *&I : Pred->OutEdges) {
230 if (I == this) { 230 if (I == this) {
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after
1175 1175
1176 void CfgNode::dump(Cfg *Func) const { 1176 void CfgNode::dump(Cfg *Func) const {
1177 if (!BuildDefs::dump()) 1177 if (!BuildDefs::dump())
1178 return; 1178 return;
1179 Func->setCurrentNode(this); 1179 Func->setCurrentNode(this);
1180 Ostream &Str = Func->getContext()->getStrDump(); 1180 Ostream &Str = Func->getContext()->getStrDump();
1181 Liveness *Liveness = Func->getLiveness(); 1181 Liveness *Liveness = Func->getLiveness();
1182 if (Func->isVerbose(IceV_Instructions)) { 1182 if (Func->isVerbose(IceV_Instructions)) {
1183 Str << getName() << ":\n"; 1183 Str << getName() << ":\n";
1184 } 1184 }
1185 // Dump the loop nest depth
1186 if (Func->isVerbose(IceV_Loop))
1187 Str << " // LoopNestDepth = " << LoopNestDepth << "\n";
Jim Stichnoth 2015/09/01 22:17:37 I suggest adding the node label - getName() - to t
ascull 2015/09/03 19:52:37 Done.
1185 // Dump list of predecessor nodes. 1188 // Dump list of predecessor nodes.
1186 if (Func->isVerbose(IceV_Preds) && !InEdges.empty()) { 1189 if (Func->isVerbose(IceV_Preds) && !InEdges.empty()) {
1187 Str << " // preds = "; 1190 Str << " // preds = ";
1188 bool First = true; 1191 bool First = true;
1189 for (CfgNode *I : InEdges) { 1192 for (CfgNode *I : InEdges) {
1190 if (!First) 1193 if (!First)
1191 Str << ", "; 1194 Str << ", ";
1192 First = false; 1195 First = false;
1193 Str << "%" << I->getName(); 1196 Str << "%" << I->getName();
1194 } 1197 }
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1277 InstIntrinsicCall *Inst = InstIntrinsicCall::create( 1280 InstIntrinsicCall *Inst = InstIntrinsicCall::create(
1278 Func, 5, Func->makeVariable(IceType_i64), RMWI64Name, Info->Info); 1281 Func, 5, Func->makeVariable(IceType_i64), RMWI64Name, Info->Info);
1279 Inst->addArg(AtomicRMWOp); 1282 Inst->addArg(AtomicRMWOp);
1280 Inst->addArg(Counter); 1283 Inst->addArg(Counter);
1281 Inst->addArg(One); 1284 Inst->addArg(One);
1282 Inst->addArg(OrderAcquireRelease); 1285 Inst->addArg(OrderAcquireRelease);
1283 Insts.push_front(Inst); 1286 Insts.push_front(Inst);
1284 } 1287 }
1285 1288
1286 } // end of namespace Ice 1289 } // end of namespace Ice
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698