brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.6 KiB · a895242 Raw
106 lines · plain
1; RUN: opt -O2 %s | llvm-dis > %t12; RUN: llc -filetype=asm -o - %t1 | FileCheck %s3; Source code:4;   struct t2 {5;       int a[8];6;       long: 64;7;       long: 64;8;       long: 64;9;       long: 64;10;   };11;12;   struct t1 {13;       int f1: 1;14;       int f2: 2;15;       long: 61;16;       long: 64;17;       long: 64;18;       long: 64;19;       long: 64;20;       long: 64;21;       long: 64;22;       long: 64;23;       struct t2 f3;24;   } __attribute__((preserve_access_index));25;26;   struct t1 g;27;   int foo() {28;     return g.f1;29;   }30; Compilation flag:31;   clang -target bpfel -O2 -g -S -emit-llvm -Xclang -disable-llvm-passes test.c32 33; ModuleID = 'test.c'34source_filename = "test.c"35target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128"36target triple = "bpfel"37 38%struct.t1 = type { i512, %struct.t2 }39%struct.t2 = type { [8 x i32], i256 }40 41@g = dso_local global %struct.t1 zeroinitializer, align 4, !dbg !042 43; Function Attrs: nounwind44define dso_local i32 @foo() #0 !dbg !22 {45entry:46  %0 = call ptr @llvm.preserve.struct.access.index.p0.p0.t1s(ptr elementtype(%struct.t1) @g, i32 0, i32 0), !dbg !26, !llvm.preserve.access.index !547  %bf.load = load i512, ptr %0, align 4, !dbg !2648  %bf.shl = shl i512 %bf.load, 511, !dbg !2649  %bf.ashr = ashr i512 %bf.shl, 511, !dbg !2650  %bf.cast = trunc i512 %bf.ashr to i32, !dbg !2651  ret i32 %bf.cast, !dbg !2752}53 54; CHECK:        .long   68                              # BTF_KIND_STRUCT(id = 4)55 56; CHECK:        .ascii  ".text"                         # string offset=957; CHECK:        .ascii  "t1"                            # string offset=6858; CHECK:        .ascii  "0:0"                           # string offset=10559 60; CHECK:        .long   16                              # FieldReloc61; CHECK:        .long   9                               # Field reloc section string offset=962; CHECK:        .long   163; CHECK:        .long   .Ltmp[[#]]64; CHECK:        .long   465; CHECK:        .long   10566; CHECK:        .long   067 68; Function Attrs: nofree nosync nounwind readnone willreturn69declare ptr @llvm.preserve.struct.access.index.p0.p0.t1s(ptr, i32 immarg, i32 immarg) #170 71attributes #0 = { nounwind "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }72attributes #1 = { nofree nosync nounwind readnone willreturn }73 74!llvm.dbg.cu = !{!2}75!llvm.module.flags = !{!17, !18, !19, !20}76!llvm.ident = !{!21}77 78!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())79!1 = distinct !DIGlobalVariable(name: "g", scope: !2, file: !3, line: 23, type: !5, isLocal: false, isDefinition: true)80!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 15.0.0 (https://github.com/llvm/llvm-project.git 468279d2d249e44ffa3535a613245b4ceb81a908)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, globals: !4, splitDebugInlining: false, nameTableKind: None)81!3 = !DIFile(filename: "test.c", directory: "/tmp/home/yhs/work/tests/llvm/bitfield/simple", checksumkind: CSK_MD5, checksum: "b9c80125731b87136772eec36d0b48a3")82!4 = !{!0}83!5 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "t1", file: !3, line: 9, size: 1024, elements: !6)84!6 = !{!7, !9, !10}85!7 = !DIDerivedType(tag: DW_TAG_member, name: "f1", scope: !5, file: !3, line: 10, baseType: !8, size: 1, flags: DIFlagBitField, extraData: i64 0)86!8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)87!9 = !DIDerivedType(tag: DW_TAG_member, name: "f2", scope: !5, file: !3, line: 11, baseType: !8, size: 2, offset: 1, flags: DIFlagBitField, extraData: i64 0)88!10 = !DIDerivedType(tag: DW_TAG_member, name: "f3", scope: !5, file: !3, line: 20, baseType: !11, size: 512, offset: 512)89!11 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "t2", file: !3, line: 1, size: 512, elements: !12)90!12 = !{!13}91!13 = !DIDerivedType(tag: DW_TAG_member, name: "a", scope: !11, file: !3, line: 2, baseType: !14, size: 256)92!14 = !DICompositeType(tag: DW_TAG_array_type, baseType: !8, size: 256, elements: !15)93!15 = !{!16}94!16 = !DISubrange(count: 8)95!17 = !{i32 7, !"Dwarf Version", i32 5}96!18 = !{i32 2, !"Debug Info Version", i32 3}97!19 = !{i32 1, !"wchar_size", i32 4}98!20 = !{i32 7, !"frame-pointer", i32 2}99!21 = !{!"clang version 15.0.0 (https://github.com/llvm/llvm-project.git 468279d2d249e44ffa3535a613245b4ceb81a908)"}100!22 = distinct !DISubprogram(name: "foo", scope: !3, file: !3, line: 24, type: !23, scopeLine: 24, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !25)101!23 = !DISubroutineType(types: !24)102!24 = !{!8}103!25 = !{}104!26 = !DILocation(line: 25, column: 12, scope: !22)105!27 = !DILocation(line: 25, column: 3, scope: !22)106