Index: src/IceInstrumentation.h |
diff --git a/src/IceInstrumentation.h b/src/IceInstrumentation.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4d1df30dda28dffe1031d00a999b7096720ba7f6 |
--- /dev/null |
+++ b/src/IceInstrumentation.h |
@@ -0,0 +1,95 @@ |
+//===- subzero/src/IceInstrumentation.h - ICE instrumentation ---*- C++ -*-===// |
+// |
+// The Subzero Code Generator |
+// |
+// This file is distributed under the University of Illinois Open Source |
+// License. See LICENSE.TXT for details. |
+// |
+//===----------------------------------------------------------------------===// |
+/// |
+/// \file |
+/// \brief Declares the Ice::Instrumentation class. |
+/// |
+/// Instrumentation is an abstract class used to drive the instrumentation |
+/// process for tools such as AddressSanitizer and MemorySanitizer. It uses a |
+/// LoweringContext to enable the insertion of new instructions into a given |
+/// Cfg. Although Instrumentation is an abstract class, each of its virtual |
+/// functions has a trivial default implementation to make subclasses more |
+/// succinct. |
+/// |
+//===----------------------------------------------------------------------===// |
+ |
+#ifndef SUBZERO_SRC_ICEINSTRUMENTATION_H |
+#define SUBZERO_SRC_ICEINSTRUMENTATION_H |
+ |
+#include "IceDefs.h" |
+ |
+#ifdef __clang__ |
+#pragma clang diagnostic push |
+#pragma clang diagnostic ignored "-Wunused-parameter" |
+#endif // __clang__ |
+ |
+namespace Ice { |
+ |
+class LoweringContext; |
+ |
+class Instrumentation { |
+ Instrumentation() = delete; |
+ Instrumentation(const Instrumentation &) = delete; |
+ Instrumentation &operator=(const Instrumentation &) = delete; |
+ |
+public: |
+ Instrumentation(GlobalContext *Ctx) : Ctx(Ctx) {} |
+ virtual void instrumentGlobals() {}; |
+ void instrumentFunc(Cfg *Func); |
+ |
+private: |
+ void instrumentInst(LoweringContext &Context); |
+ virtual void instrumentFuncStart(LoweringContext &Context) {}; |
+ virtual void instrumentAlloca(LoweringContext &Context, |
+ const class InstAlloca *Instr) {}; |
+ virtual void instrumentArithmetic(LoweringContext &Context, |
+ const class InstArithmetic *Instr) {}; |
+ virtual void instrumentBr(LoweringContext &Context, |
+ const class InstBr *Instr) {}; |
+ virtual void instrumentCall(LoweringContext &Context, |
+ const class InstCall *Instr) {}; |
+ virtual void instrumentCast(LoweringContext &Context, |
+ const class InstCast *Instr) {}; |
+ virtual void instrumentExtractElement(LoweringContext &Context, |
+ const class InstExtractElement *Instr) {}; |
+ virtual void instrumentFcmp(LoweringContext &Context, |
+ const class InstFcmp *Instr) {}; |
+ virtual void instrumentIcmp(LoweringContext &Context, |
+ const class InstIcmp *Instr) {}; |
+ virtual void instrumentInsertElement(LoweringContext &Context, |
+ const class InstInsertElement *Instr) {}; |
+ virtual void instrumentIntrinsicCall(LoweringContext &Context, |
+ const class InstIntrinsicCall *Instr) {}; |
+ virtual void instrumentLoad(LoweringContext &Context, |
+ const class InstLoad *Instr) {}; |
+ virtual void instrumentPhi(LoweringContext &Context, |
+ const class InstPhi *Instr) {}; |
+ virtual void instrumentRet(LoweringContext &Context, |
+ const class InstRet *Instr) {}; |
+ virtual void instrumentSelect(LoweringContext &Context, |
+ const class InstSelect *Instr) {}; |
+ virtual void instrumentStore(LoweringContext &Context, |
+ const class InstStore *Instr) {}; |
+ virtual void instrumentSwitch(LoweringContext &Context, |
+ const class InstSwitch *Instr) {}; |
+ virtual void instrumentUnreachable(LoweringContext &Context, |
+ const class InstUnreachable *Instr) {}; |
+ virtual void instrumentLocalVars(Cfg *Func) {}; |
+ |
+protected: |
+ GlobalContext *Ctx; |
+}; |
+ |
+} // end of namespace Ice |
+ |
+#ifdef __clang__ |
+#pragma clang diagnostic pop |
+#endif // __clang__ |
+ |
+#endif // SUBZERO_SRC_ICEINSTRUMENTATION_H |