Home | History | Annotate | Download | only in Transforms
      1 //===- Transforms/Instrumentation.h - Instrumentation passes ----*- C++ -*-===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 //
     10 // This file defines constructor functions for instrumentation passes.
     11 //
     12 //===----------------------------------------------------------------------===//
     13 
     14 #ifndef LLVM_TRANSFORMS_INSTRUMENTATION_H
     15 #define LLVM_TRANSFORMS_INSTRUMENTATION_H
     16 
     17 #include "llvm/ADT/StringRef.h"
     18 
     19 namespace llvm {
     20 
     21 class ModulePass;
     22 class FunctionPass;
     23 
     24 // Insert edge profiling instrumentation
     25 ModulePass *createEdgeProfilerPass();
     26 
     27 // Insert optimal edge profiling instrumentation
     28 ModulePass *createOptimalEdgeProfilerPass();
     29 
     30 // Insert path profiling instrumentation
     31 ModulePass *createPathProfilerPass();
     32 
     33 // Insert GCOV profiling instrumentation
     34 struct GCOVOptions {
     35   static GCOVOptions getDefault();
     36 
     37   // Specify whether to emit .gcno files.
     38   bool EmitNotes;
     39 
     40   // Specify whether to modify the program to emit .gcda files when run.
     41   bool EmitData;
     42 
     43   // A four-byte version string. The meaning of a version string is described in
     44   // gcc's gcov-io.h
     45   char Version[4];
     46 
     47   // Emit a "cfg checksum" that follows the "line number checksum" of a
     48   // function. This affects both .gcno and .gcda files.
     49   bool UseCfgChecksum;
     50 
     51   // Add the 'noredzone' attribute to added runtime library calls.
     52   bool NoRedZone;
     53 
     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;
     57 };
     58 ModulePass *createGCOVProfilerPass(const GCOVOptions &Options =
     59                                    GCOVOptions::getDefault());
     60 
     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);
     69 
     70 // Insert MemorySanitizer instrumentation (detection of uninitialized reads)
     71 FunctionPass *createMemorySanitizerPass(bool TrackOrigins = false,
     72                                         StringRef BlacklistFile = StringRef());
     73 
     74 // Insert ThreadSanitizer (race detection) instrumentation
     75 FunctionPass *createThreadSanitizerPass(StringRef BlacklistFile = StringRef());
     76 
     77 // BoundsChecking - This pass instruments the code to perform run-time bounds
     78 // checking on loads, stores, and other memory intrinsics.
     79 FunctionPass *createBoundsCheckingPass();
     80 
     81 } // End llvm namespace
     82 
     83 #endif
     84