1 ; RUN: llc -march=bpfel -filetype=asm -o - %s | FileCheck -check-prefixes=CHECK %s
2 ; RUN: llc -march=bpfeb -filetype=asm -o - %s | FileCheck -check-prefixes=CHECK %s
6 ; struct { int A1; } a1;
9 ; int f1(struct s1 *s1) { return 0; }
11 ; clang -target bpf -O2 -g -S -emit-llvm t.c
13 %struct.s1 = type { %struct.anon, ptr }
14 %struct.anon = type { i32 }
15 %struct.anon.0 = type { i64 }
17 ; Function Attrs: norecurse nounwind readnone
18 define dso_local i32 @f1(ptr nocapture readnone %s1) local_unnamed_addr #0 !dbg !7 {
20 call void @llvm.dbg.value(metadata ptr %s1, metadata !25, metadata !DIExpression()), !dbg !26
24 ; CHECK: .long 0 # BTF_KIND_PTR(id = 1)
25 ; CHECK-NEXT: .long 33554432 # 0x2000000
27 ; CHECK-NEXT: .long 1 # BTF_KIND_STRUCT(id = 2)
28 ; CHECK-NEXT: .long 67108866 # 0x4000002
29 ; CHECK-NEXT: .long 16
32 ; CHECK-NEXT: .long 0 # 0x0
35 ; CHECK-NEXT: .long 64 # 0x40
36 ; CHECK-NEXT: .long 0 # BTF_KIND_STRUCT(id = 3)
37 ; CHECK-NEXT: .long 67108865 # 0x4000001
39 ; CHECK-NEXT: .long 10
41 ; CHECK-NEXT: .long 0 # 0x0
42 ; CHECK-NEXT: .long 13 # BTF_KIND_INT(id = 4)
43 ; CHECK-NEXT: .long 16777216 # 0x1000000
45 ; CHECK-NEXT: .long 16777248 # 0x1000020
46 ; CHECK-NEXT: .long 0 # BTF_KIND_PTR(id = 5)
47 ; CHECK-NEXT: .long 33554432 # 0x2000000
49 ; CHECK-NEXT: .long 0 # BTF_KIND_STRUCT(id = 6)
50 ; CHECK-NEXT: .long 67108865 # 0x4000001
52 ; CHECK-NEXT: .long 17
54 ; CHECK-NEXT: .long 0 # 0x0
55 ; CHECK-NEXT: .long 20 # BTF_KIND_INT(id = 7)
56 ; CHECK-NEXT: .long 16777216 # 0x1000000
58 ; CHECK-NEXT: .long 16777280 # 0x1000040
60 ; CHECK: .ascii "s1" # string offset=1
61 ; CHECK: .ascii "a1" # string offset=4
62 ; CHECK: .ascii "b1" # string offset=7
63 ; CHECK: .ascii "A1" # string offset=10
64 ; CHECK: .ascii "int" # string offset=13
65 ; CHECK: .ascii "B1" # string offset=17
66 ; CHECK: .ascii "long int" # string offset=20
69 ; Function Attrs: nounwind readnone speculatable willreturn
70 declare void @llvm.dbg.value(metadata, metadata, metadata) #1
72 attributes #0 = { norecurse nounwind readnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
73 attributes #1 = { nounwind readnone speculatable willreturn }
76 !llvm.module.flags = !{!3, !4, !5}
79 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 11.0.0 (https://github.com/llvm/llvm-project.git ef36f5143d83897cc6f59ff918769d29ad5a0612)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
80 !1 = !DIFile(filename: "t.c", directory: "/tmp/home/yhs/btf/tmp")
82 !3 = !{i32 7, !"Dwarf Version", i32 4}
83 !4 = !{i32 2, !"Debug Info Version", i32 3}
84 !5 = !{i32 1, !"wchar_size", i32 4}
85 !6 = !{!"clang version 11.0.0 (https://github.com/llvm/llvm-project.git ef36f5143d83897cc6f59ff918769d29ad5a0612)"}
86 !7 = distinct !DISubprogram(name: "f1", scope: !1, file: !1, line: 5, type: !8, scopeLine: 5, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !24)
87 !8 = !DISubroutineType(types: !9)
89 !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
90 !11 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !12, size: 64)
91 !12 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "s1", file: !1, line: 1, size: 128, elements: !13)
93 !14 = !DIDerivedType(tag: DW_TAG_member, name: "a1", scope: !12, file: !1, line: 2, baseType: !15, size: 32)
94 !15 = distinct !DICompositeType(tag: DW_TAG_structure_type, scope: !12, file: !1, line: 2, size: 32, elements: !16)
96 !17 = !DIDerivedType(tag: DW_TAG_member, name: "A1", scope: !15, file: !1, line: 2, baseType: !10, size: 32)
97 !18 = !DIDerivedType(tag: DW_TAG_member, name: "b1", scope: !12, file: !1, line: 3, baseType: !19, size: 64, offset: 64)
98 !19 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !20, size: 64)
99 !20 = distinct !DICompositeType(tag: DW_TAG_structure_type, scope: !12, file: !1, line: 3, size: 64, elements: !21)
101 !22 = !DIDerivedType(tag: DW_TAG_member, name: "B1", scope: !20, file: !1, line: 3, baseType: !23, size: 64)
102 !23 = !DIBasicType(name: "long int", size: 64, encoding: DW_ATE_signed)
104 !25 = !DILocalVariable(name: "s1", arg: 1, scope: !7, file: !1, line: 5, type: !11)
105 !26 = !DILocation(line: 0, scope: !7)
106 !27 = !DILocation(line: 5, column: 25, scope: !7)