1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
|
; RUN: llc -mcpu=core2 -mtriple=i686-pc-win32 -O0 < %s | FileCheck --check-prefix=X86 %s
; RUN: llc -mcpu=core2 -mtriple=i686-pc-win32 -o - -O0 < %s | llvm-mc -triple=i686-pc-win32 -filetype=obj | llvm-readobj -s -sr -codeview -section-symbols | FileCheck --check-prefix=OBJ32 %s
; RUN: llc -mcpu=core2 -mtriple=x86_64-pc-win32 -O0 < %s | FileCheck --check-prefix=X64 %s
; RUN: llc -mcpu=core2 -mtriple=x86_64-pc-win32 -o - -O0 < %s | llvm-mc -triple=x86_64-pc-win32 -filetype=obj | llvm-readobj -s -sr -codeview -section-symbols | FileCheck --check-prefix=OBJ64 %s
; This LL file was generated by running clang on the following code:
; D:\asm.c:
; 1 void g(void);
; 2
; 3 void f(void) {
; 4 __asm align 4;
; 5 g();
; 6 }
; X86-LABEL: _f:
; X86: # BB
; X86-NEXT: [[ASM_LINE:^L.*]]:{{$}}
; X86: [[CALL_LINE:^L.*]]:{{$}}
; X86: calll _g
; X86-NEXT: [[RETURN_STMT:.*]]:
; X86: ret
; X86-NEXT: L{{.*}}:
; X86-NEXT: [[END_OF_F:^L.*]]:
;
; X86-LABEL: .section .debug$S,"dr"
; X86-NEXT: .long 4
; Symbol subsection
; X86-NEXT: .long 241
; X86-NEXT: .long [[F1_END:.*]]-[[F1_START:.*]]
; X86-NEXT: [[F1_START]]:
; X86-NEXT: .short [[PROC_SEGMENT_END:.*]]-[[PROC_SEGMENT_START:.*]]
; X86-NEXT: [[PROC_SEGMENT_START]]:
; X86-NEXT: .short 4423
; X86-NEXT: .zero 12
; X86-NEXT: .long [[END_OF_F]]-_f
; X86-NEXT: .zero 12
; X86-NEXT: .secrel32 _f
; X86-NEXT: .secidx _f
; X86-NEXT: .byte 0
; X86-NEXT: .byte 102
; X86-NEXT: .byte 0
; X86-NEXT: [[PROC_SEGMENT_END]]:
; X86-NEXT: .short 2
; X86-NEXT: .short 4431
; X86-NEXT: [[F1_END]]:
; Padding
; X86-NEXT: .zero 3
; Line table
; X86-NEXT: .long 242
; X86-NEXT: .long [[F2_END:.*]]-[[F2_START:.*]]
; X86-NEXT: [[F2_START]]:
; X86-NEXT: .secrel32 _f
; X86-NEXT: .secidx _f
; X86-NEXT: .short 0
; X86-NEXT: .long [[END_OF_F]]-_f
; X86-NEXT: [[FILE_SEGMENT_START:[^:]*]]:
; X86-NEXT: .long 0
; X86-NEXT: .long 3
; X86-NEXT: .long [[FILE_SEGMENT_END:.*]]-[[FILE_SEGMENT_START]]
; X86-NEXT: .long [[ASM_LINE]]-_f
; X86-NEXT: .long 4
; X86-NEXT: .long [[CALL_LINE]]-_f
; X86-NEXT: .long 5
; X86-NEXT: .long [[RETURN_STMT]]-_f
; X86-NEXT: .long 6
; X86-NEXT: [[FILE_SEGMENT_END]]:
; X86-NEXT: [[F2_END]]:
; File index to string table offset subsection
; X86-NEXT: .long 244
; X86-NEXT: .long 8
; X86-NEXT: .long 1
; X86-NEXT: .long 0
; String table
; X86-NEXT: .long 243
; X86-NEXT: .long 10
; X86-NEXT: .byte 0
; X86-NEXT: .ascii "D:\\asm.c"
; X86-NEXT: .byte 0
; Padding
; X86-NEXT: .zero 2
; OBJ32: Section {
; OBJ32: Name: .debug$S (2E 64 65 62 75 67 24 53)
; OBJ32: Characteristics [ (0x42100040)
; OBJ32: ]
; OBJ32: Relocations [
; OBJ32-NEXT: 0x2C IMAGE_REL_I386_SECREL _f
; OBJ32-NEXT: 0x30 IMAGE_REL_I386_SECTION _f
; OBJ32-NEXT: 0x44 IMAGE_REL_I386_SECREL _f
; OBJ32-NEXT: 0x48 IMAGE_REL_I386_SECTION _f
; OBJ32-NEXT: ]
; OBJ32: Subsection [
; OBJ32-NEXT: Type: 0xF1
; OBJ32-NOT: ]
; OBJ32: ProcStart {
; OBJ32-NEXT: DisplayName: f
; OBJ32-NEXT: Section: _f
; OBJ32-NEXT: CodeSize: 0x6
; OBJ32-NEXT: }
; OBJ32-NEXT: ProcEnd
; OBJ32-NEXT: ]
; OBJ32: FunctionLineTable [
; OBJ32-NEXT: Name: _f
; OBJ32-NEXT: CodeSize: 0x6
; OBJ32-NEXT: FilenameSegment [
; OBJ32-NEXT: Filename: D:\asm.c
; FIXME: An empty __asm stmt creates an extra entry.
; We seem to know that these offsets are the same statically during the
; execution of endModule(). See PR18679 for the details.
; OBJ32-NEXT: +0x0: 4
; OBJ32-NEXT: +0x0: 5
; OBJ32-NEXT: +0x5: 6
; OBJ32-NEXT: ]
; OBJ32-NEXT: ]
; OBJ32: }
; X64-LABEL: f:
; X64-NEXT: .L{{.*}}:{{$}}
; X64-NEXT: [[START:.*]]:{{$}}
; X64: # BB
; X64: subq $40, %rsp
; X64-NEXT: [[ASM_LINE:.*]]:{{$}}
; X64: [[CALL_LINE:.*]]:{{$}}
; X64: callq g
; X64-NEXT: [[EPILOG_AND_RET:.*]]:
; X64: addq $40, %rsp
; X64-NEXT: ret
; X64-NEXT: .L{{.*}}:
; X64-NEXT: [[END_OF_F:.*]]:
;
; X64-LABEL: .section .debug$S,"dr"
; X64-NEXT: .long 4
; Symbol subsection
; X64-NEXT: .long 241
; X64-NEXT: .long [[F1_END:.*]]-[[F1_START:.*]]
; X64-NEXT: [[F1_START]]:
; X64-NEXT: .short [[PROC_SEGMENT_END:.*]]-[[PROC_SEGMENT_START:.*]]
; X64-NEXT: [[PROC_SEGMENT_START]]:
; X64-NEXT: .short 4423
; X64-NEXT: .zero 12
; X64-NEXT: .long [[END_OF_F]]-f
; X64-NEXT: .zero 12
; X64-NEXT: .secrel32 f
; X64-NEXT: .secidx f
; X64-NEXT: .byte 0
; X64-NEXT: .byte 102
; X64-NEXT: .byte 0
; X64-NEXT: [[PROC_SEGMENT_END]]:
; X64-NEXT: .short 2
; X64-NEXT: .short 4431
; X64-NEXT: [[F1_END]]:
; Padding
; X64-NEXT: .zero 3
; Line table
; X64-NEXT: .long 242
; X64-NEXT: .long [[F2_END:.*]]-[[F2_START:.*]]
; X64-NEXT: [[F2_START]]:
; X64-NEXT: .secrel32 f
; X64-NEXT: .secidx f
; X64-NEXT: .short 0
; X64-NEXT: .long [[END_OF_F]]-f
; X64-NEXT: [[FILE_SEGMENT_START:[^:]*]]:
; X64-NEXT: .long 0
; X64-NEXT: .long 4
; X64-NEXT: .long [[FILE_SEGMENT_END:.*]]-[[FILE_SEGMENT_START]]
; X64-NEXT: .long [[START]]-f
; X64-NEXT: .long 3
; X64-NEXT: .long [[ASM_LINE]]-f
; X64-NEXT: .long 4
; X64-NEXT: .long [[CALL_LINE]]-f
; X64-NEXT: .long 5
; X64-NEXT: .long [[EPILOG_AND_RET]]-f
; X64-NEXT: .long 6
; X64-NEXT: [[FILE_SEGMENT_END]]:
; X64-NEXT: [[F2_END]]:
; File index to string table offset subsection
; X64-NEXT: .long 244
; X64-NEXT: .long 8
; X64-NEXT: .long 1
; X64-NEXT: .long 0
; String table
; X64-NEXT: .long 243
; X64-NEXT: .long 10
; X64-NEXT: .byte 0
; X64-NEXT: .ascii "D:\\asm.c"
; X64-NEXT: .byte 0
; Padding
; X64-NEXT: .zero 2
; OBJ64: Section {
; OBJ64: Name: .debug$S (2E 64 65 62 75 67 24 53)
; OBJ64: Characteristics [ (0x42100040)
; OBJ64: ]
; OBJ64: Relocations [
; OBJ64-NEXT: 0x2C IMAGE_REL_AMD64_SECREL f
; OBJ64-NEXT: 0x30 IMAGE_REL_AMD64_SECTION f
; OBJ64-NEXT: 0x44 IMAGE_REL_AMD64_SECREL f
; OBJ64-NEXT: 0x48 IMAGE_REL_AMD64_SECTION f
; OBJ64-NEXT: ]
; OBJ64: Subsection [
; OBJ64-NEXT: Type: 0xF1
; OBJ64-NOT: ]
; OBJ64: ProcStart {
; OBJ64-NEXT: DisplayName: f
; OBJ64-NEXT: Section: f
; OBJ64-NEXT: CodeSize: 0xE
; OBJ64-NEXT: }
; OBJ64-NEXT: ProcEnd
; OBJ64-NEXT: ]
; OBJ64: FunctionLineTable [
; OBJ64-NEXT: Name: f
; OBJ64-NEXT: CodeSize: 0xE
; OBJ64-NEXT: FilenameSegment [
; OBJ64-NEXT: Filename: D:\asm.c
; OBJ64-NEXT: +0x0: 3
; FIXME: An empty __asm stmt creates an extra entry.
; See PR18679 for the details.
; OBJ64-NEXT: +0x4: 4
; OBJ64-NEXT: +0x4: 5
; OBJ64-NEXT: +0x9: 6
; OBJ64-NEXT: ]
; OBJ64-NEXT: ]
; OBJ64: }
; Function Attrs: nounwind
define void @f() #0 {
entry:
call void asm sideeffect inteldialect ".align 4", "~{dirflag},~{fpsr},~{flags}"() #2, !dbg !12
call void @g(), !dbg !13
ret void, !dbg !14
}
declare void @g() #1
attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #2 = { nounwind }
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!9, !10}
!llvm.ident = !{!11}
!0 = !MDCompileUnit(language: DW_LANG_C99, producer: "clang version 3.5 ", isOptimized: false, emissionKind: 0, file: !1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2, imports: !2)
!1 = !MDFile(filename: "<unknown>", directory: "D:\5C")
!2 = !{}
!3 = !{!4}
!4 = !MDSubprogram(name: "f", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 3, file: !5, scope: !6, type: !7, function: void ()* @f, variables: !2)
!5 = !MDFile(filename: "asm.c", directory: "D:\5C")
!6 = !MDFile(filename: "asm.c", directory: "D:C")
!7 = !MDSubroutineType(types: !8)
!8 = !{null}
!9 = !{i32 2, !"Dwarf Version", i32 4}
!10 = !{i32 1, !"Debug Info Version", i32 3}
!11 = !{!"clang version 3.5 "}
!12 = !MDLocation(line: 4, scope: !4)
!13 = !MDLocation(line: 5, scope: !4)
!14 = !MDLocation(line: 6, scope: !4)
|