Chromium Code Reviews| 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 |
| 11 /// \brief Declares the AddressSanitizer instrumentation class. | 11 /// \brief Declares the AddressSanitizer instrumentation class. |
| 12 /// | 12 /// |
| 13 /// This class is responsible for inserting redzones around global and stack | 13 /// This class is responsible for inserting redzones around global and stack |
| 14 /// variables, inserting code responsible for poisoning those redzones, and | 14 /// variables, inserting code responsible for poisoning those redzones, and |
| 15 /// performing any other instrumentation necessary to implement | 15 /// performing any other instrumentation necessary to implement |
| 16 /// AddressSanitizer. | 16 /// AddressSanitizer. |
| 17 /// | 17 /// |
| 18 //===----------------------------------------------------------------------===// | 18 //===----------------------------------------------------------------------===// |
| 19 | 19 |
| 20 #ifndef SUBZERO_SRC_ICEASANINSTRUMENTATION_H | 20 #ifndef SUBZERO_SRC_ICEASANINSTRUMENTATION_H |
| 21 #define SUBZERO_SRC_ICEASANINSTRUMENTATION_H | 21 #define SUBZERO_SRC_ICEASANINSTRUMENTATION_H |
| 22 | 22 |
| 23 #include "IceGlobalInits.h" | 23 #include "IceGlobalInits.h" |
| 24 #include "IceInst.h" | |
|
Jim Stichnoth
2016/06/25 17:14:13
I'm not 100% sure about this, but it looks like yo
tlively
2016/06/27 17:03:57
Done.
| |
| 24 #include "IceInstrumentation.h" | 25 #include "IceInstrumentation.h" |
| 25 | 26 |
| 26 namespace Ice { | 27 namespace Ice { |
| 27 | 28 |
| 28 class ASanInstrumentation : public Instrumentation { | 29 class ASanInstrumentation : public Instrumentation { |
| 29 ASanInstrumentation() = delete; | 30 ASanInstrumentation() = delete; |
| 30 ASanInstrumentation(const ASanInstrumentation &) = delete; | 31 ASanInstrumentation(const ASanInstrumentation &) = delete; |
| 31 ASanInstrumentation &operator=(const ASanInstrumentation &) = delete; | 32 ASanInstrumentation &operator=(const ASanInstrumentation &) = delete; |
| 32 | 33 |
| 33 public: | 34 public: |
| 34 ASanInstrumentation(GlobalContext *Ctx) : Instrumentation(Ctx), RzNum(0) {} | 35 ASanInstrumentation(GlobalContext *Ctx) : Instrumentation(Ctx), RzNum(0) { |
| 36 ICE_TLS_INIT_FIELD(LocalDtors); | |
| 37 } | |
| 35 void instrumentGlobals(VariableDeclarationList &Globals) override; | 38 void instrumentGlobals(VariableDeclarationList &Globals) override; |
| 36 | 39 |
| 37 private: | 40 private: |
| 38 std::string nextRzName(); | 41 std::string nextRzName(); |
| 39 VariableDeclaration *createRz(VariableDeclarationList *List, | 42 VariableDeclaration *createRz(VariableDeclarationList *List, |
| 40 VariableDeclaration *RzArray, | 43 VariableDeclaration *RzArray, |
| 41 SizeT &RzArraySize, | 44 SizeT &RzArraySize, |
| 42 VariableDeclaration *Global); | 45 VariableDeclaration *Global); |
| 43 InstAlloca *createLocalRz(LoweringContext &Context, SizeT Size, | |
| 44 SizeT Alignment); | |
| 45 void instrumentFuncStart(LoweringContext &Context) override; | 46 void instrumentFuncStart(LoweringContext &Context) override; |
| 46 void instrumentAlloca(LoweringContext &Context, InstAlloca *Instr) override; | |
| 47 void instrumentCall(LoweringContext &Context, InstCall *Instr) override; | 47 void instrumentCall(LoweringContext &Context, InstCall *Instr) override; |
| 48 void instrumentRet(LoweringContext &Context, InstRet *Instr) override; | |
|
Jim Stichnoth
2016/06/25 17:14:13
You could either forward-declare InstRet somewhere
tlively
2016/06/27 17:03:57
This turned out to be unnecessary, probably becaus
| |
| 48 void instrumentLoad(LoweringContext &Context, InstLoad *Instr) override; | 49 void instrumentLoad(LoweringContext &Context, InstLoad *Instr) override; |
| 49 void instrumentStore(LoweringContext &Context, InstStore *Instr) override; | 50 void instrumentStore(LoweringContext &Context, InstStore *Instr) override; |
| 50 void instrumentAccess(LoweringContext &Context, Operand *Op, SizeT Size); | 51 void instrumentAccess(LoweringContext &Context, Operand *Op, SizeT Size); |
| 51 void instrumentStart(Cfg *Func) override; | 52 void instrumentStart(Cfg *Func) override; |
| 53 void finishFunc(Cfg *Func) override; | |
| 54 ICE_TLS_DECLARE_FIELD(std::vector<InstCall *> *, LocalDtors); | |
| 52 bool DidInsertRedZones = false; | 55 bool DidInsertRedZones = false; |
| 53 std::atomic<uint32_t> RzNum; | 56 std::atomic<uint32_t> RzNum; |
| 54 }; | 57 }; |
| 55 } // end of namespace Ice | 58 } // end of namespace Ice |
| 56 | 59 |
| 57 #endif // SUBZERO_SRC_ICEASANINSTRUMENTATION_H | 60 #endif // SUBZERO_SRC_ICEASANINSTRUMENTATION_H |
| OLD | NEW |