brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.3 KiB · fa0aa5b Raw
86 lines · plain
1; RUN: llc -mtriple=bpfel -filetype=asm -o - %s | FileCheck -check-prefixes=CHECK %s2; RUN: llc -mtriple=bpfeb -filetype=asm -o - %s | FileCheck -check-prefixes=CHECK %s3; Source code:4;   unsigned long long load_byte(ptr skb,5;       unsigned long long off) asm("llvm.bpf.load.byte");6;   unsigned long long test(ptr skb) {7;     return load_byte(skb, 10);8;   }9; Compilation flag:10;   clang -target bpf -O2 -g -S -emit-llvm test.c11 12; Function Attrs: nounwind readonly13define dso_local i64 @test(ptr readonly %skb) local_unnamed_addr !dbg !13 {14entry:15  call void @llvm.dbg.value(metadata ptr %skb, metadata !17, metadata !DIExpression()), !dbg !1816  %call = tail call i64 @llvm.bpf.load.byte(ptr %skb, i64 10), !dbg !1917  ret i64 %call, !dbg !2018}19 20; CHECK:             .section        .BTF,"",@progbits21; CHECK-NEXT:        .short  60319                   # 0xeb9f22; CHECK-NEXT:        .byte   123; CHECK-NEXT:        .byte   024; CHECK-NEXT:        .long   2425; CHECK-NEXT:        .long   026; CHECK-NEXT:        .long   6027; CHECK-NEXT:        .long   6028; CHECK-NEXT:        .long   7829; CHECK-NEXT:        .long   0                       # BTF_KIND_PTR(id = 1)30; CHECK-NEXT:        .long   33554432                # 0x200000031; CHECK-NEXT:        .long   032; CHECK-NEXT:        .long   0                       # BTF_KIND_FUNC_PROTO(id = 2)33; CHECK-NEXT:        .long   218103809               # 0xd00000134; CHECK-NEXT:        .long   335; CHECK-NEXT:        .long   136; CHECK-NEXT:        .long   137; CHECK-NEXT:        .long   5                       # BTF_KIND_INT(id = 3)38; CHECK-NEXT:        .long   16777216                # 0x100000039; CHECK-NEXT:        .long   840; CHECK-NEXT:        .long   64                      # 0x4041; CHECK-NEXT:        .long   28                      # BTF_KIND_FUNC(id = 4)42; CHECK-NEXT:        .long   201326593               # 0xc00000143; CHECK-NEXT:        .long   244; CHECK-NEXT:        .byte   0                       # string offset=045; CHECK-NEXT:        .ascii  "skb"                   # string offset=146; CHECK-NEXT:        .byte   047; CHECK-NEXT:        .ascii  "long long unsigned int" # string offset=548; CHECK-NEXT:        .byte   049; CHECK-NEXT:        .ascii  "test"                  # string offset=2850; CHECK-NEXT:        .byte   051; CHECK-NEXT:        .ascii  ".text"                 # string offset=3352; CHECK-NEXT:        .byte   053; CHECK-NEXT:        .ascii  "/tmp/home/yhs/work/tests/extern/test.c" # string offset=3954; CHECK-NEXT:        .byte   055 56; Function Attrs: nounwind readonly57declare !dbg !4 i64 @llvm.bpf.load.byte(ptr, i64)58; Function Attrs: nounwind readnone speculatable willreturn59declare void @llvm.dbg.value(metadata, metadata, metadata)60 61!llvm.dbg.cu = !{!0}62!llvm.module.flags = !{!9, !10, !11}63!llvm.ident = !{!12}64 65!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 10.0.0 (https://github.com/llvm/llvm-project.git 907019d835895443b198afcd992c42c9d3478fdf)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, splitDebugInlining: false, nameTableKind: None)66!1 = !DIFile(filename: "test.c", directory: "/tmp/home/yhs/work/tests/extern")67!2 = !{}68!3 = !{!4}69!4 = !DISubprogram(name: "load_byte", linkageName: "llvm.bpf.load.byte", scope: !1, file: !1, line: 1, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)70!5 = !DISubroutineType(types: !6)71!6 = !{!7, !8, !7}72!7 = !DIBasicType(name: "long long unsigned int", size: 64, encoding: DW_ATE_unsigned)73!8 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64)74!9 = !{i32 7, !"Dwarf Version", i32 4}75!10 = !{i32 2, !"Debug Info Version", i32 3}76!11 = !{i32 1, !"wchar_size", i32 4}77!12 = !{!"clang version 10.0.0 (https://github.com/llvm/llvm-project.git 907019d835895443b198afcd992c42c9d3478fdf)"}78!13 = distinct !DISubprogram(name: "test", scope: !1, file: !1, line: 3, type: !14, scopeLine: 3, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !16)79!14 = !DISubroutineType(types: !15)80!15 = !{!7, !8}81!16 = !{!17}82!17 = !DILocalVariable(name: "skb", arg: 1, scope: !13, file: !1, line: 3, type: !8)83!18 = !DILocation(line: 0, scope: !13)84!19 = !DILocation(line: 4, column: 10, scope: !13)85!20 = !DILocation(line: 4, column: 3, scope: !13)86