Skip to content

Commit

Permalink
Revert "[DEBUGINFO, NVPTX] Enable support for the debug info on NVPTX…
Browse files Browse the repository at this point in the history
… target."

This reverts commit r351972. Some pieces of the patch was not applied
correctly.

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

Data8bitsDirective = ".b8 ";
// FIXME: remove comment once debug info is properly supported.
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
11 changes: 3 additions & 8 deletions lib/Target/NVPTX/MCTargetDesc/NVPTXTargetStreamer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ void NVPTXTargetStreamer::outputDwarfFileDirectives() {
DwarfFiles.clear();
}

void NVPTXTargetStreamer::closeLastSection() {
if (HasSections)
getStreamer().EmitRawText("\t}");
}

void NVPTXTargetStreamer::emitDwarfFileDirective(StringRef Directive) {
DwarfFiles.emplace_back(Directive);
}
Expand Down Expand Up @@ -86,18 +81,18 @@ 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";
HasSections = true;
OS << "//\t{\n";
}
}

Expand Down
3 changes: 0 additions & 3 deletions lib/Target/NVPTX/MCTargetDesc/NVPTXTargetStreamer.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,13 @@ class MCSection;
class NVPTXTargetStreamer : public MCTargetStreamer {
private:
SmallVector<std::string, 4> DwarfFiles;
bool HasSections = false;

public:
NVPTXTargetStreamer(MCStreamer &S);
~NVPTXTargetStreamer() override;

/// Outputs the list of the DWARF '.file' directives to the streamer.
void outputDwarfFileDirectives();
/// Close last section.
void closeLastSection();

/// Record DWARF file directives for later output.
/// According to PTX ISA, CUDA Toolkit documentation, 11.5.3. Debugging
Expand Down
7 changes: 4 additions & 3 deletions lib/Target/NVPTX/NVPTXAsmPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -901,8 +901,9 @@ 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 @@ -953,10 +954,10 @@ 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)
static_cast<NVPTXTargetStreamer *>(OutStreamer->getTargetStreamer())
->closeLastSection();
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.

18 changes: 0 additions & 18 deletions test/DebugInfo/NVPTX/debug-empty.ll

This file was deleted.

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 7877655

Please sign in to comment.