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

Unified Diff: src/IceInstrumentation.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: 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
Index: src/IceInstrumentation.h
diff --git a/src/IceInstrumentation.h b/src/IceInstrumentation.h
new file mode 100644
index 0000000000000000000000000000000000000000..57aa5edb3ad4238527adf5926471169434043121
--- /dev/null
+++ b/src/IceInstrumentation.h
@@ -0,0 +1,90 @@
+//===- 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 is has a trivial default implementation to make subclasses more
Roland McGrath 2016/06/06 22:28:45 s/is has/has/
tlively 2016/06/07 00:43:06 Done.
+/// succinct.
+///
+//===----------------------------------------------------------------------===//
+
+#pragma clang diagnostic ignored "-Wunused-parameter"
Karl 2016/06/06 22:27:03 Don't change command line flags within a file, esp
Roland McGrath 2016/06/06 22:28:45 Why is this outside the include guard? And do you
tlively 2016/06/07 00:43:06 This fix makes the code much larger and uglier. Wh
Karl 2016/06/07 14:42:40 Please do NOT add code that changes command line a
+
+
+#ifndef SUBZERO_SRC_ICEASANLOWERING_H
Karl 2016/06/06 22:27:03 The coding convention is that the define name shou
tlively 2016/06/07 00:43:06 Done.
+#define SUBZERO_SRC_ICEASANLOWERING_H
+
+#include "IceDefs.h"
+
+namespace Ice {
+
+class LoweringContext;
+
+class Instrumentation {
+ Instrumentation() = delete;
+ Instrumentation(const Instrumentation &) = delete;
+ Instrumentation &operator=(const Instrumentation &) = delete;
+
+protected:
Karl 2016/06/06 22:27:03 Generally, we don't like introducing fields before
tlively 2016/06/07 00:43:06 Done.
+ GlobalContext *Ctx;
+
+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) {};
+};
+
+} // end of namespace Ice
+
+#endif // SUBZERO_SRC_ICEASANLOWERING_H

Powered by Google App Engine
This is Rietveld 408576698