LLVM 20.0.0git
Macros | Functions | Variables
TypeSanitizer.cpp File Reference
#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 ValueconvertToShadowDataInt (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< boolClWritesAlwaysSetType ("tysan-writes-always-set-type", cl::desc("Writes always set the type"), cl::Hidden, cl::init(false))
 
static const char LUT [] = "0123456789abcdef"
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "tysan"

Definition at line 49 of file TypeSanitizer.cpp.

Function Documentation

◆ collectMemAccessInfo()

void collectMemAccessInfo ( Function F,
const TargetLibraryInfo TLI,
SmallVectorImpl< std::pair< Instruction *, MemoryLocation > > &  MemoryAccesses,
SmallSetVector< const MDNode *, 8 > &  TBAAMetadata,
SmallVectorImpl< Value * > &  MemTypeResetInsts 
)

◆ convertToShadowDataInt()

static Value * convertToShadowDataInt ( IRBuilder<> &  IRB,
Value Ptr,
Type IntptrTy,
uint64_t  PtrShift,
Value ShadowBase,
Value AppMemMask 
)
static

◆ encodeName()

static std::string encodeName ( StringRef  Name)
static

Definition at line 201 of file TypeSanitizer.cpp.

References kTysanGVNamePrefix, llvm::Length, LUT, and Name.

◆ STATISTIC()

STATISTIC ( NumInstrumentedAccesses  ,
"Number of instrumented accesses"   
)

Variable Documentation

◆ ClWritesAlwaysSetType

cl::opt< bool > ClWritesAlwaysSetType("tysan-writes-always-set-type", cl::desc("Writes always set the type"), cl::Hidden, cl::init(false)) ( "tysan-writes-always-set-type"  ,
cl::desc("Writes always set the type")  ,
cl::Hidden  ,
cl::init(false)   
)
static

◆ kTysanAppMemMask

const char* const kTysanAppMemMask = "__tysan_app_memory_mask"
static

Definition at line 58 of file TypeSanitizer.cpp.

◆ kTysanCheckName

const char* const kTysanCheckName = "__tysan_check"
static

Definition at line 53 of file TypeSanitizer.cpp.

◆ kTysanGVNamePrefix

const char* const kTysanGVNamePrefix = "__tysan_v1_"
static

Definition at line 54 of file TypeSanitizer.cpp.

Referenced by encodeName().

◆ kTysanInitName

const char* const kTysanInitName = "__tysan_init"
static

Definition at line 52 of file TypeSanitizer.cpp.

Referenced by llvm::ModuleTypeSanitizerPass::run().

◆ kTysanModuleCtorName

const char* const kTysanModuleCtorName = "tysan.module_ctor"
static

Definition at line 51 of file TypeSanitizer.cpp.

Referenced by llvm::ModuleTypeSanitizerPass::run().

◆ kTysanShadowMemoryAddress

const char* const kTysanShadowMemoryAddress
static
Initial value:
=
"__tysan_shadow_memory_address"

Definition at line 56 of file TypeSanitizer.cpp.

◆ LUT

const char LUT[] = "0123456789abcdef"
static