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

Unified Diff: src/IceGlobalContext.h

Issue 2042063002: Created Ice::Instrumentation base class and accompanying hooks. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Style and comment fixes Created 4 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/IceCompileServer.cpp ('k') | src/IceGlobalContext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceGlobalContext.h
diff --git a/src/IceGlobalContext.h b/src/IceGlobalContext.h
index c216f82f92dd54a403736e4c6402eb1e929dbf5f..2d60f4845466f879ebc50a407ca021edab29a01f 100644
--- a/src/IceGlobalContext.h
+++ b/src/IceGlobalContext.h
@@ -18,6 +18,7 @@
#include "IceDefs.h"
#include "IceClFlags.h"
+#include "IceInstrumentation.h"
#include "IceIntrinsics.h"
#include "IceRNG.h"
#include "IceStringPool.h"
@@ -44,6 +45,7 @@ namespace Ice {
class ConstantPool;
class EmitterWorkItem;
class FuncSigType;
+class Instrumentation;
// Runtime helper function IDs
@@ -426,6 +428,17 @@ public:
void waitForWorkerThreads();
+ /// sets the instrumentation object to use.
+ void setInstrumentation(std::unique_ptr<Instrumentation> Instr) {
+ if (!BuildDefs::minimal())
+ Instrumentor = std::move(Instr);
+ }
+
+ void instrumentFunc(Cfg *Func) {
+ if (!BuildDefs::minimal() && Instrumentor)
+ Instrumentor->instrumentFunc(Func);
+ }
+
/// Translation thread startup routine.
void translateFunctionsWrapper(ThreadContext *MyTLS) {
ICE_TLS_SET_FIELD(TLS, MyTLS);
@@ -552,6 +565,9 @@ private:
/// program global variables) until the first code WorkItem is seen.
// TODO(jpp): move to EmitterContext.
bool HasSeenCode = false;
+ // If Instrumentor is not empty then it will be used to instrument globals and
+ // CFGs.
+ std::unique_ptr<Instrumentation> Instrumentor = nullptr;
// TODO(jpp): move to EmitterContext.
VariableDeclaration *ProfileBlockInfoVarDecl = nullptr;
std::vector<VariableDeclaration *> ProfileBlockInfos;
« no previous file with comments | « src/IceCompileServer.cpp ('k') | src/IceGlobalContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698