aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineModuleInfo.cpp
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2022-04-17 12:55:24 -0400
committerMatt Arsenault <Matthew.Arsenault@amd.com>2022-04-19 21:08:37 -0400
commit9592e88f59cfd399e9285cfec50a23675f43a43a (patch)
treea5f641a88fbb2a68e047d7a56e4a3caf9a56e151 /llvm/lib/CodeGen/MachineModuleInfo.cpp
parent9a519179d9efcde3eb8e1808258de1f0d637e990 (diff)
downloadllvm-9592e88f59cfd399e9285cfec50a23675f43a43a.zip
llvm-9592e88f59cfd399e9285cfec50a23675f43a43a.tar.gz
llvm-9592e88f59cfd399e9285cfec50a23675f43a43a.tar.bz2
MachineModuleInfo: Don't allow dynamically setting DbgInfoAvailable
This can be set up front, and used only as a cache. This avoids a field that looks like it requires MIR serialization. I believe this fixes 2 bugs for CodeView. First, this addresses a FIXME that the flag -diable-debug-info-print only works with DWARF. Second, it fixes emitting debug info with emissionKind NoDebug.
Diffstat (limited to 'llvm/lib/CodeGen/MachineModuleInfo.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineModuleInfo.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/MachineModuleInfo.cpp b/llvm/lib/CodeGen/MachineModuleInfo.cpp
index cbcef3e..4ee2427 100644
--- a/llvm/lib/CodeGen/MachineModuleInfo.cpp
+++ b/llvm/lib/CodeGen/MachineModuleInfo.cpp
@@ -25,6 +25,7 @@
#include "llvm/Pass.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Compiler.h"
+#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetMachine.h"
@@ -37,6 +38,10 @@
using namespace llvm;
using namespace llvm::dwarf;
+static cl::opt<bool>
+ DisableDebugInfoPrinting("disable-debug-info-print", cl::Hidden,
+ cl::desc("Disable debug info printing"));
+
// Out of line virtual method.
MachineModuleInfoImpl::~MachineModuleInfoImpl() = default;
@@ -200,6 +205,7 @@ void MachineModuleInfo::initialize() {
UsesMSVCFloatingPoint = UsesMorestackAddr = false;
HasSplitStack = HasNosplitStack = false;
AddrLabelSymbols = nullptr;
+ DbgInfoAvailable = false;
}
void MachineModuleInfo::finalize() {
@@ -409,7 +415,8 @@ bool MachineModuleInfoWrapperPass::doInitialization(Module &M) {
Ctx.diagnose(
DiagnosticInfoSrcMgr(SMD, M.getName(), IsInlineAsm, LocCookie));
});
- MMI.DbgInfoAvailable = !M.debug_compile_units().empty();
+ MMI.DbgInfoAvailable = !DisableDebugInfoPrinting &&
+ !M.debug_compile_units().empty();
return false;
}
@@ -424,6 +431,7 @@ MachineModuleInfo MachineModuleAnalysis::run(Module &M,
ModuleAnalysisManager &) {
MachineModuleInfo MMI(TM);
MMI.TheModule = &M;
- MMI.DbgInfoAvailable = !M.debug_compile_units().empty();
+ MMI.DbgInfoAvailable = !DisableDebugInfoPrinting &&
+ !M.debug_compile_units().empty();
return MMI;
}