Index: src/IceGlobalContext.h |
diff --git a/src/IceGlobalContext.h b/src/IceGlobalContext.h |
index c216f82f92dd54a403736e4c6402eb1e929dbf5f..d92a4984c2fdf47b3d2e4b20bfd1208cd7b941ee 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,16 @@ public: |
void waitForWorkerThreads(); |
+ /// sets the instrumentation object to use. |
+ void setInstrumentation(class Instrumentation *Instr) { |
Karl
2016/06/06 22:27:02
Conditionalize body on BuildDefs.minimal().
Also,
tlively
2016/06/07 00:43:05
Done.
|
+ Instrumentor = std::unique_ptr<class Instrumentation>(Instr); |
Karl
2016/06/06 22:27:02
Drop the "class" from the template, it shouldn't b
Roland McGrath
2016/06/06 22:28:45
The class keyword is superfluous in both these use
tlively
2016/06/07 00:43:05
Done.
tlively
2016/06/07 00:43:05
Done.
|
+ } |
+ |
+ void instrumentFunc(Cfg *Func) { |
+ if (Instrumentor) |
+ Instrumentor->instrumentFunc(Func); |
+ } |
+ |
/// Translation thread startup routine. |
void translateFunctionsWrapper(ThreadContext *MyTLS) { |
ICE_TLS_SET_FIELD(TLS, MyTLS); |
@@ -552,6 +564,10 @@ 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 = |
Roland McGrath
2016/06/06 22:28:45
Isn't that what the default constructor would do?
tlively
2016/06/07 00:43:05
Done.
|
+ std::unique_ptr<Instrumentation>(); |
// TODO(jpp): move to EmitterContext. |
VariableDeclaration *ProfileBlockInfoVarDecl = nullptr; |
std::vector<VariableDeclaration *> ProfileBlockInfos; |