tberghammer created this revision.
tberghammer added a reviewer: echristo.
tberghammer added a subscriber: cfe-commits.

Add new compiler flag to enable the generation of dwarf accelerator tables

The dwarf accelerator tables already generated on darwin platforms. This CL 
ands a new flag to clang to make it possible to enable the generation of these 
tables on other platforms also.

Note: Currently the accelerator table generation code isn't working when split 
dwarf is enabled for several reasons (accelerator tables aren't copied to dwo 
file, they contain relocation entries for the .debug_str.dwo sections). These 
issues should be addressed separately.

http://reviews.llvm.org/D14354

Files:
  include/clang/Driver/Options.td
  lib/Driver/Tools.cpp

Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -3876,6 +3876,14 @@
     CmdArgs.push_back("-split-dwarf=Enable");
   }
 
+  // -gdwarf-accel-tables should turn on -g and enable the genereation of the
+  // dwarf acceleration tables in the backend.
+  if (Args.hasArg(options::OPT_gdwarf_accel_tables)) {
+    DebugInfoKind = CodeGenOptions::LimitedDebugInfo;
+    CmdArgs.push_back("-backend-option");
+    CmdArgs.push_back("-dwarf-accel-tables=Enable");
+  }
+
   // After we've dealt with all combinations of things that could
   // make DebugInfoKind be other than None or DebugLineTablesOnly,
   // figure out if we need to "upgrade" it to standalone debug info.
Index: include/clang/Driver/Options.td
===================================================================
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -1161,6 +1161,7 @@
 def gsplit_dwarf : Flag<["-"], "gsplit-dwarf">, Group<g_flags_Group>;
 def ggnu_pubnames : Flag<["-"], "ggnu-pubnames">, Group<g_flags_Group>;
 def gdwarf_aranges : Flag<["-"], "gdwarf-aranges">, Group<g_flags_Group>;
+def gdwarf_accel_tables : Flag<["-"], "gdwarf-accel-tables">, 
Group<g_flags_Group>;
 def gmodules : Flag <["-"], "gmodules">, Group<f_Group>,
   HelpText<"Generate debug info with external references to clang modules"
            " or precompiled headers">;


Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -3876,6 +3876,14 @@
     CmdArgs.push_back("-split-dwarf=Enable");
   }
 
+  // -gdwarf-accel-tables should turn on -g and enable the genereation of the
+  // dwarf acceleration tables in the backend.
+  if (Args.hasArg(options::OPT_gdwarf_accel_tables)) {
+    DebugInfoKind = CodeGenOptions::LimitedDebugInfo;
+    CmdArgs.push_back("-backend-option");
+    CmdArgs.push_back("-dwarf-accel-tables=Enable");
+  }
+
   // After we've dealt with all combinations of things that could
   // make DebugInfoKind be other than None or DebugLineTablesOnly,
   // figure out if we need to "upgrade" it to standalone debug info.
Index: include/clang/Driver/Options.td
===================================================================
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -1161,6 +1161,7 @@
 def gsplit_dwarf : Flag<["-"], "gsplit-dwarf">, Group<g_flags_Group>;
 def ggnu_pubnames : Flag<["-"], "ggnu-pubnames">, Group<g_flags_Group>;
 def gdwarf_aranges : Flag<["-"], "gdwarf-aranges">, Group<g_flags_Group>;
+def gdwarf_accel_tables : Flag<["-"], "gdwarf-accel-tables">, Group<g_flags_Group>;
 def gmodules : Flag <["-"], "gmodules">, Group<f_Group>,
   HelpText<"Generate debug info with external references to clang modules"
            " or precompiled headers">;
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to