[PATCH] D47663: Add a debug dump for DbgValueHistoryMap
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 1 15:37:36 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL333801: Add a debug dump for DbgValueHistoryMap (authored by vedantk, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D47663?vs=149570&id=149576#toc
Repository:
rL LLVM
https://reviews.llvm.org/D47663
Files:
llvm/trunk/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.h
llvm/trunk/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
llvm/trunk/test/DebugInfo/X86/dump-dbg-value-hist-calc.ll
Index: llvm/trunk/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.h
===================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.h
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.h
@@ -52,6 +52,10 @@
void clear() { VarInstrRanges.clear(); }
InstrRangesMap::const_iterator begin() const { return VarInstrRanges.begin(); }
InstrRangesMap::const_iterator end() const { return VarInstrRanges.end(); }
+
+#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
+ LLVM_DUMP_METHOD void dump() const;
+#endif
};
void calculateDbgValueHistory(const MachineFunction *MF,
Index: llvm/trunk/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
@@ -25,6 +25,8 @@
using namespace llvm;
+#define DEBUG_TYPE "dwarfdebug"
+
Optional<DbgVariableLocation>
DbgVariableLocation::extractFromMachineInstruction(
const MachineInstr &Instruction) {
@@ -190,6 +192,7 @@
assert(DbgValues.empty() && "DbgValues map wasn't cleaned!");
calculateDbgValueHistory(MF, Asm->MF->getSubtarget().getRegisterInfo(),
DbgValues);
+ LLVM_DEBUG(DbgValues.dump());
// Request labels for the full history.
for (const auto &I : DbgValues) {
Index: llvm/trunk/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp
@@ -269,3 +269,33 @@
}
}
}
+
+#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
+LLVM_DUMP_METHOD void DbgValueHistoryMap::dump() const {
+ dbgs() << "DbgValueHistoryMap:\n";
+ for (const auto &VarRangePair : *this) {
+ const InlinedVariable &Var = VarRangePair.first;
+ const InstrRanges &Ranges = VarRangePair.second;
+
+ const DILocalVariable *LocalVar = Var.first;
+ const DILocation *Location = Var.second;
+
+ dbgs() << " - " << LocalVar->getName() << " at ";
+
+ if (Location)
+ dbgs() << Location->getFilename() << ":" << Location->getLine() << ":"
+ << Location->getColumn();
+ else
+ dbgs() << "<unknown location>";
+
+ dbgs() << " --\n";
+
+ for (const InstrRange &Range : Ranges) {
+ dbgs() << " Begin: " << *Range.first;
+ if (Range.second)
+ dbgs() << " End : " << *Range.second;
+ dbgs() << "\n";
+ }
+ }
+}
+#endif
Index: llvm/trunk/test/DebugInfo/X86/dump-dbg-value-hist-calc.ll
===================================================================
--- llvm/trunk/test/DebugInfo/X86/dump-dbg-value-hist-calc.ll
+++ llvm/trunk/test/DebugInfo/X86/dump-dbg-value-hist-calc.ll
@@ -0,0 +1,21 @@
+; REQUIRES: asserts
+; RUN: opt -S -o - -debugify %s \
+; RUN: | %llc_dwarf -debug-only=dwarfdebug -o /dev/null 2>&1 \
+; RUN: | FileCheck %s
+
+target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-apple-macosx"
+
+; CHECK: DbgValueHistoryMap:
+; CHECK-NEXT: - 1 at <unknown location> --
+; CHECK-NEXT: Begin: DBG_VALUE {{.*}} line no:1
+; CHECK-NEXT: End : CALL64pcrel32 @h{{.*}}:2:1
+
+define void @f() {
+entry:
+ %a = add i32 0, 0
+ %b = call i32 @h(i32 %a)
+ ret void
+}
+
+declare i32 @h(i32)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47663.149576.patch
Type: text/x-patch
Size: 3443 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180601/12ce29ec/attachment.bin>
More information about the llvm-commits
mailing list