aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorDjordje Todorovic <djordje.todorovic@syrmia.com>2020-03-19 12:13:18 +0100
committerDjordje Todorovic <djordje.todorovic@syrmia.com>2020-03-19 13:57:30 +0100
commitd9b962100942c71a4c26debaa716f7ab0c4ea8a1 (patch)
treec6ded0d1a6b5720a681b6b0a79a7914723a788ff /llvm/lib/CodeGen
parentdcbcec4822f47ec5b638dd9c20dcebd464569dae (diff)
downloadllvm-d9b962100942c71a4c26debaa716f7ab0c4ea8a1.zip
llvm-d9b962100942c71a4c26debaa716f7ab0c4ea8a1.tar.gz
llvm-d9b962100942c71a4c26debaa716f7ab0c4ea8a1.tar.bz2
Reland D73534: [DebugInfo] Enable the debug entry values feature by default
The issue that was causing the build failures was fixed with the D76164.
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp15
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h9
-rw-r--r--llvm/lib/CodeGen/CommandFlags.cpp2
-rw-r--r--llvm/lib/CodeGen/LiveDebugValues.cpp4
-rw-r--r--llvm/lib/CodeGen/TargetOptionsImpl.cpp6
5 files changed, 30 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 7efeb1a..7b469d4 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -95,6 +95,10 @@ static cl::opt<bool> UseDwarfRangesBaseAddressSpecifier(
"use-dwarf-ranges-base-address-specifier", cl::Hidden,
cl::desc("Use base address specifiers in debug_ranges"), cl::init(false));
+static cl::opt<bool> EmitDwarfDebugEntryValues(
+ "emit-debug-entry-values", cl::Hidden,
+ cl::desc("Emit the debug entry values"), cl::init(false));
+
static cl::opt<bool> GenerateARangeSection("generate-arange-section",
cl::Hidden,
cl::desc("Generate dwarf aranges"),
@@ -419,6 +423,12 @@ DwarfDebug::DwarfDebug(AsmPrinter *A, Module *M)
// a monolithic string offsets table without any header.
UseSegmentedStringOffsetsTable = DwarfVersion >= 5;
+ // Emit call-site-param debug info for GDB and LLDB, if the target supports
+ // the debug entry values feature. It can also be enabled explicitly.
+ EmitDebugEntryValues = (Asm->TM.Options.ShouldEmitDebugEntryValues() &&
+ (tuneForGDB() || tuneForLLDB())) ||
+ EmitDwarfDebugEntryValues;
+
Asm->OutStreamer->getContext().setDwarfVersion(DwarfVersion);
}
@@ -886,9 +896,8 @@ void DwarfDebug::constructCallSiteEntryDIEs(const DISubprogram &SP,
DIE &CallSiteDIE = CU.constructCallSiteEntryDIE(ScopeDIE, CalleeDIE,
IsTail, PCAddr, CallReg);
- // GDB and LLDB support call site parameter debug info.
- if (Asm->TM.Options.EnableDebugEntryValues &&
- (tuneForGDB() || tuneForLLDB())) {
+ // Optionally emit call-site-param debug info.
+ if (emitDebugEntryValues()) {
ParamSet Params;
// Try to interpret values of call site parameters.
collectCallSiteParameters(&MI, Params);
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
index a449605..882fc73 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
@@ -386,6 +386,11 @@ class DwarfDebug : public DebugHandlerBase {
/// a monolithic sequence of string offsets.
bool UseSegmentedStringOffsetsTable;
+ /// Enable production of call site parameters needed to print the debug entry
+ /// values. Useful for testing purposes when a debugger does not support the
+ /// feature yet.
+ bool EmitDebugEntryValues;
+
/// Separated Dwarf Variables
/// In general these will all be for bits that are left in the
/// original object file, rather than things that are meant
@@ -708,6 +713,10 @@ public:
return UseSegmentedStringOffsetsTable;
}
+ bool emitDebugEntryValues() const {
+ return EmitDebugEntryValues;
+ }
+
bool shareAcrossDWOCUs() const;
/// Returns the Dwarf Version.
diff --git a/llvm/lib/CodeGen/CommandFlags.cpp b/llvm/lib/CodeGen/CommandFlags.cpp
index 7acb84d..d5dc49a 100644
--- a/llvm/lib/CodeGen/CommandFlags.cpp
+++ b/llvm/lib/CodeGen/CommandFlags.cpp
@@ -380,7 +380,7 @@ codegen::RegisterCodeGenFlags::RegisterCodeGenFlags() {
static cl::opt<bool> EnableDebugEntryValues(
"debug-entry-values",
- cl::desc("Emit debug info about parameter's entry values"),
+ cl::desc("Enable debug info for the debug entry values."),
cl::init(false));
CGBINDOPT(EnableDebugEntryValues);
diff --git a/llvm/lib/CodeGen/LiveDebugValues.cpp b/llvm/lib/CodeGen/LiveDebugValues.cpp
index 94c5cc5..a013c41 100644
--- a/llvm/lib/CodeGen/LiveDebugValues.cpp
+++ b/llvm/lib/CodeGen/LiveDebugValues.cpp
@@ -1125,7 +1125,7 @@ void LiveDebugValues::transferRegisterDef(
if (auto *TPC = getAnalysisIfAvailable<TargetPassConfig>()) {
auto &TM = TPC->getTM<TargetMachine>();
- if (TM.Options.EnableDebugEntryValues)
+ if (TM.Options.ShouldEmitDebugEntryValues())
emitEntryValues(MI, OpenRanges, VarLocIDs, Transfers, KillSet);
}
}
@@ -1630,7 +1630,7 @@ void LiveDebugValues::recordEntryValue(const MachineInstr &MI,
VarLocMap &VarLocIDs) {
if (auto *TPC = getAnalysisIfAvailable<TargetPassConfig>()) {
auto &TM = TPC->getTM<TargetMachine>();
- if (!TM.Options.EnableDebugEntryValues)
+ if (!TM.Options.ShouldEmitDebugEntryValues())
return;
}
diff --git a/llvm/lib/CodeGen/TargetOptionsImpl.cpp b/llvm/lib/CodeGen/TargetOptionsImpl.cpp
index d794a26..4866d4c 100644
--- a/llvm/lib/CodeGen/TargetOptionsImpl.cpp
+++ b/llvm/lib/CodeGen/TargetOptionsImpl.cpp
@@ -45,3 +45,9 @@ bool TargetOptions::DisableFramePointerElim(const MachineFunction &MF) const {
bool TargetOptions::HonorSignDependentRoundingFPMath() const {
return !UnsafeFPMath && HonorSignDependentRoundingFPMathOption;
}
+
+/// NOTE: There are targets that still do not support the debug entry values
+/// production.
+bool TargetOptions::ShouldEmitDebugEntryValues() const {
+ return SupportsDebugEntryValues || EnableDebugEntryValues;
+}