Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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(); |
| 221 // Depth is the minimum as it works if both are the same, but if one is | |
| 222 // outside the loop and the other is inside, the new node should be placed | |
| 223 // outside and not be executed multiple times within the loop. | |
| 224 NewNode->setLoopNestDepth( | |
| 225 std::min(getLoopNestDepth(), Pred->getLoopNestDepth())); | |
| 221 if (BuildDefs::dump()) | 226 if (BuildDefs::dump()) |
| 222 NewNode->setName("split_" + Pred->getName() + "_" + getName() + "_" + | 227 NewNode->setName("split_" + Pred->getName() + "_" + getName() + "_" + |
| 223 std::to_string(EdgeIndex)); | 228 std::to_string(EdgeIndex)); |
| 224 // The new node is added to the end of the node list, and will later | 229 // 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. | 230 // need to be sorted into a reasonable topological order. |
| 226 NewNode->setNeedsPlacement(true); | 231 NewNode->setNeedsPlacement(true); |
| 227 // Repoint Pred's out-edge. | 232 // Repoint Pred's out-edge. |
| 228 bool Found = false; | 233 bool Found = false; |
| 229 for (CfgNode *&I : Pred->OutEdges) { | 234 for (CfgNode *&I : Pred->OutEdges) { |
| 230 if (I == this) { | 235 if (I == this) { |
| (...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1172 assert(!Helper.isInBundleLockRegion()); | 1177 assert(!Helper.isInBundleLockRegion()); |
| 1173 assert(!Retrying); | 1178 assert(!Retrying); |
| 1174 } | 1179 } |
| 1175 | 1180 |
| 1176 void CfgNode::dump(Cfg *Func) const { | 1181 void CfgNode::dump(Cfg *Func) const { |
| 1177 if (!BuildDefs::dump()) | 1182 if (!BuildDefs::dump()) |
| 1178 return; | 1183 return; |
| 1179 Func->setCurrentNode(this); | 1184 Func->setCurrentNode(this); |
| 1180 Ostream &Str = Func->getContext()->getStrDump(); | 1185 Ostream &Str = Func->getContext()->getStrDump(); |
| 1181 Liveness *Liveness = Func->getLiveness(); | 1186 Liveness *Liveness = Func->getLiveness(); |
| 1182 if (Func->isVerbose(IceV_Instructions)) { | 1187 if (Func->isVerbose(IceV_Instructions) || Func->isVerbose(IceV_Loop)) |
|
Jim Stichnoth
2015/09/03 21:35:09
I think it would be better to leave this line the
ascull
2015/09/03 22:47:12
Done.
| |
| 1183 Str << getName() << ":\n"; | 1188 Str << getName() << ":\n"; |
| 1184 } | 1189 // Dump the loop nest depth |
| 1190 if (Func->isVerbose(IceV_Loop)) | |
| 1191 Str << " // LoopNestDepth = " << getLoopNestDepth() << "\n"; | |
| 1185 // Dump list of predecessor nodes. | 1192 // Dump list of predecessor nodes. |
| 1186 if (Func->isVerbose(IceV_Preds) && !InEdges.empty()) { | 1193 if (Func->isVerbose(IceV_Preds) && !InEdges.empty()) { |
| 1187 Str << " // preds = "; | 1194 Str << " // preds = "; |
| 1188 bool First = true; | 1195 bool First = true; |
| 1189 for (CfgNode *I : InEdges) { | 1196 for (CfgNode *I : InEdges) { |
| 1190 if (!First) | 1197 if (!First) |
| 1191 Str << ", "; | 1198 Str << ", "; |
| 1192 First = false; | 1199 First = false; |
| 1193 Str << "%" << I->getName(); | 1200 Str << "%" << I->getName(); |
| 1194 } | 1201 } |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1277 InstIntrinsicCall *Inst = InstIntrinsicCall::create( | 1284 InstIntrinsicCall *Inst = InstIntrinsicCall::create( |
| 1278 Func, 5, Func->makeVariable(IceType_i64), RMWI64Name, Info->Info); | 1285 Func, 5, Func->makeVariable(IceType_i64), RMWI64Name, Info->Info); |
| 1279 Inst->addArg(AtomicRMWOp); | 1286 Inst->addArg(AtomicRMWOp); |
| 1280 Inst->addArg(Counter); | 1287 Inst->addArg(Counter); |
| 1281 Inst->addArg(One); | 1288 Inst->addArg(One); |
| 1282 Inst->addArg(OrderAcquireRelease); | 1289 Inst->addArg(OrderAcquireRelease); |
| 1283 Insts.push_front(Inst); | 1290 Insts.push_front(Inst); |
| 1284 } | 1291 } |
| 1285 | 1292 |
| 1286 } // end of namespace Ice | 1293 } // end of namespace Ice |
| OLD | NEW |