Skip to content

Commit

Permalink
[DEBUGINFO, NVPTX] Enable support for the debug info on NVPTX target.
Browse files Browse the repository at this point in the history
Summary: Enable full support for the debug info.

Reviewers: echristo

Subscribers: jholewinski, aprantl, JDevlieghere, llvm-commits

Differential Revision: https://reviews.llvm.org/D46189

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351846 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
alexey-bataev committed Jan 22, 2019
1 parent 27047c8 commit d77902a
Show file tree
Hide file tree
Showing 8 changed files with 5,257 additions and 5,261 deletions.
9 changes: 4 additions & 5 deletions lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,11 @@ NVPTXMCAsmInfo::NVPTXMCAsmInfo(const Triple &TheTriple) {
HiddenDeclarationVisibilityAttr = HiddenVisibilityAttr = MCSA_Invalid;
ProtectedVisibilityAttr = MCSA_Invalid;

// FIXME: remove comment once debug info is properly supported.
Data8bitsDirective = "// .b8 ";
Data8bitsDirective = ".b8 ";
Data16bitsDirective = nullptr; // not supported
Data32bitsDirective = "// .b32 ";
Data64bitsDirective = "// .b64 ";
ZeroDirective = "// .b8";
Data32bitsDirective = ".b32 ";
Data64bitsDirective = ".b64 ";
ZeroDirective = ".b8";
AsciiDirective = nullptr; // not supported
AscizDirective = nullptr; // not supported
SupportsQuotedNames = false;
Expand Down
5 changes: 2 additions & 3 deletions lib/Target/NVPTX/MCTargetDesc/NVPTXTargetStreamer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,17 @@ void NVPTXTargetStreamer::changeSection(const MCSection *CurSection,
raw_ostream &OS) {
assert(!SubSection && "SubSection is not null!");
const MCObjectFileInfo *FI = getStreamer().getContext().getObjectFileInfo();
// FIXME: remove comment once debug info is properly supported.
// Emit closing brace for DWARF sections only.
if (isDwarfSection(FI, CurSection))
OS << "//\t}\n";
OS << "\t}\n";
if (isDwarfSection(FI, Section)) {
// Emit DWARF .file directives in the outermost scope.
outputDwarfFileDirectives();
OS << "//\t.section";
Section->PrintSwitchToSection(*getStreamer().getContext().getAsmInfo(),
FI->getTargetTriple(), OS, SubSection);
// DWARF sections are enclosed into braces - emit the open one.
OS << "//\t{\n";
OS << "\t{\n";
}
}

Expand Down
6 changes: 2 additions & 4 deletions lib/Target/NVPTX/NVPTXAsmPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -901,9 +901,8 @@ void NVPTXAsmPrinter::emitHeader(Module &M, raw_ostream &O,
if (HasFullDebugInfo)
break;
}
// FIXME: remove comment once debug info is properly supported.
if (MMI && MMI->hasDebugInfo() && HasFullDebugInfo)
O << "//, debug";
O << ", debug";

O << "\n";

Expand Down Expand Up @@ -954,10 +953,9 @@ bool NVPTXAsmPrinter::doFinalization(Module &M) {
clearAnnotationCache(&M);

delete[] gv_array;
// FIXME: remove comment once debug info is properly supported.
// Close the last emitted section
if (HasDebugInfo)
OutStreamer->EmitRawText("//\t}");
OutStreamer->EmitRawText("\t}");

// Output last DWARF .file directives, if any.
static_cast<NVPTXTargetStreamer *>(OutStreamer->getTargetStreamer())
Expand Down
280 changes: 140 additions & 140 deletions test/DebugInfo/NVPTX/cu-range-hole.ll

Large diffs are not rendered by default.

328 changes: 164 additions & 164 deletions test/DebugInfo/NVPTX/dbg-declare-alloca.ll

Large diffs are not rendered by default.

94 changes: 47 additions & 47 deletions test/DebugInfo/NVPTX/debug-file-loc.ll
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
;__device__ void bar() {}
;}

; CHECK: .target sm_{{[0-9]+}}//, debug
; CHECK: .target sm_{{[0-9]+}}, debug

; CHECK: .visible .func foo()
; CHECK: .loc [[FOO:[0-9]+]] 1 31
Expand All @@ -29,52 +29,52 @@ bb:

; CHECK-DAG: .file [[FOO]] "{{.*}}foo.h"
; CHECK-DAG: .file [[BAR]] "{{.*}}bar.cu"
; CHECK: // .section .debug_abbrev
; CHECK-NEXT: // {
; CHECK-NEXT: // .b8 1 // Abbreviation Code
; CHECK-NEXT: // .b8 17 // DW_TAG_compile_unit
; CHECK-NEXT: // .b8 0 // DW_CHILDREN_no
; CHECK-NEXT: // .b8 37 // DW_AT_producer
; CHECK-NEXT: // .b8 8 // DW_FORM_string
; CHECK-NEXT: // .b8 19 // DW_AT_language
; CHECK-NEXT: // .b8 5 // DW_FORM_data2
; CHECK-NEXT: // .b8 3 // DW_AT_name
; CHECK-NEXT: // .b8 8 // DW_FORM_string
; CHECK-NEXT: // .b8 16 // DW_AT_stmt_list
; CHECK-NEXT: // .b8 6 // DW_FORM_data4
; CHECK-NEXT: // .b8 27 // DW_AT_comp_dir
; CHECK-NEXT: // .b8 8 // DW_FORM_string
; CHECK-NEXT: // .b8 17 // DW_AT_low_pc
; CHECK-NEXT: // .b8 1 // DW_FORM_addr
; CHECK-NEXT: // .b8 18 // DW_AT_high_pc
; CHECK-NEXT: // .b8 1 // DW_FORM_addr
; CHECK-NEXT: // .b8 0 // EOM(1)
; CHECK-NEXT: // .b8 0 // EOM(2)
; CHECK-NEXT: // .b8 0 // EOM(3)
; CHECK-NEXT: // }
; CHECK-NEXT: // .section .debug_info
; CHECK-NEXT: // {
; CHECK-NEXT: // .b32 50 // Length of Unit
; CHECK-NEXT: // .b8 2 // DWARF version number
; CHECK-NEXT: // .b8 0
; CHECK-NEXT: // .b32 .debug_abbrev // Offset Into Abbrev. Section
; CHECK-NEXT: // .b8 8 // Address Size (in bytes)
; CHECK-NEXT: // .b8 1 // Abbrev [1] 0xb:0x2b DW_TAG_compile_unit
; CHECK-NEXT: // .b8 0 // DW_AT_producer
; CHECK-NEXT: // .b8 4 // DW_AT_language
; CHECK-NEXT: // .b8 0
; CHECK-NEXT: // .b8 98,97,114,46,99,117 // DW_AT_name
; CHECK-NEXT: // .b8 0
; CHECK-NEXT: // .b32 .debug_line // DW_AT_stmt_list
; CHECK-NEXT: // .b8 47,115,111,117,114,99,101,47,100,105,114 // DW_AT_comp_dir
; CHECK-NEXT: // .b8 0
; CHECK-NEXT: // .b64 Lfunc_begin0 // DW_AT_low_pc
; CHECK-NEXT: // .b64 Lfunc_end1 // DW_AT_high_pc
; CHECK-NEXT: // }
; CHECK-NEXT: // .section .debug_macinfo
; CHECK-NEXT: // {
; CHECK-NEXT: // .b8 0 // End Of Macro List Mark
; CHECK: // }
; CHECK: .section .debug_abbrev
; CHECK-NEXT: {
; CHECK-NEXT: .b8 1 // Abbreviation Code
; CHECK-NEXT: .b8 17 // DW_TAG_compile_unit
; CHECK-NEXT: .b8 0 // DW_CHILDREN_no
; CHECK-NEXT: .b8 37 // DW_AT_producer
; CHECK-NEXT: .b8 8 // DW_FORM_string
; CHECK-NEXT: .b8 19 // DW_AT_language
; CHECK-NEXT: .b8 5 // DW_FORM_data2
; CHECK-NEXT: .b8 3 // DW_AT_name
; CHECK-NEXT: .b8 8 // DW_FORM_string
; CHECK-NEXT: .b8 16 // DW_AT_stmt_list
; CHECK-NEXT: .b8 6 // DW_FORM_data4
; CHECK-NEXT: .b8 27 // DW_AT_comp_dir
; CHECK-NEXT: .b8 8 // DW_FORM_string
; CHECK-NEXT: .b8 17 // DW_AT_low_pc
; CHECK-NEXT: .b8 1 // DW_FORM_addr
; CHECK-NEXT: .b8 18 // DW_AT_high_pc
; CHECK-NEXT: .b8 1 // DW_FORM_addr
; CHECK-NEXT: .b8 0 // EOM(1)
; CHECK-NEXT: .b8 0 // EOM(2)
; CHECK-NEXT: .b8 0 // EOM(3)
; CHECK-NEXT: }
; CHECK-NEXT: .section .debug_info
; CHECK-NEXT: {
; CHECK-NEXT: .b32 50 // Length of Unit
; CHECK-NEXT: .b8 2 // DWARF version number
; CHECK-NEXT: .b8 0
; CHECK-NEXT: .b32 .debug_abbrev // Offset Into Abbrev. Section
; CHECK-NEXT: .b8 8 // Address Size (in bytes)
; CHECK-NEXT: .b8 1 // Abbrev [1] 0xb:0x2b DW_TAG_compile_unit
; CHECK-NEXT: .b8 0 // DW_AT_producer
; CHECK-NEXT: .b8 4 // DW_AT_language
; CHECK-NEXT: .b8 0
; CHECK-NEXT: .b8 98,97,114,46,99,117 // DW_AT_name
; CHECK-NEXT: .b8 0
; CHECK-NEXT: .b32 .debug_line // DW_AT_stmt_list
; CHECK-NEXT: .b8 47,115,111,117,114,99,101,47,100,105,114 // DW_AT_comp_dir
; CHECK-NEXT: .b8 0
; CHECK-NEXT: .b64 Lfunc_begin0 // DW_AT_low_pc
; CHECK-NEXT: .b64 Lfunc_end1 // DW_AT_high_pc
; CHECK-NEXT: }
; CHECK-NEXT: .section .debug_macinfo
; CHECK-NEXT: {
; CHECK-NEXT: .b8 0 // End Of Macro List Mark
; CHECK: }

!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!8, !9}
Expand Down
Loading

0 comments on commit d77902a

Please sign in to comment.