LLVM API Documentation

Instrumentation.h
Go to the documentation of this file.
00001 //===- Transforms/Instrumentation.h - Instrumentation passes ----*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file defines constructor functions for instrumentation passes.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef LLVM_TRANSFORMS_INSTRUMENTATION_H
00015 #define LLVM_TRANSFORMS_INSTRUMENTATION_H
00016 
00017 #include "llvm/ADT/StringRef.h"
00018 
00019 namespace llvm {
00020 
00021 class ModulePass;
00022 class FunctionPass;
00023 
00024 // Insert edge profiling instrumentation
00025 ModulePass *createEdgeProfilerPass();
00026 
00027 // Insert optimal edge profiling instrumentation
00028 ModulePass *createOptimalEdgeProfilerPass();
00029 
00030 // Insert path profiling instrumentation
00031 ModulePass *createPathProfilerPass();
00032 
00033 // Insert GCOV profiling instrumentation
00034 struct GCOVOptions {
00035   static GCOVOptions getDefault();
00036 
00037   // Specify whether to emit .gcno files.
00038   bool EmitNotes;
00039 
00040   // Specify whether to modify the program to emit .gcda files when run.
00041   bool EmitData;
00042 
00043   // A four-byte version string. The meaning of a version string is described in
00044   // gcc's gcov-io.h
00045   char Version[4];
00046 
00047   // Emit a "cfg checksum" that follows the "line number checksum" of a
00048   // function. This affects both .gcno and .gcda files.
00049   bool UseCfgChecksum;
00050 
00051   // Add the 'noredzone' attribute to added runtime library calls.
00052   bool NoRedZone;
00053 
00054   // Emit the name of the function in the .gcda files. This is redundant, as
00055   // the function identifier can be used to find the name from the .gcno file.
00056   bool FunctionNamesInData;
00057 };
00058 ModulePass *createGCOVProfilerPass(const GCOVOptions &Options =
00059                                    GCOVOptions::getDefault());
00060 
00061 // Insert AddressSanitizer (address sanity checking) instrumentation
00062 FunctionPass *createAddressSanitizerFunctionPass(
00063     bool CheckInitOrder = true, bool CheckUseAfterReturn = false,
00064     bool CheckLifetime = false, StringRef BlacklistFile = StringRef(),
00065     bool ZeroBaseShadow = false);
00066 ModulePass *createAddressSanitizerModulePass(
00067     bool CheckInitOrder = true, StringRef BlacklistFile = StringRef(),
00068     bool ZeroBaseShadow = false);
00069 
00070 // Insert MemorySanitizer instrumentation (detection of uninitialized reads)
00071 FunctionPass *createMemorySanitizerPass(bool TrackOrigins = false,
00072                                         StringRef BlacklistFile = StringRef());
00073 
00074 // Insert ThreadSanitizer (race detection) instrumentation
00075 FunctionPass *createThreadSanitizerPass(StringRef BlacklistFile = StringRef());
00076 
00077 // BoundsChecking - This pass instruments the code to perform run-time bounds
00078 // checking on loads, stores, and other memory intrinsics.
00079 FunctionPass *createBoundsCheckingPass();
00080 
00081 /// createDebugIRPass - Create and return a pass that modifies a module's
00082 /// debug metadata to point back to IR instead of the original source file
00083 ModulePass *createDebugIRPass(StringRef FilenamePostfix,
00084                               bool hideDebugIntrinsics = true,
00085                               bool hideDebugMetadata = true);
00086 
00087 } // End llvm namespace
00088 
00089 #endif