| 1 |
; RUN: llc -mtriple=bpfel -filetype=asm -o - %s | FileCheck -check-prefixes=CHECK %s |
| 2 |
; RUN: llc -mtriple=bpfeb -filetype=asm -o - %s | FileCheck -check-prefixes=CHECK %s |
| 3 |
; Source: |
| 4 |
; struct tt; |
| 5 |
; typedef struct tt _tt; |
| 6 |
; typedef _tt __tt; |
| 7 |
; struct s1 { __tt *mp; }; |
| 8 |
; int test1(struct s1 *arg) |
| 9 |
; { |
| 10 |
; return 0; |
| 11 |
; } |
| 12 |
; |
| 13 |
; struct tt { int m1; int m2; }; |
| 14 |
; struct s2 { __tt m3; }; |
| 15 |
; int test2(struct s2 *arg) |
| 16 |
; { |
| 17 |
; return arg->m3.m1; |
| 18 |
; } |
| 19 |
; Compilation flags: |
| 20 |
; clang -target bpf -O2 -g -S -emit-llvm t.c |
| 21 |
|
| 22 |
%struct.s1 = type { ptr } |
| 23 |
%struct.tt = type { i32, i32 } |
| 24 |
%struct.s2 = type { %struct.tt } |
| 25 |
|
| 26 |
; Function Attrs: norecurse nounwind readnone |
| 27 |
define dso_local i32 @test1(ptr nocapture readnone %arg) local_unnamed_addr !dbg !7 { |
| 28 |
entry: |
| 29 |
call void @llvm.dbg.value(metadata ptr %arg, metadata !23, metadata !DIExpression()), !dbg !24 |
| 30 |
ret i32 0, !dbg !25 |
| 31 |
} |
| 32 |
|
| 33 |
; Function Attrs: norecurse nounwind readonly |
| 34 |
define dso_local i32 @test2(ptr nocapture readonly %arg) local_unnamed_addr !dbg !26 { |
| 35 |
entry: |
| 36 |
call void @llvm.dbg.value(metadata ptr %arg, metadata !34, metadata !DIExpression()), !dbg !35 |
| 37 |
%0 = load i32, ptr %arg, align 4, !dbg !36, !tbaa !37 |
| 38 |
ret i32 %0, !dbg !43 |
| 39 |
} |
| 40 |
|
| 41 |
; CHECK: .long 7 # BTF_KIND_TYPEDEF(id = 4) |
| 42 |
; CHECK-NEXT: .long 134217728 # 0x8000000 |
| 43 |
; CHECK-NEXT: .long 5 |
| 44 |
; CHECK-NEXT: .long 12 # BTF_KIND_TYPEDEF(id = 5) |
| 45 |
; CHECK-NEXT: .long 134217728 # 0x8000000 |
| 46 |
; CHECK-NEXT: .long 11 |
| 47 |
|
| 48 |
; CHECK: .long 69 # BTF_KIND_STRUCT(id = 10) |
| 49 |
; CHECK-NEXT: .long 67108865 # 0x4000001 |
| 50 |
; CHECK-NEXT: .long 8 |
| 51 |
; CHECK-NEXT: .long 72 |
| 52 |
; CHECK-NEXT: .long 4 |
| 53 |
; CHECK-NEXT: .long 0 # 0x0 |
| 54 |
|
| 55 |
; CHECK: .long 75 # BTF_KIND_STRUCT(id = 11) |
| 56 |
; CHECK-NEXT: .long 67108866 # 0x4000002 |
| 57 |
; CHECK-NEXT: .long 8 |
| 58 |
; CHECK-NEXT: .long 78 |
| 59 |
; CHECK-NEXT: .long 7 |
| 60 |
; CHECK-NEXT: .long 0 # 0x0 |
| 61 |
; CHECK-NEXT: .long 81 |
| 62 |
; CHECK-NEXT: .long 7 |
| 63 |
; CHECK-NEXT: .long 32 # 0x20 |
| 64 |
|
| 65 |
; CHECK: .ascii "__tt" # string offset=7 |
| 66 |
; CHECK: .ascii "_tt" # string offset=12 |
| 67 |
; CHECK: .ascii "s2" # string offset=69 |
| 68 |
; CHECK: .ascii "m3" # string offset=72 |
| 69 |
; CHECK: .ascii "tt" # string offset=75 |
| 70 |
; CHECK: .ascii "m1" # string offset=78 |
| 71 |
; CHECK: .ascii "m2" # string offset=81 |
| 72 |
|
| 73 |
; Function Attrs: nounwind readnone speculatable willreturn |
| 74 |
declare void @llvm.dbg.value(metadata, metadata, metadata) |
| 75 |
|
| 76 |
!llvm.dbg.cu = !{!0} |
| 77 |
!llvm.module.flags = !{!3, !4, !5} |
| 78 |
!llvm.ident = !{!6} |
| 79 |
|
| 80 |
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 11.0.0 (https://github.com/llvm/llvm-project.git 7cfd267c518aba226b34b7fbfe8db70000b22053)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None) |
| 81 |
!1 = !DIFile(filename: "t.c", directory: "/tmp/home/yhs/work/tests/btf") |
| 82 |
!2 = !{} |
| 83 |
!3 = !{i32 7, !"Dwarf Version", i32 4} |
| 84 |
!4 = !{i32 2, !"Debug Info Version", i32 3} |
| 85 |
!5 = !{i32 1, !"wchar_size", i32 4} |
| 86 |
!6 = !{!"clang version 11.0.0 (https://github.com/llvm/llvm-project.git 7cfd267c518aba226b34b7fbfe8db70000b22053)"} |
| 87 |
!7 = distinct !DISubprogram(name: "test1", scope: !1, file: !1, line: 5, type: !8, scopeLine: 6, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !22) |
| 88 |
!8 = !DISubroutineType(types: !9) |
| 89 |
!9 = !{!10, !11} |
| 90 |
!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) |
| 91 |
!11 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !12, size: 64) |
| 92 |
!12 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "s1", file: !1, line: 4, size: 64, elements: !13) |
| 93 |
!13 = !{!14} |
| 94 |
!14 = !DIDerivedType(tag: DW_TAG_member, name: "mp", scope: !12, file: !1, line: 4, baseType: !15, size: 64) |
| 95 |
!15 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !16, size: 64) |
| 96 |
!16 = !DIDerivedType(tag: DW_TAG_typedef, name: "__tt", file: !1, line: 3, baseType: !17) |
| 97 |
!17 = !DIDerivedType(tag: DW_TAG_typedef, name: "_tt", file: !1, line: 2, baseType: !18) |
| 98 |
!18 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "tt", file: !1, line: 10, size: 64, elements: !19) |
| 99 |
!19 = !{!20, !21} |
| 100 |
!20 = !DIDerivedType(tag: DW_TAG_member, name: "m1", scope: !18, file: !1, line: 10, baseType: !10, size: 32) |
| 101 |
!21 = !DIDerivedType(tag: DW_TAG_member, name: "m2", scope: !18, file: !1, line: 10, baseType: !10, size: 32, offset: 32) |
| 102 |
!22 = !{!23} |
| 103 |
!23 = !DILocalVariable(name: "arg", arg: 1, scope: !7, file: !1, line: 5, type: !11) |
| 104 |
!24 = !DILocation(line: 0, scope: !7) |
| 105 |
!25 = !DILocation(line: 7, column: 3, scope: !7) |
| 106 |
!26 = distinct !DISubprogram(name: "test2", scope: !1, file: !1, line: 12, type: !27, scopeLine: 13, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !33) |
| 107 |
!27 = !DISubroutineType(types: !28) |
| 108 |
!28 = !{!10, !29} |
| 109 |
!29 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !30, size: 64) |
| 110 |
!30 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "s2", file: !1, line: 11, size: 64, elements: !31) |
| 111 |
!31 = !{!32} |
| 112 |
!32 = !DIDerivedType(tag: DW_TAG_member, name: "m3", scope: !30, file: !1, line: 11, baseType: !16, size: 64) |
| 113 |
!33 = !{!34} |
| 114 |
!34 = !DILocalVariable(name: "arg", arg: 1, scope: !26, file: !1, line: 12, type: !29) |
| 115 |
!35 = !DILocation(line: 0, scope: !26) |
| 116 |
!36 = !DILocation(line: 14, column: 18, scope: !26) |
| 117 |
!37 = !{!38, !40, i64 0} |
| 118 |
!38 = !{!"s2", !39, i64 0} |
| 119 |
!39 = !{!"tt", !40, i64 0, !40, i64 4} |
| 120 |
!40 = !{!"int", !41, i64 0} |
| 121 |
!41 = !{!"omnipotent char", !42, i64 0} |
| 122 |
!42 = !{!"Simple C/C++ TBAA"} |
| 123 |
!43 = !DILocation(line: 14, column: 3, scope: !26) |