diff options
author | Eric Christopher <echristo@gmail.com> | 2012-12-10 23:34:43 +0000 |
---|---|---|
committer | Eric Christopher <echristo@gmail.com> | 2012-12-10 23:34:43 +0000 |
commit | c8a310edc140807ad9ab51c0f4e519c574eca9a6 (patch) | |
tree | da7fc34aff930cbb649dc46ba5161ee1e4e8c010 /llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h | |
parent | e6a6d9ae07540e99bed9abd28690579ef6116855 (diff) | |
download | bcm5719-llvm-c8a310edc140807ad9ab51c0f4e519c574eca9a6.tar.gz bcm5719-llvm-c8a310edc140807ad9ab51c0f4e519c574eca9a6.zip |
Refactor out the abbreviation handling into a separate class that
controls each of the abbreviation sets (only a single one at the
moment) and computes offsets separately as well for each set
of DIEs.
No real function change, ordering of abbreviations for the skeleton
CU changed but only because we're computing in a separate order. Fix
the testcase not to care.
llvm-svn: 169793
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h index 23f95e3cb69..9ddefee8e70 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h @@ -188,6 +188,39 @@ public: DIType getType() const; }; +/// \brief Collects and handles information specific to a particular +/// collection of units. +class DwarfUnits { + // Target of Dwarf emission, used for sizing of abbreviations. + AsmPrinter *Asm; + + // Used to uniquely define abbreviations. + FoldingSet<DIEAbbrev> *AbbreviationsSet; + + // A list of all the unique abbreviations in use. + std::vector<DIEAbbrev *> *Abbreviations; + + // A pointer to all units in the section. + SmallVector<CompileUnit *, 1> CUs; + +public: + DwarfUnits(AsmPrinter *AP, FoldingSet<DIEAbbrev> *AS, + std::vector<DIEAbbrev *> *A) : + Asm(AP), AbbreviationsSet(AS), Abbreviations(A) {} + + /// \brief Compute the size and offset of a DIE given an incoming Offset. + unsigned computeSizeAndOffset(DIE *Die, unsigned Offset); + + /// \brief Compute the size and offset of all the DIEs. + void computeSizeAndOffsets(); + + /// \brief Define a unique number for the abbreviation. + void assignAbbrevNumber(DIEAbbrev &Abbrev); + + /// \brief Add a unit to the list of CUs. + void addUnit(CompileUnit *CU) { CUs.push_back(CU); } +}; + /// \brief Collects and handles dwarf debug information. class DwarfDebug { // Target of Dwarf emission. @@ -312,6 +345,9 @@ class DwarfDebug { // Counter for assigning globally unique IDs for CUs. unsigned GlobalCUIndexCount; + // Holder for the file specific debug information. + DwarfUnits InfoHolder; + // Holders for the various debug information flags that we might need to // have exposed. See accessor functions below for description. @@ -329,12 +365,10 @@ class DwarfDebug { // The CU left in the original object file for Fission debug info. CompileUnit *SkeletonCU; + DwarfUnits SkeletonHolder; private: - /// \brief Define a unique number for the abbreviation. - void assignAbbrevNumber(DIEAbbrev &Abbrev); - void addScopeVariable(LexicalScope *LS, DbgVariable *Var); /// \brief Find abstract variable associated with Var. |