summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2017-04-21 23:35:26 +0000
committerDavid Blaikie <dblaikie@gmail.com>2017-04-21 23:35:26 +0000
commit96b1ed50e879751637519b84a215255128b5dedd (patch)
treecec1a2012ed99922091255d7c343bda51dd6a1e6
parent5b4293c7d968e0ef43503599fa5fdb6c16801e79 (diff)
downloadbcm5719-llvm-96b1ed50e879751637519b84a215255128b5dedd.tar.gz
bcm5719-llvm-96b1ed50e879751637519b84a215255128b5dedd.zip
Move Split DWARF handling to an MC option/command line argument rather than using metadata
Since Split DWARF needs to name the actual .dwo file that is generated, it can't be known at the time the llvm::Module is produced as it may be merged with other Modules before the object is generated and that object may be generated with any name. By passing the Split DWARF file name when LLVM is producing object code the .dwo file name in the object file can match correctly. The support for Split DWARF for implicit modules remains the same - using metadata to store the dwo name and dwo id so that potentially multiple skeleton CUs referring to different dwo files can be generated from one llvm::Module. llvm-svn: 301062
-rw-r--r--llvm/include/llvm/MC/MCTargetOptions.h1
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp19
-rw-r--r--llvm/test/CodeGen/X86/dwarf-headers.ll8
-rw-r--r--llvm/test/DebugInfo/Generic/empty.ll2
-rw-r--r--llvm/test/DebugInfo/PowerPC/tls-fission.ll2
-rw-r--r--llvm/test/DebugInfo/X86/cu-ranges-odr.ll2
-rw-r--r--llvm/test/DebugInfo/X86/cu-ranges.ll4
-rw-r--r--llvm/test/DebugInfo/X86/dwarf-pubnames-split.ll2
-rw-r--r--llvm/test/DebugInfo/X86/empty.ll2
-rw-r--r--llvm/test/DebugInfo/X86/fission-cu.ll2
-rw-r--r--llvm/test/DebugInfo/X86/fission-hash.ll2
-rw-r--r--llvm/test/DebugInfo/X86/fission-inline.ll2
-rw-r--r--llvm/test/DebugInfo/X86/fission-no-inlining.ll2
-rw-r--r--llvm/test/DebugInfo/X86/fission-ranges.ll2
-rw-r--r--llvm/test/DebugInfo/X86/generate-odr-hash.ll2
-rw-r--r--llvm/test/DebugInfo/X86/sret.ll2
-rw-r--r--llvm/test/DebugInfo/X86/tls.ll2
-rw-r--r--llvm/test/DebugInfo/X86/type_units_with_addresses.ll4
-rw-r--r--llvm/tools/llc/llc.cpp6
19 files changed, 32 insertions, 36 deletions
diff --git a/llvm/include/llvm/MC/MCTargetOptions.h b/llvm/include/llvm/MC/MCTargetOptions.h
index 06f58d49803..ab027ab27a4 100644
--- a/llvm/include/llvm/MC/MCTargetOptions.h
+++ b/llvm/include/llvm/MC/MCTargetOptions.h
@@ -54,6 +54,7 @@ public:
int DwarfVersion = 0;
std::string ABIName;
+ std::string SplitDwarfFile;
/// Additional paths to search for `.include` directives when using the
/// integrated assembler.
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index d72656bcc58..6f442f5c317 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -91,14 +91,6 @@ DwarfAccelTables("dwarf-accel-tables", cl::Hidden,
cl::init(Default));
static cl::opt<DefaultOnOff>
-SplitDwarf("split-dwarf", cl::Hidden,
- cl::desc("Output DWARF5 split debug info."),
- cl::values(clEnumVal(Default, "Default for platform"),
- clEnumVal(Enable, "Enabled"),
- clEnumVal(Disable, "Disabled")),
- cl::init(Default));
-
-static cl::opt<DefaultOnOff>
DwarfPubSections("generate-dwarf-pub-sections", cl::Hidden,
cl::desc("Generate DWARF pubnames and pubtypes sections"),
cl::values(clEnumVal(Default, "Default for platform"),
@@ -253,11 +245,8 @@ DwarfDebug::DwarfDebug(AsmPrinter *A, Module *M)
HasAppleExtensionAttributes = tuneForLLDB();
- // Handle split DWARF. Off by default for now.
- if (SplitDwarf == Default)
- HasSplitDwarf = false;
- else
- HasSplitDwarf = SplitDwarf == Enable;
+ // Handle split DWARF.
+ HasSplitDwarf = !Asm->TM.Options.MCOptions.SplitDwarfFile.empty();
// Pubnames/pubtypes on by default for GDB.
if (DwarfPubSections == Default)
@@ -412,7 +401,7 @@ DwarfDebug::constructDwarfCompileUnit(const DICompileUnit *DIUnit) {
if (useSplitDwarf()) {
NewCU.setSkeleton(constructSkeletonCU(NewCU));
NewCU.addString(Die, dwarf::DW_AT_GNU_dwo_name,
- DIUnit->getSplitDebugFilename());
+ Asm->TM.Options.MCOptions.SplitDwarfFile);
}
// LTO with assembly output shares a single line table amongst multiple CUs.
@@ -1885,7 +1874,7 @@ void DwarfDebug::emitDebugMacinfo() {
void DwarfDebug::initSkeletonUnit(const DwarfUnit &U, DIE &Die,
std::unique_ptr<DwarfCompileUnit> NewU) {
NewU->addString(Die, dwarf::DW_AT_GNU_dwo_name,
- U.getCUNode()->getSplitDebugFilename());
+ Asm->TM.Options.MCOptions.SplitDwarfFile);
if (!CompilationDir.empty())
NewU->addString(Die, dwarf::DW_AT_comp_dir, CompilationDir);
diff --git a/llvm/test/CodeGen/X86/dwarf-headers.ll b/llvm/test/CodeGen/X86/dwarf-headers.ll
index 612807dd812..c2111f672a2 100644
--- a/llvm/test/CodeGen/X86/dwarf-headers.ll
+++ b/llvm/test/CodeGen/X86/dwarf-headers.ll
@@ -1,16 +1,16 @@
-; RUN: llc -split-dwarf=Disable -dwarf-version=4 -generate-type-units \
+; RUN: llc -dwarf-version=4 -generate-type-units \
; RUN: -filetype=obj -O0 -mtriple=x86_64-unknown-linux-gnu < %s \
; RUN: | llvm-dwarfdump - | FileCheck %s --check-prefix=SINGLE-4
-; RUN: llc -split-dwarf=Enable -dwarf-version=4 -generate-type-units \
+; RUN: llc -split-dwarf-file=foo.dwo -dwarf-version=4 -generate-type-units \
; RUN: -filetype=obj -O0 -mtriple=x86_64-unknown-linux-gnu < %s \
; RUN: | llvm-dwarfdump - | FileCheck %s --check-prefix=SPLIT-4
-; RUN: llc -split-dwarf=Disable -dwarf-version=5 -generate-type-units \
+; RUN: llc -dwarf-version=5 -generate-type-units \
; RUN: -filetype=obj -O0 -mtriple=x86_64-unknown-linux-gnu < %s \
; RUN: | llvm-dwarfdump - | FileCheck %s --check-prefix=SINGLE-5
-; RUN: llc -split-dwarf=Enable -dwarf-version=5 -generate-type-units \
+; RUN: llc -split-dwarf-file=foo.dwo -dwarf-version=5 -generate-type-units \
; RUN: -filetype=obj -O0 -mtriple=x86_64-unknown-linux-gnu < %s \
; RUN: | llvm-dwarfdump - | FileCheck %s --check-prefix=SPLIT-5
diff --git a/llvm/test/DebugInfo/Generic/empty.ll b/llvm/test/DebugInfo/Generic/empty.ll
index 82faeca41db..d5f738fa027 100644
--- a/llvm/test/DebugInfo/Generic/empty.ll
+++ b/llvm/test/DebugInfo/Generic/empty.ll
@@ -1,7 +1,7 @@
; REQUIRES: object-emission
; RUN: %llc_dwarf < %s -filetype=obj | llvm-dwarfdump - | FileCheck %s
-; RUN: %llc_dwarf -split-dwarf=Enable < %s -filetype=obj | llvm-dwarfdump - | FileCheck --check-prefix=FISSION %s
+; RUN: %llc_dwarf -split-dwarf-file=foo.dwo < %s -filetype=obj | llvm-dwarfdump - | FileCheck --check-prefix=FISSION %s
; darwin has a workaround for a linker bug so it always emits one line table entry
; XFAIL: darwin
diff --git a/llvm/test/DebugInfo/PowerPC/tls-fission.ll b/llvm/test/DebugInfo/PowerPC/tls-fission.ll
index f456cbcb714..e01baaf1fb6 100644
--- a/llvm/test/DebugInfo/PowerPC/tls-fission.ll
+++ b/llvm/test/DebugInfo/PowerPC/tls-fission.ll
@@ -1,4 +1,4 @@
-; RUN: llc -split-dwarf=Enable -mtriple=powerpc64-unknown-linux-gnu -O0 -filetype=asm < %s | FileCheck %s
+; RUN: llc -split-dwarf-file=foo.dwo -mtriple=powerpc64-unknown-linux-gnu -O0 -filetype=asm < %s | FileCheck %s
; FIXME: add relocation and DWARF expression support to llvm-dwarfdump & use
; that here instead of raw assembly printing
diff --git a/llvm/test/DebugInfo/X86/cu-ranges-odr.ll b/llvm/test/DebugInfo/X86/cu-ranges-odr.ll
index cf54aeeb87b..e2ee29b55d8 100644
--- a/llvm/test/DebugInfo/X86/cu-ranges-odr.ll
+++ b/llvm/test/DebugInfo/X86/cu-ranges-odr.ll
@@ -1,4 +1,4 @@
-; RUN: llc -split-dwarf=Enable -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
+; RUN: llc -split-dwarf-file=foo.dwo -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
; RUN: llvm-dwarfdump -debug-dump=all %t | FileCheck %s
; RUN: llvm-readobj --relocations %t | FileCheck --check-prefix=CHECK-RELOCS %s
diff --git a/llvm/test/DebugInfo/X86/cu-ranges.ll b/llvm/test/DebugInfo/X86/cu-ranges.ll
index af129c7525d..f2540589b24 100644
--- a/llvm/test/DebugInfo/X86/cu-ranges.ll
+++ b/llvm/test/DebugInfo/X86/cu-ranges.ll
@@ -1,8 +1,8 @@
-; RUN: llc -split-dwarf=Enable -O0 %s -function-sections -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
+; RUN: llc -split-dwarf-file=foo.dwo -O0 %s -function-sections -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
; RUN: llvm-dwarfdump -debug-dump=abbrev %t | FileCheck --check-prefix=FUNCTION-SECTIONS %s
; RUN: llvm-readobj --relocations %t | FileCheck --check-prefix=FUNCTION-SECTIONS-RELOCS %s
-; RUN: llc -split-dwarf=Enable -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
+; RUN: llc -split-dwarf-file=foo.dwo -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
; RUN: llvm-dwarfdump -debug-dump=abbrev %t | FileCheck --check-prefix=NO-FUNCTION-SECTIONS %s
; From:
diff --git a/llvm/test/DebugInfo/X86/dwarf-pubnames-split.ll b/llvm/test/DebugInfo/X86/dwarf-pubnames-split.ll
index fcec66cc76b..6685615dc83 100644
--- a/llvm/test/DebugInfo/X86/dwarf-pubnames-split.ll
+++ b/llvm/test/DebugInfo/X86/dwarf-pubnames-split.ll
@@ -1,4 +1,4 @@
-; RUN: llc -mtriple=x86_64-pc-linux-gnu -split-dwarf=Enable %s -o - | FileCheck %s
+; RUN: llc -mtriple=x86_64-pc-linux-gnu -split-dwarf-file=foo.dwo %s -o - | FileCheck %s
; Derived from:
; int main (void) {
diff --git a/llvm/test/DebugInfo/X86/empty.ll b/llvm/test/DebugInfo/X86/empty.ll
index e156e3bbe5e..774b908adb3 100644
--- a/llvm/test/DebugInfo/X86/empty.ll
+++ b/llvm/test/DebugInfo/X86/empty.ll
@@ -1,5 +1,5 @@
; RUN: llc -mtriple i686-pc-cygwin < %s -filetype=obj | llvm-dwarfdump - | FileCheck %s
-; RUN: llc -mtriple i686-pc-cygwin -split-dwarf=Enable < %s -filetype=obj | llvm-dwarfdump - | FileCheck --check-prefix=FISSION %s
+; RUN: llc -mtriple i686-pc-cygwin -split-dwarf-file=foo.dwo < %s -filetype=obj | llvm-dwarfdump - | FileCheck --check-prefix=FISSION %s
; Expect no line table entry since there are no functions and file references in this compile unit
; CHECK: .debug_line contents:
diff --git a/llvm/test/DebugInfo/X86/fission-cu.ll b/llvm/test/DebugInfo/X86/fission-cu.ll
index 1ca2372fbad..51f4584a282 100644
--- a/llvm/test/DebugInfo/X86/fission-cu.ll
+++ b/llvm/test/DebugInfo/X86/fission-cu.ll
@@ -1,4 +1,4 @@
-; RUN: llc -split-dwarf=Enable -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
+; RUN: llc -split-dwarf-file=baz.dwo -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
; RUN: llvm-dwarfdump -debug-dump=all %t | FileCheck %s
; RUN: llvm-readobj --relocations %t | FileCheck --check-prefix=OBJ %s
; RUN: llvm-objdump -h %t | FileCheck --check-prefix=HDR %s
diff --git a/llvm/test/DebugInfo/X86/fission-hash.ll b/llvm/test/DebugInfo/X86/fission-hash.ll
index 7273e4c675c..1a5fba29317 100644
--- a/llvm/test/DebugInfo/X86/fission-hash.ll
+++ b/llvm/test/DebugInfo/X86/fission-hash.ll
@@ -1,4 +1,4 @@
-; RUN: llc -split-dwarf=Enable -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
+; RUN: llc -split-dwarf-file=foo.dwo -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
; RUN: llvm-dwarfdump -debug-dump=all %t | FileCheck %s
; The source is an empty file.
diff --git a/llvm/test/DebugInfo/X86/fission-inline.ll b/llvm/test/DebugInfo/X86/fission-inline.ll
index 85c594c118a..45e0127294d 100644
--- a/llvm/test/DebugInfo/X86/fission-inline.ll
+++ b/llvm/test/DebugInfo/X86/fission-inline.ll
@@ -1,4 +1,4 @@
-; RUN: llc -split-dwarf=Enable -O0 < %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj > %t
+; RUN: llc -split-dwarf-file=foo.dwo -O0 < %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj > %t
; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s
; RUN: llvm-objdump -r %t | FileCheck --check-prefix=RELOCS %s
diff --git a/llvm/test/DebugInfo/X86/fission-no-inlining.ll b/llvm/test/DebugInfo/X86/fission-no-inlining.ll
index 3f1e087f9ba..5a80d61b5a4 100644
--- a/llvm/test/DebugInfo/X86/fission-no-inlining.ll
+++ b/llvm/test/DebugInfo/X86/fission-no-inlining.ll
@@ -1,4 +1,4 @@
-; RUN: llc -split-dwarf=Enable -O0 < %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj | llvm-dwarfdump -debug-dump=info - | FileCheck %s
+; RUN: llc -split-dwarf-file=foo.dwo -O0 < %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj | llvm-dwarfdump -debug-dump=info - | FileCheck %s
; CHECK-NOT: DW_TAG_subprogram
diff --git a/llvm/test/DebugInfo/X86/fission-ranges.ll b/llvm/test/DebugInfo/X86/fission-ranges.ll
index 60d0f1777a4..bd3b8526b88 100644
--- a/llvm/test/DebugInfo/X86/fission-ranges.ll
+++ b/llvm/test/DebugInfo/X86/fission-ranges.ll
@@ -1,4 +1,4 @@
-; RUN: llc -split-dwarf=Enable -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
+; RUN: llc -split-dwarf-file=foo.dwo -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
; RUN: llvm-dwarfdump %t | FileCheck %s
; RUN: llvm-objdump -h %t | FileCheck --check-prefix=HDR %s
diff --git a/llvm/test/DebugInfo/X86/generate-odr-hash.ll b/llvm/test/DebugInfo/X86/generate-odr-hash.ll
index 7b3a291f566..e9303e6a265 100644
--- a/llvm/test/DebugInfo/X86/generate-odr-hash.ll
+++ b/llvm/test/DebugInfo/X86/generate-odr-hash.ll
@@ -4,7 +4,7 @@
; RUN: llvm-dwarfdump %t | FileCheck --check-prefix=CHECK --check-prefix=SINGLE %s
; RUN: llvm-readobj -s -t %t | FileCheck --check-prefix=OBJ_SINGLE %s
-; RUN: llc < %s -split-dwarf=Enable -o %t -filetype=obj -O0 -generate-type-units -mtriple=x86_64-unknown-linux-gnu
+; RUN: llc < %s -split-dwarf-file=foo.dwo -o %t -filetype=obj -O0 -generate-type-units -mtriple=x86_64-unknown-linux-gnu
; RUN: llvm-dwarfdump %t | FileCheck --check-prefix=CHECK --check-prefix=FISSION %s
; RUN: llvm-readobj -s -t %t | FileCheck --check-prefix=OBJ_FISSION %s
diff --git a/llvm/test/DebugInfo/X86/sret.ll b/llvm/test/DebugInfo/X86/sret.ll
index c4bb005a366..152a1b9bfd9 100644
--- a/llvm/test/DebugInfo/X86/sret.ll
+++ b/llvm/test/DebugInfo/X86/sret.ll
@@ -1,4 +1,4 @@
-; RUN: llc -split-dwarf=Enable -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
+; RUN: llc -split-dwarf-file=foo.dwo -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
; RUN: llvm-dwarfdump -debug-dump=all %t | FileCheck %s --check-prefix=CHECK-DWO
; Based on the debuginfo-tests/sret.cpp code.
diff --git a/llvm/test/DebugInfo/X86/tls.ll b/llvm/test/DebugInfo/X86/tls.ll
index b6ea213dd74..78b45e568a7 100644
--- a/llvm/test/DebugInfo/X86/tls.ll
+++ b/llvm/test/DebugInfo/X86/tls.ll
@@ -4,7 +4,7 @@
; RUN: llc %s -o - -filetype=asm -O0 -mtriple=i386-linux-gnu \
; RUN: | FileCheck --check-prefix=NOEMU --check-prefix=SINGLE --check-prefix=SINGLE-32 --check-prefix=GNUOP %s
-; RUN: llc %s -o - -filetype=asm -O0 -mtriple=x86_64-unknown-linux-gnu -split-dwarf=Enable \
+; RUN: llc %s -o - -filetype=asm -O0 -mtriple=x86_64-unknown-linux-gnu -split-dwarf-file=foo.dwo \
; RUN: | FileCheck --check-prefix=NOEMU --check-prefix=FISSION --check-prefix=GNUOP %s
; RUN: llc %s -o - -filetype=asm -O0 -mtriple=x86_64-scei-ps4 \
diff --git a/llvm/test/DebugInfo/X86/type_units_with_addresses.ll b/llvm/test/DebugInfo/X86/type_units_with_addresses.ll
index 4816ce3ac69..e93ed699ac5 100644
--- a/llvm/test/DebugInfo/X86/type_units_with_addresses.ll
+++ b/llvm/test/DebugInfo/X86/type_units_with_addresses.ll
@@ -1,9 +1,9 @@
; REQUIRES: object-emission
-; RUN: llc -split-dwarf=Enable -filetype=obj -O0 -generate-type-units -mtriple=x86_64-unknown-linux-gnu < %s \
+; RUN: llc -split-dwarf-file=foo.dwo -filetype=obj -O0 -generate-type-units -mtriple=x86_64-unknown-linux-gnu < %s \
; RUN: | llvm-dwarfdump - | FileCheck %s
-; RUN: llc -split-dwarf=Disable -filetype=obj -O0 -generate-type-units -mtriple=x86_64-unknown-linux-gnu < %s \
+; RUN: llc -filetype=obj -O0 -generate-type-units -mtriple=x86_64-unknown-linux-gnu < %s \
; RUN: | llvm-dwarfdump - | FileCheck --check-prefix=SINGLE %s
; Test case built from:
diff --git a/llvm/tools/llc/llc.cpp b/llvm/tools/llc/llc.cpp
index 43f97f112f6..7c81abaed75 100644
--- a/llvm/tools/llc/llc.cpp
+++ b/llvm/tools/llc/llc.cpp
@@ -90,6 +90,11 @@ OptLevel("O",
static cl::opt<std::string>
TargetTriple("mtriple", cl::desc("Override target triple for module"));
+static cl::opt<std::string> SplitDwarfFile(
+ "split-dwarf-file",
+ cl::desc(
+ "Specify the name of the .dwo file to encode in the DWARF output"));
+
static cl::opt<bool> NoVerify("disable-verify", cl::Hidden,
cl::desc("Do not verify input module"));
@@ -450,6 +455,7 @@ static int compileModule(char **argv, LLVMContext &Context) {
Options.MCOptions.AsmVerbose = AsmVerbose;
Options.MCOptions.PreserveAsmComments = PreserveComments;
Options.MCOptions.IASSearchPaths = IncludeDirs;
+ Options.MCOptions.SplitDwarfFile = SplitDwarfFile;
std::unique_ptr<TargetMachine> Target(
TheTarget->createTargetMachine(TheTriple.getTriple(), CPUStr, FeaturesStr,
OpenPOWER on IntegriCloud