diff options
Diffstat (limited to 'include/llvm/Transforms/Instrumentation.h')
-rw-r--r-- | include/llvm/Transforms/Instrumentation.h | 44 |
1 files changed, 14 insertions, 30 deletions
diff --git a/include/llvm/Transforms/Instrumentation.h b/include/llvm/Transforms/Instrumentation.h index f2fc6dc8dad5e..cd6b770f76ac0 100644 --- a/include/llvm/Transforms/Instrumentation.h +++ b/include/llvm/Transforms/Instrumentation.h @@ -22,24 +22,11 @@ #include <string> #include <vector> -#if defined(__GNUC__) && defined(__linux__) && !defined(ANDROID) -inline void *getDFSanArgTLSPtrForJIT() { - extern __thread __attribute__((tls_model("initial-exec"))) - void *__dfsan_arg_tls; - return (void *)&__dfsan_arg_tls; -} - -inline void *getDFSanRetValTLSPtrForJIT() { - extern __thread __attribute__((tls_model("initial-exec"))) - void *__dfsan_retval_tls; - return (void *)&__dfsan_retval_tls; -} -#endif - namespace llvm { class FunctionPass; class ModulePass; +class OptimizationRemarkEmitter; /// Instrumentation passes often insert conditional checks into entry blocks. /// Call this function before splitting the entry block to move instructions @@ -90,9 +77,12 @@ ModulePass *createPGOIndirectCallPromotionLegacyPass(bool InLTO = false, bool SamplePGO = false); FunctionPass *createPGOMemOPSizeOptLegacyPass(); -// Helper function to check if it is legal to promote indirect call \p Inst -// to a direct call of function \p F. Stores the reason in \p Reason. -bool isLegalToPromote(Instruction *Inst, Function *F, const char **Reason); +// The pgo-specific indirect call promotion function declared below is used by +// the pgo-driven indirect call promotion and sample profile passes. It's a +// wrapper around llvm::promoteCall, et al. that additionally computes !prof +// metadata. We place it in a pgo namespace so it's not confused with the +// generic utilities. +namespace pgo { // Helper function that transforms Inst (either an indirect-call instruction, or // an invoke instruction , to a conditional call to F. This is like: @@ -109,7 +99,9 @@ bool isLegalToPromote(Instruction *Inst, Function *F, const char **Reason); // Returns the promoted direct call instruction. Instruction *promoteIndirectCall(Instruction *Inst, Function *F, uint64_t Count, uint64_t TotalCount, - bool AttachProfToDirectCall); + bool AttachProfToDirectCall, + OptimizationRemarkEmitter *ORE); +} // namespace pgo /// Options for the frontend instrumentation based profiling pass. struct InstrProfOptions { @@ -141,6 +133,8 @@ ModulePass *createAddressSanitizerModulePass(bool CompileKernel = false, FunctionPass *createMemorySanitizerPass(int TrackOrigins = 0, bool Recover = false); +FunctionPass *createHWAddressSanitizerPass(); + // Insert ThreadSanitizer (race detection) instrumentation FunctionPass *createThreadSanitizerPass(); @@ -181,7 +175,9 @@ struct SanitizerCoverageOptions { bool TracePC = false; bool TracePCGuard = false; bool Inline8bitCounters = false; + bool PCTable = false; bool NoPrune = false; + bool StackDepth = false; SanitizerCoverageOptions() = default; }; @@ -190,18 +186,6 @@ struct SanitizerCoverageOptions { ModulePass *createSanitizerCoverageModulePass( const SanitizerCoverageOptions &Options = SanitizerCoverageOptions()); -#if defined(__GNUC__) && defined(__linux__) && !defined(ANDROID) -inline ModulePass *createDataFlowSanitizerPassForJIT( - const std::vector<std::string> &ABIListFiles = std::vector<std::string>()) { - return createDataFlowSanitizerPass(ABIListFiles, getDFSanArgTLSPtrForJIT, - getDFSanRetValTLSPtrForJIT); -} -#endif - -// BoundsChecking - This pass instruments the code to perform run-time bounds -// checking on loads, stores, and other memory intrinsics. -FunctionPass *createBoundsCheckingPass(); - /// \brief Calculate what to divide by to scale counts. /// /// Given the maximum count, calculate a divisor that will scale all the |