OLD | NEW |
(Empty) | |
| 1 //===- subzero/src/IceInstrumentation.h - ICE instrumentation ---*- C++ -*-===// |
| 2 // |
| 3 // The Subzero Code Generator |
| 4 // |
| 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. |
| 7 // |
| 8 //===----------------------------------------------------------------------===// |
| 9 /// |
| 10 /// \file |
| 11 /// \brief Declares the Ice::Instrumentation class. |
| 12 /// |
| 13 /// Instrumentation is an abstract class used to drive the instrumentation |
| 14 /// process for tools such as AddressSanitizer and MemorySanitizer. It uses a |
| 15 /// LoweringContext to enable the insertion of new instructions into a given |
| 16 /// Cfg. Although Instrumentation is an abstract class, each of its virtual |
| 17 /// functions has a trivial default implementation to make subclasses more |
| 18 /// succinct. |
| 19 /// |
| 20 //===----------------------------------------------------------------------===// |
| 21 |
| 22 #ifndef SUBZERO_SRC_ICEINSTRUMENTATION_H |
| 23 #define SUBZERO_SRC_ICEINSTRUMENTATION_H |
| 24 |
| 25 #include "IceDefs.h" |
| 26 |
| 27 #ifdef __clang__ |
| 28 #pragma clang diagnostic push |
| 29 #pragma clang diagnostic ignored "-Wunused-parameter" |
| 30 #endif // __clang__ |
| 31 |
| 32 namespace Ice { |
| 33 |
| 34 class LoweringContext; |
| 35 |
| 36 class Instrumentation { |
| 37 Instrumentation() = delete; |
| 38 Instrumentation(const Instrumentation &) = delete; |
| 39 Instrumentation &operator=(const Instrumentation &) = delete; |
| 40 |
| 41 public: |
| 42 Instrumentation(GlobalContext *Ctx) : Ctx(Ctx) {} |
| 43 virtual void instrumentGlobals() {}; |
| 44 void instrumentFunc(Cfg *Func); |
| 45 |
| 46 private: |
| 47 void instrumentInst(LoweringContext &Context); |
| 48 virtual void instrumentFuncStart(LoweringContext &Context) {}; |
| 49 virtual void instrumentAlloca(LoweringContext &Context, |
| 50 const class InstAlloca *Instr) {}; |
| 51 virtual void instrumentArithmetic(LoweringContext &Context, |
| 52 const class InstArithmetic *Instr) {}; |
| 53 virtual void instrumentBr(LoweringContext &Context, |
| 54 const class InstBr *Instr) {}; |
| 55 virtual void instrumentCall(LoweringContext &Context, |
| 56 const class InstCall *Instr) {}; |
| 57 virtual void instrumentCast(LoweringContext &Context, |
| 58 const class InstCast *Instr) {}; |
| 59 virtual void instrumentExtractElement(LoweringContext &Context, |
| 60 const class InstExtractElement *Instr) {
}; |
| 61 virtual void instrumentFcmp(LoweringContext &Context, |
| 62 const class InstFcmp *Instr) {}; |
| 63 virtual void instrumentIcmp(LoweringContext &Context, |
| 64 const class InstIcmp *Instr) {}; |
| 65 virtual void instrumentInsertElement(LoweringContext &Context, |
| 66 const class InstInsertElement *Instr) {}; |
| 67 virtual void instrumentIntrinsicCall(LoweringContext &Context, |
| 68 const class InstIntrinsicCall *Instr) {}; |
| 69 virtual void instrumentLoad(LoweringContext &Context, |
| 70 const class InstLoad *Instr) {}; |
| 71 virtual void instrumentPhi(LoweringContext &Context, |
| 72 const class InstPhi *Instr) {}; |
| 73 virtual void instrumentRet(LoweringContext &Context, |
| 74 const class InstRet *Instr) {}; |
| 75 virtual void instrumentSelect(LoweringContext &Context, |
| 76 const class InstSelect *Instr) {}; |
| 77 virtual void instrumentStore(LoweringContext &Context, |
| 78 const class InstStore *Instr) {}; |
| 79 virtual void instrumentSwitch(LoweringContext &Context, |
| 80 const class InstSwitch *Instr) {}; |
| 81 virtual void instrumentUnreachable(LoweringContext &Context, |
| 82 const class InstUnreachable *Instr) {}; |
| 83 virtual void instrumentLocalVars(Cfg *Func) {}; |
| 84 |
| 85 protected: |
| 86 GlobalContext *Ctx; |
| 87 }; |
| 88 |
| 89 } // end of namespace Ice |
| 90 |
| 91 #ifdef __clang__ |
| 92 #pragma clang diagnostic pop |
| 93 #endif // __clang__ |
| 94 |
| 95 #endif // SUBZERO_SRC_ICEINSTRUMENTATION_H |
OLD | NEW |