Skip to content

Commit 233a7a2

Browse files
committed
[llvm/DebugInfo] Emit DW_OP_implicit_value when tuning for LLDB
This patch enables emitting DWARF `DW_OP_implicit_value` opcode when tuning debug information for LLDB (`-debugger-tune=lldb`). This will also propagate to Darwin platforms, since they use LLDB tuning as a default. rdar://67406059 Differential Revision: https://reviews.llvm.org/D90001 Signed-off-by: Med Ismail Bennani <[email protected]>
1 parent c18ab8b commit 233a7a2

File tree

4 files changed

+25
-6
lines changed

4 files changed

+25
-6
lines changed

llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2513,7 +2513,8 @@ void DwarfDebug::emitDebugLocValue(const AsmPrinter &AP, const DIBasicType *BT,
25132513
// encoding is supported.
25142514
DwarfExpr.addWasmLocation(Loc.Index, static_cast<uint64_t>(Loc.Offset));
25152515
} else if (Value.isConstantFP()) {
2516-
if (AP.getDwarfVersion() >= 4 && AP.getDwarfDebug()->tuneForGDB()) {
2516+
if (AP.getDwarfVersion() >= 4 && (AP.getDwarfDebug()->tuneForGDB() ||
2517+
AP.getDwarfDebug()->tuneForLLDB())) {
25172518
DwarfExpr.addConstantFP(Value.getConstantFP()->getValueAPF(), AP);
25182519
return;
25192520
} else if (Value.getConstantFP()

llvm/test/DebugInfo/X86/implicit_value-double.ll

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
;; This test checks for emission of DW_OP_implicit_value operation
22
;; for double type.
33

4-
; RUN: llc -debugger-tune=gdb -filetype=obj %s -o - | llvm-dwarfdump - | FileCheck %s
4+
; RUN: llc -debugger-tune=gdb -filetype=obj %s -o - | llvm-dwarfdump - | FileCheck %s
5+
; RUN: llc -debugger-tune=lldb -filetype=obj %s -o - | llvm-dwarfdump - | FileCheck %s
56

67
; CHECK: .debug_info contents:
78
; CHECK: DW_TAG_variable
89
; CHECK-NEXT: DW_AT_location ({{.*}}
910
; CHECK-NEXT: [{{.*}}): DW_OP_implicit_value 0x8 0x1f 0x85 0xeb 0x51 0xb8 0x1e 0x09 0x40)
1011
; CHECK-NEXT: DW_AT_name ("d")
1112

13+
; RUN: llc -debugger-tune=sce -filetype=obj %s -o - | llvm-dwarfdump - | FileCheck %s -check-prefix=SCE-CHECK
14+
15+
; SCE-CHECK: .debug_info contents:
16+
; SCE-CHECK: DW_TAG_variable
17+
; SCE-CHECK-NEXT: DW_AT_location ({{.*}}
18+
; SCE-CHECK-NEXT: [{{.*}}): DW_OP_constu 0x40091eb851eb851f, DW_OP_stack_value)
19+
; SCE-CHECK-NEXT: DW_AT_name ("d")
20+
1221
;; Generated from: clang -ggdb -O1
1322
;;int main() {
1423
;; double d = 3.14;

llvm/test/DebugInfo/X86/implicit_value-float.ll

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
;; This test checks for emission of DW_OP_implicit_value operation
22
;; for float type.
33

4-
; RUN: llc -debugger-tune=gdb -filetype=obj %s -o - | llvm-dwarfdump - | FileCheck %s
4+
; RUN: llc -debugger-tune=gdb -filetype=obj %s -o - | llvm-dwarfdump - | FileCheck %s
5+
; RUN: llc -debugger-tune=lldb -filetype=obj %s -o - | llvm-dwarfdump - | FileCheck %s
56

67
; CHECK: .debug_info contents:
78
; CHECK: DW_TAG_variable
89
; CHECK-NEXT: DW_AT_location ({{.*}}
910
; CHECK-NEXT: [{{.*}}): DW_OP_implicit_value 0x4 0xc3 0xf5 0x48 0x40)
1011
; CHECK-NEXT: DW_AT_name ("f")
1112

13+
; RUN: llc -debugger-tune=sce -filetype=obj %s -o - | llvm-dwarfdump - | FileCheck %s -check-prefix=SCE-CHECK
14+
15+
; SCE-CHECK: .debug_info contents:
16+
; SCE-CHECK: DW_TAG_variable
17+
; SCE-CHECK-NEXT: DW_AT_location ({{.*}}
18+
; SCE-CHECK-NEXT: [{{.*}}): DW_OP_constu 0x4048f5c3, DW_OP_stack_value)
19+
; SCE-CHECK-NEXT: DW_AT_name ("f")
20+
1221
;; Generated from: clang -ggdb -O1
1322
;;int main() {
1423
;; float f = 3.14f;

llvm/test/DebugInfo/X86/stack-value-piece.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@
2626
; CHECK: DW_AT_name ("f")
2727
; CHECK: DW_TAG_variable
2828
; CHECK-NEXT: DW_AT_location ([[F:0x[0-9a-f]+]]
29-
; CHECK-NEXT: [{{.*}}, {{.*}}): DW_OP_reg17 XMM0, DW_OP_piece 0x4, DW_OP_lit0, DW_OP_stack_value, DW_OP_piece 0x4
30-
; CHECK-NEXT: [{{.*}}, {{.*}}): DW_OP_piece 0x4, DW_OP_lit0, DW_OP_stack_value, DW_OP_piece 0x4)
29+
; CHECK-NEXT: [{{.*}}, {{.*}}): DW_OP_reg17 XMM0, DW_OP_piece 0x4, {{(DW_OP_lit0, DW_OP_stack_value, DW_OP_piece 0x4|DW_OP_implicit_value 0x4 0x00 0x00 0x00 0x00)}}
30+
; CHECK-NEXT: [{{.*}}, {{.*}}): DW_OP_piece 0x4, {{(DW_OP_lit0, DW_OP_stack_value, DW_OP_piece 0x4|DW_OP_implicit_value 0x4 0x00 0x00 0x00 0x00)}})
3131
; CHECK-NEXT: DW_AT_name ("r")
3232
;
3333
; CHECK: .debug_loc contents:
3434
; CHECK: [[I]]:
3535
; CHECK-NEXT: ({{.*}}, {{.*}}): DW_OP_reg5 RDI, DW_OP_piece 0x4, DW_OP_lit0, DW_OP_stack_value, DW_OP_piece 0x4
3636
; CHECK: [[F]]:
37-
; CHECK-NEXT: ({{.*}}, {{.*}}): DW_OP_reg17 XMM0, DW_OP_piece 0x4, DW_OP_lit0, DW_OP_stack_value, DW_OP_piece 0x4
37+
; CHECK-NEXT: ({{.*}}, {{.*}}): DW_OP_reg17 XMM0, DW_OP_piece 0x4, {{DW_OP_lit0, DW_OP_stack_value, DW_OP_piece 0x4|DW_OP_implicit_value 0x4 0x00 0x00 0x00 0x00}}
3838

3939
source_filename = "stack-value-piece.c"
4040
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"

0 commit comments

Comments
 (0)