summaryrefslogtreecommitdiff
path: root/llvm/lib/Target/NVPTX
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2018-12-06 16:25:35 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2018-12-06 16:25:35 +0000
commit91f88917a323d1c77bae468da4bdd275dfe19648 (patch)
tree7bd42ce1b93ce735ba7e55b7cdecff88b4e44474 /llvm/lib/Target/NVPTX
parent158c6181483208a8814ab47f22fe25dbc8be0541 (diff)
[DEBUGINFO, NVPTX] Disable emission of ',debug' option if only debug directives are allowed.
Summary: If the output of debug directives only is requested, we should drop emission of ',debug' option from the target directive. Required for supporting of nvprof profiler. Reviewers: echristo Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D46061
Diffstat (limited to 'llvm/lib/Target/NVPTX')
-rw-r--r--llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
index e28d633fabe..aec0d7db81a 100644
--- a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
@@ -881,8 +881,22 @@ void NVPTXAsmPrinter::emitHeader(Module &M, raw_ostream &O,
if (NTM.getDrvInterface() == NVPTX::NVCL)
O << ", texmode_independent";
+ bool HasFullDebugInfo = false;
+ for (DICompileUnit *CU : M.debug_compile_units()) {
+ switch(CU->getEmissionKind()) {
+ case DICompileUnit::NoDebug:
+ case DICompileUnit::DebugDirectivesOnly:
+ break;
+ case DICompileUnit::LineTablesOnly:
+ case DICompileUnit::FullDebug:
+ HasFullDebugInfo = true;
+ break;
+ }
+ if (HasFullDebugInfo)
+ break;
+ }
// FIXME: remove comment once debug info is properly supported.
- if (MMI && MMI->hasDebugInfo())
+ if (MMI && MMI->hasDebugInfo() && HasFullDebugInfo)
O << "//, debug";
O << "\n";