|
LLVM 22.0.0git
|
#include "llvm/Transforms/Instrumentation/TypeSanitizer.h"#include "llvm/ADT/SetVector.h"#include "llvm/ADT/SmallVector.h"#include "llvm/ADT/Statistic.h"#include "llvm/ADT/StringExtras.h"#include "llvm/Analysis/MemoryLocation.h"#include "llvm/Analysis/TargetLibraryInfo.h"#include "llvm/IR/DataLayout.h"#include "llvm/IR/Function.h"#include "llvm/IR/IRBuilder.h"#include "llvm/IR/InstIterator.h"#include "llvm/IR/Instructions.h"#include "llvm/IR/IntrinsicInst.h"#include "llvm/IR/Intrinsics.h"#include "llvm/IR/LLVMContext.h"#include "llvm/IR/MDBuilder.h"#include "llvm/IR/Metadata.h"#include "llvm/IR/Module.h"#include "llvm/IR/Type.h"#include "llvm/ProfileData/InstrProf.h"#include "llvm/Support/CommandLine.h"#include "llvm/Support/MD5.h"#include "llvm/Support/Regex.h"#include "llvm/Transforms/Utils/BasicBlockUtils.h"#include "llvm/Transforms/Utils/Local.h"#include "llvm/Transforms/Utils/ModuleUtils.h"#include <cctype>Go to the source code of this file.
Macros | |
| #define | DEBUG_TYPE "tysan" |
Functions | |
| STATISTIC (NumInstrumentedAccesses, "Number of instrumented accesses") | |
| static std::string | encodeName (StringRef Name) |
| void | collectMemAccessInfo (Function &F, const TargetLibraryInfo &TLI, SmallVectorImpl< std::pair< Instruction *, MemoryLocation > > &MemoryAccesses, SmallSetVector< const MDNode *, 8 > &TBAAMetadata, SmallVectorImpl< Value * > &MemTypeResetInsts) |
| Collect all loads and stores, and for what TBAA nodes we need to generate type descriptors. | |
| static Value * | convertToShadowDataInt (IRBuilder<> &IRB, Value *Ptr, Type *IntptrTy, uint64_t PtrShift, Value *ShadowBase, Value *AppMemMask) |
Variables | |
| static const char *const | kTysanModuleCtorName = "tysan.module_ctor" |
| static const char *const | kTysanInitName = "__tysan_init" |
| static const char *const | kTysanCheckName = "__tysan_check" |
| static const char *const | kTysanGVNamePrefix = "__tysan_v1_" |
| static const char *const | kTysanShadowMemoryAddress |
| static const char *const | kTysanAppMemMask = "__tysan_app_memory_mask" |
| static cl::opt< bool > | ClWritesAlwaysSetType ("tysan-writes-always-set-type", cl::desc("Writes always set the type"), cl::Hidden, cl::init(false)) |
| static cl::opt< bool > | ClOutlineInstrumentation ("tysan-outline-instrumentation", cl::desc("Uses function calls for all TySan instrumentation, reducing " "ELF size"), cl::Hidden, cl::init(false)) |
| static cl::opt< bool > | ClVerifyOutlinedInstrumentation ("tysan-verify-outlined-instrumentation", cl::desc("Check types twice with both inlined instrumentation and " "function calls. This verifies that they behave the same."), cl::Hidden, cl::init(false)) |
| static const char | LUT [] = "0123456789abcdef" |
| #define DEBUG_TYPE "tysan" |
Definition at line 45 of file TypeSanitizer.cpp.
| void collectMemAccessInfo | ( | Function & | F, |
| const TargetLibraryInfo & | TLI, | ||
| SmallVectorImpl< std::pair< Instruction *, MemoryLocation > > & | MemoryAccesses, | ||
| SmallSetVector< const MDNode *, 8 > & | TBAAMetadata, | ||
| SmallVectorImpl< Value * > & | MemTypeResetInsts ) |
Collect all loads and stores, and for what TBAA nodes we need to generate type descriptors.
Definition at line 507 of file TypeSanitizer.cpp.
References llvm::MemoryLocation::AATags, llvm::cast(), llvm::dyn_cast(), F, llvm::MemoryLocation::get(), llvm::Type::getPointerAddressSpace(), llvm::Value::getType(), llvm::SetVector< T, Vector, Set, N >::insert(), instructions, llvm::isa(), llvm::Value::isSwiftError(), llvm::maybeMarkSanitizerLibraryCallNoBuiltin(), llvm::MemoryLocation::Ptr, llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::AAMDNodes::TBAA.
|
static |
Definition at line 608 of file TypeSanitizer.cpp.
References llvm::IRBuilderBase::CreateAdd(), llvm::IRBuilderBase::CreateAnd(), llvm::IRBuilderBase::CreatePtrToInt(), llvm::IRBuilderBase::CreateShl(), and Ptr.
|
static |
Definition at line 239 of file TypeSanitizer.cpp.
References kTysanGVNamePrefix, llvm::Length, and LUT.
| STATISTIC | ( | NumInstrumentedAccesses | , |
| "Number of instrumented accesses" | ) |
|
static |
Referenced by llvm::TypeSanitizerPass::run().
|
static |
Referenced by llvm::TypeSanitizerPass::run().
|
static |
Definition at line 54 of file TypeSanitizer.cpp.
Definition at line 49 of file TypeSanitizer.cpp.
Definition at line 50 of file TypeSanitizer.cpp.
Referenced by encodeName().
Definition at line 48 of file TypeSanitizer.cpp.
Referenced by llvm::TypeSanitizerPass::run().
Definition at line 47 of file TypeSanitizer.cpp.
Referenced by llvm::TypeSanitizerPass::run().
Definition at line 52 of file TypeSanitizer.cpp.
Definition at line 237 of file TypeSanitizer.cpp.
Referenced by encodeName(), llvm::hexdigit(), llvm::hexDigitValue(), LowerCTPOP(), LowerShift(), LowerVectorCTLZInRegLUT(), and LowerVectorCTPOPInRegLUT().