diff options
author | Devang Patel <dpatel@apple.com> | 2009-07-28 19:55:13 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2009-07-28 19:55:13 +0000 |
commit | d2f79a13463f8797fbffa0e5d577c5bddc9126fb (patch) | |
tree | 34e942a87e226446d96d0205b8e1bf888e082502 /include | |
parent | c3cc45aa8be036412726ccd02d8a6496652eac2b (diff) | |
download | external_llvm-d2f79a13463f8797fbffa0e5d577c5bddc9126fb.zip external_llvm-d2f79a13463f8797fbffa0e5d577c5bddc9126fb.tar.gz external_llvm-d2f79a13463f8797fbffa0e5d577c5bddc9126fb.tar.bz2 |
Add DebugInfoEnumerator to collect debug info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77360 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Analysis/DebugInfo.h | 53 |
1 files changed, 53 insertions, 0 deletions
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<GlobalVariable *, 8>::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<GlobalVariable *, 8> CUs; // Compile Units + SmallVector<GlobalVariable *, 8> SPs; // Subprograms + SmallVector<GlobalVariable *, 8> GVs; // Global Variables; + SmallPtrSet<GlobalVariable *, 64> NodesSeen; + + }; } // end namespace llvm #endif |