LLVM  16.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 Module;
22 class StringRef;
23 class raw_ostream;
24 
30  bool EagerChecks);
31  bool Kernel;
33  bool Recover;
35 };
36 
37 /// A function pass for msan instrumentation.
38 ///
39 /// Instruments functions to detect unitialized reads. This function pass
40 /// inserts calls to runtime library functions. If the functions aren't declared
41 /// yet, the pass inserts the declarations. Otherwise the existing globals are
42 /// used.
43 struct MemorySanitizerPass : public PassInfoMixin<MemorySanitizerPass> {
45 
47  void printPipeline(raw_ostream &OS,
48  function_ref<StringRef(StringRef)> MapClassName2PassName);
49  static bool isRequired() { return true; }
50 
51 private:
52  MemorySanitizerOptions Options;
53 };
54 
55 /// A module pass for msan instrumentation.
56 ///
57 /// Instruments functions to detect unitialized reads. This function pass
58 /// inserts calls to runtime library functions. If the functions aren't declared
59 /// yet, the pass inserts the declarations. Otherwise the existing globals are
60 /// used.
61 struct ModuleMemorySanitizerPass : public PassInfoMixin<ModuleMemorySanitizerPass> {
63 
65  static bool isRequired() { return true; }
66 
67 private:
68  MemorySanitizerOptions Options;
69 };
70 }
71 
72 #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:18
llvm::MemorySanitizerOptions::TrackOrigins
int TrackOrigins
Definition: MemorySanitizer.h:32
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:31
llvm::MemorySanitizerPass::MemorySanitizerPass
MemorySanitizerPass(MemorySanitizerOptions Options)
Definition: MemorySanitizer.h:44
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:680
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:52
STLFunctionalExtras.h
llvm::ModuleMemorySanitizerPass::isRequired
static bool isRequired()
Definition: MemorySanitizer.h:65
llvm::MemorySanitizerOptions::Recover
bool Recover
Definition: MemorySanitizer.h:33
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:49
llvm::ModuleMemorySanitizerPass
A module pass for msan instrumentation.
Definition: MemorySanitizer.h:61
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:50
llvm::ModuleMemorySanitizerPass::ModuleMemorySanitizerPass
ModuleMemorySanitizerPass(MemorySanitizerOptions Options)
Definition: MemorySanitizer.h:62
Module
Machine Check Debug Module
Definition: MachineCheckDebugify.cpp:122
llvm::MemorySanitizerPass
A function pass for msan instrumentation.
Definition: MemorySanitizer.h:43
llvm::ModuleMemorySanitizerPass::run
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
Definition: MemorySanitizer.cpp:673
PassManager.h
llvm::MemorySanitizerOptions
Definition: MemorySanitizer.h:25
llvm::MemorySanitizerPass::run
PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM)
Definition: MemorySanitizer.cpp:664
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:34
llvm::MemorySanitizerOptions::MemorySanitizerOptions
MemorySanitizerOptions(int TrackOrigins, bool Recover, bool Kernel)
Definition: MemorySanitizer.h:27
llvm::MemorySanitizerOptions::MemorySanitizerOptions
MemorySanitizerOptions()
Definition: MemorySanitizer.h:26
llvm::codeview::PublicSymFlags::Function
@ Function