diff options
author | Andrew Savonichev <andrew.savonichev@gmail.com> | 2022-04-26 18:45:09 +0300 |
---|---|---|
committer | Andrew Savonichev <andrew.savonichev@gmail.com> | 2022-04-26 21:40:36 +0300 |
commit | 0a27622a1d625f179a17f3a22a547d50b042b76e (patch) | |
tree | ffa3547bb8d7cc84e77b0ce0b384586f314b3735 /llvm/lib/CodeGen/LLVMTargetMachine.cpp | |
parent | 903aa5e0f80efd413624a59e37c6ace6cd3cf5cd (diff) | |
download | llvm-0a27622a1d625f179a17f3a22a547d50b042b76e.zip llvm-0a27622a1d625f179a17f3a22a547d50b042b76e.tar.gz llvm-0a27622a1d625f179a17f3a22a547d50b042b76e.tar.bz2 |
[NVPTX] Disable DWARF .file directory for PTX
Default behavior for .file directory was changed in D105856, but
ptxas (CUDA 11.5 release) refuses to parse it:
$ llc -march=nvptx64 llvm/test/DebugInfo/NVPTX/debug-file-loc.ll
$ ptxas debug-file-loc.s
ptxas debug-file-loc.s, line 42; fatal : Parsing error near
'"foo.h"': syntax error
Added a new field to MCAsmInfo to control default value of
UseDwarfDirectory. This value is used if -dwarf-directory command line
option is not specified.
Differential Revision: https://reviews.llvm.org/D121299
Diffstat (limited to 'llvm/lib/CodeGen/LLVMTargetMachine.cpp')
-rw-r--r-- | llvm/lib/CodeGen/LLVMTargetMachine.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/LLVMTargetMachine.cpp b/llvm/lib/CodeGen/LLVMTargetMachine.cpp index 495efc6..ee6c462 100644 --- a/llvm/lib/CodeGen/LLVMTargetMachine.cpp +++ b/llvm/lib/CodeGen/LLVMTargetMachine.cpp @@ -165,13 +165,26 @@ Expected<std::unique_ptr<MCStreamer>> LLVMTargetMachine::createMCStreamer( if (Options.MCOptions.ShowMCEncoding) MCE.reset(getTarget().createMCCodeEmitter(MII, Context)); + bool UseDwarfDirectory = false; + switch (Options.MCOptions.MCUseDwarfDirectory) { + case MCTargetOptions::DisableDwarfDirectory: + UseDwarfDirectory = false; + break; + case MCTargetOptions::EnableDwarfDirectory: + UseDwarfDirectory = true; + break; + case MCTargetOptions::DefaultDwarfDirectory: + UseDwarfDirectory = MAI.enableDwarfFileDirectoryDefault(); + break; + } + std::unique_ptr<MCAsmBackend> MAB( getTarget().createMCAsmBackend(STI, MRI, Options.MCOptions)); auto FOut = std::make_unique<formatted_raw_ostream>(Out); MCStreamer *S = getTarget().createAsmStreamer( Context, std::move(FOut), Options.MCOptions.AsmVerbose, - Options.MCOptions.MCUseDwarfDirectory, InstPrinter, std::move(MCE), - std::move(MAB), Options.MCOptions.ShowMCInst); + UseDwarfDirectory, InstPrinter, std::move(MCE), std::move(MAB), + Options.MCOptions.ShowMCInst); AsmStreamer.reset(S); break; } |