[llvm] r194875 - DwarfCompileUnit: Push DIDescriptors through a getDIE/insertDIE

David Blaikie dblaikie at gmail.com
Fri Nov 15 15:09:13 PST 2013


Author: dblaikie
Date: Fri Nov 15 17:09:13 2013
New Revision: 194875

URL: http://llvm.org/viewvc/llvm-project?rev=194875&view=rev
Log:
DwarfCompileUnit: Push DIDescriptors through a getDIE/insertDIE

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

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=194875&r1=194874&r2=194875&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Fri Nov 15 17:09:13 2013
@@ -38,7 +38,7 @@ CompileUnit::CompileUnit(unsigned UID, D
     : UniqueID(UID), Node(N), CUDie(D), Asm(A), DD(DW), DU(DWU), IndexTyDie(0),
       DebugInfoOffset(0) {
   DIEIntegerOne = new (DIEValueAllocator) DIEInteger(1);
-  insertDIE(N, D);
+  insertDIE(DIDescriptor(N), D);
 }
 
 /// ~CompileUnit - Destructor for compile unit.
@@ -110,21 +110,21 @@ static bool isShareableAcrossCUs(DIDescr
 /// specified debug variable. We delegate the request to DwarfDebug
 /// when the DIE for this MDNode can be shared across CUs. The mappings
 /// will be kept in DwarfDebug for shareable DIEs.
-DIE *CompileUnit::getDIE(const MDNode *N) const {
-  if (isShareableAcrossCUs(DIDescriptor(N)))
-    return DD->getDIE(N);
-  return MDNodeToDieMap.lookup(N);
+DIE *CompileUnit::getDIE(DIDescriptor D) const {
+  if (isShareableAcrossCUs(D))
+    return DD->getDIE(D);
+  return MDNodeToDieMap.lookup(D);
 }
 
 /// insertDIE - Insert DIE into the map. We delegate the request to DwarfDebug
 /// when the DIE for this MDNode can be shared across CUs. The mappings
 /// will be kept in DwarfDebug for shareable DIEs.
-void CompileUnit::insertDIE(const MDNode *N, DIE *D) {
-  if (isShareableAcrossCUs(DIDescriptor(N))) {
-    DD->insertDIE(N, D);
+void CompileUnit::insertDIE(DIDescriptor Desc, DIE *D) {
+  if (isShareableAcrossCUs(Desc)) {
+    DD->insertDIE(Desc, D);
     return;
   }
-  MDNodeToDieMap.insert(std::make_pair(N, D));
+  MDNodeToDieMap.insert(std::make_pair(Desc, D));
 }
 
 /// addFlag - Add a flag that is true.
@@ -300,7 +300,7 @@ DIE *CompileUnit::createAndAddDIE(unsign
   DIE *Die = new DIE(Tag);
   Parent.addChild(Die);
   if (MD)
-    insertDIE(MD, Die);
+    insertDIE(DIDescriptor(MD), Die);
   return Die;
 }
 
@@ -1512,11 +1512,12 @@ static const ConstantExpr *getMergedGlob
 
 /// createGlobalVariableDIE - create global variable DIE.
 void CompileUnit::createGlobalVariableDIE(const MDNode *N) {
+  DIGlobalVariable GV(N);
+
   // Check for pre-existence.
-  if (getDIE(N))
+  if (getDIE(GV))
     return;
 
-  DIGlobalVariable GV(N);
   if (!GV.isGlobalVariable())
     return;
 
@@ -1735,10 +1736,10 @@ void CompileUnit::constructContainingTyp
                                                  CE = ContainingTypeMap.end();
        CI != CE; ++CI) {
     DIE *SPDie = CI->first;
-    const MDNode *N = CI->second;
-    if (!N)
+    DIDescriptor D(CI->second);
+    if (!D)
       continue;
-    DIE *NDie = getDIE(N);
+    DIE *NDie = getDIE(D);
     if (!NDie)
       continue;
     addDIEEntry(SPDie, dwarf::DW_AT_containing_type, NDie);
@@ -1904,7 +1905,7 @@ void CompileUnit::constructMemberDIE(DIE
 }
 
 /// getOrCreateStaticMemberDIE - Create new DIE for C++ static member.
-DIE *CompileUnit::getOrCreateStaticMemberDIE(const DIDerivedType DT) {
+DIE *CompileUnit::getOrCreateStaticMemberDIE(DIDerivedType DT) {
   if (!DT.Verify())
     return NULL;
 

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h?rev=194875&r1=194874&r2=194875&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h Fri Nov 15 17:09:13 2013
@@ -159,7 +159,7 @@ public:
   /// when the MDNode can be part of the type system, since DIEs for
   /// the type system can be shared across CUs and the mappings are
   /// kept in DwarfDebug.
-  DIE *getDIE(const MDNode *N) const;
+  DIE *getDIE(DIDescriptor D) const;
 
   DIEBlock *getDIEBlock() { return new (DIEValueAllocator) DIEBlock(); }
 
@@ -167,7 +167,7 @@ public:
   /// when the MDNode can be part of the type system, since DIEs for
   /// the type system can be shared across CUs and the mappings are
   /// kept in DwarfDebug.
-  void insertDIE(const MDNode *N, DIE *D);
+  void insertDIE(DIDescriptor Desc, DIE *D);
 
   /// addDie - Adds or interns the DIE to the compile unit.
   ///

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=194875&r1=194874&r2=194875&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Fri Nov 15 17:09:13 2013
@@ -368,7 +368,7 @@ bool DwarfDebug::isSubprogramContext(con
 // scope then create and insert DIEs for these variables.
 DIE *DwarfDebug::updateSubprogramScopeDIE(CompileUnit *SPCU,
                                           const MDNode *SPNode) {
-  DIE *SPDie = SPCU->getDIE(SPNode);
+  DIE *SPDie = SPCU->getDIE(DIDescriptor(SPNode));
 
   assert(SPDie && "Unable to find subprogram DIE!");
   DISubprogram SP(SPNode);





More information about the llvm-commits mailing list