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

Unified Diff: src/IceCfgNode.cpp

Issue 1147023007: Subzero: Basic Block Profiler. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Adds a $ to the profiler generated labels. Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceCfgNode.h ('k') | src/IceClFlags.h » ('j') | src/IceGlobalContext.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceCfgNode.cpp
diff --git a/src/IceCfgNode.cpp b/src/IceCfgNode.cpp
index 87eee0f8a31ff5a53cc37b939a4ce3ae7f324d9a..68578b9b5a14b4fcf8c3bf3323f29528d11f0ef8 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,31 @@ void CfgNode::dump(Cfg *Func) const {
}
}
+void CfgNode::profileExecutionCount(VariableDeclaration *Var) {
+ constexpr char RMW_I64[] = "llvm.nacl.atomic.rmw.i64";
+
+ GlobalContext *Context = Func->getContext();
+
+ bool BadIntrinsic = false;
+ const Intrinsics::FullIntrinsicInfo *Info =
+ Context->getIntrinsicsInfo().find(RMW_I64, BadIntrinsic);
+ assert(!BadIntrinsic);
+ assert(Info != nullptr);
+
+ Operand *RMWI64Name = Context->getConstantExternSym(RMW_I64);
+ Constant *Counter = Context->getConstantExternSym(Var->getName());
+ Constant *AtomicRMWOp = Context->getConstantInt32(Intrinsics::AtomicAdd);
+ Constant *One = Context->getConstantInt64(1);
+ Constant *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
« no previous file with comments | « src/IceCfgNode.h ('k') | src/IceClFlags.h » ('j') | src/IceGlobalContext.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698