Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 //===- subzero/src/IceASanInstrumentation.cpp - ASan ------------*- C++ -*-===// | 1 //===- subzero/src/IceASanInstrumentation.cpp - ASan ------------*- 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 Implements the AddressSanitizer instrumentation class. | 11 /// \brief Implements the AddressSanitizer instrumentation class. |
| 12 /// | 12 /// |
| 13 //===----------------------------------------------------------------------===// | 13 //===----------------------------------------------------------------------===// |
| 14 | 14 |
| 15 #include "IceASanInstrumentation.h" | 15 #include "IceASanInstrumentation.h" |
| 16 | 16 |
| 17 #include "IceBuildDefs.h" | 17 #include "IceBuildDefs.h" |
| 18 #include "IceCfgNode.h" | |
| 18 #include "IceGlobalInits.h" | 19 #include "IceGlobalInits.h" |
| 20 #include "IceInst.h" | |
| 19 | 21 |
| 20 #include <sstream> | 22 #include <sstream> |
| 21 | 23 |
| 22 namespace Ice { | 24 namespace Ice { |
| 23 | 25 |
| 24 namespace { | 26 namespace { |
| 25 constexpr SizeT RzSize = 32; | 27 constexpr SizeT RzSize = 32; |
| 26 const std::string RzPrefix = "__$rz"; | 28 const std::string RzPrefix = "__$rz"; |
| 27 const llvm::NaClBitcodeRecord::RecordVector RzContents = | 29 const llvm::NaClBitcodeRecord::RecordVector RzContents = |
| 28 llvm::NaClBitcodeRecord::RecordVector(RzSize, 'R'); | 30 llvm::NaClBitcodeRecord::RecordVector(RzSize, 'R'); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 102 Rz->addInitializer( | 104 Rz->addInitializer( |
| 103 VariableDeclaration::ZeroInitializer::create(List, RzSize)); | 105 VariableDeclaration::ZeroInitializer::create(List, RzSize)); |
| 104 } | 106 } |
| 105 Rz->setIsConstant(Global->getIsConstant()); | 107 Rz->setIsConstant(Global->getIsConstant()); |
| 106 RzArray->addInitializer(VariableDeclaration::RelocInitializer::create( | 108 RzArray->addInitializer(VariableDeclaration::RelocInitializer::create( |
| 107 List, Rz, RelocOffsetArray(0))); | 109 List, Rz, RelocOffsetArray(0))); |
| 108 ++RzArraySize; | 110 ++RzArraySize; |
| 109 return Rz; | 111 return Rz; |
| 110 } | 112 } |
| 111 | 113 |
| 114 void ASanInstrumentation::instrumentStart(Cfg *Func) { | |
| 115 Constant *ShadowMemInit = | |
| 116 Ctx->getConstantExternSym(Ctx->getGlobalString("__asan_init")); | |
| 117 constexpr SizeT NumArgs = 0; | |
| 118 constexpr Variable *Void = nullptr; | |
| 119 constexpr bool HasTailCall = false; | |
|
Jim Stichnoth
2016/06/15 00:19:35
Newer code in Subzero uses a documentation idiom f
tlively
2016/06/15 16:32:00
Done.
| |
| 120 | |
| 121 auto *Call = | |
| 122 InstCall::create(Func, NumArgs, Void, ShadowMemInit, HasTailCall); | |
| 123 Func->getEntryNode()->getInsts().push_front(Call); | |
| 124 } | |
| 125 | |
| 112 } // end of namespace Ice | 126 } // end of namespace Ice |
| OLD | NEW |