[llvm-commits] [llvm] r144354 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp

Eric Christopher echristo at apple.com
Thu Nov 10 17:55:22 PST 2011


Author: echristo
Date: Thu Nov 10 19:55:22 2011
New Revision: 144354

URL: http://llvm.org/viewvc/llvm-project?rev=144354&view=rev
Log:
If we have a DIE with an AT_specification use that instead of the normal
addr DIE when adding to the dwarf accelerator tables.

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

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=144354&r1=144353&r2=144354&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Thu Nov 10 19:55:22 2011
@@ -1095,6 +1095,7 @@
   addToContextOwner(VariableDIE, GVContext);
   // Add location.
   bool addToAccelTable = false;
+  DIE *VariableSpecDIE;
   if (isGlobalVariable) {
     addToAccelTable = true;
     DIEBlock *Block = new (DIEValueAllocator) DIEBlock();
@@ -1106,7 +1107,7 @@
     if (GVContext && GV.isDefinition() && !GVContext.isCompileUnit() &&
         !GVContext.isFile() && !isSubprogramContext(GVContext)) {
       // Create specification DIE.
-      DIE *VariableSpecDIE = new DIE(dwarf::DW_TAG_variable);
+      VariableSpecDIE = new DIE(dwarf::DW_TAG_variable);
       addDIEEntry(VariableSpecDIE, dwarf::DW_AT_specification,
                   dwarf::DW_FORM_ref4, VariableDIE);
       addBlock(VariableSpecDIE, dwarf::DW_AT_location, 0, Block);
@@ -1135,13 +1136,15 @@
     addBlock(VariableDIE, dwarf::DW_AT_location, 0, Block);
   }
 
-  if (addToAccelTable)
-    addAccelName(GV.getName(), VariableDIE);
-
-  // If the linkage name is different than the name, go ahead and output
-  // that as well into the name table.
-  if (GV.getLinkageName() != "" && GV.getName() != GV.getLinkageName())
-    addAccelName(GV.getLinkageName(), VariableDIE);
+  if (addToAccelTable) {
+    DIE *AddrDIE = VariableSpecDIE ? VariableSpecDIE : VariableDIE;
+    addAccelName(GV.getName(), AddrDIE);
+
+    // If the linkage name is different than the name, go ahead and output
+    // that as well into the name table.
+    if (GV.getLinkageName() != "" && GV.getName() != GV.getLinkageName())
+      addAccelName(GV.getLinkageName(), AddrDIE);
+  }
 
   return;
 }





More information about the llvm-commits mailing list