OLD | NEW |
1 //===- subzero/src/IceInstrumentation.h - ICE instrumentation ---*- C++ -*-===// | 1 //===- subzero/src/IceInstrumentation.h - ICE instrumentation ---*- C++ -*-===// |
2 // | 2 // |
3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 /// | 9 /// |
10 /// \file | 10 /// \file |
(...skipping 12 matching lines...) Expand all Loading... |
23 /// subclass is still responsible for driving the instrumentation, but it can | 23 /// subclass is still responsible for driving the instrumentation, but it can |
24 /// use other Instrumentation subclasses however it needs to. | 24 /// use other Instrumentation subclasses however it needs to. |
25 /// | 25 /// |
26 //===----------------------------------------------------------------------===// | 26 //===----------------------------------------------------------------------===// |
27 | 27 |
28 #ifndef SUBZERO_SRC_ICEINSTRUMENTATION_H | 28 #ifndef SUBZERO_SRC_ICEINSTRUMENTATION_H |
29 #define SUBZERO_SRC_ICEINSTRUMENTATION_H | 29 #define SUBZERO_SRC_ICEINSTRUMENTATION_H |
30 | 30 |
31 #include "IceDefs.h" | 31 #include "IceDefs.h" |
32 | 32 |
| 33 #include <condition_variable> |
| 34 |
33 namespace Ice { | 35 namespace Ice { |
34 | 36 |
35 class LoweringContext; | 37 class LoweringContext; |
36 | 38 |
37 class Instrumentation { | 39 class Instrumentation { |
38 Instrumentation() = delete; | 40 Instrumentation() = delete; |
39 Instrumentation(const Instrumentation &) = delete; | 41 Instrumentation(const Instrumentation &) = delete; |
40 Instrumentation &operator=(const Instrumentation &) = delete; | 42 Instrumentation &operator=(const Instrumentation &) = delete; |
41 | 43 |
42 public: | 44 public: |
43 Instrumentation(GlobalContext *Ctx) : Ctx(Ctx) {} | 45 Instrumentation(GlobalContext *Ctx) : Ctx(Ctx) {} |
| 46 virtual ~Instrumentation() = default; |
44 virtual void instrumentGlobals(VariableDeclarationList &) {} | 47 virtual void instrumentGlobals(VariableDeclarationList &) {} |
45 void instrumentFunc(Cfg *Func); | 48 void instrumentFunc(Cfg *Func); |
| 49 void setHasSeenGlobals(); |
46 | 50 |
47 protected: | 51 protected: |
48 virtual void instrumentInst(LoweringContext &Context); | 52 virtual void instrumentInst(LoweringContext &Context); |
| 53 LockedPtr<VariableDeclarationList> getGlobals(); |
49 | 54 |
50 private: | 55 private: |
51 virtual bool isInstrumentable(Cfg *) { return true; } | 56 virtual bool isInstrumentable(Cfg *) { return true; } |
52 virtual void instrumentFuncStart(LoweringContext &) {} | 57 virtual void instrumentFuncStart(LoweringContext &) {} |
53 virtual void instrumentAlloca(LoweringContext &, class InstAlloca *) {} | 58 virtual void instrumentAlloca(LoweringContext &, class InstAlloca *) {} |
54 virtual void instrumentArithmetic(LoweringContext &, class InstArithmetic *) { | 59 virtual void instrumentArithmetic(LoweringContext &, class InstArithmetic *) { |
55 } | 60 } |
56 virtual void instrumentBr(LoweringContext &, class InstBr *) {} | 61 virtual void instrumentBr(LoweringContext &, class InstBr *) {} |
57 virtual void instrumentCall(LoweringContext &, class InstCall *) {} | 62 virtual void instrumentCall(LoweringContext &, class InstCall *) {} |
58 virtual void instrumentCast(LoweringContext &, class InstCast *) {} | 63 virtual void instrumentCast(LoweringContext &, class InstCast *) {} |
(...skipping 12 matching lines...) Expand all Loading... |
71 virtual void instrumentStore(LoweringContext &, class InstStore *) {} | 76 virtual void instrumentStore(LoweringContext &, class InstStore *) {} |
72 virtual void instrumentSwitch(LoweringContext &, class InstSwitch *) {} | 77 virtual void instrumentSwitch(LoweringContext &, class InstSwitch *) {} |
73 virtual void instrumentUnreachable(LoweringContext &, | 78 virtual void instrumentUnreachable(LoweringContext &, |
74 class InstUnreachable *) {} | 79 class InstUnreachable *) {} |
75 virtual void instrumentStart(Cfg *) {} | 80 virtual void instrumentStart(Cfg *) {} |
76 virtual void instrumentLocalVars(Cfg *) {} | 81 virtual void instrumentLocalVars(Cfg *) {} |
77 virtual void finishFunc(Cfg *) {} | 82 virtual void finishFunc(Cfg *) {} |
78 | 83 |
79 protected: | 84 protected: |
80 GlobalContext *Ctx; | 85 GlobalContext *Ctx; |
| 86 |
| 87 private: |
| 88 bool HasSeenGlobals = false; |
| 89 std::mutex GlobalsSeenMutex; |
| 90 std::condition_variable GlobalsSeenCV; |
81 }; | 91 }; |
82 | 92 |
83 } // end of namespace Ice | 93 } // end of namespace Ice |
84 | 94 |
85 #endif // SUBZERO_SRC_ICEINSTRUMENTATION_H | 95 #endif // SUBZERO_SRC_ICEINSTRUMENTATION_H |
OLD | NEW |