[llvm] 64c4dac - [llvm/DebugInfo] Emit DW_OP_implicit_value when tuning for LLDB

Med Ismail Bennani via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 23 21:46:06 PDT 2020


Author: Med Ismail Bennani
Date: 2020-10-24T06:45:33+02:00
New Revision: 64c4dac60e3af340c0e97ce213206472463c4873

URL: https://github.com/llvm/llvm-project/commit/64c4dac60e3af340c0e97ce213206472463c4873
DIFF: https://github.com/llvm/llvm-project/commit/64c4dac60e3af340c0e97ce213206472463c4873.diff

LOG: [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 <medismail.bennani at gmail.com>

Added: 
    

Modified: 
    llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
    llvm/test/DebugInfo/X86/implicit_value-double.ll
    llvm/test/DebugInfo/X86/implicit_value-float.ll
    llvm/test/DebugInfo/X86/stack-value-piece.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 130df99bb185..5e15abbc3a7c 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -2480,7 +2480,8 @@ void DwarfDebug::emitDebugLocValue(const AsmPrinter &AP, const DIBasicType *BT,
       DwarfExpr.addExpression(std::move(ExprCursor));
       return;
   } else if (Value.isConstantFP()) {
-    if (AP.getDwarfVersion() >= 4 && AP.getDwarfDebug()->tuneForGDB()) {
+    if (AP.getDwarfVersion() >= 4 && (AP.getDwarfDebug()->tuneForGDB() ||
+                                      AP.getDwarfDebug()->tuneForLLDB())) {
       DwarfExpr.addConstantFP(Value.getConstantFP()->getValueAPF(), AP);
       return;
     } else if (Value.getConstantFP()

diff  --git a/llvm/test/DebugInfo/X86/implicit_value-double.ll b/llvm/test/DebugInfo/X86/implicit_value-double.ll
index 3c14c7dfefce..f205cb9a68ee 100644
--- a/llvm/test/DebugInfo/X86/implicit_value-double.ll
+++ b/llvm/test/DebugInfo/X86/implicit_value-double.ll
@@ -1,7 +1,8 @@
 ;; This test checks for emission of DW_OP_implicit_value operation
 ;; for double type.
 
-; RUN: llc -debugger-tune=gdb -filetype=obj %s -o - | llvm-dwarfdump - | FileCheck %s
+; RUN: llc -debugger-tune=gdb -filetype=obj %s -o -  | llvm-dwarfdump - | FileCheck %s
+; RUN: llc -debugger-tune=lldb -filetype=obj %s -o - | llvm-dwarfdump - | FileCheck %s
 
 ; CHECK: .debug_info contents:
 ; CHECK: DW_TAG_variable
@@ -9,6 +10,14 @@
 ; CHECK-NEXT:                     [{{.*}}): DW_OP_implicit_value 0x8 0x1f 0x85 0xeb 0x51 0xb8 0x1e 0x09 0x40)
 ; CHECK-NEXT:  DW_AT_name    ("d")
 
+; RUN: llc -debugger-tune=sce -filetype=obj %s -o -  | llvm-dwarfdump - | FileCheck %s -check-prefix=SCE-CHECK
+
+; SCE-CHECK: .debug_info contents:
+; SCE-CHECK: DW_TAG_variable
+; SCE-CHECK-NEXT:  DW_AT_location        ({{.*}}
+; SCE-CHECK-NEXT:                     [{{.*}}): DW_OP_constu 0x40091eb851eb851f, DW_OP_stack_value)
+; SCE-CHECK-NEXT:  DW_AT_name    ("d")
+
 ;; Generated from: clang -ggdb -O1
 ;;int main() {
 ;;        double d = 3.14;

diff  --git a/llvm/test/DebugInfo/X86/implicit_value-float.ll b/llvm/test/DebugInfo/X86/implicit_value-float.ll
index 8c51b4948177..aa0e639de143 100644
--- a/llvm/test/DebugInfo/X86/implicit_value-float.ll
+++ b/llvm/test/DebugInfo/X86/implicit_value-float.ll
@@ -1,7 +1,8 @@
 ;; This test checks for emission of DW_OP_implicit_value operation
 ;; for float type.
 
-; RUN: llc -debugger-tune=gdb -filetype=obj %s -o - | llvm-dwarfdump - | FileCheck %s
+; RUN: llc -debugger-tune=gdb -filetype=obj %s -o -  | llvm-dwarfdump - | FileCheck %s
+; RUN: llc -debugger-tune=lldb -filetype=obj %s -o - | llvm-dwarfdump - | FileCheck %s
 
 ; CHECK: .debug_info contents:
 ; CHECK: DW_TAG_variable
@@ -9,6 +10,14 @@
 ; CHECK-NEXT:                     [{{.*}}): DW_OP_implicit_value 0x4 0xc3 0xf5 0x48 0x40)
 ; CHECK-NEXT:  DW_AT_name    ("f")
 
+; RUN: llc -debugger-tune=sce -filetype=obj %s -o -  | llvm-dwarfdump - | FileCheck %s -check-prefix=SCE-CHECK
+
+; SCE-CHECK: .debug_info contents:
+; SCE-CHECK: DW_TAG_variable
+; SCE-CHECK-NEXT:  DW_AT_location        ({{.*}}
+; SCE-CHECK-NEXT:                     [{{.*}}): DW_OP_constu 0x4048f5c3, DW_OP_stack_value)
+; SCE-CHECK-NEXT:  DW_AT_name    ("f")
+
 ;; Generated from: clang -ggdb -O1
 ;;int main() {
 ;;        float f = 3.14f;

diff  --git a/llvm/test/DebugInfo/X86/stack-value-piece.ll b/llvm/test/DebugInfo/X86/stack-value-piece.ll
index 5b03a10d2f11..fd5d768c1544 100644
--- a/llvm/test/DebugInfo/X86/stack-value-piece.ll
+++ b/llvm/test/DebugInfo/X86/stack-value-piece.ll
@@ -26,15 +26,15 @@
 ; CHECK:   DW_AT_name ("f")
 ; CHECK:   DW_TAG_variable
 ; CHECK-NEXT:   DW_AT_location ([[F:0x[0-9a-f]+]]
-; CHECK-NEXT:     [{{.*}}, {{.*}}): DW_OP_reg17 XMM0, DW_OP_piece 0x4, DW_OP_lit0, DW_OP_stack_value, DW_OP_piece 0x4
-; CHECK-NEXT:     [{{.*}}, {{.*}}): DW_OP_piece 0x4, DW_OP_lit0, DW_OP_stack_value, DW_OP_piece 0x4)
+; 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)}}
+; 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)}})
 ; CHECK-NEXT:   DW_AT_name ("r")
 ;
 ; CHECK: .debug_loc contents:
 ; CHECK:      [[I]]:
 ; CHECK-NEXT:   ({{.*}}, {{.*}}): DW_OP_reg5 RDI, DW_OP_piece 0x4, DW_OP_lit0, DW_OP_stack_value, DW_OP_piece 0x4
 ; CHECK:      [[F]]:
-; CHECK-NEXT:   ({{.*}}, {{.*}}): DW_OP_reg17 XMM0, DW_OP_piece 0x4, DW_OP_lit0, DW_OP_stack_value, DW_OP_piece 0x4
+; 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}}
 
 source_filename = "stack-value-piece.c"
 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"


        


More information about the llvm-commits mailing list