diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2019-01-23 18:59:54 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2019-01-23 18:59:54 +0000 |
commit | 897129dc3fe79137e00c5dccc30e11221dbd6d7f (patch) | |
tree | 25cafacae2924306ae87c99fd78bc387baba5148 /llvm/lib/Target/NVPTX | |
parent | 25624e2e5bb5229d0c230d6d076d39966e038320 (diff) | |
download | bcm5719-llvm-897129dc3fe79137e00c5dccc30e11221dbd6d7f.tar.gz bcm5719-llvm-897129dc3fe79137e00c5dccc30e11221dbd6d7f.zip |
[DEBUGINFO, NVPTX] Enable support for the debug info on NVPTX target.
Enable full support for the debug info.
Differential revision: https://reviews.llvm.org/D46189
llvm-svn: 351974
Diffstat (limited to 'llvm/lib/Target/NVPTX')
4 files changed, 19 insertions, 13 deletions
diff --git a/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.cpp b/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.cpp index 52110b9ddfd..556745825a1 100644 --- a/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.cpp +++ b/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.cpp @@ -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; diff --git a/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXTargetStreamer.cpp b/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXTargetStreamer.cpp index 7e978869133..94959a5078c 100644 --- a/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXTargetStreamer.cpp +++ b/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXTargetStreamer.cpp @@ -30,6 +30,11 @@ void NVPTXTargetStreamer::outputDwarfFileDirectives() { DwarfFiles.clear(); } +void NVPTXTargetStreamer::closeLastSection() { + if (HasSections) + getStreamer().EmitRawText("\t}"); +} + void NVPTXTargetStreamer::emitDwarfFileDirective(StringRef Directive) { DwarfFiles.emplace_back(Directive); } @@ -81,18 +86,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"; + 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"; + HasSections = true; } } diff --git a/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXTargetStreamer.h b/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXTargetStreamer.h index cfe856718b1..8185efadefd 100644 --- a/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXTargetStreamer.h +++ b/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXTargetStreamer.h @@ -18,6 +18,7 @@ class MCSection; class NVPTXTargetStreamer : public MCTargetStreamer { private: SmallVector<std::string, 4> DwarfFiles; + bool HasSections = false; public: NVPTXTargetStreamer(MCStreamer &S); @@ -25,6 +26,8 @@ public: /// 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 diff --git a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp index f07266d1fae..274f1c59b6c 100644 --- a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp +++ b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp @@ -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"; @@ -954,10 +953,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) - OutStreamer->EmitRawText("//\t}"); + static_cast<NVPTXTargetStreamer *>(OutStreamer->getTargetStreamer()) + ->closeLastSection(); // Output last DWARF .file directives, if any. static_cast<NVPTXTargetStreamer *>(OutStreamer->getTargetStreamer()) |