1 //===- Transforms/Instrumentation.h - Instrumentation passes ----*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines constructor functions for instrumentation passes.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_TRANSFORMS_INSTRUMENTATION_H
15 #define LLVM_TRANSFORMS_INSTRUMENTATION_H
17 #include "llvm/ADT/StringRef.h"
24 // Insert edge profiling instrumentation
25 ModulePass *createEdgeProfilerPass();
27 // Insert optimal edge profiling instrumentation
28 ModulePass *createOptimalEdgeProfilerPass();
30 // Insert path profiling instrumentation
31 ModulePass *createPathProfilerPass();
33 // Insert GCOV profiling instrumentation
35 static GCOVOptions getDefault();
37 // Specify whether to emit .gcno files.
40 // Specify whether to modify the program to emit .gcda files when run.
43 // A four-byte version string. The meaning of a version string is described in
47 // Emit a "cfg checksum" that follows the "line number checksum" of a
48 // function. This affects both .gcno and .gcda files.
51 // Add the 'noredzone' attribute to added runtime library calls.
54 // Emit the name of the function in the .gcda files. This is redundant, as
55 // the function identifier can be used to find the name from the .gcno file.
56 bool FunctionNamesInData;
58 ModulePass *createGCOVProfilerPass(const GCOVOptions &Options =
59 GCOVOptions::getDefault());
61 // Insert AddressSanitizer (address sanity checking) instrumentation
62 FunctionPass *createAddressSanitizerFunctionPass(
63 bool CheckInitOrder = true, bool CheckUseAfterReturn = false,
64 bool CheckLifetime = false, StringRef BlacklistFile = StringRef(),
65 bool ZeroBaseShadow = false);
66 ModulePass *createAddressSanitizerModulePass(
67 bool CheckInitOrder = true, StringRef BlacklistFile = StringRef(),
68 bool ZeroBaseShadow = false);
70 // Insert MemorySanitizer instrumentation (detection of uninitialized reads)
71 FunctionPass *createMemorySanitizerPass(bool TrackOrigins = false,
72 StringRef BlacklistFile = StringRef());
74 // Insert ThreadSanitizer (race detection) instrumentation
75 FunctionPass *createThreadSanitizerPass(StringRef BlacklistFile = StringRef());
77 // BoundsChecking - This pass instruments the code to perform run-time bounds
78 // checking on loads, stores, and other memory intrinsics.
79 FunctionPass *createBoundsCheckingPass();
81 /// createDebugIRPass - Enable interactive stepping through LLVM IR in LLDB (or
82 /// GDB) and generate a file with the LLVM IR to be
83 /// displayed in the debugger.
85 /// Existing debug metadata is preserved (but may be modified) in order to allow
86 /// accessing variables in the original source. The line table and file
87 /// information is modified to correspond to the lines in the LLVM IR. If
88 /// Filename and Directory are empty, a file name is generated based on existing
89 /// debug information. If no debug information is available, a temporary file
90 /// name is generated.
92 /// @param HideDebugIntrinsics Omit debug intrinsics in emitted IR source file.
93 /// @param HideDebugMetadata Omit debug metadata in emitted IR source file.
94 /// @param Filename Embed this file name in the debug information.
95 /// @param Directory Embed this directory in the debug information.
96 ModulePass *createDebugIRPass(bool HideDebugIntrinsics,
97 bool HideDebugMetadata,
98 StringRef Filename = StringRef(),
99 StringRef Directory = StringRef());
101 /// createDebugIRPass - Enable interactive stepping through LLVM IR in LLDB
102 /// (or GDB) with an existing IR file on disk. When creating
103 /// a DebugIR pass with this function, no source file is
104 /// output to disk and the existing one is unmodified. Debug
105 /// metadata in the Module is created/updated to point to
106 /// the existing textual IR file on disk.
107 /// NOTE: If the IR file to be debugged is not on disk, use the version of this
108 /// function with parameters in order to generate the file that will be
109 /// seen by the debugger.
110 ModulePass *createDebugIRPass();
112 } // End llvm namespace