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 code:
5;   struct key_type {
6;     int a1;
7;   };
8;   typedef struct map_type {
9;     struct key_type *key;
10;   } _map_type;
11;   typedef _map_type __map_type;
12;   __map_type __attribute__((section(".maps"))) hash_map;
13; Compilation flag:
14;   clang -target bpf -O2 -g -S -emit-llvm t2.c
15
16%struct.map_type = type { %struct.key_type* }
17%struct.key_type = type { i32 }
18
19@hash_map = dso_local local_unnamed_addr global %struct.map_type zeroinitializer, section ".maps", align 8, !dbg !0
20
21; CHECK:             .long   0                               # BTF_KIND_PTR(id = 1)
22; CHECK-NEXT:        .long   33554432                        # 0x2000000
23; CHECK-NEXT:        .long   2
24; CHECK-NEXT:        .long   1                               # BTF_KIND_STRUCT(id = 2)
25; CHECK-NEXT:        .long   67108865                        # 0x4000001
26; CHECK-NEXT:        .long   4
27; CHECK-NEXT:        .long   10
28; CHECK-NEXT:        .long   3
29; CHECK-NEXT:        .long   0                               # 0x0
30; CHECK-NEXT:        .long   13                              # BTF_KIND_INT(id = 3)
31; CHECK-NEXT:        .long   16777216                        # 0x1000000
32; CHECK-NEXT:        .long   4
33; CHECK-NEXT:        .long   16777248                        # 0x1000020
34; CHECK-NEXT:        .long   17                              # BTF_KIND_TYPEDEF(id = 4)
35; CHECK-NEXT:        .long   134217728                       # 0x8000000
36; CHECK-NEXT:        .long   5
37; CHECK-NEXT:        .long   28                              # BTF_KIND_TYPEDEF(id = 5)
38; CHECK-NEXT:        .long   134217728                       # 0x8000000
39; CHECK-NEXT:        .long   6
40; CHECK-NEXT:        .long   38                              # BTF_KIND_STRUCT(id = 6)
41; CHECK-NEXT:        .long   67108865                        # 0x4000001
42; CHECK-NEXT:        .long   8
43; CHECK-NEXT:        .long   47
44; CHECK-NEXT:        .long   1
45; CHECK-NEXT:        .long   0                               # 0x0
46; CHECK-NEXT:        .long   51                              # BTF_KIND_VAR(id = 7)
47; CHECK-NEXT:        .long   234881024                       # 0xe000000
48; CHECK-NEXT:        .long   4
49; CHECK-NEXT:        .long   1
50; CHECK-NEXT:        .long   60                              # BTF_KIND_DATASEC(id = 8)
51; CHECK-NEXT:        .long   251658241                       # 0xf000001
52; CHECK-NEXT:        .long   0
53; CHECK-NEXT:        .long   7
54; CHECK-NEXT:        .long   hash_map
55; CHECK-NEXT:        .long   8
56
57; CHECK:             .ascii  "key_type"                      # string offset=1
58; CHECK:             .ascii  "a1"                            # string offset=10
59; CHECK:             .ascii  "int"                           # string offset=13
60; CHECK:             .ascii  "__map_type"                    # string offset=17
61; CHECK:             .ascii  "_map_type"                     # string offset=28
62; CHECK:             .ascii  "map_type"                      # string offset=38
63; CHECK:             .ascii  "key"                           # string offset=47
64; CHECK:             .ascii  "hash_map"                      # string offset=51
65; CHECK:             .ascii  ".maps"                         # string offset=60
66
67!llvm.dbg.cu = !{!2}
68!llvm.module.flags = !{!16, !17, !18}
69!llvm.ident = !{!19}
70
71!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
72!1 = distinct !DIGlobalVariable(name: "hash_map", scope: !2, file: !3, line: 8, type: !6, isLocal: false, isDefinition: true)
73!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 11.0.0 (https://github.com/llvm/llvm-project.git b8409c03ed90807f3d49c7d98dceea98cf461f7a)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, splitDebugInlining: false, nameTableKind: None)
74!3 = !DIFile(filename: "t2.c", directory: "/tmp/home/yhs/tmp1")
75!4 = !{}
76!5 = !{!0}
77!6 = !DIDerivedType(tag: DW_TAG_typedef, name: "__map_type", file: !3, line: 7, baseType: !7)
78!7 = !DIDerivedType(tag: DW_TAG_typedef, name: "_map_type", file: !3, line: 6, baseType: !8)
79!8 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "map_type", file: !3, line: 4, size: 64, elements: !9)
80!9 = !{!10}
81!10 = !DIDerivedType(tag: DW_TAG_member, name: "key", scope: !8, file: !3, line: 5, baseType: !11, size: 64)
82!11 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !12, size: 64)
83!12 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "key_type", file: !3, line: 1, size: 32, elements: !13)
84!13 = !{!14}
85!14 = !DIDerivedType(tag: DW_TAG_member, name: "a1", scope: !12, file: !3, line: 2, baseType: !15, size: 32)
86!15 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
87!16 = !{i32 7, !"Dwarf Version", i32 4}
88!17 = !{i32 2, !"Debug Info Version", i32 3}
89!18 = !{i32 1, !"wchar_size", i32 4}
90!19 = !{!"clang version 11.0.0 (https://github.com/llvm/llvm-project.git b8409c03ed90807f3d49c7d98dceea98cf461f7a)"}
91