Bump version to 19.1.0-rc3
[llvm-project.git] / llvm / test / CodeGen / BPF / BTF / extern-var-section.ll
blob05bb10c1bbeef0752a17d99861df12830f439f2a
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
4 ; Source code:
5 ;   extern int global_func(char c) __attribute__((section("abc")));
6 ;   extern char ch __attribute__((section("abc")));
7 ;   int test() {
8 ;     return global_func(0) + ch;
9 ;   }
10 ; Compilation flag:
11 ;   clang -target bpf -O2 -g -S -emit-llvm test.c
13 @ch = external dso_local local_unnamed_addr global i8, section "abc", align 1, !dbg !0
15 ; Function Attrs: nounwind
16 define dso_local i32 @test() local_unnamed_addr #0 !dbg !16 {
17 entry:
18   %call = tail call i32 @global_func(i8 signext 0) #2, !dbg !19
19   %0 = load i8, ptr @ch, align 1, !dbg !20, !tbaa !21
20   %conv = sext i8 %0 to i32, !dbg !20
21   %add = add nsw i32 %call, %conv, !dbg !24
22   ret i32 %add, !dbg !25
25 ; CHECK:             .section        .BTF,"",@progbits
26 ; CHECK-NEXT:        .short  60319                   # 0xeb9f
27 ; CHECK-NEXT:        .byte   1
28 ; CHECK-NEXT:        .byte   0
29 ; CHECK-NEXT:        .long   24
30 ; CHECK-NEXT:        .long   0
31 ; CHECK-NEXT:        .long   140
32 ; CHECK-NEXT:        .long   140
33 ; CHECK-NEXT:        .long   79
34 ; CHECK-NEXT:        .long   0                       # BTF_KIND_FUNC_PROTO(id = 1)
35 ; CHECK-NEXT:        .long   218103808               # 0xd000000
36 ; CHECK-NEXT:        .long   2
37 ; CHECK-NEXT:        .long   1                       # BTF_KIND_INT(id = 2)
38 ; CHECK-NEXT:        .long   16777216                # 0x1000000
39 ; CHECK-NEXT:        .long   4
40 ; CHECK-NEXT:        .long   16777248                # 0x1000020
41 ; CHECK-NEXT:        .long   5                       # BTF_KIND_FUNC(id = 3)
42 ; CHECK-NEXT:        .long   201326593               # 0xc000001
43 ; CHECK-NEXT:        .long   1
44 ; CHECK-NEXT:        .long   0                       # BTF_KIND_FUNC_PROTO(id = 4)
45 ; CHECK-NEXT:        .long   218103809               # 0xd000001
46 ; CHECK-NEXT:        .long   2
47 ; CHECK-NEXT:        .long   0
48 ; CHECK-NEXT:        .long   5
49 ; CHECK-NEXT:        .long   55                      # BTF_KIND_INT(id = 5)
50 ; CHECK-NEXT:        .long   16777216                # 0x1000000
51 ; CHECK-NEXT:        .long   1
52 ; CHECK-NEXT:        .long   16777224                # 0x1000008
53 ; CHECK-NEXT:        .long   60                      # BTF_KIND_FUNC(id = 6)
54 ; CHECK-NEXT:        .long   201326594               # 0xc000002
55 ; CHECK-NEXT:        .long   4
56 ; CHECK-NEXT:        .long   72                      # BTF_KIND_VAR(id = 7)
57 ; CHECK-NEXT:        .long   234881024               # 0xe000000
58 ; CHECK-NEXT:        .long   5
59 ; CHECK-NEXT:        .long   2
60 ; CHECK-NEXT:        .long   75                      # BTF_KIND_DATASEC(id = 8)
61 ; CHECK-NEXT:        .long   251658242               # 0xf000002
62 ; CHECK-NEXT:        .long   0
63 ; CHECK-NEXT:        .long   6
64 ; CHECK-NEXT:        .long   global_func
65 ; CHECK-NEXT:        .long   0
66 ; CHECK-NEXT:        .long   7
67 ; CHECK-NEXT:        .long   ch
68 ; CHECK-NEXT:        .long   1
69 ; CHECK-NEXT:        .byte   0                       # string offset=0
70 ; CHECK-NEXT:        .ascii  "int"                   # string offset=1
71 ; CHECK-NEXT:        .byte   0
72 ; CHECK-NEXT:        .ascii  "test"                  # string offset=5
73 ; CHECK-NEXT:        .byte   0
74 ; CHECK-NEXT:        .ascii  ".text"                 # string offset=10
75 ; CHECK-NEXT:        .byte   0
76 ; CHECK-NEXT:        .ascii  "/tmp/home/yhs/work/tests/extern/test.c" # string offset=16
77 ; CHECK-NEXT:        .byte   0
78 ; CHECK-NEXT:        .ascii  "char"                  # string offset=55
79 ; CHECK-NEXT:        .byte   0
80 ; CHECK-NEXT:        .ascii  "global_func"           # string offset=60
81 ; CHECK-NEXT:        .byte   0
82 ; CHECK-NEXT:        .ascii  "ch"                    # string offset=72
83 ; CHECK-NEXT:        .byte   0
84 ; CHECK-NEXT:        .ascii  "abc"                   # string offset=75
85 ; CHECK-NEXT:        .byte   0
87 declare !dbg !6 dso_local i32 @global_func(i8 signext) local_unnamed_addr #1 section "abc"
89 attributes #0 = { nounwind "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"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
90 attributes #1 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "no-infs-fp-math"="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" }
91 attributes #2 = { nounwind }
93 !llvm.dbg.cu = !{!2}
94 !llvm.module.flags = !{!12, !13, !14}
95 !llvm.ident = !{!15}
97 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
98 !1 = distinct !DIGlobalVariable(name: "ch", scope: !2, file: !3, line: 2, type: !10, isLocal: false, isDefinition: false)
99 !2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 10.0.0 (https://github.com/llvm/llvm-project.git 0ad024346185b3f0b5167438e126568982b1168d)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, retainedTypes: !5, globals: !11, nameTableKind: None)
100 !3 = !DIFile(filename: "test.c", directory: "/tmp/home/yhs/work/tests/extern")
101 !4 = !{}
102 !5 = !{!6}
103 !6 = !DISubprogram(name: "global_func", scope: !3, file: !3, line: 1, type: !7, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !4)
104 !7 = !DISubroutineType(types: !8)
105 !8 = !{!9, !10}
106 !9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
107 !10 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
108 !11 = !{!0}
109 !12 = !{i32 2, !"Dwarf Version", i32 4}
110 !13 = !{i32 2, !"Debug Info Version", i32 3}
111 !14 = !{i32 1, !"wchar_size", i32 4}
112 !15 = !{!"clang version 10.0.0 (https://github.com/llvm/llvm-project.git 0ad024346185b3f0b5167438e126568982b1168d)"}
113 !16 = distinct !DISubprogram(name: "test", scope: !3, file: !3, line: 3, type: !17, scopeLine: 3, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !4)
114 !17 = !DISubroutineType(types: !18)
115 !18 = !{!9}
116 !19 = !DILocation(line: 4, column: 10, scope: !16)
117 !20 = !DILocation(line: 4, column: 27, scope: !16)
118 !21 = !{!22, !22, i64 0}
119 !22 = !{!"omnipotent char", !23, i64 0}
120 !23 = !{!"Simple C/C++ TBAA"}
121 !24 = !DILocation(line: 4, column: 25, scope: !16)
122 !25 = !DILocation(line: 4, column: 3, scope: !16)