[llvm-commits] [llvm] r162487 - in /llvm/trunk: lib/CodeGen/AsmPrinter/DwarfDebug.cpp lib/CodeGen/AsmPrinter/DwarfDebug.h test/DebugInfo/2010-04-13-PubType.ll

Eric Christopher echristo at apple.com
Thu Aug 23 15:36:40 PDT 2012


Author: echristo
Date: Thu Aug 23 17:36:40 2012
New Revision: 162487

URL: http://llvm.org/viewvc/llvm-project?rev=162487&view=rev
Log:
Turn these two options in to trinary state so that they can be
turned on and off separate from the platform if you're on darwin.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
    llvm/trunk/test/DebugInfo/2010-04-13-PubType.ll

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=162487&r1=162486&r2=162487&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Thu Aug 23 17:36:40 2012
@@ -54,13 +54,29 @@
      cl::desc("Make an absence of debug location information explicit."),
      cl::init(false));
 
-static cl::opt<bool> DwarfAccelTables("dwarf-accel-tables", cl::Hidden,
+namespace {
+  enum DefaultOnOff {
+    Default, Enable, Disable
+  };
+}
+
+static cl::opt<DefaultOnOff> DwarfAccelTables("dwarf-accel-tables", cl::Hidden,
      cl::desc("Output prototype dwarf accelerator tables."),
-     cl::init(false));
+     cl::values(
+                clEnumVal(Default, "Default for platform"),
+                clEnumVal(Enable, "Enabled"),
+                clEnumVal(Disable, "Disabled"),
+                clEnumValEnd),
+     cl::init(Default));
 
-static cl::opt<bool> DarwinGDBCompat("darwin-gdb-compat", cl::Hidden,
+static cl::opt<DefaultOnOff> DarwinGDBCompat("darwin-gdb-compat", cl::Hidden,
      cl::desc("Compatibility with Darwin gdb."),
-     cl::init(false));
+     cl::values(
+                clEnumVal(Default, "Default for platform"),
+                clEnumVal(Enable, "Enabled"),
+                clEnumVal(Disable, "Disabled"),
+                clEnumValEnd),
+     cl::init(Default));
 
 namespace {
   const char *DWARFGroupName = "DWARF Emission";
@@ -141,13 +157,23 @@
 
   // Turn on accelerator tables and older gdb compatibility
   // for Darwin.
-  if (Triple(M->getTargetTriple()).isOSDarwin()) {
-    DwarfAccelTables = true;
-    DarwinGDBCompat = true;
-  }
+  bool isDarwin = Triple(M->getTargetTriple()).isOSDarwin();
+  if (DarwinGDBCompat == Default) {
+    if (isDarwin)
+      isDarwinGDBCompat = true;
+    else
+      isDarwinGDBCompat = false;
+  } else
+    isDarwinGDBCompat = DarwinGDBCompat == Enable ? true : false;
+
+  if (DwarfAccelTables == Default) {
+    if (isDarwin)
+      hasDwarfAccelTables = true;
+    else
+      hasDwarfAccelTables = false;
+  } else
+    hasDwarfAccelTables = DwarfAccelTables == Enable ? true : false;
 
-  isDarwinGDBCompat = DarwinGDBCompat;
-  
   {
     NamedRegionTimer T(DbgTimerName, DWARFGroupName, TimePassesIsEnabled);
     beginModule(M);
@@ -826,7 +852,7 @@
   emitAbbreviations();
 
   // Emit info into the dwarf accelerator table sections.
-  if (DwarfAccelTables) {
+  if (useDwarfAccelTables()) {
     emitAccelNames();
     emitAccelObjC();
     emitAccelNamespaces();
@@ -836,7 +862,7 @@
   // Emit info into a debug pubtypes section.
   // TODO: When we don't need the option anymore we can
   // remove all of the code that adds to the table.
-  if (DarwinGDBCompat)
+  if (useDarwinGDBCompat())
     emitDebugPubTypes();
 
   // Emit info into a debug loc section.
@@ -855,7 +881,7 @@
   // TODO: When we don't need the option anymore we
   // can remove all of the code that this section
   // depends upon.
-  if (DarwinGDBCompat)
+  if (useDarwinGDBCompat())
     emitDebugInlineInfo();
 
   // Emit info into a debug str section.

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=162487&r1=162486&r2=162487&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Thu Aug 23 17:36:40 2012
@@ -309,7 +309,7 @@
 
   // A holder for the DarwinGDBCompat flag so that the compile unit can use it.
   bool isDarwinGDBCompat;
-
+  bool hasDwarfAccelTables;
 private:
 
   /// assignAbbrevNumber - Define a unique number for the abbreviation.
@@ -527,6 +527,7 @@
   /// useDarwinGDBCompat - returns whether or not to limit some of our debug
   /// output to the limitations of darwin gdb.
   bool useDarwinGDBCompat() { return isDarwinGDBCompat; }
+  bool useDwarfAccelTables() { return hasDwarfAccelTables; }
 };
 } // End of namespace llvm
 

Modified: llvm/trunk/test/DebugInfo/2010-04-13-PubType.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/2010-04-13-PubType.ll?rev=162487&r1=162486&r2=162487&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/2010-04-13-PubType.ll (original)
+++ llvm/trunk/test/DebugInfo/2010-04-13-PubType.ll Thu Aug 23 17:36:40 2012
@@ -1,4 +1,4 @@
-; RUN: llc -O0 -asm-verbose -darwin-gdb-compat -mtriple=x86_64-macosx < %s | FileCheck %s
+; RUN: llc -O0 -asm-verbose -mtriple=x86_64-macosx < %s | FileCheck %s
 ; CHECK-NOT: .asciz "X" ## External Name
 ; CHECK: .asciz "Y" ## External Name
 ; Test to check type with no definition is listed in pubtypes section.





More information about the llvm-commits mailing list