43 #define DEBUG_TYPE "sancov" 46 "__sanitizer_cov_trace_pc_indir";
53 "__sanitizer_cov_trace_const_cmp1";
55 "__sanitizer_cov_trace_const_cmp2";
57 "__sanitizer_cov_trace_const_cmp4";
59 "__sanitizer_cov_trace_const_cmp8";
68 "__sanitizer_cov_trace_pc_guard";
70 "__sanitizer_cov_trace_pc_guard_init";
72 "__sanitizer_cov_8bit_counters_init";
82 "sanitizer-coverage-level",
83 cl::desc(
"Sanitizer Coverage. 0: none, 1: entry block, 2: all blocks, " 84 "3: all blocks and critical edges"),
101 cl::desc(
"create a static PC table"),
106 cl::desc(
"increments 8-bit counter for every edge"),
111 cl::desc(
"Tracing of CMP and similar instructions"),
115 cl::desc(
"Tracing of DIV instructions"),
119 cl::desc(
"Tracing of GEP instructions"),
124 cl::desc(
"Reduce the number of instrumented blocks"),
128 cl::desc(
"max stack depth tracing"),
135 switch (LegacyCoverageLevel) {
176 class SanitizerCoverageModule :
public ModulePass {
178 SanitizerCoverageModule(
183 bool runOnModule(
Module &M)
override;
186 StringRef getPassName()
const override {
return "SanitizerCoverageModule"; }
194 void InjectCoverageForIndirectCalls(
Function &
F,
204 bool IsLeafFunc =
true);
205 GlobalVariable *CreateFunctionLocalArrayInSection(
size_t NumElements,
211 bool IsLeafFunc =
true);
212 Function *CreateInitCallsForSections(
Module &M,
const char *InitFunctionName,
214 std::pair<GlobalVariable *, GlobalVariable *>
222 std::string getSectionName(
const std::string &
Section)
const;
223 std::string getSectionStart(
const std::string &
Section)
const;
224 std::string getSectionEnd(
const std::string &
Section)
const;
226 Function *SanCovTracePC, *SanCovTracePCGuard;
227 Function *SanCovTraceCmpFunction[4];
228 Function *SanCovTraceConstCmpFunction[4];
229 Function *SanCovTraceDivFunction[2];
231 Function *SanCovTraceSwitchFunction;
234 Type *IntptrTy, *IntptrPtrTy, *Int64Ty, *Int64PtrTy, *
Int32Ty, *Int32PtrTy,
235 *Int16Ty, *Int8Ty, *Int8PtrTy;
252 std::pair<GlobalVariable *, GlobalVariable *>
253 SanitizerCoverageModule::CreateSecStartEnd(
Module &M,
const char *
Section,
257 getSectionStart(Section));
261 nullptr, getSectionEnd(Section));
264 return std::make_pair(SecStart, SecEnd);
268 Function *SanitizerCoverageModule::CreateInitCallsForSections(
269 Module &M,
const char *InitFunctionName,
Type *Ty,
270 const char *Section) {
272 auto SecStartEnd = CreateSecStartEnd(M, Section, Ty);
273 auto SecStart = SecStartEnd.first;
274 auto SecEnd = SecStartEnd.second;
277 M, SanCovModuleCtorName, InitFunctionName, {Ty, Ty},
278 {IRB.CreatePointerCast(SecStart, Ty), IRB.CreatePointerCast(SecEnd, Ty)});
280 if (TargetTriple.supportsCOMDAT()) {
290 bool SanitizerCoverageModule::runOnModule(
Module &M) {
297 FunctionGuardArray =
nullptr;
298 Function8bitCounterArray =
nullptr;
299 FunctionPCsArray =
nullptr;
314 SanCovTraceCmpFunction[0] =
323 SanCovTraceCmpFunction[3] =
325 SanCovTraceCmp8, VoidTy, Int64Ty, Int64Ty));
327 SanCovTraceConstCmpFunction[0] =
329 SanCovTraceConstCmp1, VoidTy, Int8Ty, Int8Ty));
330 SanCovTraceConstCmpFunction[1] =
332 SanCovTraceConstCmp2, VoidTy, Int16Ty, Int16Ty));
333 SanCovTraceConstCmpFunction[2] =
336 SanCovTraceConstCmpFunction[3] =
338 SanCovTraceConstCmp8, VoidTy, Int64Ty, Int64Ty));
340 SanCovTraceDivFunction[0] =
343 SanCovTraceDivFunction[1] =
345 SanCovTraceDiv8, VoidTy, Int64Ty));
346 SanCovTraceGepFunction =
348 SanCovTraceGep, VoidTy, IntptrTy));
349 SanCovTraceSwitchFunction =
351 SanCovTraceSwitchName, VoidTy, Int64Ty, Int64PtrTy));
353 Constant *SanCovLowestStackConstant =
355 SanCovLowestStack = cast<GlobalVariable>(SanCovLowestStackConstant);
356 SanCovLowestStack->setThreadLocalMode(
357 GlobalValue::ThreadLocalMode::InitialExecTLSModel);
358 if (Options.
StackDepth && !SanCovLowestStack->isDeclaration())
364 for (
int i = 0; i < 3; i++) {
365 SanCovTraceCmpFunction[i]->addParamAttr(0, Attribute::ZExt);
366 SanCovTraceCmpFunction[i]->addParamAttr(1, Attribute::ZExt);
367 SanCovTraceConstCmpFunction[i]->addParamAttr(0, Attribute::ZExt);
368 SanCovTraceConstCmpFunction[i]->addParamAttr(1, Attribute::ZExt);
370 SanCovTraceDivFunction[0]->addParamAttr(0, Attribute::ZExt);
382 SanCovTracePCGuardName, VoidTy, Int32PtrTy));
389 if (FunctionGuardArray)
390 Ctor = CreateInitCallsForSections(M, SanCovTracePCGuardInitName, Int32PtrTy,
391 SanCovGuardsSectionName);
392 if (Function8bitCounterArray)
393 Ctor = CreateInitCallsForSections(M, SanCov8bitCountersInitName, Int8PtrTy,
394 SanCovCountersSectionName);
396 auto SecStartEnd = CreateSecStartEnd(M, SanCovPCsSectionName, IntptrPtrTy);
398 M, SanCovPCsInitName, {IntptrPtrTy, IntptrPtrTy});
401 {IRB.CreatePointerCast(SecStartEnd.first, IntptrPtrTy),
402 IRB.CreatePointerCast(SecStartEnd.second, IntptrPtrTy)});
406 if (TargetTriple.isOSBinFormatMachO())
472 if (F.
getName().
find(
".module_ctor") != std::string::npos)
481 if (F.
getName() ==
"__local_stdio_printf_options" ||
482 F.
getName() ==
"__local_stdio_scanf_options")
502 &getAnalysis<DominatorTreeWrapperPass>(
F).getDomTree();
504 &getAnalysis<PostDominatorTreeWrapperPass>(
F).getPostDomTree();
505 bool IsLeafFunc =
true;
510 for (
auto &Inst : BB) {
517 if (isa<ICmpInst>(&Inst))
519 if (isa<SwitchInst>(&Inst))
524 if (BO->getOpcode() == Instruction::SDiv ||
525 BO->getOpcode() == Instruction::UDiv)
531 if (isa<InvokeInst>(Inst) ||
532 (isa<CallInst>(Inst) && !isa<IntrinsicInst>(Inst)))
537 InjectCoverage(F, BlocksToInstrument, IsLeafFunc);
538 InjectCoverageForIndirectCalls(F, IndirCalls);
539 InjectTraceForCmp(F, CmpTraceTargets);
540 InjectTraceForSwitch(F, SwitchTraceTargets);
541 InjectTraceForDiv(F, DivTraceTargets);
542 InjectTraceForGep(F, GepTraceTargets);
546 GlobalVariable *SanitizerCoverageModule::CreateFunctionLocalArrayInSection(
547 size_t NumElements,
Function &F,
Type *Ty,
const char *Section) {
554 Array->setSection(getSectionName(Section));
561 SanitizerCoverageModule::CreatePCArray(
Function &F,
563 size_t N = AllBlocks.
size();
567 for (
size_t i = 0; i <
N; i++) {
579 auto *PCArray = CreateFunctionLocalArrayInSection(N * 2, F, IntptrPtrTy,
580 SanCovPCsSectionName);
581 PCArray->setInitializer(
583 PCArray->setConstant(
true);
588 void SanitizerCoverageModule::CreateFunctionLocalArrays(
591 FunctionGuardArray = CreateFunctionLocalArrayInSection(
593 GlobalsToAppendToUsed.push_back(FunctionGuardArray);
596 Function8bitCounterArray = CreateFunctionLocalArrayInSection(
598 GlobalsToAppendToCompilerUsed.push_back(Function8bitCounterArray);
603 FunctionPCsArray = CreatePCArray(F, AllBlocks);
604 GlobalsToAppendToCompilerUsed.push_back(FunctionPCsArray);
610 bool SanitizerCoverageModule::InjectCoverage(
Function &F,
613 if (AllBlocks.
empty())
return false;
614 CreateFunctionLocalArrays(F, AllBlocks);
615 for (
size_t i = 0,
N = AllBlocks.
size(); i <
N; i++)
616 InjectCoverageAtBlock(F, *AllBlocks[i], i, IsLeafFunc);
627 void SanitizerCoverageModule::InjectCoverageForIndirectCalls(
629 if (IndirCalls.
empty())
632 for (
auto I : IndirCalls) {
636 if (isa<InlineAsm>(Callee))
646 void SanitizerCoverageModule::InjectTraceForSwitch(
648 for (
auto I : SwitchTraceTargets) {
652 Value *Cond =
SI->getCondition();
654 Int64Ty->getScalarSizeInBits())
660 Int64Ty->getScalarSizeInBits())
662 for (
auto It :
SI->cases()) {
665 Int64Ty->getScalarSizeInBits())
671 return cast<ConstantInt>(A)->getLimitedValue() <
672 cast<ConstantInt>(
B)->getLimitedValue();
678 "__sancov_gen_cov_switch_values");
685 void SanitizerCoverageModule::InjectTraceForDiv(
687 for (
auto BO : DivTraceTargets) {
689 Value *A1 = BO->getOperand(1);
690 if (isa<ConstantInt>(A1))
continue;
693 uint64_t TypeSize = DL->getTypeStoreSizeInBits(A1->
getType());
694 int CallbackIdx = TypeSize == 32 ? 0 :
695 TypeSize == 64 ? 1 : -1;
696 if (CallbackIdx < 0)
continue;
698 IRB.
CreateCall(SanCovTraceDivFunction[CallbackIdx],
703 void SanitizerCoverageModule::InjectTraceForGep(
705 for (
auto GEP : GepTraceTargets) {
707 for (
auto I =
GEP->idx_begin();
I !=
GEP->idx_end(); ++
I)
708 if (!isa<ConstantInt>(*
I) && (*I)->getType()->isIntegerTy())
710 {IRB.CreateIntCast(*I, IntptrTy, true)});
714 void SanitizerCoverageModule::InjectTraceForCmp(
716 for (
auto I : CmpTraceTargets) {
723 uint64_t TypeSize = DL->getTypeStoreSizeInBits(A0->
getType());
724 int CallbackIdx = TypeSize == 8 ? 0 :
727 TypeSize == 64 ? 3 : -1;
728 if (CallbackIdx < 0)
continue;
730 auto CallbackFunc = SanCovTraceCmpFunction[CallbackIdx];
731 bool FirstIsConst = isa<ConstantInt>(A0);
732 bool SecondIsConst = isa<ConstantInt>(A1);
734 if (FirstIsConst && SecondIsConst)
continue;
736 if (FirstIsConst || SecondIsConst) {
737 CallbackFunc = SanCovTraceConstCmpFunction[CallbackIdx];
763 EntryLoc = IP->getDebugLoc();
782 Function8bitCounterArray,
787 SetNoSanitizeMetadata(
Load);
788 SetNoSanitizeMetadata(
Store);
790 if (Options.
StackDepth && IsEntryBB && !IsLeafFunc) {
797 auto LowestStack = IRB.
CreateLoad(SanCovLowestStack);
798 auto IsStackLower = IRB.
CreateICmpULT(FrameAddrInt, LowestStack);
802 SetNoSanitizeMetadata(LowestStack);
803 SetNoSanitizeMetadata(
Store);
808 SanitizerCoverageModule::getSectionName(
const std::string &Section)
const {
811 if (TargetTriple.isOSBinFormatMachO())
812 return "__DATA,__" + Section;
817 SanitizerCoverageModule::getSectionStart(
const std::string &Section)
const {
818 if (TargetTriple.isOSBinFormatMachO())
819 return "\1section$start$__DATA$__" + Section;
824 SanitizerCoverageModule::getSectionEnd(
const std::string &Section)
const {
825 if (TargetTriple.isOSBinFormatMachO())
826 return "\1section$end$__DATA$__" + Section;
833 "SanitizerCoverage: TODO." 839 "SanitizerCoverage: TODO."
844 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.
void push_back(const T &Elt)
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)
Compute iterated dominance frontiers using a linear time algorithm.
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.
A Module instance is used to store all the information related to an LLVM module. ...
static const char *const SanCovPCsInitName
Available for inspection, not emission.
static bool isFullPostDominator(const BasicBlock *BB, const PostDominatorTree *PDT)
static const char *const SanCovGuardsSectionName
Like Internal, but omit from symbol table.
Externally visible function.
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
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 ...
LoadInst * CreateLoad(Value *Ptr, const char *Name)
Provided to resolve 'CreateLoad(Ptr, "...")' correctly, instead of converting the string to 'bool' fo...
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.
Constant * getOrInsertGlobal(StringRef Name, Type *Ty)
Look up the specified global in the module symbol table.
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)
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
TerminatorInst * 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 ...
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 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...
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.
const Comdat * getComdat() const
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
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).
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.
const TerminatorInst * getTerminator() const LLVM_READONLY
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
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.
CallInst * CreateCall(Value *Callee, ArrayRef< Value *> Args=None, const Twine &Name="", MDNode *FPMathTag=nullptr)