OSDN Git Service

[Object/ELF] - Improve error reporting for notes.
[android-x86/external-llvm.git] / test / DebugInfo / MIR / X86 / dbgcall-site-lea-interpretation.mir
1 # RUN: llc -debug-entry-values -start-after=machineverifier -filetype=obj %s -o -| llvm-dwarfdump -| FileCheck %s
2 # CHECK: DW_TAG_GNU_call_site
3 # CHECK-NEXT:   DW_AT_abstract_origin {{.*}} "foo")
4 # CHECK-NEXT:   DW_AT_low_pc {{.*}} 
5 # CHECK-EMPTY: 
6 # CHECK-NEXT:   DW_TAG_GNU_call_site_parameter
7 # CHECK-NEXT:     DW_AT_location      (DW_OP_reg9 R9)
8 # CHECK-NEXT:     DW_AT_GNU_call_site_value   (DW_OP_breg15 R15+10)
9 # CHECK-EMPTY: 
10 # CHECK-NEXT:   DW_TAG_GNU_call_site_parameter
11 # CHECK-NEXT:     DW_AT_location      (DW_OP_reg8 R8)
12 # CHECK-NEXT:     DW_AT_GNU_call_site_value   (DW_OP_breg15 R15+0, DW_OP_lit2, DW_OP_mul, DW_OP_lit8, DW_OP_plus)
13 # CHECK-EMPTY: 
14 # CHECK-NEXT:   DW_TAG_GNU_call_site_parameter
15 # CHECK-NEXT:     DW_AT_location      (DW_OP_reg1 RDX)
16 # CHECK-NEXT:     DW_AT_GNU_call_site_value   (DW_OP_breg14 R14+0, DW_OP_lit5, DW_OP_mul, DW_OP_lit8, DW_OP_plus)
17 # CHECK-EMPTY: 
18 # CHECK-NEXT:   DW_TAG_GNU_call_site_parameter
19 # CHECK-NEXT:     DW_AT_location      (DW_OP_reg4 RSI)
20 # CHECK-NEXT:     DW_AT_GNU_call_site_value   (DW_OP_breg14 R14+0)
21 # CHECK-EMPTY: 
22 # CHECK-NEXT:   DW_TAG_GNU_call_site_parameter
23 # CHECK-NEXT:     DW_AT_location      (DW_OP_reg5 RDI)
24 # CHECK-NEXT:     DW_AT_GNU_call_site_value   (DW_OP_breg14 R14+0, DW_OP_breg15 R15+0, DW_OP_lit2, DW_OP_mul, DW_OP_plus, DW_OP_lit4, DW_OP_plus)
25 # CHECK-EMPTY: 
26 # CHECK-NEXT:   DW_TAG_GNU_call_site_parameter
27 # CHECK-NEXT:     DW_AT_location      (DW_OP_reg2 RCX)
28 # CHECK-NEXT:     DW_AT_GNU_call_site_value   (DW_OP_breg14 R14+0, DW_OP_breg15 R15+0, DW_OP_plus)
29 # CHECK: DW_TAG_GNU_call_site
30 # CHECK-NEXT:   DW_AT_abstract_origin {{.*}} "foo2")
31 # CHECK-NEXT:   DW_AT_low_pc {{.*}}
32 # CHECK-EMPTY: 
33 # CHECK-NEXT:   DW_TAG_GNU_call_site_parameter
34 # CHECK-NEXT:     DW_AT_location      (DW_OP_reg5 RDI)
35 # CHECK-NEXT:     DW_AT_GNU_call_site_value   (DW_OP_breg14 R14+0, DW_OP_lit2, DW_OP_mul)
36 --- |
37   ; ModuleID = 'dbgcall-site-lea-interpretation.ll'
38   source_filename = "dbgcall-site-lea-interpretation.c"
39   target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
40   target triple = "x86_64-unknown-linux-gnu"
41   
42   define dso_local i32 @baa(i32 %arg1, i32 %arg2, i32 %arg3) local_unnamed_addr !dbg !10 {
43   entry:
44     %arg1.addr = alloca i32, align 4
45     %arg3.addr = alloca i32, align 4
46     %local1 = alloca i32, align 4
47     store i32 %arg1, i32* %arg1.addr, align 4
48     store i32 %arg3, i32* %arg3.addr, align 4
49     %0 = bitcast i32* %local1 to i8*, !dbg !14
50     %mul = mul nsw i32 %arg3, %arg1, !dbg !14
51     store i32 %mul, i32* %local1, align 4, !dbg !14
52     %add = add nsw i32 %arg2, %arg1, !dbg !14
53     %sub = sub nsw i32 %add, %arg3, !dbg !14
54     %call = call i32 @foo(i32 %mul, i32 %sub, i32* nonnull %local1, i32* nonnull %arg1.addr, i32* nonnull %arg3.addr, i32 %add), !dbg !14
55     %1 = load i32, i32* %local1, align 4, !dbg !14
56     %add2 = add nsw i32 %1, %call, !dbg !14
57     store i32 %add2, i32* %local1, align 4, !dbg !14
58     %call3 = call i32 @foo2(i32* nonnull %local1), !dbg !14
59     %2 = load i32, i32* %local1, align 4, !dbg !14
60     ret i32 %2, !dbg !14
61   }
62   
63   declare !dbg !4 dso_local i32 @foo(i32, i32, i32*, i32*, i32*, i32) local_unnamed_addr
64   
65   declare !dbg !5 dso_local i32 @foo2(i32*) local_unnamed_addr
66   
67   !llvm.dbg.cu = !{!0}
68   !llvm.module.flags = !{!6, !7, !8}
69   !llvm.ident = !{!9}
70   
71   !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 9.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, nameTableKind: None)
72   !1 = !DIFile(filename: "dbgcall-site-lea-interpretation.c", directory: "/dir")
73   !2 = !{}
74   !3 = !{!4, !5}
75   !4 = !DISubprogram(name: "foo", scope: !1, file: !1, line: 8, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
76   !5 = !DISubprogram(name: "foo2", scope: !1, file: !1, line: 9, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
77   !6 = !{i32 2, !"Dwarf Version", i32 4}
78   !7 = !{i32 2, !"Debug Info Version", i32 3}
79   !8 = !{i32 1, !"wchar_size", i32 4}
80   !9 = !{!"clang version 9.0.0"}
81   !10 = distinct !DISubprogram(name: "baa", scope: !1, file: !1, line: 11, type: !11, scopeLine: 11, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
82   !11 = !DISubroutineType(types: !12)
83   !12 = !{!13, !13, !13, !13}
84   !13 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
85   !14 = !DILocation(line: 11, column: 13, scope: !10)
86
87 ...
88 ---
89 name:            baa
90 liveins:         
91   - { reg: '$edi', virtual-reg: '' }
92   - { reg: '$esi', virtual-reg: '' }
93   - { reg: '$edx', virtual-reg: '' }
94 callSites:       
95   - { bb: 0, offset: 21, fwdArgRegs: 
96       - { arg: 0, reg: '$edi' }
97       - { arg: 1, reg: '$esi' }
98       - { arg: 2, reg: '$rdx' }
99       - { arg: 3, reg: '$rcx' }
100       - { arg: 4, reg: '$r8' }
101       - { arg: 5, reg: '$r9d' } }
102   - { bb: 0, offset: 24, fwdArgRegs: 
103       - { arg: 0, reg: '$rdi' } }
104 body:             |
105   bb.0.entry:
106     liveins: $edi, $edx, $esi, $rbx
107   
108     frame-setup PUSH64r killed $rbx, implicit-def $rsp, implicit $rsp
109     CFI_INSTRUCTION def_cfa_offset 16
110     $rsp = frame-setup SUB64ri8 $rsp, 16, implicit-def dead $eflags
111     CFI_INSTRUCTION def_cfa_offset 32
112     CFI_INSTRUCTION offset $rbx, -16
113     $r9d = MOV32rr $esi
114     $r14 = MOV64rr $rsi
115     $r15 = MOV64rr $rdi
116     MOV32mr $rsp, 1, $noreg, 12, $noreg, renamable $edi :: (store 4 into %ir.arg1.addr)
117     MOV32mr $rsp, 1, $noreg, 8, $noreg, renamable $edx :: (store 4 into %ir.arg3.addr)
118     renamable $r9d = nsw ADD32rr killed renamable $r9d, renamable $edi, implicit-def dead $eflags, debug-location !14
119     $esi = MOV32rr $r9d, debug-location !14
120     renamable $esi = nsw SUB32rr killed renamable $esi, renamable $edx, implicit-def dead $eflags, debug-location !14
121     renamable $edx = nsw IMUL32rr killed renamable $edx, killed renamable $edi, implicit-def dead $eflags, debug-location !14
122     MOV32mr $rsp, 1, $noreg, 4, $noreg, renamable $edx, debug-location !14 :: (store 4 into %ir.local1)
123     renamable $rcx = LEA64r $r14, 1, $r15, 0, $noreg
124     renamable $rdi = LEA64r $r14, 2, $r15, 4, $noreg
125     renamable $rsi = LEA64r $r14, 1, $noreg, 0, $noreg
126     renamable $rdx = LEA64r $r14, 4, $r14, 8, $noreg
127     renamable $r8 = LEA64r $noreg, 2, $r15, 8, $noreg
128     renamable $r9 = LEA64r  $noreg, 1, $r15, 10, $noreg, implicit-def $r9d
129     CALL64pcrel32 @foo, csr_64, implicit $rsp, implicit $ssp, implicit $edi, implicit $esi, implicit $rdx, implicit $rcx, implicit $r8, implicit $r9d, implicit-def $rsp, implicit-def $ssp, implicit-def $eax, debug-location !14
130     ADD32mr $rsp, 1, $noreg, 4, $noreg, killed renamable $eax, implicit-def dead $eflags, debug-location !14 :: (store 4 into %ir.local1), (dereferenceable load 4 from %ir.local1)
131     $rdi = LEA64r $r14, 1, killed $r14, 0, $noreg
132     CALL64pcrel32 @foo2, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, implicit-def $rsp, implicit-def $ssp, implicit-def dead $eax, debug-location !14
133     renamable $eax = MOV32rm $rsp, 1, $noreg, 4, $noreg, debug-location !14 :: (dereferenceable load 4 from %ir.local1)
134     $rsp = frame-destroy ADD64ri8 $rsp, 16, implicit-def dead $eflags, debug-location !14
135     CFI_INSTRUCTION def_cfa_offset 16, debug-location !14
136     $rbx = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !14
137     CFI_INSTRUCTION def_cfa_offset 8, debug-location !14
138     RETQ $eax, debug-location !14
139
140 ...