1 //===-- DebugInfoProbe.h - DebugInfo Probe ----------------------*- 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 a probe, DebugInfoProbe, that can be used by pass 11 // manager to analyze how optimizer is treating debugging information. 12 // 13 //===----------------------------------------------------------------------===// 14 15 #ifndef LLVM_TRANSFORMS_UTILS_DEBUGINFOPROBE_H 16 #define LLVM_TRANSFORMS_UTILS_DEBUGINFOPROBE_H 17 18 #include "llvm/ADT/StringMap.h" 19 20 namespace llvm { 21 class Function; 22 class Pass; 23 class DebugInfoProbeImpl; 24 25 /// DebugInfoProbe - This class provides a interface to monitor 26 /// how an optimization pass is preserving debugging information. 27 class DebugInfoProbe { 28 public: 29 DebugInfoProbe(); 30 ~DebugInfoProbe(); 31 32 /// initialize - Collect information before running an optimization pass. 33 void initialize(StringRef PName, Function &F); 34 35 /// finalize - Collect information after running an optimization pass. This 36 /// must be used after initialization. 37 void finalize(Function &F); 38 39 /// report - Report findings. This should be invoked after finalize. 40 void report(); 41 42 private: 43 DebugInfoProbeImpl *pImpl; 44 }; 45 46 /// DebugInfoProbeInfo - This class provides an interface that a pass manager 47 /// can use to manage debug info probes. 48 class DebugInfoProbeInfo { 49 StringMap<DebugInfoProbe *> Probes; 50 public: DebugInfoProbeInfo()51 DebugInfoProbeInfo() {} 52 53 /// ~DebugInfoProbeInfo - Report data collected by all probes before deleting 54 /// them. 55 ~DebugInfoProbeInfo(); 56 57 /// initialize - Collect information before running an optimization pass. 58 void initialize(Pass *P, Function &F); 59 60 /// finalize - Collect information after running an optimization pass. This 61 /// must be used after initialization. 62 void finalize(Pass *P, Function &F); 63 }; 64 65 } // End llvm namespace 66 67 #endif 68