OLD | NEW |
1 //===- subzero/src/IceASanInstrumentation.h - AddressSanitizer --*- C++ -*-===// | 1 //===- subzero/src/IceASanInstrumentation.h - AddressSanitizer --*- 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 19 matching lines...) Expand all Loading... |
30 | 30 |
31 class ASanInstrumentation : public Instrumentation { | 31 class ASanInstrumentation : public Instrumentation { |
32 ASanInstrumentation() = delete; | 32 ASanInstrumentation() = delete; |
33 ASanInstrumentation(const ASanInstrumentation &) = delete; | 33 ASanInstrumentation(const ASanInstrumentation &) = delete; |
34 ASanInstrumentation &operator=(const ASanInstrumentation &) = delete; | 34 ASanInstrumentation &operator=(const ASanInstrumentation &) = delete; |
35 | 35 |
36 public: | 36 public: |
37 ASanInstrumentation(GlobalContext *Ctx) : Instrumentation(Ctx), RzNum(0) { | 37 ASanInstrumentation(GlobalContext *Ctx) : Instrumentation(Ctx), RzNum(0) { |
38 ICE_TLS_INIT_FIELD(LocalVars); | 38 ICE_TLS_INIT_FIELD(LocalVars); |
39 ICE_TLS_INIT_FIELD(LocalDtors); | 39 ICE_TLS_INIT_FIELD(LocalDtors); |
| 40 ICE_TLS_INIT_FIELD(CurNode); |
| 41 ICE_TLS_INIT_FIELD(CheckedVars); |
40 } | 42 } |
41 void instrumentGlobals(VariableDeclarationList &Globals) override; | 43 void instrumentGlobals(VariableDeclarationList &Globals) override; |
42 | 44 |
43 private: | 45 private: |
44 std::string nextRzName(); | 46 std::string nextRzName(); |
45 bool isOkGlobalAccess(Operand *Op, SizeT Size); | 47 bool isOkGlobalAccess(Operand *Op, SizeT Size); |
46 bool isInstrumentable(Cfg *Func) override; | 48 bool isInstrumentable(Cfg *Func) override; |
47 void instrumentFuncStart(LoweringContext &Context) override; | 49 void instrumentFuncStart(LoweringContext &Context) override; |
48 void instrumentCall(LoweringContext &Context, InstCall *Instr) override; | 50 void instrumentCall(LoweringContext &Context, InstCall *Instr) override; |
49 void instrumentRet(LoweringContext &Context, InstRet *Instr) override; | 51 void instrumentRet(LoweringContext &Context, InstRet *Instr) override; |
50 void instrumentLoad(LoweringContext &Context, InstLoad *Instr) override; | 52 void instrumentLoad(LoweringContext &Context, InstLoad *Instr) override; |
51 void instrumentStore(LoweringContext &Context, InstStore *Instr) override; | 53 void instrumentStore(LoweringContext &Context, InstStore *Instr) override; |
52 void instrumentAccess(LoweringContext &Context, Operand *Op, SizeT Size, | 54 void instrumentAccess(LoweringContext &Context, Operand *Op, SizeT Size, |
53 Constant *AccessFunc); | 55 Constant *AccessFunc); |
54 void instrumentStart(Cfg *Func) override; | 56 void instrumentStart(Cfg *Func) override; |
55 void finishFunc(Cfg *Func) override; | 57 void finishFunc(Cfg *Func) override; |
56 ICE_TLS_DECLARE_FIELD(VarSizeMap *, LocalVars); | 58 ICE_TLS_DECLARE_FIELD(VarSizeMap *, LocalVars); |
57 ICE_TLS_DECLARE_FIELD(std::vector<InstStore *> *, LocalDtors); | 59 ICE_TLS_DECLARE_FIELD(std::vector<InstStore *> *, LocalDtors); |
| 60 ICE_TLS_DECLARE_FIELD(CfgNode *, CurNode); |
| 61 ICE_TLS_DECLARE_FIELD(VarSizeMap *, CheckedVars); |
58 GlobalSizeMap GlobalSizes; | 62 GlobalSizeMap GlobalSizes; |
59 std::atomic<uint32_t> RzNum; | 63 std::atomic<uint32_t> RzNum; |
60 bool DidProcessGlobals = false; | 64 bool DidProcessGlobals = false; |
61 SizeT RzGlobalsNum = 0; | 65 SizeT RzGlobalsNum = 0; |
62 std::mutex GlobalsMutex; | 66 std::mutex GlobalsMutex; |
63 }; | 67 }; |
64 } // end of namespace Ice | 68 } // end of namespace Ice |
65 | 69 |
66 #endif // SUBZERO_SRC_ICEASANINSTRUMENTATION_H | 70 #endif // SUBZERO_SRC_ICEASANINSTRUMENTATION_H |
OLD | NEW |