Chromium Code Reviews| Index: src/IceCfgNode.cpp |
| diff --git a/src/IceCfgNode.cpp b/src/IceCfgNode.cpp |
| index 87eee0f8a31ff5a53cc37b939a4ce3ae7f324d9a..bba9e5bcd396cd7543c390cf6e210bddddd1e78d 100644 |
| --- a/src/IceCfgNode.cpp |
| +++ b/src/IceCfgNode.cpp |
| @@ -15,6 +15,7 @@ |
| #include "assembler.h" |
| #include "IceCfg.h" |
| #include "IceCfgNode.h" |
| +#include "IceGlobalInits.h" |
| #include "IceInst.h" |
| #include "IceLiveness.h" |
| #include "IceOperand.h" |
| @@ -1243,4 +1244,30 @@ void CfgNode::dump(Cfg *Func) const { |
| } |
| } |
| +void CfgNode::profileExecutionCount(VariableDeclaration *Var) { |
| + constexpr char RMW_I64[] = "llvm.nacl.atomic.rmw.i64"; |
| + |
| + 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
|
| + |
| + bool BadIntrinsic = false; |
| + auto *Info = Context->getIntrinsicsInfo().find(RMW_I64, BadIntrinsic); |
| + assert(!BadIntrinsic); |
| + assert(Info != nullptr); |
| + |
| + auto *RMWI64Name = Context->getConstantExternSym(RMW_I64); |
| + auto *Counter = Context->getConstantExternSym(Var->getName()); |
| + auto *AtomicRMWOp = Context->getConstantInt32(Intrinsics::AtomicAdd); |
| + auto *One = Context->getConstantInt64(1); |
| + auto *OrderAcquireRelease = |
| + Context->getConstantInt32(Intrinsics::MemoryOrderAcquireRelease); |
| + |
| + InstIntrinsicCall *Inst = InstIntrinsicCall::create( |
| + Func, 5, Func->makeVariable(IceType_i64), RMWI64Name, Info->Info); |
| + Inst->addArg(AtomicRMWOp); |
| + Inst->addArg(Counter); |
| + Inst->addArg(One); |
| + Inst->addArg(OrderAcquireRelease); |
| + Insts.push_front(Inst); |
| +} |
| + |
| } // end of namespace Ice |