1; RUN: llc -mtriple aarch64_be-gnu-linux -O0 -filetype=obj -o %t_be.o %s 2; RUN: llvm-dwarfdump -v -debug-info %t_be.o | FileCheck %s 3 4; Produced at -O0 from: 5; struct bitfield { 6; int a : 2; 7; int b : 32; 8; int c : 1; 9; int d : 28; 10; }; 11; struct bitfield b; 12 13; Note that DWARF 2 counts bit offsets backwards from the high end of 14; the storage unit to the high end of the bit field. 15 16; CHECK: DW_TAG_member 17; CHECK-NEXT: DW_AT_name{{.*}}"a" 18; CHECK-NOT: DW_TAG_member 19; CHECK: DW_AT_byte_size {{.*}} (0x04) 20; CHECK-NEXT: DW_AT_bit_size {{.*}} (0x02) 21; CHECK-NEXT: DW_AT_bit_offset {{.*}} (0x00) 22; CHECK-NEXT: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x0) 23 24; CHECK: DW_TAG_member 25; CHECK-NEXT: DW_AT_name{{.*}}"b" 26; CHECK-NOT: DW_TAG_member 27; CHECK: DW_AT_byte_size {{.*}} (0x04) 28; CHECK-NEXT: DW_AT_bit_size {{.*}} (0x20) 29; CHECK-NEXT: DW_AT_bit_offset {{.*}} (0x00) 30; CHECK: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x4) 31 32; CHECK: DW_TAG_member 33; CHECK-NEXT: DW_AT_name{{.*}}"c" 34; CHECK-NOT: DW_TAG_member 35; CHECK: DW_AT_byte_size {{.*}} (0x04) 36; CHECK-NEXT: DW_AT_bit_size {{.*}} (0x01) 37; CHECK-NEXT: DW_AT_bit_offset {{.*}} (0x00) 38; CHECK: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x8) 39 40; CHECK: DW_TAG_member 41; CHECK-NEXT: DW_AT_name{{.*}}"d" 42; CHECK-NOT: DW_TAG_member 43; CHECK: DW_AT_byte_size {{.*}} (0x04) 44; CHECK-NEXT: DW_AT_bit_size {{.*}} (0x1c) 45; CHECK-NEXT: DW_AT_bit_offset {{.*}} (0x01) 46; CHECK-NEXT: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x8) 47 48; ModuleID = 'bitfields.c' 49source_filename = "test/DebugInfo/AArch64/bitfields.ll" 50target datalayout = "E-m:e-i64:64-i128:128-n32:64-S128" 51target triple = "aarch64_be--linux-gnu" 52 53%struct.bitfield = type <{ i8, [3 x i8], i64 }> 54 55@b = common global %struct.bitfield zeroinitializer, align 4, !dbg !0 56 57!llvm.dbg.cu = !{!2} 58!llvm.module.flags = !{!13, !14, !15} 59!llvm.ident = !{!16} 60 61!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) 62!1 = !DIGlobalVariable(name: "b", scope: !2, file: !3, line: 8, type: !6, isLocal: false, isDefinition: true) 63!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 3.7.0 (trunk 240548) (llvm/trunk 240554)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, retainedTypes: !4, globals: !5, imports: !4) 64!3 = !DIFile(filename: "bitfields.c", directory: "/") 65!4 = !{} 66!5 = !{!0} 67!6 = !DICompositeType(tag: DW_TAG_structure_type, name: "bitfield", file: !3, line: 1, size: 96, elements: !7) 68!7 = !{!8, !10, !11, !12} 69!8 = !DIDerivedType(tag: DW_TAG_member, name: "a", scope: !6, file: !3, line: 2, baseType: !9, size: 2, flags: DIFlagBitField) 70!9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 71!10 = !DIDerivedType(tag: DW_TAG_member, name: "b", scope: !6, file: !3, line: 3, baseType: !9, size: 32, offset: 32, flags: DIFlagBitField) 72!11 = !DIDerivedType(tag: DW_TAG_member, name: "c", scope: !6, file: !3, line: 4, baseType: !9, size: 1, offset: 64, flags: DIFlagBitField) 73!12 = !DIDerivedType(tag: DW_TAG_member, name: "d", scope: !6, file: !3, line: 5, baseType: !9, size: 28, offset: 65, flags: DIFlagBitField) 74!13 = !{i32 2, !"Dwarf Version", i32 2} 75!14 = !{i32 2, !"Debug Info Version", i32 3} 76!15 = !{i32 1, !"PIC Level", i32 2} 77!16 = !{!"clang version 3.7.0 (trunk 240548) (llvm/trunk 240554)"} 78 79