LLVM  15.0.0git
MemorySanitizer.h
Go to the documentation of this file.
1 //===- Transforms/Instrumentation/MemorySanitizer.h - MSan Pass -----------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines the memoy sanitizer pass.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_TRANSFORMS_INSTRUMENTATION_MEMORYSANITIZER_H
14 #define LLVM_TRANSFORMS_INSTRUMENTATION_MEMORYSANITIZER_H
15 
17 #include "llvm/IR/PassManager.h"
18 
19 namespace llvm {
20 class Function;
21 class FunctionPass;
22 class Module;
23 class StringRef;
24 class raw_ostream;
25 
31  bool EagerChecks);
32  bool Kernel;
34  bool Recover;
36 };
37 
38 /// A function pass for msan instrumentation.
39 ///
40 /// Instruments functions to detect unitialized reads. This function pass
41 /// inserts calls to runtime library functions. If the functions aren't declared
42 /// yet, the pass inserts the declarations. Otherwise the existing globals are
43 /// used.
44 struct MemorySanitizerPass : public PassInfoMixin<MemorySanitizerPass> {
46 
48  void printPipeline(raw_ostream &OS,
49  function_ref<StringRef(StringRef)> MapClassName2PassName);
50  static bool isRequired() { return true; }
51 
52 private:
53  MemorySanitizerOptions Options;
54 };
55 
56 /// A module pass for msan instrumentation.
57 ///
58 /// Instruments functions to detect unitialized reads. This function pass
59 /// inserts calls to runtime library functions. If the functions aren't declared
60 /// yet, the pass inserts the declarations. Otherwise the existing globals are
61 /// used.
62 struct ModuleMemorySanitizerPass : public PassInfoMixin<ModuleMemorySanitizerPass> {
64 
66  static bool isRequired() { return true; }
67 
68 private:
69  MemorySanitizerOptions Options;
70 };
71 }
72 
73 #endif /* LLVM_TRANSFORMS_INSTRUMENTATION_MEMORYSANITIZER_H */
llvm::PreservedAnalyses
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:152
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
llvm::MemorySanitizerOptions::TrackOrigins
int TrackOrigins
Definition: MemorySanitizer.h:33
llvm::PassInfoMixin
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:371
llvm::Function
Definition: Function.h:60
llvm::MemorySanitizerOptions::Kernel
bool Kernel
Definition: MemorySanitizer.h:32
llvm::MemorySanitizerPass::MemorySanitizerPass
MemorySanitizerPass(MemorySanitizerOptions Options)
Definition: MemorySanitizer.h:45
FAM
FunctionAnalysisManager FAM
Definition: PassBuilderBindings.cpp:59
F
#define F(x, y, z)
Definition: MD5.cpp:55
llvm::MemorySanitizerPass::printPipeline
void printPipeline(raw_ostream &OS, function_ref< StringRef(StringRef)> MapClassName2PassName)
Definition: MemorySanitizer.cpp:661
false
Definition: StackSlotColoring.cpp:141
Options
const char LLVMTargetMachineRef LLVMPassBuilderOptionsRef Options
Definition: PassBuilderBindings.cpp:48
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:54
STLFunctionalExtras.h
llvm::ModuleMemorySanitizerPass::isRequired
static bool isRequired()
Definition: MemorySanitizer.h:66
llvm::MemorySanitizerOptions::Recover
bool Recover
Definition: MemorySanitizer.h:34
llvm::function_ref
An efficient, type-erasing, non-owning reference to a callable.
Definition: STLFunctionalExtras.h:36
llvm::MemorySanitizerPass::isRequired
static bool isRequired()
Definition: MemorySanitizer.h:50
llvm::ModuleMemorySanitizerPass
A module pass for msan instrumentation.
Definition: MemorySanitizer.h:62
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::ModuleMemorySanitizerPass::ModuleMemorySanitizerPass
ModuleMemorySanitizerPass(MemorySanitizerOptions Options)
Definition: MemorySanitizer.h:63
Module
Machine Check Debug Module
Definition: MachineCheckDebugify.cpp:122
llvm::MemorySanitizerPass
A function pass for msan instrumentation.
Definition: MemorySanitizer.h:44
llvm::ModuleMemorySanitizerPass::run
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
Definition: MemorySanitizer.cpp:654
PassManager.h
llvm::MemorySanitizerOptions
Definition: MemorySanitizer.h:26
llvm::MemorySanitizerPass::run
PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM)
Definition: MemorySanitizer.cpp:645
llvm::AnalysisManager
A container for analyses that lazily runs them and caches their results.
Definition: InstructionSimplify.h:42
llvm::MemorySanitizerOptions::EagerChecks
bool EagerChecks
Definition: MemorySanitizer.h:35
llvm::MemorySanitizerOptions::MemorySanitizerOptions
MemorySanitizerOptions(int TrackOrigins, bool Recover, bool Kernel)
Definition: MemorySanitizer.h:28
llvm::MemorySanitizerOptions::MemorySanitizerOptions
MemorySanitizerOptions()
Definition: MemorySanitizer.h:27
llvm::codeview::PublicSymFlags::Function
@ Function