44 #define DEBUG_TYPE "sancov" 47 "__sanitizer_cov_trace_pc_indir";
54 "__sanitizer_cov_trace_const_cmp1";
56 "__sanitizer_cov_trace_const_cmp2";
58 "__sanitizer_cov_trace_const_cmp4";
60 "__sanitizer_cov_trace_const_cmp8";
69 "__sanitizer_cov_trace_pc_guard";
71 "__sanitizer_cov_trace_pc_guard_init";
73 "__sanitizer_cov_8bit_counters_init";
83 "sanitizer-coverage-level",
84 cl::desc(
"Sanitizer Coverage. 0: none, 1: entry block, 2: all blocks, " 85 "3: all blocks and critical edges"),
102 cl::desc(
"create a static PC table"),
107 cl::desc(
"increments 8-bit counter for every edge"),
112 cl::desc(
"Tracing of CMP and similar instructions"),
116 cl::desc(
"Tracing of DIV instructions"),
120 cl::desc(
"Tracing of GEP instructions"),
125 cl::desc(
"Reduce the number of instrumented blocks"),
129 cl::desc(
"max stack depth tracing"),
136 switch (LegacyCoverageLevel) {
177 class SanitizerCoverageModule :
public ModulePass {
179 SanitizerCoverageModule(
184 bool runOnModule(
Module &M)
override;
187 StringRef getPassName()
const override {
return "SanitizerCoverageModule"; }
195 void InjectCoverageForIndirectCalls(
Function &
F,
205 bool IsLeafFunc =
true);
206 GlobalVariable *CreateFunctionLocalArrayInSection(
size_t NumElements,
212 bool IsLeafFunc =
true);
213 Function *CreateInitCallsForSections(
Module &M,
const char *InitFunctionName,
215 std::pair<Value *, Value *> CreateSecStartEnd(
Module &M,
const char *
Section,
223 std::string getSectionName(
const std::string &
Section)
const;
224 std::string getSectionStart(
const std::string &
Section)
const;
225 std::string getSectionEnd(
const std::string &
Section)
const;
227 Function *SanCovTracePC, *SanCovTracePCGuard;
228 Function *SanCovTraceCmpFunction[4];
229 Function *SanCovTraceConstCmpFunction[4];
230 Function *SanCovTraceDivFunction[2];
232 Function *SanCovTraceSwitchFunction;
235 Type *IntptrTy, *IntptrPtrTy, *Int64Ty, *Int64PtrTy, *
Int32Ty, *Int32PtrTy,
236 *Int16Ty, *Int8Ty, *Int8PtrTy;
238 std::string CurModuleUniqueId;
254 std::pair<Value *, Value *>
255 SanitizerCoverageModule::CreateSecStartEnd(
Module &M,
const char *
Section,
259 getSectionStart(Section));
263 nullptr, getSectionEnd(Section));
266 Value *SecEndPtr = IRB.CreatePointerCast(SecEnd, Ty);
267 if (!TargetTriple.isOSBinFormatCOFF())
268 return std::make_pair(IRB.CreatePointerCast(SecStart, Ty), SecEndPtr);
272 auto SecStartI8Ptr = IRB.CreatePointerCast(SecStart, Int8PtrTy);
273 auto GEP = IRB.CreateGEP(SecStartI8Ptr,
275 return std::make_pair(IRB.CreatePointerCast(
GEP, Ty), SecEndPtr);
278 Function *SanitizerCoverageModule::CreateInitCallsForSections(
279 Module &M,
const char *InitFunctionName,
Type *Ty,
280 const char *Section) {
281 auto SecStartEnd = CreateSecStartEnd(M, Section, Ty);
282 auto SecStart = SecStartEnd.first;
283 auto SecEnd = SecStartEnd.second;
286 M, SanCovModuleCtorName, InitFunctionName, {Ty, Ty}, {SecStart, SecEnd});
288 if (TargetTriple.supportsCOMDAT()) {
296 if (TargetTriple.isOSBinFormatCOFF()) {
309 bool SanitizerCoverageModule::runOnModule(
Module &M) {
317 FunctionGuardArray =
nullptr;
318 Function8bitCounterArray =
nullptr;
319 FunctionPCsArray =
nullptr;
334 SanCovTraceCmpFunction[0] =
343 SanCovTraceCmpFunction[3] =
345 SanCovTraceCmp8, VoidTy, Int64Ty, Int64Ty));
347 SanCovTraceConstCmpFunction[0] =
349 SanCovTraceConstCmp1, VoidTy, Int8Ty, Int8Ty));
350 SanCovTraceConstCmpFunction[1] =
352 SanCovTraceConstCmp2, VoidTy, Int16Ty, Int16Ty));
353 SanCovTraceConstCmpFunction[2] =
356 SanCovTraceConstCmpFunction[3] =
358 SanCovTraceConstCmp8, VoidTy, Int64Ty, Int64Ty));
360 SanCovTraceDivFunction[0] =
363 SanCovTraceDivFunction[1] =
365 SanCovTraceDiv8, VoidTy, Int64Ty));
366 SanCovTraceGepFunction =
368 SanCovTraceGep, VoidTy, IntptrTy));
369 SanCovTraceSwitchFunction =
371 SanCovTraceSwitchName, VoidTy, Int64Ty, Int64PtrTy));
373 Constant *SanCovLowestStackConstant =
375 SanCovLowestStack = cast<GlobalVariable>(SanCovLowestStackConstant);
376 SanCovLowestStack->setThreadLocalMode(
377 GlobalValue::ThreadLocalMode::InitialExecTLSModel);
378 if (Options.
StackDepth && !SanCovLowestStack->isDeclaration())
384 for (
int i = 0; i < 3; i++) {
402 SanCovTracePCGuardName, VoidTy, Int32PtrTy));
409 if (FunctionGuardArray)
410 Ctor = CreateInitCallsForSections(M, SanCovTracePCGuardInitName, Int32PtrTy,
411 SanCovGuardsSectionName);
412 if (Function8bitCounterArray)
413 Ctor = CreateInitCallsForSections(M, SanCov8bitCountersInitName, Int8PtrTy,
414 SanCovCountersSectionName);
416 auto SecStartEnd = CreateSecStartEnd(M, SanCovPCsSectionName, IntptrPtrTy);
418 M, SanCovPCsInitName, {IntptrPtrTy, IntptrPtrTy});
420 IRBCtor.
CreateCall(InitFunction, {SecStartEnd.first, SecStartEnd.second});
424 if (TargetTriple.isOSBinFormatMachO())
490 if (F.
getName().
find(
".module_ctor") != std::string::npos)
499 if (F.
getName() ==
"__local_stdio_printf_options" ||
500 F.
getName() ==
"__local_stdio_scanf_options")
520 &getAnalysis<DominatorTreeWrapperPass>(
F).getDomTree();
522 &getAnalysis<PostDominatorTreeWrapperPass>(
F).getPostDomTree();
523 bool IsLeafFunc =
true;
528 for (
auto &Inst : BB) {
535 if (isa<ICmpInst>(&Inst))
537 if (isa<SwitchInst>(&Inst))
542 if (BO->getOpcode() == Instruction::SDiv ||
543 BO->getOpcode() == Instruction::UDiv)
549 if (isa<InvokeInst>(Inst) ||
550 (isa<CallInst>(Inst) && !isa<IntrinsicInst>(Inst)))
555 InjectCoverage(F, BlocksToInstrument, IsLeafFunc);
556 InjectCoverageForIndirectCalls(F, IndirCalls);
557 InjectTraceForCmp(F, CmpTraceTargets);
558 InjectTraceForSwitch(F, SwitchTraceTargets);
559 InjectTraceForDiv(F, DivTraceTargets);
560 InjectTraceForGep(F, GepTraceTargets);
564 GlobalVariable *SanitizerCoverageModule::CreateFunctionLocalArrayInSection(
565 size_t NumElements,
Function &F,
Type *Ty,
const char *Section) {
575 Array->setSection(getSectionName(Section));
576 Array->setAlignment(Ty->
isPointerTy() ? DL->getPointerSize()
578 GlobalsToAppendToUsed.push_back(Array);
579 GlobalsToAppendToCompilerUsed.push_back(Array);
587 SanitizerCoverageModule::CreatePCArray(
Function &F,
589 size_t N = AllBlocks.
size();
593 for (
size_t i = 0; i <
N; i++) {
605 auto *PCArray = CreateFunctionLocalArrayInSection(N * 2, F, IntptrPtrTy,
606 SanCovPCsSectionName);
607 PCArray->setInitializer(
609 PCArray->setConstant(
true);
614 void SanitizerCoverageModule::CreateFunctionLocalArrays(
617 FunctionGuardArray = CreateFunctionLocalArrayInSection(
621 Function8bitCounterArray = CreateFunctionLocalArrayInSection(
625 FunctionPCsArray = CreatePCArray(F, AllBlocks);
628 bool SanitizerCoverageModule::InjectCoverage(
Function &F,
631 if (AllBlocks.
empty())
return false;
632 CreateFunctionLocalArrays(F, AllBlocks);
633 for (
size_t i = 0,
N = AllBlocks.
size(); i <
N; i++)
634 InjectCoverageAtBlock(F, *AllBlocks[i], i, IsLeafFunc);
645 void SanitizerCoverageModule::InjectCoverageForIndirectCalls(
647 if (IndirCalls.
empty())
650 for (
auto I : IndirCalls) {
654 if (isa<InlineAsm>(Callee))
664 void SanitizerCoverageModule::InjectTraceForSwitch(
666 for (
auto I : SwitchTraceTargets) {
670 Value *Cond =
SI->getCondition();
672 Int64Ty->getScalarSizeInBits())
678 Int64Ty->getScalarSizeInBits())
680 for (
auto It :
SI->cases()) {
683 Int64Ty->getScalarSizeInBits())
689 return cast<ConstantInt>(A)->getLimitedValue() <
690 cast<ConstantInt>(
B)->getLimitedValue();
696 "__sancov_gen_cov_switch_values");
703 void SanitizerCoverageModule::InjectTraceForDiv(
705 for (
auto BO : DivTraceTargets) {
707 Value *A1 = BO->getOperand(1);
708 if (isa<ConstantInt>(A1))
continue;
711 uint64_t TypeSize = DL->getTypeStoreSizeInBits(A1->
getType());
712 int CallbackIdx = TypeSize == 32 ? 0 :
713 TypeSize == 64 ? 1 : -1;
714 if (CallbackIdx < 0)
continue;
716 IRB.
CreateCall(SanCovTraceDivFunction[CallbackIdx],
721 void SanitizerCoverageModule::InjectTraceForGep(
723 for (
auto GEP : GepTraceTargets) {
725 for (
auto I =
GEP->idx_begin();
I !=
GEP->idx_end(); ++
I)
726 if (!isa<ConstantInt>(*
I) && (*I)->getType()->isIntegerTy())
728 {IRB.CreateIntCast(*I, IntptrTy, true)});
732 void SanitizerCoverageModule::InjectTraceForCmp(
734 for (
auto I : CmpTraceTargets) {
741 uint64_t TypeSize = DL->getTypeStoreSizeInBits(A0->
getType());
742 int CallbackIdx = TypeSize == 8 ? 0 :
745 TypeSize == 64 ? 3 : -1;
746 if (CallbackIdx < 0)
continue;
748 auto CallbackFunc = SanCovTraceCmpFunction[CallbackIdx];
749 bool FirstIsConst = isa<ConstantInt>(A0);
750 bool SecondIsConst = isa<ConstantInt>(A1);
752 if (FirstIsConst && SecondIsConst)
continue;
754 if (FirstIsConst || SecondIsConst) {
755 CallbackFunc = SanCovTraceConstCmpFunction[CallbackIdx];
781 EntryLoc = IP->getDebugLoc();
800 Function8bitCounterArray,
805 SetNoSanitizeMetadata(
Load);
806 SetNoSanitizeMetadata(
Store);
808 if (Options.
StackDepth && IsEntryBB && !IsLeafFunc) {
815 auto LowestStack = IRB.
CreateLoad(SanCovLowestStack);
816 auto IsStackLower = IRB.
CreateICmpULT(FrameAddrInt, LowestStack);
820 SetNoSanitizeMetadata(LowestStack);
821 SetNoSanitizeMetadata(
Store);
826 SanitizerCoverageModule::getSectionName(
const std::string &Section)
const {
827 if (TargetTriple.isOSBinFormatCOFF()) {
828 if (Section == SanCovCountersSectionName)
830 if (Section == SanCovPCsSectionName)
834 if (TargetTriple.isOSBinFormatMachO())
835 return "__DATA,__" + Section;
840 SanitizerCoverageModule::getSectionStart(
const std::string &Section)
const {
841 if (TargetTriple.isOSBinFormatMachO())
842 return "\1section$start$__DATA$__" + Section;
847 SanitizerCoverageModule::getSectionEnd(
const std::string &Section)
const {
848 if (TargetTriple.isOSBinFormatMachO())
849 return "\1section$end$__DATA$__" + Section;
856 "SanitizerCoverage: TODO." 862 "SanitizerCoverage: TODO."
867 return new SanitizerCoverageModule(Options);
void setVisibility(VisibilityTypes V)
static const char *const SanCovPCsSectionName
void appendToCompilerUsed(Module &M, ArrayRef< GlobalValue *> Values)
Adds global values to the llvm.compiler.used list.
A parsed version of the target data layout string in and methods for querying it. ...
const std::string & getTargetTriple() const
Get the target triple which is a string describing the target host.
Function * declareSanitizerInitFunction(Module &M, StringRef InitName, ArrayRef< Type *> InitArgTypes)
static const uint64_t SanCtorAndDtorPriority
DILocation * get() const
Get the underlying DILocation.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
Function * checkSanitizerInterfaceFunction(Constant *FuncOrBitcast)
This class represents lattice values for constants.
static const char *const SanCovTraceConstCmp1
Value * CreateICmpULT(Value *LHS, Value *RHS, const Twine &Name="")
Constant * getOrInsertFunction(StringRef Name, FunctionType *T, AttributeList AttributeList)
Look up the specified function in the module symbol table.
LoadInst * CreateLoad(Type *Ty, Value *Ptr, const char *Name)
Provided to resolve 'CreateLoad(Ty, Ptr, "...")' correctly, instead of converting the string to 'bool...
A Module instance is used to store all the information related to an LLVM module. ...
Same, but only replaced by something equivalent.
static const char *const SanCovPCsInitName
Available for inspection, not emission.
void push_back(const T &Elt)
static bool isFullPostDominator(const BasicBlock *BB, const PostDominatorTree *PDT)
static const char *const SanCovGuardsSectionName
Like Internal, but omit from symbol table.
Externally visible function.
bool isInterposable() const
Return true if this global's definition can be substituted with an arbitrary definition at link time...
static cl::opt< bool > ClStackDepth("sanitizer-coverage-stack-depth", cl::desc("max stack depth tracing"), cl::Hidden, cl::init(false))
static IntegerType * getInt64Ty(LLVMContext &C)
unsigned SplitAllCriticalEdges(Function &F, const CriticalEdgeSplittingOptions &Options=CriticalEdgeSplittingOptions())
Loop over all of the edges in the CFG, breaking critical edges as they are found. ...
static const char *const SanCovTracePCName
const Instruction * getTerminator() const LLVM_READONLY
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
static IntegerType * getInt16Ty(LLVMContext &C)
static const char *const SanCovTraceSwitchName
static const char *const SanCovTraceConstCmp2
static Constant * get(ArrayType *T, ArrayRef< Constant *> V)
static Constant * getNullValue(Type *Ty)
Constructor to create a '0' constant of arbitrary type.
static const char *const SanCov8bitCountersInitName
AnalysisUsage & addRequired()
#define INITIALIZE_PASS_DEPENDENCY(depName)
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
static const char *const SanCovTraceCmp2
LLVMContext & getContext() const
Get the global data context.
bool isIntegerTy() const
True if this is an instance of IntegerType.
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
static const char *const SanCovLowestStackName
Value * CreateAdd(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
static cl::opt< int > ClCoverageLevel("sanitizer-coverage-level", cl::desc("Sanitizer Coverage. 0: none, 1: entry block, 2: all blocks, " "3: all blocks and critical edges"), cl::Hidden, cl::init(0))
Interval::succ_iterator succ_begin(Interval *I)
succ_begin/succ_end - define methods so that Intervals may be used just like BasicBlocks can with the...
StoreInst * CreateStore(Value *Val, Value *Ptr, bool isVolatile=false)
Value * CreateIntToPtr(Value *V, Type *DestTy, const Twine &Name="")
ValTy * getCalledValue() const
Return the pointer to function that is being called.
static const char *const SanCovTraceGep
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
Type * getType() const
All values are typed, get the type of this value.
void appendToUsed(Module &M, ArrayRef< GlobalValue *> Values)
Adds global values to the llvm.used list.
static cl::opt< bool > ClDIVTracing("sanitizer-coverage-trace-divs", cl::desc("Tracing of DIV instructions"), cl::Hidden, cl::init(false))
Class to represent array types.
void setComdat(Comdat *C)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
static cl::opt< bool > ClCMPTracing("sanitizer-coverage-trace-compares", cl::desc("Tracing of CMP and similar instructions"), cl::Hidden, cl::init(false))
bool hasPersonalityFn() const
Check whether this function has a personality function.
void SetCurrentDebugLocation(DebugLoc L)
Set location information used by debugging information.
LinkageTypes getLinkage() const
static const char *const SanCovTracePCGuardName
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree...
amdgpu Simplify well known AMD library false Value * Callee
Function * getDeclaration(Module *M, ID id, ArrayRef< Type *> Tys=None)
Create or insert an LLVM Function declaration for an intrinsic, and return it.
INITIALIZE_PASS_BEGIN(SanitizerCoverageModule, "sancov", "SanitizerCoverage: TODO." "ModulePass", false, false) INITIALIZE_PASS_END(SanitizerCoverageModule
Interval::succ_iterator succ_end(Interval *I)
const BasicBlock & getEntryBlock() const
an instruction for type-safe pointer arithmetic to access elements of arrays and structs ...
static const char *const SanCovTracePCIndirName
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata *> MDs)
static bool runOnFunction(Function &F, bool PostInlining)
initializer< Ty > init(const Ty &Val)
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
const_iterator getFirstInsertionPt() const
Returns an iterator to the first instruction in this block that is suitable for inserting a non-PHI i...
static const char *const SanCovTraceCmp1
const BasicBlock * getSinglePredecessor() const
Return the predecessor of this block if it has a single predecessor block.
LLVM Basic Block Representation.
The instances of the Type class are immutable: once they are created, they are never changed...
std::pair< Function *, Function * > createSanitizerCtorAndInitFunctions(Module &M, StringRef CtorName, StringRef InitName, ArrayRef< Type *> InitArgTypes, ArrayRef< Value *> InitArgs, StringRef VersionCheckName=StringRef())
Creates sanitizer constructor function, and calls sanitizer's init function from it.
This is an important class for using LLVM in a threaded context.
DISubprogram * getSubprogram() const
Get the attached subprogram.
static cl::opt< bool > ClCreatePCTable("sanitizer-coverage-pc-table", cl::desc("create a static PC table"), cl::Hidden, cl::init(false))
static const char *const SanCovTraceDiv4
static BlockAddress * get(Function *F, BasicBlock *BB)
Return a BlockAddress for the specified function and basic block.
size_t size() const
size - Get the array size.
This is an important base class in LLVM.
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator begin()
bool isPointerTy() const
True if this is an instance of PointerType.
static const char *const SanCovTraceConstCmp8
Interval::pred_iterator pred_begin(Interval *I)
pred_begin/pred_end - define methods so that Intervals may be used just like BasicBlocks can with the...
EHPersonality classifyEHPersonality(const Value *Pers)
See if the given exception handling personality function is one that we understand.
Represent the analysis usage information of a pass.
static Type * getVoidTy(LLVMContext &C)
This instruction compares its operands according to the predicate given to the constructor.
static FunctionType * get(Type *Result, ArrayRef< Type *> Params, bool isVarArg)
This static method is the primary way of constructing a FunctionType.
Interval::pred_iterator pred_end(Interval *I)
static cl::opt< bool > ClPruneBlocks("sanitizer-coverage-prune-blocks", cl::desc("Reduce the number of instrumented blocks"), cl::Hidden, cl::init(true))
static cl::opt< bool > ClTracePCGuard("sanitizer-coverage-trace-pc-guard", cl::desc("pc tracing with a guard"), cl::Hidden, cl::init(false))
static const char *const SanCovTraceCmp4
static Constant * getAllOnesValue(Type *Ty)
std::string getUniqueModuleId(Module *M)
Produce a unique identifier for this module by taking the MD5 sum of the names of the module's strong...
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function. ...
Comdat * getOrInsertComdat(StringRef Name)
Return the Comdat in the module with the specified name.
static const char *const SanCovTraceCmp8
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE, "Assign register bank of generic virtual registers", false, false) RegBankSelect
void setMetadata(unsigned KindID, MDNode *Node)
Set the metadata of the specified kind to the specified node.
Triple - Helper class for working with autoconf configuration names.
void sort(IteratorTy Start, IteratorTy End)
Value * CreateGEP(Value *Ptr, ArrayRef< Value *> IdxList, const Twine &Name="")
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
Iterator for intrusive lists based on ilist_node.
static const char *const SanCovModuleCtorName
static PointerType * getUnqual(Type *ElementType)
This constructs a pointer to an object of the specified type in the generic address space (address sp...
static bool isFullDominator(const BasicBlock *BB, const DominatorTree *DT)
unsigned getScalarSizeInBits() const LLVM_READONLY
If this is a vector type, return the getPrimitiveSizeInBits value for the element type...
Value * CreateIntCast(Value *V, Type *DestTy, bool isSigned, const Twine &Name="")
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
bool dominates(const Instruction *Def, const Use &U) const
Return true if Def dominates a use in User.
Module.h This file contains the declarations for the Module class.
static const char *const SanCovCountersSectionName
static IntegerType * getIntNTy(LLVMContext &C, unsigned N)
enum llvm::SanitizerCoverageOptions::Type CoverageType
static Constant * get(Type *Ty, uint64_t V, bool isSigned=false)
If Ty is a vector type, return a Constant with a splat of the given value.
void appendToGlobalCtors(Module &M, Function *F, int Priority, Constant *Data=nullptr)
Append F to the list of global ctors of module M with the given Priority.
static bool shouldInstrumentBlock(const Function &F, const BasicBlock *BB, const DominatorTree *DT, const PostDominatorTree *PDT, const SanitizerCoverageOptions &Options)
BasicBlock::iterator PrepareToSplitEntryBlock(BasicBlock &BB, BasicBlock::iterator IP)
Instrumentation passes often insert conditional checks into entry blocks.
void setLinkage(LinkageTypes LT)
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
const Module * getModule() const
Return the module owning the function this instruction belongs to or nullptr it the function does not...
Comdat * GetOrCreateFunctionComdat(Function &F, Triple &T, const std::string &ModuleId)
static Constant * getCast(unsigned ops, Constant *C, Type *Ty, bool OnlyIfReduced=false)
Convenience function for getting a Cast operation.
PostDominatorTree Class - Concrete subclass of DominatorTree that is used to compute the post-dominat...
static cl::opt< bool > ClTracePC("sanitizer-coverage-trace-pc", cl::desc("Experimental pc tracing"), cl::Hidden, cl::init(false))
Value * CreatePointerCast(Value *V, Type *DestTy, const Twine &Name="")
bool dominates(const DomTreeNodeBase< NodeT > *A, const DomTreeNodeBase< NodeT > *B) const
dominates - Returns true iff A dominates B.
Instruction * SplitBlockAndInsertIfThen(Value *Cond, Instruction *SplitBefore, bool Unreachable, MDNode *BranchWeights=nullptr, DominatorTree *DT=nullptr, LoopInfo *LI=nullptr)
Split the containing block at the specified instruction - everything before SplitBefore stays in the ...
This file provides various utilities for inspecting and working with the control flow graph in LLVM I...
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
Constant * getOrInsertGlobal(StringRef Name, Type *Ty, function_ref< GlobalVariable *()> CreateGlobalCallback)
Look up the specified global in the module symbol table.
static IntegerType * getInt32Ty(LLVMContext &C)
static cl::opt< bool > ClGEPTracing("sanitizer-coverage-trace-geps", cl::desc("Tracing of GEP instructions"), cl::Hidden, cl::init(false))
static const char *const SanCovTraceDiv8
StringRef getName() const
Return a constant reference to the value's name.
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
static ArrayType * get(Type *ElementType, uint64_t NumElements)
This static method is the primary way to construct an ArrayType.
ModulePass * createSanitizerCoverageModulePass(const SanitizerCoverageOptions &Options=SanitizerCoverageOptions())
Rename collisions when linking (static functions).
CallInst * CreateCall(FunctionType *FTy, Value *Callee, ArrayRef< Value *> Args=None, const Twine &Name="", MDNode *FPMathTag=nullptr)
static InlineAsm * get(FunctionType *Ty, StringRef AsmString, StringRef Constraints, bool hasSideEffects, bool isAlignStack=false, AsmDialect asmDialect=AD_ATT)
InlineAsm::get - Return the specified uniqued inline asm string.
static cl::opt< bool > ClInline8bitCounters("sanitizer-coverage-inline-8bit-counters", cl::desc("increments 8-bit counter for every edge"), cl::Hidden, cl::init(false))
Value * CreatePtrToInt(Value *V, Type *DestTy, const Twine &Name="")
FunTy * getCalledFunction() const
Return the function being called if this is a direct call, otherwise return null (if it's an indirect...
unsigned getMDKindID(StringRef Name) const
Return a unique non-zero ID for the specified metadata kind.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool isAsynchronousEHPersonality(EHPersonality Pers)
Returns true if this personality function catches asynchronous exceptions.
unsigned getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.
static const char *const SanCovTracePCGuardInitName
Module * getParent()
Get the module that this global value is contained inside of...
LLVM Value Representation.
Constant * getPersonalityFn() const
Get the personality function associated with this function.
void initializeSanitizerCoverageModulePass(PassRegistry &)
StringRef - Represent a constant reference to a string, i.e.
Legacy analysis pass which computes a DominatorTree.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t find(char C, size_t From=0) const
Search for the first character C in the string.
static const char *const SanCovTraceConstCmp4
static IntegerType * getInt8Ty(LLVMContext &C)
bool empty() const
empty - Check if the array is empty.