Debian Codegraph @

llvm/test/CodeGen/BPF/BTF/ptr-named-2.ll

raw
1 ; RUN: llc -mtriple=bpfel -filetype=obj -o %t1 %s
2 ; RUN: llvm-objcopy --dump-section='.BTF'=%t2 %t1
3 ; RUN: %python %p/print_btf.py %t2 | FileCheck -check-prefixes=CHECK-BTF %s
4 ; RUN: llc -mtriple=bpfeb -filetype=obj -o %t1 %s
5 ; RUN: llvm-objcopy --dump-section='.BTF'=%t2 %t1
6 ; RUN: %python %p/print_btf.py %t2 | FileCheck -check-prefixes=CHECK-BTF %s
7 ;
8 ; This IR is hand-written.
9
10 ; ModuleID = 'ptr-named-2.ll'
11 source_filename = "ptr-named-2.ll"
12 target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128"
13 target triple = "bpfel-unknown-none"
14
15 %struct.TypeExamples = type { ptr, i32, i32, ptr }
16
17 @type_examples = internal global %struct.TypeExamples zeroinitializer, align 8, !dbg !0
18
19 !llvm.dbg.cu = !{!1}
20 !llvm.module.flags = !{!2, !3, !4}
21 !llvm.ident = !{!21}
22
23 ; CHECK-BTF: [1] STRUCT 'TypeExamples' size=32 vlen=4
24 ; CHECK-BTF-NEXT: 'ptr' type_id=2 bits_offset=0
25 ; CHECK-BTF-NEXT: 'volatile' type_id=4 bits_offset=64
26 ; CHECK-BTF-NEXT: 'const' type_id=5 bits_offset=128
27 ; CHECK-BTF-NEXT: 'restrict_ptr' type_id=6 bits_offset=192
28 ; CHECK-BTF-NEXT: [2] PTR '(anon)' type_id=3
29 ; CHECK-BTF-NEXT: [3] INT 'int' size=4 bits_offset=0 nr_bits=32 encoding=SIGNED
30 ; CHECK-BTF-NEXT: [4] VOLATILE '(anon)' type_id=3
31 ; CHECK-BTF-NEXT: [5] CONST '(anon)' type_id=3
32 ; CHECK-BTF-NEXT: [6] RESTRICT '(anon)' type_id=7
33 ; CHECK-BTF-NEXT: [7] PTR '(anon)' type_id=3
34 ; CHECK-BTF-NEXT: [8] VAR 'type_examples' type_id=1, linkage=static
35 ; CHECK-BTF-NEXT: [9] DATASEC '.bss' size=0 vlen=1
36 ; CHECK-BTF-NEXT: type_id=8 offset=0 size=24
37
38 !0 = !DIGlobalVariableExpression(var: !5, expr: !DIExpression())
39 !1 = distinct !DICompileUnit(language: DW_LANG_C99, file: !6, isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !7, globals: !8, splitDebugInlining: false, nameTableKind: None)
40 !2 = !{i32 2, !"Dwarf Version", i32 4}
41 !3 = !{i32 2, !"Debug Info Version", i32 3}
42 !4 = !{i32 1, !"wchar_size", i32 4}
43 !5 = distinct !DIGlobalVariable(name: "type_examples", scope: !1, file: !6, line: 12, type: !9, isLocal: true, isDefinition: true)
44 !6 = !DIFile(filename: "ptr-named-2.ll", directory: "/tmp")
45 !7 = !{}
46 !8 = !{!0}
47 !9 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "TypeExamples", file: !6, line: 5, size: 256, elements: !10)
48 !10 = !{!11, !12, !13, !14}
49 !11 = !DIDerivedType(tag: DW_TAG_member, name: "ptr", scope: !9, file: !6, line: 6, baseType: !15, size: 64)
50 !12 = !DIDerivedType(tag: DW_TAG_member, name: "volatile", scope: !9, file: !6, line: 7, baseType: !17, size: 64, offset: 64)
51 !13 = !DIDerivedType(tag: DW_TAG_member, name: "const", scope: !9, file: !6, line: 8, baseType: !18, size: 64, offset: 128)
52 !14 = !DIDerivedType(tag: DW_TAG_member, name: "restrict_ptr", scope: !9, file: !6, line: 9, baseType: !19, size: 64, offset: 192)
53 !15 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "*int", baseType: !16, size: 64)
54 !16 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
55 !17 = !DIDerivedType(tag: DW_TAG_volatile_type, name: "volatile int", baseType: !16)
56 !18 = !DIDerivedType(tag: DW_TAG_const_type, name: "const int", baseType: !16)
57 !19 = !DIDerivedType(tag: DW_TAG_restrict_type, name: "*int restrict", baseType: !20)
58 !20 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !16, size: 64)
59 !21 = !{!"my hand-written IR"}