From c8a310edc140807ad9ab51c0f4e519c574eca9a6 Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Mon, 10 Dec 2012 23:34:43 +0000 Subject: 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 --- llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h | 40 +++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h') 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 *AbbreviationsSet; + + // A list of all the unique abbreviations in use. + std::vector *Abbreviations; + + // A pointer to all units in the section. + SmallVector CUs; + +public: + DwarfUnits(AsmPrinter *AP, FoldingSet *AS, + std::vector *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. -- cgit v1.2.3