1 //===- subzero/src/IceASanInstrumentation.h - AddressSanitizer --*- C++ -*-===//
3 // The Subzero Code Generator
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 /// \brief Declares the AddressSanitizer instrumentation class.
13 /// This class is responsible for inserting redzones around global and stack
14 /// variables, inserting code responsible for poisoning those redzones, and
15 /// performing any other instrumentation necessary to implement
18 //===----------------------------------------------------------------------===//
20 #ifndef SUBZERO_SRC_ICEASANINSTRUMENTATION_H
21 #define SUBZERO_SRC_ICEASANINSTRUMENTATION_H
23 #include "IceGlobalInits.h"
24 #include "IceInstrumentation.h"
28 class ASanInstrumentation : public Instrumentation {
29 ASanInstrumentation() = delete;
30 ASanInstrumentation(const ASanInstrumentation &) = delete;
31 ASanInstrumentation &operator=(const ASanInstrumentation &) = delete;
34 ASanInstrumentation(GlobalContext *Ctx) : Instrumentation(Ctx) {}
35 void instrumentGlobals(VariableDeclarationList &Globals) override;
38 std::string nextRzName();
39 VariableDeclaration *createRz(VariableDeclarationList *List,
40 VariableDeclaration *RzArray,
42 VariableDeclaration *Global);
43 void instrumentCall(LoweringContext &Context, InstCall *Instr) override;
44 void instrumentLoad(LoweringContext &Context, InstLoad *Instr) override;
45 void instrumentStore(LoweringContext &Context, InstStore *Instr) override;
46 void instrumentAccess(LoweringContext &Context, Operand *Op, SizeT Size);
47 void instrumentStart(Cfg *Func) override;
48 bool DidInsertRedZones = false;
51 } // end of namespace Ice
53 #endif // SUBZERO_SRC_ICEASANINSTRUMENTATION_H