• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# We do not support the call site info for the target now, so we use the experimental option (-emit-call-site-info -debug-entry-values).
2
3# RUN: llc -emit-call-site-info -debug-entry-values -mtriple hexagon -start-after=machineverifier -filetype=obj %s -o - | llvm-dwarfdump - | FileCheck %s
4
5# Based on the following C reproducer:
6#
7# int ga, gb, gc;
8#
9# extern void callee(int, int, int);
10#
11# void caller() {
12#   int a = ga;
13#   int b = gb;
14#   int c = gc;
15#
16#   // Clobber all integer registers.
17#   __asm("" : : :
18#         "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10",
19#         "r11", "r12", "r13", "r14", "r15", "r16", "r17", "r18", "r19", "r20",
20#         "r21", "r22", "r23", "r24", "r25", "r26", "r27", "r28");
21#
22#   callee(a, b, c);
23# }
24
25--- |
26  target datalayout = "e-m:e-p:32:32:32-a:0-n16:32-i64:64:64-i32:32:32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-v32:32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048:2048:2048"
27  target triple = "hexagon"
28
29  @ga = common global i32 0, align 4
30  @gb = common global i32 0, align 4
31  @gc = common global i32 0, align 4
32
33  ; Function Attrs: nounwind
34  define void @caller() #0 !dbg !12 {
35  entry:
36    %0 = load i32, i32* @ga, align 4, !dbg !15
37    %1 = load i32, i32* @gb, align 4, !dbg !16
38    %2 = load i32, i32* @gc, align 4, !dbg !17
39    call void asm sideeffect "", "~{r0},~{r1},~{r2},~{r3},~{r4},~{r5},~{r6},~{r7},~{r8},~{r9},~{r10},~{r11},~{r12},~{r13},~{r14},~{r15},~{r16},~{r17},~{r18},~{r19},~{r20},~{r21},~{r22},~{r23},~{r24},~{r25},~{r26},~{r27},~{r28}"(), !dbg !18, !srcloc !19
40    call void @callee(i32 %0, i32 %1, i32 %2), !dbg !20
41    ret void, !dbg !21
42  }
43
44  declare !dbg !4 void @callee(i32, i32, i32)
45
46  attributes #0 = { nounwind }
47
48  !llvm.dbg.cu = !{!0}
49  !llvm.module.flags = !{!8, !9, !10}
50  !llvm.ident = !{!11}
51
52  !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 10.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, globals: !2, nameTableKind: None)
53  !1 = !DIFile(filename: "h.c", directory: "/")
54  !2 = !{}
55  !3 = !{!4}
56  !4 = !DISubprogram(name: "callee", scope: !1, file: !1, line: 3, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
57  !5 = !DISubroutineType(types: !6)
58  !6 = !{null, !7, !7, !7}
59  !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
60  !8 = !{i32 7, !"Dwarf Version", i32 4}
61  !9 = !{i32 2, !"Debug Info Version", i32 3}
62  !10 = !{i32 1, !"wchar_size", i32 4}
63  !11 = !{!"clang version 10.0.0"}
64  !12 = distinct !DISubprogram(name: "caller", scope: !1, file: !1, line: 5, type: !13, scopeLine: 5, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
65  !13 = !DISubroutineType(types: !14)
66  !14 = !{null}
67  !15 = !DILocation(line: 6, scope: !12)
68  !16 = !DILocation(line: 7, scope: !12)
69  !17 = !DILocation(line: 8, scope: !12)
70  !18 = !DILocation(line: 11, scope: !12)
71  !19 = !{i32 158}
72  !20 = !DILocation(line: 16, scope: !12)
73  !21 = !DILocation(line: 17, scope: !12)
74
75...
76---
77name:            caller
78tracksRegLiveness: true
79frameInfo:
80  stackSize:       64
81  maxAlignment:    4
82  adjustsStack:    true
83  hasCalls:        true
84  maxCallFrameSize: 0
85fixedStack:
86  - { id: 0, type: spill-slot, offset: -48, size: 8, alignment: 8, callee-saved-register: '$d13' }
87  - { id: 1, type: spill-slot, offset: -40, size: 8, alignment: 8, callee-saved-register: '$d12' }
88  - { id: 2, type: spill-slot, offset: -32, size: 8, alignment: 8, callee-saved-register: '$d11' }
89  - { id: 3, type: spill-slot, offset: -24, size: 8, alignment: 8, callee-saved-register: '$d10' }
90  - { id: 4, type: spill-slot, offset: -16, size: 8, alignment: 8, callee-saved-register: '$d9' }
91  - { id: 5, type: spill-slot, offset: -8, size: 8, alignment: 8, callee-saved-register: '$d8' }
92stack:
93  - { id: 0, type: spill-slot, offset: -52, size: 4, alignment: 4 }
94  - { id: 1, type: spill-slot, offset: -56, size: 4, alignment: 4 }
95  - { id: 2, type: spill-slot, offset: -60, size: 4, alignment: 4 }
96callSites:
97  - { bb: 0, offset: 40, fwdArgRegs:
98      - { arg: 0, reg: '$r0' }
99      - { arg: 1, reg: '$r1' }
100      - { arg: 2, reg: '$r2' } }
101body:             |
102  bb.0.entry:
103    liveins: $d8, $d9, $d10, $d11, $d12, $d13, $d8, $d9, $d10, $d11, $d12, $d13
104
105    BUNDLE implicit-def $r29, implicit-def $r30, implicit $r29, implicit killed $framekey, implicit killed $framelimit, implicit killed $r30, implicit killed $r31, implicit killed $d8, debug-location !15 {
106      $r29 = S2_allocframe $r29, 64, implicit-def $r30, implicit killed $framekey, implicit killed $framelimit, implicit killed $r30, implicit killed $r31, debug-location !15 :: (store 4 into stack)
107      S2_storerd_io internal $r29, -16, killed $d8, debug-location !15 :: (store 8 into %fixed-stack.5)
108    }
109    CFI_INSTRUCTION def_cfa $r30, 8
110    CFI_INSTRUCTION offset $r31, -4
111    CFI_INSTRUCTION offset $r30, -8
112    CFI_INSTRUCTION offset $r17, -12
113    CFI_INSTRUCTION offset $r16, -16
114    CFI_INSTRUCTION offset $r19, -20
115    CFI_INSTRUCTION offset $r18, -24
116    CFI_INSTRUCTION offset $r21, -28
117    CFI_INSTRUCTION offset $r20, -32
118    CFI_INSTRUCTION offset $r23, -36
119    CFI_INSTRUCTION offset $r22, -40
120    CFI_INSTRUCTION offset $r25, -44
121    CFI_INSTRUCTION offset $r24, -48
122    CFI_INSTRUCTION offset $r27, -52
123    CFI_INSTRUCTION offset $r26, -56
124    BUNDLE implicit $r29, implicit killed $d9, implicit killed $d10, debug-location !15 {
125      S2_storerd_io $r29, 48, killed $d9, debug-location !15 :: (store 8 into %fixed-stack.4)
126      S2_storerd_io $r29, 40, killed $d10, debug-location !15 :: (store 8 into %fixed-stack.3)
127    }
128    BUNDLE implicit $r29, implicit killed $d11, implicit killed $d12, debug-location !15 {
129      S2_storerd_io $r29, 32, killed $d11, debug-location !15 :: (store 8 into %fixed-stack.2)
130      S2_storerd_io $r29, 24, killed $d12, debug-location !15 :: (store 8 into %fixed-stack.1)
131    }
132    BUNDLE implicit-def $r0, implicit $r29, implicit killed $d13, implicit $gp, debug-location !15 {
133      S2_storerd_io $r29, 16, killed $d13, debug-location !15 :: (store 8 into %fixed-stack.0)
134      renamable $r0 = L2_loadrigp @ga, implicit $gp, debug-location !15 :: (dereferenceable load 4 from @ga)
135    }
136    BUNDLE implicit-def $r0, implicit $r29, implicit killed $r0, implicit $gp, debug-location !16 {
137      S2_storeri_io $r29, 12, killed renamable $r0, debug-location !16 :: (store 4 into %stack.0)
138      renamable $r0 = L2_loadrigp @gb, implicit $gp, debug-location !16 :: (dereferenceable load 4 from @gb)
139    }
140    BUNDLE implicit-def $r0, implicit $r29, implicit killed $r0, implicit killed $gp, debug-location !17 {
141      S2_storeri_io $r29, 8, killed renamable $r0, debug-location !17 :: (store 4 into %stack.1)
142      renamable $r0 = L2_loadrigp @gc, implicit killed $gp, debug-location !17 :: (dereferenceable load 4 from @gc)
143    }
144    S2_storeri_io $r29, 4, killed renamable $r0, debug-location !18 :: (store 4 into %stack.2)
145    INLINEASM &"", 1, 12, implicit-def dead early-clobber $r0, 12, implicit-def dead early-clobber $r1, 12, implicit-def dead early-clobber $r2, 12, implicit-def dead early-clobber $r3, 12, implicit-def dead early-clobber $r4, 12, implicit-def dead early-clobber $r5, 12, implicit-def dead early-clobber $r6, 12, implicit-def dead early-clobber $r7, 12, implicit-def dead early-clobber $r8, 12, implicit-def dead early-clobber $r9, 12, implicit-def dead early-clobber $r10, 12, implicit-def dead early-clobber $r11, 12, implicit-def dead early-clobber $r12, 12, implicit-def dead early-clobber $r13, 12, implicit-def dead early-clobber $r14, 12, implicit-def dead early-clobber $r15, 12, implicit-def dead early-clobber $r16, 12, implicit-def dead early-clobber $r17, 12, implicit-def dead early-clobber $r18, 12, implicit-def dead early-clobber $r19, 12, implicit-def dead early-clobber $r20, 12, implicit-def dead early-clobber $r21, 12, implicit-def dead early-clobber $r22, 12, implicit-def dead early-clobber $r23, 12, implicit-def dead early-clobber $r24, 12, implicit-def dead early-clobber $r25, 12, implicit-def dead early-clobber $r26, 12, implicit-def dead early-clobber $r27, 12, implicit-def dead early-clobber $r28, !19, debug-location !18
146    BUNDLE implicit-def $r0, implicit-def $r1, implicit $r29, debug-location !20 {
147      $r0 = L2_loadri_io $r29, 12, debug-location !20 :: (load 4 from %stack.0)
148      $r1 = L2_loadri_io $r29, 8, debug-location !20 :: (load 4 from %stack.1)
149    }
150    BUNDLE implicit-def dead $r2, implicit-def dead $pc, implicit-def dead $r31, implicit-def $r29, implicit $r29, implicit killed $r0, implicit killed $r1, debug-location !20 {
151      $r2 = L2_loadri_io $r29, 4, debug-location !20 :: (load 4 from %stack.2)
152      J2_call @callee, hexagoncsr, implicit-def dead $pc, implicit-def dead $r31, implicit $r29, implicit killed $r0, implicit killed $r1, implicit internal killed $r2, implicit-def $r29, debug-location !20
153    }
154    BUNDLE implicit-def $d8, implicit-def $r16, implicit-def $r17, implicit-def $d9, implicit-def $r18, implicit-def $r19, implicit $r29, debug-location !21 {
155      $d8 = L2_loadrd_io $r29, 56, debug-location !21 :: (load 8 from %fixed-stack.5)
156      $d9 = L2_loadrd_io $r29, 48, debug-location !21 :: (load 8 from %fixed-stack.4)
157    }
158    BUNDLE implicit-def $d10, implicit-def $r20, implicit-def $r21, implicit-def $d11, implicit-def $r22, implicit-def $r23, implicit $r29, debug-location !21 {
159      $d10 = L2_loadrd_io $r29, 40, debug-location !21 :: (load 8 from %fixed-stack.3)
160      $d11 = L2_loadrd_io $r29, 32, debug-location !21 :: (load 8 from %fixed-stack.2)
161    }
162    BUNDLE implicit-def $d12, implicit-def $r24, implicit-def $r25, implicit-def $d13, implicit-def $r26, implicit-def $r27, implicit killed $r29, debug-location !21 {
163      $d12 = L2_loadrd_io $r29, 24, debug-location !21 :: (load 8 from %fixed-stack.1)
164      $d13 = L2_loadrd_io killed $r29, 16, debug-location !21 :: (load 8 from %fixed-stack.0)
165    }
166    $d15 = L4_return killed $r30, implicit-def $pc, implicit-def $r29, implicit killed $framekey, implicit-def dead $pc, implicit $d8, implicit $d9, implicit $d10, implicit $d11, implicit $d12, implicit $d13, debug-location !21
167
168...
169
170# Verify that call site entries are emitted for all three parameters.
171# Previously the code that's looking for instructions to describe parameters
172# with would stop when reaching the bundle header for the bundled call,
173# resulting in $r0 and $r1 not being described.
174#
175# Please note that at the time of creating this test the Hexagon target did not
176# support call site information, so the "callSites" array has been manually
177# added.
178
179# CHECK: DW_TAG_GNU_call_site_parameter
180# CHECK-NEXT: DW_AT_location      (DW_OP_reg2 R2)
181# CHECK-NEXT: DW_AT_GNU_call_site_value   (DW_OP_breg29 R29+4, DW_OP_deref_size 0x4)
182
183# CHECK: DW_TAG_GNU_call_site_parameter
184# CHECK-NEXT: DW_AT_location      (DW_OP_reg1 R1)
185# CHECK-NEXT: DW_AT_GNU_call_site_value   (DW_OP_breg29 R29+8, DW_OP_deref_size 0x4)
186
187# CHECK: DW_TAG_GNU_call_site_parameter
188# CHECK-NEXT: DW_AT_location      (DW_OP_reg0 R0)
189# CHECK-NEXT: DW_AT_GNU_call_site_value   (DW_OP_breg29 R29+12, DW_OP_deref_size 0x4)
190