[PATCH] D41364: move UseDwarfRangesBaseAddressSpecifier to front end flag

Modupe Theko Lekena via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 18 11:28:02 PST 2017


mlekena created this revision.
mlekena added reviewers: aprantl, probinson, thakis, dblaikie, echristo.
Herald added a subscriber: JDevlieghere.

Merge branch 'master' of https://git.llvm.org/git/llvm

Move UseDwarfRangesBaseAddressSpecifier handling to the MC options command line argument.
This is a change to make the flag more accessible without needing to pass in arguments directly to the 
LLVM backend.

Following this change, what would be a better name for this flag given that the
current name is rather verbose? Are there any opinions around this?


https://reviews.llvm.org/D41364

Files:
  include/llvm/MC/MCTargetOptions.h
  lib/CodeGen/AsmPrinter/DwarfDebug.cpp
  test/DebugInfo/X86/range_reloc.ll
  tools/llc/llc.cpp


Index: tools/llc/llc.cpp
===================================================================
--- tools/llc/llc.cpp
+++ tools/llc/llc.cpp
@@ -166,6 +166,10 @@
 
 static int compileModule(char **, LLVMContext &);
 
+static cl::opt<bool> UseDwarfRangesBaseAddressSpecifier(
+    "use-dwarf-ranges-base-address-specifier", cl::Hidden,
+    cl::desc("Use base address specifiers in debug_ranges"), cl::init(false));
+
 static std::unique_ptr<ToolOutputFile> GetOutputStream(const char *TargetName,
                                                        Triple::OSType OS,
                                                        const char *ProgName) {
@@ -451,6 +455,7 @@
   Options.MCOptions.PreserveAsmComments = PreserveComments;
   Options.MCOptions.IASSearchPaths = IncludeDirs;
   Options.MCOptions.SplitDwarfFile = SplitDwarfFile;
+  Options.MCOptions.UseDwarfRangesBaseAddressSpecifier = UseDwarfRangesBaseAddressSpecifier;
 
   std::unique_ptr<TargetMachine> Target(TheTarget->createTargetMachine(
       TheTriple.getTriple(), CPUStr, FeaturesStr, Options, getRelocModel(),
Index: test/DebugInfo/X86/range_reloc.ll
===================================================================
--- test/DebugInfo/X86/range_reloc.ll
+++ test/DebugInfo/X86/range_reloc.ll
@@ -1,4 +1,4 @@
-; RUN: llc -filetype=asm -mtriple=x86_64-pc-linux-gnu %s -o - -use-dwarf-ranges-base-address-specifier | FileCheck --check-prefix=COMMON --check-prefix=BASE %s
+; RUN: llc -filetype=asm -mtriple=x86_64-pc-linux-gnu -use-dwarf-ranges-base-address-specifier %s -o  - | FileCheck --check-prefix=COMMON --check-prefix=BASE %s
 ; RUN: llc -filetype=asm -mtriple=x86_64-pc-linux-gnu %s -o - | FileCheck --check-prefix=COMMON --check-prefix=NOBASE %s
 
 ; Group ranges in a range list that apply to the same section and use a base
Index: lib/CodeGen/AsmPrinter/DwarfDebug.cpp
===================================================================
--- lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -85,9 +85,9 @@
 DisableDebugInfoPrinting("disable-debug-info-print", cl::Hidden,
                          cl::desc("Disable debug info printing"));
 
-static cl::opt<bool> UseDwarfRangesBaseAddressSpecifier(
-    "use-dwarf-ranges-base-address-specifier", cl::Hidden,
-    cl::desc("Use base address specifiers in debug_ranges"), cl::init(false));
+// static cl::opt<bool> UseDwarfRangesBaseAddressSpecifier(
+//     "use-dwarf-ranges-base-address-specifier", cl::Hidden,
+//     cl::desc("Use base address specifiers in debug_ranges"), cl::init(false));
 
 static cl::opt<bool> GenerateARangeSection("generate-arange-section",
                                            cl::Hidden,
@@ -1909,7 +1909,7 @@
         // contrubutions.
         auto *Base = CUBase;
         if (!Base && P.second.size() > 1 &&
-            UseDwarfRangesBaseAddressSpecifier) {
+            Asm->TM.Options.MCOptions.UseDwarfRangesBaseAddressSpecifier) { //UseDwarfRangesBaseAddressSpecifier) {
           BaseIsSet = true;
           // FIXME/use care: This may not be a useful base address if it's not
           // the lowest address/range in this object.
Index: include/llvm/MC/MCTargetOptions.h
===================================================================
--- include/llvm/MC/MCTargetOptions.h
+++ include/llvm/MC/MCTargetOptions.h
@@ -62,6 +62,9 @@
   std::string ABIName;
   std::string SplitDwarfFile;
 
+  /// Enable base address specification in dwarf ranges 
+  bool UseDwarfRangesBaseAddressSpecifier;
+
   /// Additional paths to search for `.include` directives when using the
   /// integrated assembler.
   std::vector<std::string> IASSearchPaths;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41364.127395.patch
Type: text/x-patch
Size: 3659 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171218/85dc7435/attachment.bin>


More information about the llvm-commits mailing list