brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.2 KiB · 67ad819 Raw
108 lines · plain
1; RUN: opt -O2 -mtriple=bpf-pc-linux %s | llvm-dis > %t12; RUN: llc -filetype=asm -o - %t1 | FileCheck %s3; RUN: llc -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck %s4; Source code:5;   #define BPF_FIELD_EXISTS 26;   unsigned test1() {7;     struct t {8;       int val;9;     } bar;10;     return __builtin_preserve_field_info((&bar)[1], BPF_FIELD_EXISTS);11;   }12; Compilation flag:13;   clang -target bpf -O2 -g -S -emit-llvm -Xclang -disable-llvm-passes test.c14 15%struct.t = type { i32 }16 17; Function Attrs: nounwind18define dso_local i32 @test1() #0 !dbg !6 {19entry:20  %bar = alloca %struct.t, align 421  call void @llvm.lifetime.start.p0(i64 4, ptr %bar) #5, !dbg !2022  call void @llvm.dbg.declare(metadata ptr %bar, metadata !11, metadata !DIExpression()), !dbg !2123  %0 = call ptr @llvm.preserve.array.access.index.p0.ts.p0.ts(ptr elementtype(%struct.t) %bar, i32 0, i32 1), !dbg !22, !llvm.preserve.access.index !424  %1 = call i32 @llvm.bpf.preserve.field.info.p0.ts(ptr %0, i64 2), !dbg !2325  call void @llvm.lifetime.end.p0(i64 4, ptr %bar) #5, !dbg !2426  ret i32 %1, !dbg !2527}28 29; CHECK:             r0 = 130; CHECK-NEXT:        exit31 32; CHECK:             .long   26                              # BTF_KIND_STRUCT(id = 4)33; CHECK-NEXT:        .long   67108865                        # 0x400000134; CHECK-NEXT:        .long   435; CHECK-NEXT:        .long   2836; CHECK-NEXT:        .long   537; CHECK-NEXT:        .long   0                               # 0x038; CHECK-NEXT:        .long   32                              # BTF_KIND_INT(id = 5)39; CHECK-NEXT:        .long   16777216                        # 0x100000040; CHECK-NEXT:        .long   441; CHECK-NEXT:        .long   16777248                        # 0x100002042 43; CHECK:             .byte   116                             # string offset=2644; CHECK:             .ascii  "val"                           # string offset=2845; CHECK:             .ascii  "int"                           # string offset=3246; CHECK:             .byte   49                              # string offset=3647 48; CHECK:             .long   16                              # FieldReloc49; CHECK-NEXT:        .long   {{[0-9]+}}                      # Field reloc section string50; CHECK-NEXT:        .long   151; CHECK-NEXT:        .long   .Ltmp{{[0-9]+}}52; CHECK-NEXT:        .long   453; CHECK-NEXT:        .long   3654; CHECK-NEXT:        .long   255 56; Function Attrs: argmemonly nofree nosync nounwind willreturn57declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #158 59; Function Attrs: nofree nosync nounwind readnone speculatable willreturn60declare void @llvm.dbg.declare(metadata, metadata, metadata) #261 62; Function Attrs: nofree nosync nounwind readnone willreturn63declare ptr @llvm.preserve.array.access.index.p0.ts.p0.ts(ptr, i32 immarg, i32 immarg) #364 65; Function Attrs: nounwind readnone66declare i32 @llvm.bpf.preserve.field.info.p0.ts(ptr, i64 immarg) #467 68; Function Attrs: argmemonly nofree nosync nounwind willreturn69declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #170 71attributes #0 = { nounwind "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }72attributes #1 = { argmemonly nofree nosync nounwind willreturn }73attributes #2 = { nofree nosync nounwind readnone speculatable willreturn }74attributes #3 = { nofree nosync nounwind readnone willreturn }75attributes #4 = { nounwind readnone }76attributes #5 = { nounwind }77 78!llvm.dbg.cu = !{!0}79!llvm.module.flags = !{!15, !16, !17, !18}80!llvm.ident = !{!19}81 82!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 13.0.0 (https://github.com/llvm/llvm-project.git 2e0ee68dc85c0a2b7e65e489a60ab363393b06a8)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, splitDebugInlining: false, nameTableKind: None)83!1 = !DIFile(filename: "test.c", directory: "/tmp/home/yhs/work/tests/core")84!2 = !{}85!3 = !{!4}86!4 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !5, size: 64)87!5 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "t", scope: !6, file: !1, line: 3, size: 32, elements: !12)88!6 = distinct !DISubprogram(name: "test1", scope: !1, file: !1, line: 2, type: !7, scopeLine: 2, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !10)89!7 = !DISubroutineType(types: !8)90!8 = !{!9}91!9 = !DIBasicType(name: "unsigned int", size: 32, encoding: DW_ATE_unsigned)92!10 = !{!11}93!11 = !DILocalVariable(name: "bar", scope: !6, file: !1, line: 5, type: !5)94!12 = !{!13}95!13 = !DIDerivedType(tag: DW_TAG_member, name: "val", scope: !5, file: !1, line: 4, baseType: !14, size: 32)96!14 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)97!15 = !{i32 7, !"Dwarf Version", i32 4}98!16 = !{i32 2, !"Debug Info Version", i32 3}99!17 = !{i32 1, !"wchar_size", i32 4}100!18 = !{i32 7, !"frame-pointer", i32 2}101!19 = !{!"clang version 13.0.0 (https://github.com/llvm/llvm-project.git 2e0ee68dc85c0a2b7e65e489a60ab363393b06a8)"}102!20 = !DILocation(line: 3, column: 3, scope: !6)103!21 = !DILocation(line: 5, column: 5, scope: !6)104!22 = !DILocation(line: 6, column: 40, scope: !6)105!23 = !DILocation(line: 6, column: 10, scope: !6)106!24 = !DILocation(line: 7, column: 1, scope: !6)107!25 = !DILocation(line: 6, column: 3, scope: !6)108