From: David Blaikie Date: Thu, 9 Jan 2014 03:23:41 +0000 (+0000) Subject: DwarfUnit: Rename "Node" to "CUNode" and propagate it through DwarfTypeUnit as well. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=2af945d2cd3ab79430d136cc2599d0b23592529f;p=oota-llvm.git DwarfUnit: Rename "Node" to "CUNode" and propagate it through DwarfTypeUnit as well. Since we'll now also need the split dwarf file name along with the language in DwarfTypeUnits, just use the whole DICompileUnit rather than explicitly handling each field needed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198842 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 7205f00b36d..72074cb9ad1 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -2938,12 +2938,12 @@ DwarfCompileUnit *DwarfDebug::constructSkeletonCU(const DwarfCompileUnit *CU) { DIE *Die = new DIE(dwarf::DW_TAG_compile_unit); DwarfCompileUnit *NewCU = new DwarfCompileUnit( - CU->getUniqueID(), Die, CU->getNode(), Asm, this, &SkeletonHolder); + CU->getUniqueID(), Die, CU->getCUNode(), Asm, this, &SkeletonHolder); NewCU->initSection(Asm->getObjFileLowering().getDwarfInfoSection(), DwarfInfoSectionSym); NewCU->addLocalString(Die, dwarf::DW_AT_GNU_dwo_name, - CU->getNode().getSplitDebugFilename()); + CU->getCUNode().getSplitDebugFilename()); // Relocate to the beginning of the addr_base section, else 0 for the // beginning of the one for this compile unit. @@ -2999,19 +2999,20 @@ void DwarfDebug::emitDebugStrDWO() { OffSec, StrSym); } -void DwarfDebug::addDwarfTypeUnitType(uint16_t Language, StringRef Identifier, - DIE *RefDie, DICompositeType CTy) { +void DwarfDebug::addDwarfTypeUnitType(DICompileUnit CUNode, + StringRef Identifier, DIE *RefDie, + DICompositeType CTy) { const DwarfTypeUnit *&TU = DwarfTypeUnits[CTy]; if (!TU) { DIE *UnitDie = new DIE(dwarf::DW_TAG_type_unit); DwarfTypeUnit *NewTU = - new DwarfTypeUnit(InfoHolder.getUnits().size(), UnitDie, Language, Asm, + new DwarfTypeUnit(InfoHolder.getUnits().size(), UnitDie, CUNode, Asm, this, &InfoHolder); TU = NewTU; InfoHolder.addUnit(NewTU); NewTU->addUInt(UnitDie, dwarf::DW_AT_language, dwarf::DW_FORM_data2, - Language); + CUNode.getLanguage()); DIE *Die = NewTU->createTypeDIE(CTy); diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.h b/lib/CodeGen/AsmPrinter/DwarfDebug.h index 84d9cae7a1d..b0a6894bfa8 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.h +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.h @@ -695,8 +695,8 @@ public: /// \brief Add a DIE to the set of types that we're going to pull into /// type units. - void addDwarfTypeUnitType(uint16_t Language, StringRef Identifier, DIE *Die, - DICompositeType CTy); + void addDwarfTypeUnitType(DICompileUnit CUNode, StringRef Identifier, + DIE *Die, DICompositeType CTy); /// \brief Add a label so that arange data can be generated for it. void addArangeLabel(SymbolCU SCU) { ArangeLabels.push_back(SCU); } diff --git a/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfUnit.cpp index 8df9c3b05cd..b066c95fe9b 100644 --- a/lib/CodeGen/AsmPrinter/DwarfUnit.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfUnit.cpp @@ -42,8 +42,8 @@ GenerateDwarfTypeUnits("generate-type-units", cl::Hidden, /// Unit - Unit constructor. DwarfUnit::DwarfUnit(unsigned UID, DIE *D, DICompileUnit Node, AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU) - : UniqueID(UID), Node(Node), UnitDie(D), DebugInfoOffset(0), Asm(A), DD(DW), - DU(DWU), IndexTyDie(0), Section(0), Skeleton(0) { + : UniqueID(UID), CUNode(Node), UnitDie(D), DebugInfoOffset(0), Asm(A), + DD(DW), DU(DWU), IndexTyDie(0), Section(0), Skeleton(0) { DIEIntegerOne = new (DIEValueAllocator) DIEInteger(1); } @@ -54,9 +54,9 @@ DwarfCompileUnit::DwarfCompileUnit(unsigned UID, DIE *D, DICompileUnit Node, insertDIE(Node, D); } -DwarfTypeUnit::DwarfTypeUnit(unsigned UID, DIE *D, uint16_t Language, +DwarfTypeUnit::DwarfTypeUnit(unsigned UID, DIE *D, DICompileUnit CUNode, AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU) - : DwarfUnit(UID, D, DICompileUnit(), A, DW, DWU), Language(Language) {} + : DwarfUnit(UID, D, CUNode, A, DW, DWU) {} /// ~Unit - Destructor for compile unit. DwarfUnit::~DwarfUnit() { @@ -956,8 +956,7 @@ DIE *DwarfUnit::getOrCreateTypeDIE(const MDNode *TyNode) { DICompositeType CTy(Ty); if (GenerateDwarfTypeUnits && !Ty.isForwardDecl()) if (MDString *TypeId = CTy.getIdentifier()) { - DD->addDwarfTypeUnitType(getLanguage(), TypeId->getString(), TyDIE, - CTy); + DD->addDwarfTypeUnitType(getCUNode(), TypeId->getString(), TyDIE, CTy); // Skip updating the accellerator tables since this is not the full type return TyDIE; } diff --git a/lib/CodeGen/AsmPrinter/DwarfUnit.h b/lib/CodeGen/AsmPrinter/DwarfUnit.h index 524cdc1b59f..3f42e2f6728 100644 --- a/lib/CodeGen/AsmPrinter/DwarfUnit.h +++ b/lib/CodeGen/AsmPrinter/DwarfUnit.h @@ -66,7 +66,7 @@ protected: unsigned UniqueID; /// Node - MDNode for the compile unit. - DICompileUnit Node; + DICompileUnit CUNode; /// Unit debug information entry. const OwningPtr UnitDie; @@ -218,8 +218,8 @@ public: // Accessors. unsigned getUniqueID() const { return UniqueID; } - virtual uint16_t getLanguage() const = 0; - DICompileUnit getNode() const { return Node; } + uint16_t getLanguage() const { return CUNode.getLanguage(); } + DICompileUnit getCUNode() const { return CUNode; } DIE *getUnitDie() const { return UnitDie.get(); } const StringMap &getGlobalNames() const { return GlobalNames; } const StringMap &getGlobalTypes() const { return GlobalTypes; } @@ -545,18 +545,15 @@ public: /// addLabelAddress - Add a dwarf label attribute data and value using /// either DW_FORM_addr or DW_FORM_GNU_addr_index. void addLabelAddress(DIE *Die, dwarf::Attribute Attribute, MCSymbol *Label); - - uint16_t getLanguage() const LLVM_OVERRIDE { return getNode().getLanguage(); } }; class DwarfTypeUnit : public DwarfUnit { private: - uint16_t Language; uint64_t TypeSignature; const DIE *Ty; public: - DwarfTypeUnit(unsigned UID, DIE *D, uint16_t Language, AsmPrinter *A, + DwarfTypeUnit(unsigned UID, DIE *D, DICompileUnit CUNode, AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU); virtual ~DwarfTypeUnit() LLVM_OVERRIDE; @@ -564,7 +561,6 @@ public: uint64_t getTypeSignature() const { return TypeSignature; } void setType(const DIE *Ty) { this->Ty = Ty; } - uint16_t getLanguage() const LLVM_OVERRIDE { return Language; } /// Emit the header for this unit, not including the initial length field. void emitHeader(const MCSection *ASection, const MCSymbol *ASectionSym) const LLVM_OVERRIDE;