gn build: Merge r374476
[llvm-complete.git] / test / MC / COFF / cv-inline-linetable.s
blob08f250eb43b9e970babf260357b663270f440725
1 # RUN: llvm-mc -triple=i686-pc-win32 -filetype=obj %s -o %t.o
2 # RUN: llvm-readobj --codeview %t.o | FileCheck %s
3 # RUN: llvm-objdump -d %t.o | FileCheck %s --check-prefix=ASM
4 # RUN: llvm-pdbutil dump -symbols %t.o | FileCheck %s --check-prefix=PDB
5 .text
6 .def @feat.00;
7 .scl 3;
8 .type 0;
9 .endef
10 .globl @feat.00
11 @feat.00 = 1
12 .def "?baz@@YAXXZ";
13 .scl 2;
14 .type 32;
15 .endef
16 .globl "?baz@@YAXXZ"
17 .p2align 4, 0x90
18 "?baz@@YAXXZ": # @"\01?baz@@YAXXZ"
19 Lfunc_begin0:
20 .cv_file 1 "D:\\src\\llvm\\build\\t.cpp"
21 .cv_func_id 0
22 .cv_inline_site_id 1 within 0 inlined_at 1 15 3
23 .cv_inline_site_id 2 within 1 inlined_at 1 10 3
24 .cv_loc 0 1 13 0 is_stmt 0 # t.cpp:13:0
25 # %bb.0: # %entry
26 pushl %eax
27 .cv_loc 0 1 14 5 # t.cpp:14:5
28 addl $6, "?x@@3HC"
29 .cv_loc 1 1 9 5 # t.cpp:9:5
30 addl $4, "?x@@3HC"
31 .cv_loc 2 1 3 7 # t.cpp:3:7
32 movl $1, (%esp)
33 leal (%esp), %eax
34 .cv_loc 2 1 4 5 # t.cpp:4:5
35 addl %eax, "?x@@3HC"
36 .cv_loc 2 1 5 5 # t.cpp:5:5
37 addl $2, "?x@@3HC"
38 .cv_loc 2 1 6 5 # t.cpp:6:5
39 addl $3, "?x@@3HC"
40 .cv_loc 1 1 11 5 # t.cpp:11:5
41 addl $5, "?x@@3HC"
42 .cv_loc 0 1 16 5 # t.cpp:16:5
43 addl $7, "?x@@3HC"
44 .cv_loc 0 1 17 1 # t.cpp:17:1
45 popl %eax
46 retl
47 Lfunc_end0:
49 # Check the disassembly so we have accurate instruction offsets in hex.
50 # ASM-LABEL: ?baz@@YAXXZ:
51 # ASM-NEXT: 0: {{.*}} pushl %eax
52 # ASM-NEXT: 1: {{.*}} addl $6, 0
53 # ASM-NEXT: 8: {{.*}} addl $4, 0
54 # ASM-NEXT: f: {{.*}} movl $1, (%esp)
55 # ASM-NEXT: 16: {{.*}} leal (%esp), %eax
56 # ASM-NEXT: 19: {{.*}} addl %eax, 0
57 # ASM-NEXT: 1f: {{.*}} addl $2, 0
58 # ASM-NEXT: 26: {{.*}} addl $3, 0
59 # ASM-NEXT: 2d: {{.*}} addl $5, 0
60 # ASM-NEXT: 34: {{.*}} addl $7, 0
61 # ASM-NEXT: 3b: {{.*}} popl %eax
62 # ASM-NEXT: 3c: {{.*}} retl
64 # PDB: S_GPROC32_ID {{.*}} `baz`
65 # PDB: S_INLINESITE
66 # PDB-NEXT: inlinee = 0x1003 (bar), parent = 0, end = 0
67 # PDB-NEXT: 0B08 code 0x8 (+0x8) line 0 (-0)
68 # PDB-NEXT: 0B27 code 0xF (+0x7) line 1 (+1)
69 # PDB-NEXT: 0602 line 2 (+1)
70 # PDB-NEXT: 031E code 0x2D (+0x1E)
71 # PDB-NEXT: 0407 code end 0x34 (+0x7)
72 # PDB: S_INLINESITE
73 # PDB-NEXT: inlinee = 0x1004 (foo), parent = 0, end = 0
74 # PDB-NEXT: 0B0F code 0xF (+0xF) line 0 (-0)
75 # PDB-NEXT: 0B2A code 0x19 (+0xA) line 1 (+1)
76 # PDB-NEXT: 0B26 code 0x1F (+0x6) line 2 (+1)
77 # PDB-NEXT: 0B27 code 0x26 (+0x7) line 3 (+1)
78 # PDB-NEXT: 0407 code end 0x2D (+0x7)
79 # PEB: S_INLINESITE_END
80 # PEB: S_INLINESITE_END
81 # PEB: S_PROC_ID_END
83 .section .debug$T,"dr"
84 .long 4
85 .short 6
86 .short 4609
87 .long 0
88 .short 14
89 .short 4104
90 .asciz "\003\000\000\000\000\000\000\000\000\020\000"
91 .short 14
92 .short 5633
93 .asciz "\000\000\000\000\001\020\000"
94 .ascii "baz"
95 .byte 0
96 .short 14
97 .short 5633
98 .asciz "\000\000\000\000\001\020\000"
99 .ascii "bar"
100 .byte 0
101 .short 14
102 .short 5633
103 .asciz "\000\000\000\000\001\020\000"
104 .ascii "foo"
105 .byte 0
106 .section .debug$S,"dr"
107 .long 4
108 .long 241 # Symbol subsection for baz
109 .long Ltmp1-Ltmp0
110 Ltmp0:
111 .short Ltmp3-Ltmp2
112 Ltmp2:
113 .short 4423
114 .zero 12
115 .long Lfunc_end0-"?baz@@YAXXZ"
116 .zero 12
117 .secrel32 "?baz@@YAXXZ"
118 .secidx "?baz@@YAXXZ"
119 .byte 0
120 .ascii "baz"
121 .byte 0
122 Ltmp3:
123 .short Ltmp5-Ltmp4
124 Ltmp4:
125 .short 4429
126 .long 0 # parent
127 .long 0 # end
128 .long 0x1003 # inlinee, bar
129 .cv_inline_linetable 1 1 9 Lfunc_begin0 Lfunc_end0
130 # CHECK: InlineSiteSym {
131 # CHECK: PtrParent: 0x0
132 # CHECK: PtrEnd: 0x0
133 # CHECK: Inlinee: bar (0x1003)
134 # CHECK: BinaryAnnotations [
135 # CHECK-NEXT: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0x8, LineOffset: 0}
136 # CHECK-NEXT: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0x7, LineOffset: 1}
137 # CHECK-NEXT: ChangeLineOffset: 1
138 # CHECK-NEXT: ChangeCodeOffset: 0x1E
139 # CHECK-NEXT: ChangeCodeLength: 0x7
140 # CHECK-NEXT: ]
141 # CHECK: }
142 Ltmp5:
143 .short Ltmp7-Ltmp6
144 Ltmp6:
145 .short 4429
146 .asciz "\000\000\000\000\000\000\000\000\004\020\000"
147 .cv_inline_linetable 2 1 3 Lfunc_begin0 Lfunc_end0
148 # CHECK: InlineSiteSym {
149 # CHECK: PtrParent: 0x0
150 # CHECK: PtrEnd: 0x0
151 # CHECK: Inlinee: foo (0x1004)
152 # CHECK: BinaryAnnotations [
153 # CHECK-NEXT: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0xF, LineOffset: 0}
154 # CHECK-NEXT: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0xA, LineOffset: 1}
155 # CHECK-NEXT: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0x6, LineOffset: 1}
156 # CHECK-NEXT: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0x7, LineOffset: 1}
157 # CHECK-NEXT: ChangeCodeLength: 0x7
158 # CHECK-NEXT: ]
159 # CHECK: }
160 Ltmp7:
161 .short 2
162 .short 4430
163 # CHECK: InlineSiteEnd {
164 # CHECK: }
165 .short 2
166 .short 4430
167 # CHECK: InlineSiteEnd {
168 # CHECK: }
169 .short 2
170 .short 4431
171 Ltmp1:
172 .p2align 2
173 .cv_linetable 0, "?baz@@YAXXZ", Lfunc_end0
174 .cv_filechecksums # File index to string table offset subsection
175 .cv_stringtable # String table
177 # CHECK-LABEL: FunctionLineTable [
178 # CHECK: LinkageName: ?baz@@YAXXZ
179 # CHECK: Flags: 0x1
180 # CHECK: CodeSize: 0x3D
181 # CHECK: FilenameSegment [
182 # CHECK: Filename: D:\src\llvm\build\t.cpp (0x0)
183 # CHECK: +0x0 [
184 # CHECK: LineNumberStart: 13
185 # CHECK: ]
186 # CHECK: +0x1 [
187 # CHECK: LineNumberStart: 14
188 # CHECK: ]
189 # CHECK: +0x8 [
190 # CHECK: LineNumberStart: 15
191 # CHECK: ]
192 # There shouldn't be any other line number entries because all the other
193 # .cv_locs are on line 15 where the top-level inline call site is.
194 # CHECK-NOT: LineNumberStart
195 # CHECK: +0x34 [
196 # CHECK: LineNumberStart: 16
197 # CHECK: ]
198 # CHECK: +0x3B [
199 # CHECK: LineNumberStart: 17
200 # CHECK: ]
201 # CHECK: ]
202 # CHECK: ]