[llvm] r198842 - DwarfUnit: Rename "Node" to "CUNode" and propagate it through DwarfTypeUnit as well.

David Blaikie dblaikie at gmail.com
Wed Jan 8 19:23:41 PST 2014


Author: dblaikie
Date: Wed Jan  8 21:23:41 2014
New Revision: 198842

URL: http://llvm.org/viewvc/llvm-project?rev=198842&view=rev
Log:
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.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=198842&r1=198841&r2=198842&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Jan  8 21:23:41 2014
@@ -2938,12 +2938,12 @@ DwarfCompileUnit *DwarfDebug::constructS
 
   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);
 

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=198842&r1=198841&r2=198842&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Wed Jan  8 21:23:41 2014
@@ -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); }

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp?rev=198842&r1=198841&r2=198842&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp Wed Jan  8 21:23:41 2014
@@ -42,8 +42,8 @@ GenerateDwarfTypeUnits("generate-type-un
 /// 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(unsig
   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
     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;
       }

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h?rev=198842&r1=198841&r2=198842&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h Wed Jan  8 21:23:41 2014
@@ -66,7 +66,7 @@ protected:
   unsigned UniqueID;
 
   /// Node - MDNode for the compile unit.
-  DICompileUnit Node;
+  DICompileUnit CUNode;
 
   /// Unit debug information entry.
   const OwningPtr<DIE> 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<const DIE *> &getGlobalNames() const { return GlobalNames; }
   const StringMap<const DIE *> &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;





More information about the llvm-commits mailing list