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
3;
4; Source:
5;   struct s1 {
6;     struct { int A1; } a1;
7;     struct { long B1; } *b1;
8;   };
9;   int f1(struct s1 *s1) { return 0; }
10; Compilation flag:
11;   clang -target bpf -O2 -g -S -emit-llvm t.c
12
13%struct.s1 = type { %struct.anon, %struct.anon.0* }
14%struct.anon = type { i32 }
15%struct.anon.0 = type { i64 }
16
17; Function Attrs: norecurse nounwind readnone
18define dso_local i32 @f1(%struct.s1* nocapture readnone %s1) local_unnamed_addr #0 !dbg !7 {
19entry:
20  call void @llvm.dbg.value(metadata %struct.s1* %s1, metadata !25, metadata !DIExpression()), !dbg !26
21  ret i32 0, !dbg !27
22}
23
24; CHECK:             .long   0                       # BTF_KIND_PTR(id = 1)
25; CHECK-NEXT:        .long   33554432                # 0x2000000
26; CHECK-NEXT:        .long   2
27; CHECK-NEXT:        .long   1                       # BTF_KIND_STRUCT(id = 2)
28; CHECK-NEXT:        .long   67108866                # 0x4000002
29; CHECK-NEXT:        .long   16
30; CHECK-NEXT:        .long   4
31; CHECK-NEXT:        .long   3
32; CHECK-NEXT:        .long   0                       # 0x0
33; CHECK-NEXT:        .long   7
34; CHECK-NEXT:        .long   5
35; CHECK-NEXT:        .long   64                      # 0x40
36; CHECK-NEXT:        .long   0                       # BTF_KIND_STRUCT(id = 3)
37; CHECK-NEXT:        .long   67108865                # 0x4000001
38; CHECK-NEXT:        .long   4
39; CHECK-NEXT:        .long   10
40; CHECK-NEXT:        .long   4
41; CHECK-NEXT:        .long   0                       # 0x0
42; CHECK-NEXT:        .long   13                      # BTF_KIND_INT(id = 4)
43; CHECK-NEXT:        .long   16777216                # 0x1000000
44; CHECK-NEXT:        .long   4
45; CHECK-NEXT:        .long   16777248                # 0x1000020
46; CHECK-NEXT:        .long   0                       # BTF_KIND_PTR(id = 5)
47; CHECK-NEXT:        .long   33554432                # 0x2000000
48; CHECK-NEXT:        .long   6
49; CHECK-NEXT:        .long   0                       # BTF_KIND_STRUCT(id = 6)
50; CHECK-NEXT:        .long   67108865                # 0x4000001
51; CHECK-NEXT:        .long   8
52; CHECK-NEXT:        .long   17
53; CHECK-NEXT:        .long   7
54; CHECK-NEXT:        .long   0                       # 0x0
55; CHECK-NEXT:        .long   20                      # BTF_KIND_INT(id = 7)
56; CHECK-NEXT:        .long   16777216                # 0x1000000
57; CHECK-NEXT:        .long   8
58; CHECK-NEXT:        .long   16777280                # 0x1000040
59
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
67
68
69; Function Attrs: nounwind readnone speculatable willreturn
70declare void @llvm.dbg.value(metadata, metadata, metadata) #1
71
72attributes #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" }
73attributes #1 = { nounwind readnone speculatable willreturn }
74
75!llvm.dbg.cu = !{!0}
76!llvm.module.flags = !{!3, !4, !5}
77!llvm.ident = !{!6}
78
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")
81!2 = !{}
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)
88!9 = !{!10, !11}
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)
92!13 = !{!14, !18}
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)
95!16 = !{!17}
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)
100!21 = !{!22}
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)
103!24 = !{!25}
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)
107