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
10 ; static volatile struct t sv = {3, 4, "abcdefghi"};
11 ; int test() { return sv.a; }
13 ; clang -target bpf -O2 -g -S -emit-llvm test.c
15 @sv = internal global { i32, i32, [10 x i8] } { i32 3, i32 4, [10 x i8] c"abcdefghi\00" }, align 4, !dbg !0
17 ; Function Attrs: norecurse nounwind
18 define dso_local i32 @test() local_unnamed_addr #0 !dbg !21 {
19 %1 = load volatile i32, i32* getelementptr inbounds ({ i32, i32, [10 x i8] }, { i32, i32, [10 x i8] }* @sv, i64 0, i32 0), align 4, !dbg !24, !tbaa !25
23 ; CHECK: .section .BTF,"",@progbits
24 ; CHECK-NEXT: .short 60319 # 0xeb9f
27 ; CHECK-NEXT: .long 24
29 ; CHECK-NEXT: .long 196
30 ; CHECK-NEXT: .long 196
31 ; CHECK-NEXT: .long 95
32 ; CHECK-NEXT: .long 0 # BTF_KIND_FUNC_PROTO(id = 1)
33 ; CHECK-NEXT: .long 218103808 # 0xd000000
35 ; CHECK-NEXT: .long 1 # BTF_KIND_INT(id = 2)
36 ; CHECK-NEXT: .long 16777216 # 0x1000000
38 ; CHECK-NEXT: .long 16777248 # 0x1000020
39 ; CHECK-NEXT: .long 5 # BTF_KIND_FUNC(id = 3)
40 ; CHECK-NEXT: .long 201326592 # 0xc000000
42 ; CHECK-NEXT: .long 0 # BTF_KIND_VOLATILE(id = 4)
43 ; CHECK-NEXT: .long 150994944 # 0x9000000
45 ; CHECK-NEXT: .long 53 # BTF_KIND_STRUCT(id = 5)
46 ; CHECK-NEXT: .long 67108867 # 0x4000003
48 ; CHECK-NEXT: .long 55
50 ; CHECK-NEXT: .long 0 # 0x0
51 ; CHECK-NEXT: .long 57
53 ; CHECK-NEXT: .long 32 # 0x20
54 ; CHECK-NEXT: .long 59
56 ; CHECK-NEXT: .long 64 # 0x40
57 ; CHECK-NEXT: .long 61 # BTF_KIND_INT(id = 6)
58 ; CHECK-NEXT: .long 16777216 # 0x1000000
60 ; CHECK-NEXT: .long 16777224 # 0x1000008
61 ; CHECK-NEXT: .long 0 # BTF_KIND_ARRAY(id = 7)
62 ; CHECK-NEXT: .long 50331648 # 0x3000000
67 ; CHECK-NEXT: .long 66 # BTF_KIND_INT(id = 8)
68 ; CHECK-NEXT: .long 16777216 # 0x1000000
70 ; CHECK-NEXT: .long 32 # 0x20
71 ; CHECK-NEXT: .long 86 # BTF_KIND_VAR(id = 9)
72 ; CHECK-NEXT: .long 234881024 # 0xe000000
75 ; CHECK-NEXT: .long 89 # BTF_KIND_DATASEC(id = 10)
76 ; CHECK-NEXT: .long 251658241 # 0xf000001
79 ; CHECK-NEXT: .long sv
80 ; CHECK-NEXT: .long 20
81 ; CHECK-NEXT: .byte 0 # string offset=0
82 ; CHECK-NEXT: .ascii "int" # string offset=1
84 ; CHECK-NEXT: .ascii "test" # string offset=5
86 ; CHECK-NEXT: .ascii ".text" # string offset=10
88 ; CHECK-NEXT: .ascii "/home/yhs/work/tests/llvm/bug/test.c" # string offset=16
90 ; CHECK-NEXT: .byte 116 # string offset=53
92 ; CHECK-NEXT: .byte 97 # string offset=55
94 ; CHECK-NEXT: .byte 98 # string offset=57
96 ; CHECK-NEXT: .byte 99 # string offset=59
98 ; CHECK-NEXT: .ascii "char" # string offset=61
100 ; CHECK-NEXT: .ascii "__ARRAY_SIZE_TYPE__" # string offset=66
101 ; CHECK-NEXT: .byte 0
102 ; CHECK-NEXT: .ascii "sv" # string offset=86
103 ; CHECK-NEXT: .byte 0
104 ; CHECK-NEXT: .ascii ".data" # string offset=89
105 ; CHECK-NEXT: .byte 0
107 attributes #0 = { norecurse nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
110 !llvm.module.flags = !{!17, !18, !19}
113 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
114 !1 = distinct !DIGlobalVariable(name: "sv", scope: !2, file: !3, line: 6, type: !6, isLocal: true, isDefinition: true)
115 !2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 8.0.20181009 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, nameTableKind: None)
116 !3 = !DIFile(filename: "test.c", directory: "/home/yhs/work/tests/llvm/bug")
119 !6 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !7)
120 !7 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "t", file: !3, line: 1, size: 64, elements: !8)
122 !9 = !DIDerivedType(tag: DW_TAG_member, name: "a", scope: !7, file: !3, line: 2, baseType: !10, size: 32)
123 !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
124 !11 = !DIDerivedType(tag: DW_TAG_member, name: "b", scope: !7, file: !3, line: 3, baseType: !10, size: 32, offset: 32)
125 !12 = !DIDerivedType(tag: DW_TAG_member, name: "c", scope: !7, file: !3, line: 4, baseType: !13, offset: 64)
126 !13 = !DICompositeType(tag: DW_TAG_array_type, baseType: !14, elements: !15)
127 !14 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
129 !16 = !DISubrange(count: -1)
130 !17 = !{i32 2, !"Dwarf Version", i32 4}
131 !18 = !{i32 2, !"Debug Info Version", i32 3}
132 !19 = !{i32 1, !"wchar_size", i32 4}
133 !20 = !{!"clang version 8.0.20181009 "}
134 !21 = distinct !DISubprogram(name: "test", scope: !3, file: !3, line: 7, type: !22, isLocal: false, isDefinition: true, scopeLine: 7, isOptimized: true, unit: !2, retainedNodes: !4)
135 !22 = !DISubroutineType(types: !23)
137 !24 = !DILocation(line: 7, column: 24, scope: !21)
138 !25 = !{!26, !26, i64 0}
139 !26 = !{!"int", !27, i64 0}
140 !27 = !{!"omnipotent char", !28, i64 0}
141 !28 = !{!"Simple C/C++ TBAA"}
142 !29 = !DILocation(line: 7, column: 14, scope: !21)