LLVM 20.0.0git
|
#include "llvm/Transforms/Instrumentation/TypeSanitizer.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallSet.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/Debug.h"
#include "llvm/Support/MD5.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/Regex.h"
#include "llvm/Support/raw_ostream.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 const char | LUT [] = "0123456789abcdef" |
#define DEBUG_TYPE "tysan" |
Definition at line 49 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 469 of file TypeSanitizer.cpp.
References llvm::MemoryLocation::AATags, F, llvm::MemoryLocation::get(), llvm::Type::getPointerAddressSpace(), llvm::Value::getType(), II, llvm::SetVector< T, Vector, Set, N >::insert(), instructions, llvm::Value::isSwiftError(), llvm::maybeMarkSanitizerLibraryCallNoBuiltin(), llvm::MemoryLocation::Ptr, llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::AAMDNodes::TBAA.
|
static |
Definition at line 572 of file TypeSanitizer.cpp.
References llvm::IRBuilderBase::CreateAdd(), llvm::IRBuilderBase::CreateAnd(), llvm::IRBuilderBase::CreatePtrToInt(), llvm::IRBuilderBase::CreateShl(), and Ptr.
|
static |
Definition at line 201 of file TypeSanitizer.cpp.
References kTysanGVNamePrefix, llvm::Length, LUT, and Name.
STATISTIC | ( | NumInstrumentedAccesses | , |
"Number of instrumented accesses" | |||
) |
|
static |
Definition at line 58 of file TypeSanitizer.cpp.
Definition at line 53 of file TypeSanitizer.cpp.
Definition at line 54 of file TypeSanitizer.cpp.
Referenced by encodeName().
Definition at line 52 of file TypeSanitizer.cpp.
Referenced by llvm::ModuleTypeSanitizerPass::run().
Definition at line 51 of file TypeSanitizer.cpp.
Referenced by llvm::ModuleTypeSanitizerPass::run().
Definition at line 56 of file TypeSanitizer.cpp.
Definition at line 199 of file TypeSanitizer.cpp.
Referenced by encodeName(), LowerCTPOP(), LowerShift(), LowerVectorCTLZInRegLUT(), and LowerVectorCTPOPInRegLUT().