diff options
| author | Jeremy Morse <jeremy.morse@sony.com> | 2023-11-09 16:00:21 +0000 |
|---|---|---|
| committer | Jeremy Morse <jeremy.morse@sony.com> | 2023-11-09 22:30:49 +0000 |
| commit | 10a9e7442c4c4e09ee94f6e1d67e2ba7396bf7cb (patch) | |
| tree | ccec403324fd1611f268e26e550d5424f45ad24c /llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp | |
| parent | 1d1fede493ad6a0e2f9a7b6677f7b77f7e3a00bb (diff) | |
[DebugInfo][RemoveDIs] Add conversion utilities for new-debug-info format
This patch plumbs the command line --experimental-debuginfo-iterators flag
in to the pass managers, so that modules can be converted to the new
format, passes run, then converted back to the old format. That allows
developers to test-out the new debuginfo representation across some part of
LLVM with no further work, and from the command line. It also installs
flag-catchers at the various points that bitcode and textual IR can egress
from a process, and temporarily convert the module to dbg.value format when
doing so.
No tests alas as it's designed to be transparent.
Differential Revision: https://reviews.llvm.org/D154372
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp')
| -rw-r--r-- | llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp index 536d04f2fe26..28941d6c41cf 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp @@ -19,10 +19,20 @@ using namespace llvm; PreservedAnalyses BitcodeWriterPass::run(Module &M, ModuleAnalysisManager &AM) { + // RemoveDIs: there's no bitcode representation of the DPValue debug-info, + // convert to dbg.values before writing out. + bool IsNewDbgInfoFormat = M.IsNewDbgInfoFormat; + if (IsNewDbgInfoFormat) + M.convertFromNewDbgValues(); + const ModuleSummaryIndex *Index = EmitSummaryIndex ? &(AM.getResult<ModuleSummaryIndexAnalysis>(M)) : nullptr; WriteBitcodeToFile(M, OS, ShouldPreserveUseListOrder, Index, EmitModuleHash); + + if (IsNewDbgInfoFormat) + M.convertToNewDbgValues(); + return PreservedAnalyses::all(); } @@ -54,8 +64,17 @@ namespace { EmitSummaryIndex ? &(getAnalysis<ModuleSummaryIndexWrapperPass>().getIndex()) : nullptr; + // RemoveDIs: there's no bitcode representation of the DPValue debug-info, + // convert to dbg.values before writing out. + bool IsNewDbgInfoFormat = M.IsNewDbgInfoFormat; + if (IsNewDbgInfoFormat) + M.convertFromNewDbgValues(); + WriteBitcodeToFile(M, OS, ShouldPreserveUseListOrder, Index, EmitModuleHash); + + if (IsNewDbgInfoFormat) + M.convertToNewDbgValues(); return false; } void getAnalysisUsage(AnalysisUsage &AU) const override { |
