[llvm-commits] [llvm] r104785 - in /llvm/trunk: lib/CodeGen/AsmPrinter/DwarfDebug.cpp test/CodeGen/X86/2010-05-26-DotDebugLoc.ll test/DebugInfo/2010-05-25-DotDebugLoc.ll

Devang Patel dpatel at apple.com
Wed May 26 16:55:23 PDT 2010


Author: dpatel
Date: Wed May 26 18:55:23 2010
New Revision: 104785

URL: http://llvm.org/viewvc/llvm-project?rev=104785&view=rev
Log:
Simplify. Eliminate unneeded debug_loc entry.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
    llvm/trunk/test/CodeGen/X86/2010-05-26-DotDebugLoc.ll
    llvm/trunk/test/DebugInfo/2010-05-25-DotDebugLoc.ll

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=104785&r1=104784&r2=104785&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed May 26 18:55:23 2010
@@ -2210,9 +2210,10 @@
     }
 
     // handle multiple DBG_VALUE instructions describing one variable.
-    RegVar->setDotDebugLocOffset(DotDebugLocEntries.size());
     if (DotDebugLocEntries.empty())
-      DotDebugLocEntries.push_back(DotDebugLocEntry());
+      RegVar->setDotDebugLocOffset(0);
+    else
+      RegVar->setDotDebugLocOffset(DotDebugLocEntries.size());
     const MachineInstr *Begin = NULL;
     const MachineInstr *End = NULL;
     for (SmallVector<const MachineInstr *, 4>::iterator 
@@ -3481,23 +3482,22 @@
 /// emitDebugLoc - Emit visible names into a debug loc section.
 ///
 void DwarfDebug::emitDebugLoc() {
+  if (DotDebugLocEntries.empty())
+    return;
+
   // Start the dwarf loc section.
   Asm->OutStreamer.SwitchSection(
     Asm->getObjFileLowering().getDwarfLocSection());
   unsigned char Size = Asm->getTargetData().getPointerSize();
-  unsigned index = 0;
-  bool needMarker = true;
+  Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("debug_loc", 0));
+  unsigned index = 1;
   for (SmallVector<DotDebugLocEntry, 4>::iterator I = DotDebugLocEntries.begin(),
          E = DotDebugLocEntries.end(); I != E; ++I, ++index) {
     DotDebugLocEntry Entry = *I;
-    if (needMarker) {
-      Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("debug_loc", index));
-      needMarker = false;
-    }
     if (Entry.isEmpty()) {
       Asm->OutStreamer.EmitIntValue(0, Size, /*addrspace*/0);
       Asm->OutStreamer.EmitIntValue(0, Size, /*addrspace*/0);
-      needMarker = true;
+      Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("debug_loc", index));
     } else {
       Asm->OutStreamer.EmitSymbolValue(Entry.Begin, Size, 0);
       Asm->OutStreamer.EmitSymbolValue(Entry.End, Size, 0);

Modified: llvm/trunk/test/CodeGen/X86/2010-05-26-DotDebugLoc.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2010-05-26-DotDebugLoc.ll?rev=104785&r1=104784&r2=104785&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/2010-05-26-DotDebugLoc.ll (original)
+++ llvm/trunk/test/CodeGen/X86/2010-05-26-DotDebugLoc.ll Wed May 26 18:55:23 2010
@@ -55,7 +55,7 @@
 !29 = metadata !{i32 524299, metadata !9, i32 17, i32 0} ; [ DW_TAG_lexical_block ]
 !30 = metadata !{i32 19, i32 0, metadata !29, null}
 
-; CHECK: Ldebug_loc1
+; CHECK: Ldebug_loc0:
 ; CHECK-NEXT: .quad   Lfunc_begin0
 ; CHECK-NEXT: .quad   Ltmp3
 ; CHECK-NEXT: .short  1

Modified: llvm/trunk/test/DebugInfo/2010-05-25-DotDebugLoc.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/2010-05-25-DotDebugLoc.ll?rev=104785&r1=104784&r2=104785&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/2010-05-25-DotDebugLoc.ll (original)
+++ llvm/trunk/test/DebugInfo/2010-05-25-DotDebugLoc.ll Wed May 26 18:55:23 2010
@@ -1,5 +1,5 @@
-; RUN: llc -O2 < %s | grep debug_loc13
-; Test to check .debug_loc support. This test case emits 14 debug_loc entries.
+; RUN: llc -O2 < %s | grep debug_loc12
+; Test to check .debug_loc support. This test case emits 13 debug_loc entries.
 
 %0 = type { double }
 





More information about the llvm-commits mailing list