From d2f79a13463f8797fbffa0e5d577c5bddc9126fb Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Tue, 28 Jul 2009 19:55:13 +0000 Subject: Add DebugInfoEnumerator to collect debug info. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77360 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Analysis/DebugInfo.h | 53 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'include') diff --git a/include/llvm/Analysis/DebugInfo.h b/include/llvm/Analysis/DebugInfo.h index b8e4c6c..4e511eb 100644 --- a/include/llvm/Analysis/DebugInfo.h +++ b/include/llvm/Analysis/DebugInfo.h @@ -21,6 +21,7 @@ #include "llvm/ADT/StringMap.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/SmallPtrSet.h" #include "llvm/Support/Dwarf.h" namespace llvm { @@ -609,6 +610,58 @@ namespace llvm { /// isInlinedFnEnd - Return true if REI is ending an inlined function. bool isInlinedFnEnd(DbgRegionEndInst &REI, const Function *CurrentFn); + /// DebugInfoEnumrator - This object collects DebugInfo from + /// the module. + class DebugInfoEnumerator { + + public: + /// EnumerateModule - Enumerate entire module and collect debug info + /// anchors. + void enumerateModule(Module &M); + + private: + /// enumerateType - Enumerate DIType. + /// for a type. + void enumerateType(DIType DT); + + /// enumerateSubprogram - Enumberate DISubprogram. + void enumerateSubprogram(DISubprogram SP); + + /// enumerateStopPoint - Enumerate DbgStopPointInst. + void enumerateStopPoint(DbgStopPointInst *SPI); + + /// enumerateFuncStart - Enumberate DbgFuncStartInst. + void enumerateFuncStart(DbgFuncStartInst *FSI); + + /// addCompileUnit - Add compile unit into CUs. + bool addCompileUnit(DICompileUnit CU); + + /// addGlobalVariable - Add global variable into GVs. + bool addGlobalVariable(DIGlobalVariable DIG); + + // addSubprogram - Add subprgoram into SPs. + bool addSubprogram(DISubprogram SP); + + public: + typedef SmallVector::iterator iterator; + iterator compile_unit_begin() { return CUs.begin(); } + iterator compile_unit_end() { return CUs.end(); } + iterator subprogram_begin() { return SPs.begin(); } + iterator subprogram_end() { return SPs.end(); } + iterator global_variable_begin() { return GVs.begin(); } + iterator global_variable_end() { return GVs.end(); } + + unsigned compile_unit_count() { return CUs.size(); } + unsigned global_variable_count() { return GVs.size(); } + unsigned subprogram_count() { return SPs.size(); } + + private: + SmallVector CUs; // Compile Units + SmallVector SPs; // Subprograms + SmallVector GVs; // Global Variables; + SmallPtrSet NodesSeen; + + }; } // end namespace llvm #endif -- cgit v1.1