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 // This file implements the CfgNode class, including the complexities | 10 // This file implements the CfgNode class, including the complexities |
| 11 // of instruction insertion and in-edge calculation. | 11 // of instruction insertion and in-edge calculation. |
| 12 // | 12 // |
| 13 //===----------------------------------------------------------------------===// | 13 //===----------------------------------------------------------------------===// |
| 14 | 14 |
| 15 #include "assembler.h" | 15 #include "assembler.h" |
| 16 #include "IceCfg.h" | 16 #include "IceCfg.h" |
| 17 #include "IceCfgNode.h" | 17 #include "IceCfgNode.h" |
| 18 #include "IceGlobalInits.h" | |
| 18 #include "IceInst.h" | 19 #include "IceInst.h" |
| 19 #include "IceLiveness.h" | 20 #include "IceLiveness.h" |
| 20 #include "IceOperand.h" | 21 #include "IceOperand.h" |
| 21 #include "IceTargetLowering.h" | 22 #include "IceTargetLowering.h" |
| 22 | 23 |
| 23 namespace Ice { | 24 namespace Ice { |
| 24 | 25 |
| 25 CfgNode::CfgNode(Cfg *Func, SizeT LabelNumber) | 26 CfgNode::CfgNode(Cfg *Func, SizeT LabelNumber) |
| 26 : Func(Func), Number(LabelNumber), NameIndex(Cfg::IdentifierIndexInvalid), | 27 : Func(Func), Number(LabelNumber), NameIndex(Cfg::IdentifierIndexInvalid), |
| 27 HasReturn(false), NeedsPlacement(false), InstCountEstimate(0) {} | 28 HasReturn(false), NeedsPlacement(false), InstCountEstimate(0) {} |
| (...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1236 for (CfgNode *I : OutEdges) { | 1237 for (CfgNode *I : OutEdges) { |
| 1237 if (!First) | 1238 if (!First) |
| 1238 Str << ", "; | 1239 Str << ", "; |
| 1239 First = false; | 1240 First = false; |
| 1240 Str << "%" << I->getName(); | 1241 Str << "%" << I->getName(); |
| 1241 } | 1242 } |
| 1242 Str << "\n"; | 1243 Str << "\n"; |
| 1243 } | 1244 } |
| 1244 } | 1245 } |
| 1245 | 1246 |
| 1247 void CfgNode::profileExecutionCount(VariableDeclaration *Var) { | |
| 1248 constexpr char RMW_I64[] = "llvm.nacl.atomic.rmw.i64"; | |
| 1249 | |
| 1250 auto *Context = Func->getContext(); | |
|
Jim Stichnoth
2015/06/08 23:45:31
In Subzero, we've been more sparing with our use o
John
2015/06/09 15:36:18
Done. I was just following items 5 and 6 from Mode
Jim Stichnoth
2015/06/09 16:39:46
I'm fairly new to "auto" and as such, the code bas
| |
| 1251 | |
| 1252 bool BadIntrinsic = false; | |
| 1253 auto *Info = Context->getIntrinsicsInfo().find(RMW_I64, BadIntrinsic); | |
| 1254 assert(!BadIntrinsic); | |
| 1255 assert(Info != nullptr); | |
| 1256 | |
| 1257 auto *RMWI64Name = Context->getConstantExternSym(RMW_I64); | |
| 1258 auto *Counter = Context->getConstantExternSym(Var->getName()); | |
| 1259 auto *AtomicRMWOp = Context->getConstantInt32(Intrinsics::AtomicAdd); | |
| 1260 auto *One = Context->getConstantInt64(1); | |
| 1261 auto *OrderAcquireRelease = | |
| 1262 Context->getConstantInt32(Intrinsics::MemoryOrderAcquireRelease); | |
| 1263 | |
| 1264 InstIntrinsicCall *Inst = InstIntrinsicCall::create( | |
| 1265 Func, 5, Func->makeVariable(IceType_i64), RMWI64Name, Info->Info); | |
| 1266 Inst->addArg(AtomicRMWOp); | |
| 1267 Inst->addArg(Counter); | |
| 1268 Inst->addArg(One); | |
| 1269 Inst->addArg(OrderAcquireRelease); | |
| 1270 Insts.push_front(Inst); | |
| 1271 } | |
| 1272 | |
| 1246 } // end of namespace Ice | 1273 } // end of namespace Ice |
| OLD | NEW |