[InstCombine] Signed saturation patterns
[llvm-core.git] / include / llvm / Transforms / Instrumentation / SanitizerCoverage.h
blob85a43ff86f2e0a5c02cae35666eec725061b2b17
1 //===--------- Definition of the SanitizerCoverage class --------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
6 // See https://llvm.org/LICENSE.txt for license information.
7 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8 //
9 //===----------------------------------------------------------------------===//
11 // This file declares the SanitizerCoverage class which is a port of the legacy
12 // SanitizerCoverage pass to use the new PassManager infrastructure.
14 //===----------------------------------------------------------------------===//
16 #ifndef LLVM_TRANSFORMS_INSTRUMENTATION_SANITIZERCOVERAGE_H
17 #define LLVM_TRANSFORMS_INSTRUMENTATION_SANITIZERCOVERAGE_H
19 #include "llvm/IR/Module.h"
20 #include "llvm/IR/PassManager.h"
21 #include "llvm/Transforms/Instrumentation.h"
23 namespace llvm {
25 /// This is the ModuleSanitizerCoverage pass used in the new pass manager. The
26 /// pass instruments functions for coverage, adds initialization calls to the
27 /// module for trace PC guards and 8bit counters if they are requested, and
28 /// appends globals to llvm.compiler.used.
29 class ModuleSanitizerCoveragePass
30 : public PassInfoMixin<ModuleSanitizerCoveragePass> {
31 public:
32 explicit ModuleSanitizerCoveragePass(
33 SanitizerCoverageOptions Options = SanitizerCoverageOptions())
34 : Options(Options) {}
35 PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
37 private:
38 SanitizerCoverageOptions Options;
41 // Insert SanitizerCoverage instrumentation.
42 ModulePass *createModuleSanitizerCoverageLegacyPassPass(
43 const SanitizerCoverageOptions &Options = SanitizerCoverageOptions());
45 } // namespace llvm
47 #endif