xref: /llvm-project/llvm/test/DebugInfo/AArch64/dbg-entry-value-swiftasync.mir (revision bc5dac17439dc7be0a5cbdf3b4f19845c2d873d6)
1ee75422cSFelipe de Azevedo Piovezan# RUN: llc -start-after=machineverifier -O0 %s -filetype=obj -o - | llvm-dwarfdump - | FileCheck %s
2ee75422cSFelipe de Azevedo Piovezan
3ee75422cSFelipe de Azevedo Piovezan# CHECK:      DW_TAG_variable
4ee75422cSFelipe de Azevedo Piovezan# CHECK-NEXT:   DW_AT_location        (DW_OP_GNU_entry_value(DW_OP_reg22 W22))
5ee75422cSFelipe de Azevedo Piovezan# CHECK-NEXT:   DW_AT_name    ("a")
6af6d43eaSFelipe de Azevedo Piovezan# CHECK:      DW_TAG_variable
7af6d43eaSFelipe de Azevedo Piovezan# CHECK-NEXT:   DW_AT_location
8af6d43eaSFelipe de Azevedo Piovezan# CHECK-SAME:     DW_OP_GNU_entry_value(DW_OP_reg22 W22), DW_OP_piece 0x8,
9af6d43eaSFelipe de Azevedo Piovezan# CHECK-SAME:     DW_OP_GNU_entry_value(DW_OP_reg22 W22), DW_OP_plus_uconst 0x2a, DW_OP_piece 0x8)
10af6d43eaSFelipe de Azevedo Piovezan# CHECK-NEXT:   DW_AT_name    ("fragmented_var")
11*bc5dac17SFelipe de Azevedo Piovezan# CHECK:      DW_TAG_variable
12*bc5dac17SFelipe de Azevedo Piovezan# CHECK-NEXT:   DW_AT_location       (DW_OP_piece 0x8, DW_OP_GNU_entry_value(DW_OP_reg22 W22), DW_OP_piece 0x8)
13*bc5dac17SFelipe de Azevedo Piovezan# CHECK-NEXT:   DW_AT_name    ("multi_type_fragmented_var")
14ee75422cSFelipe de Azevedo Piovezan
15ee75422cSFelipe de Azevedo Piovezan
16ee75422cSFelipe de Azevedo Piovezan--- |
17ee75422cSFelipe de Azevedo Piovezan  target triple = "aarch64--"
18ee75422cSFelipe de Azevedo Piovezan  define void @foo(ptr %unused_arg, ptr swiftasync %async_arg) !dbg !4 {
19*bc5dac17SFelipe de Azevedo Piovezan    %storage = alloca i64
20ee75422cSFelipe de Azevedo Piovezan    call void @llvm.dbg.declare(metadata ptr %async_arg, metadata !10, metadata !DIExpression(DW_OP_LLVM_entry_value, 1)), !dbg !12
21af6d43eaSFelipe de Azevedo Piovezan    ; A two fragment variable.
22af6d43eaSFelipe de Azevedo Piovezan    ; Fragments intentionally out of order to ensure the code can handle this.
23af6d43eaSFelipe de Azevedo Piovezan    call void @llvm.dbg.declare(metadata ptr %async_arg, metadata !10, metadata !DIExpression(DW_OP_LLVM_entry_value, 1, DW_OP_plus_uconst, 42, DW_OP_LLVM_fragment, 64, 64)), !dbg !12
24af6d43eaSFelipe de Azevedo Piovezan    call void @llvm.dbg.declare(metadata ptr %async_arg, metadata !11, metadata !DIExpression(DW_OP_LLVM_entry_value, 1, DW_OP_LLVM_fragment, 0, 64)), !dbg !12
25*bc5dac17SFelipe de Azevedo Piovezan    ; A fragmented variable mixing entry values and stack slot locations.
26*bc5dac17SFelipe de Azevedo Piovezan    call void @llvm.dbg.declare(metadata ptr %async_arg, metadata !13, metadata !DIExpression(DW_OP_LLVM_entry_value, 1, DW_OP_LLVM_fragment, 64, 64)), !dbg !12
27*bc5dac17SFelipe de Azevedo Piovezan    call void @llvm.dbg.declare(metadata ptr %storage, metadata !13, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 64)), !dbg !12
28ee75422cSFelipe de Azevedo Piovezan    ret void, !dbg !12
29ee75422cSFelipe de Azevedo Piovezan  }
30ee75422cSFelipe de Azevedo Piovezan  declare void @llvm.dbg.declare(metadata, metadata, metadata)
31ee75422cSFelipe de Azevedo Piovezan  declare void @consume(ptr)
32ee75422cSFelipe de Azevedo Piovezan  !llvm.dbg.cu = !{!0}
33ee75422cSFelipe de Azevedo Piovezan  !llvm.module.flags = !{!2, !3}
34ee75422cSFelipe de Azevedo Piovezan  !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
35ee75422cSFelipe de Azevedo Piovezan  !1 = !DIFile(filename: "x.c", directory: "/")
36ee75422cSFelipe de Azevedo Piovezan  !2 = !{i32 2, !"Dwarf Version", i32 4}
37ee75422cSFelipe de Azevedo Piovezan  !3 = !{i32 2, !"Debug Info Version", i32 3}
38ee75422cSFelipe de Azevedo Piovezan  !4 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 1, type: !5, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0)
39ee75422cSFelipe de Azevedo Piovezan  !5 = !DISubroutineType(types: !6)
40ee75422cSFelipe de Azevedo Piovezan  !6 = !{null, !7, !7, !7}
41af6d43eaSFelipe de Azevedo Piovezan  !7 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !9, size: 128)
42ee75422cSFelipe de Azevedo Piovezan  !9 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
43ee75422cSFelipe de Azevedo Piovezan  !10 = !DILocalVariable(name: "a", scope: !4, file: !1, line: 1, type: !7)
44af6d43eaSFelipe de Azevedo Piovezan  !11 = !DILocalVariable(name: "fragmented_var", scope: !4, file: !1, line: 1, type: !7)
45ee75422cSFelipe de Azevedo Piovezan  !12 = !DILocation(line: 1, column: 37, scope: !4)
46*bc5dac17SFelipe de Azevedo Piovezan  !13 = !DILocalVariable(name: "multi_type_fragmented_var", scope: !4, file: !1, line: 1, type: !7)
47ee75422cSFelipe de Azevedo Piovezan...
48ee75422cSFelipe de Azevedo Piovezan---
49ee75422cSFelipe de Azevedo Piovezanname:            foo
50ee75422cSFelipe de Azevedo Piovezanliveins:
51ee75422cSFelipe de Azevedo Piovezan  - { reg: '$x0', virtual-reg: '' }
52ee75422cSFelipe de Azevedo Piovezan  - { reg: '$x22', virtual-reg: '' }
53ee75422cSFelipe de Azevedo Piovezanstack:
54ee75422cSFelipe de Azevedo Piovezan  - { id: 0, name: '', type: spill-slot, offset: -16, size: 8, alignment: 16,
55ee75422cSFelipe de Azevedo Piovezan      stack-id: default, callee-saved-register: '$lr', callee-saved-restored: true }
56*bc5dac17SFelipe de Azevedo Piovezan  - { id: 1, name: '', type: default, offset: 0, size: 1, alignment: 8,
57*bc5dac17SFelipe de Azevedo Piovezan      stack-id: default, callee-saved-register: '', callee-saved-restored: true,
58*bc5dac17SFelipe de Azevedo Piovezan      debug-info-variable: '!13', debug-info-expression: '!DIExpression(DW_OP_LLVM_fragment, 0, 64)',
59*bc5dac17SFelipe de Azevedo Piovezan      debug-info-location: '!12' }
60*bc5dac17SFelipe de Azevedo Piovezan
61ee75422cSFelipe de Azevedo Piovezanentry_values:
6288417098SFelipe de Azevedo Piovezan  - { entry-value-register: '$x22', debug-info-variable: '!10', debug-info-expression: '!DIExpression(DW_OP_LLVM_entry_value, 1, DW_OP_deref)',
63ee75422cSFelipe de Azevedo Piovezan      debug-info-location: '!12' }
64af6d43eaSFelipe de Azevedo Piovezan  - { entry-value-register: '$x22', debug-info-variable: '!11', debug-info-expression: '!DIExpression(DW_OP_LLVM_entry_value, 1, DW_OP_plus_uconst, 42, DW_OP_deref, DW_OP_LLVM_fragment, 64, 64)',
65af6d43eaSFelipe de Azevedo Piovezan      debug-info-location: '!12' }
66af6d43eaSFelipe de Azevedo Piovezan  - { entry-value-register: '$x22', debug-info-variable: '!11', debug-info-expression: '!DIExpression(DW_OP_LLVM_entry_value, 1,  DW_OP_deref, DW_OP_LLVM_fragment, 0, 64)',
67af6d43eaSFelipe de Azevedo Piovezan      debug-info-location: '!12' }
68*bc5dac17SFelipe de Azevedo Piovezan  - { entry-value-register: '$x22', debug-info-variable: '!13', debug-info-expression: '!DIExpression(DW_OP_LLVM_entry_value, 1, DW_OP_deref, DW_OP_LLVM_fragment, 64, 64)',
69*bc5dac17SFelipe de Azevedo Piovezan      debug-info-location: '!12' }
70ee75422cSFelipe de Azevedo Piovezanbody:             |
71ee75422cSFelipe de Azevedo Piovezan  bb.0 (%ir-block.0):
72ee75422cSFelipe de Azevedo Piovezan    liveins: $x0, $x22, $lr
73ee75422cSFelipe de Azevedo Piovezan    RET undef $lr, debug-location !12
74ee75422cSFelipe de Azevedo Piovezan...
75