1 ; Generated from tools/clang/test/CodeGen/debug-info-packed-struct.c
2 ; ModuleID = 'llvm/tools/clang/test/CodeGen/debug-info-packed-struct.c'
3 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
4 target triple = "x86_64-apple-darwin"
6 ; RUN: %llc_dwarf -O0 -filetype=obj -o %t.o %s
7 ; RUN: llvm-dwarfdump -debug-dump=info %t.o | FileCheck %s
8 ; REQUIRES: object-emission
10 ; // ---------------------------------------------------------------------
12 ; // ---------------------------------------------------------------------
19 ; struct size8 l0_ofs8;
23 %struct.layout0 = type { i8, %struct.size8, i8 }
24 %struct.size8 = type { i64 }
25 ; CHECK: DW_TAG_structure_type
26 ; CHECK: DW_AT_name {{.*}} "layout0"
27 ; CHECK: DW_AT_byte_size {{.*}} (0x18)
28 ; CHECK: DW_TAG_member
29 ; CHECK: DW_AT_name {{.*}} "l0_ofs0"
30 ; CHECK: DW_AT_data_member_location {{.*}}00
31 ; CHECK: DW_TAG_member
32 ; CHECK: DW_AT_name {{.*}} "l0_ofs8"
33 ; CHECK: DW_AT_data_member_location {{.*}}08
34 ; CHECK: DW_TAG_member
35 ; CHECK: DW_AT_name {{.*}} "l0_ofs16"
36 ; CHECK: DW_AT_bit_size {{.*}} (0x01)
37 ; CHECK: DW_AT_bit_offset {{.*}} (0x1f)
38 ; CHECK: DW_AT_data_member_location {{.*}}10
41 ; // ---------------------------------------------------------------------
42 ; // Implicitly packed.
43 ; // ---------------------------------------------------------------------
50 ; struct size8_anon l1_ofs1;
54 %struct.layout1 = type <{ i8, %struct.size8_anon, i8, [2 x i8] }>
55 %struct.size8_anon = type { i64 }
57 ; CHECK: DW_TAG_structure_type
58 ; CHECK: DW_AT_name {{.*}} "layout1"
59 ; CHECK: DW_AT_byte_size {{.*}} (0x0c)
60 ; CHECK: DW_TAG_member
61 ; CHECK: DW_AT_name {{.*}} "l1_ofs0"
62 ; CHECK: DW_AT_data_member_location {{.*}}00
63 ; CHECK: DW_TAG_member
64 ; CHECK: DW_AT_name {{.*}} "l1_ofs1"
65 ; CHECK: DW_AT_data_member_location {{.*}}01
66 ; CHECK: DW_TAG_member
67 ; CHECK: DW_AT_name {{.*}} "l1_ofs9"
68 ; CHECK: DW_AT_byte_size {{.*}} (0x04)
69 ; CHECK: DW_AT_bit_size {{.*}} (0x01)
70 ; CHECK: DW_AT_bit_offset {{.*}} (0x17)
71 ; CHECK: DW_AT_data_member_location {{.*}}08
73 ; // ---------------------------------------------------------------------
74 ; // Explicitly packed.
75 ; // ---------------------------------------------------------------------
77 ; struct size8_pack1 {
83 ; struct size8_pack1 l2_ofs1;
88 %struct.layout2 = type <{ i8, %struct.size8_pack1, i8 }>
89 %struct.size8_pack1 = type { i64 }
91 ; CHECK: DW_TAG_structure_type
92 ; CHECK: DW_AT_name {{.*}} "layout2"
93 ; CHECK: DW_AT_byte_size {{.*}} (0x0a)
94 ; CHECK: DW_TAG_member
95 ; CHECK: DW_AT_name {{.*}} "l2_ofs0"
96 ; CHECK: DW_AT_data_member_location {{.*}}00
97 ; CHECK: DW_TAG_member
98 ; CHECK: DW_AT_name {{.*}} "l2_ofs1"
99 ; CHECK: DW_AT_data_member_location {{.*}}01
100 ; CHECK: DW_TAG_member
101 ; CHECK: DW_AT_name {{.*}} "l2_ofs9"
102 ; CHECK: DW_AT_byte_size {{.*}} (0x04)
103 ; CHECK: DW_AT_bit_size {{.*}} (0x01)
104 ; CHECK: DW_AT_bit_offset {{.*}} (0x17)
105 ; CHECK: DW_AT_data_member_location {{.*}}08
107 ; // ---------------------------------------------------------------------
108 ; // Explicitly packed with different alignment.
109 ; // ---------------------------------------------------------------------
111 ; struct size8_pack4 {
117 ; struct size8_pack4 l3_ofs4;
123 %struct.layout3 = type <{ i8, [3 x i8], %struct.size8_pack4, i8, [3 x i8] }>
124 %struct.size8_pack4 = type { i64 }
126 ; CHECK: DW_TAG_structure_type
127 ; CHECK: DW_AT_name {{.*}} "layout3"
128 ; CHECK: DW_AT_byte_size {{.*}} (0x10)
129 ; CHECK: DW_TAG_member
130 ; CHECK: DW_AT_name {{.*}} "l3_ofs0"
131 ; CHECK: DW_AT_data_member_location {{.*}}00
132 ; CHECK: DW_TAG_member
133 ; CHECK: DW_AT_name {{.*}} "l3_ofs4"
134 ; CHECK: DW_AT_data_member_location {{.*}}04
135 ; CHECK: DW_TAG_member
136 ; CHECK: DW_AT_name {{.*}} "l3_ofs12"
137 ; CHECK: DW_AT_byte_size {{.*}} (0x04)
138 ; CHECK: DW_AT_bit_size {{.*}} (0x01)
139 ; CHECK: DW_AT_bit_offset {{.*}} (0x1f)
140 ; CHECK: DW_AT_data_member_location {{.*}}0c
142 @l0 = common global %struct.layout0 zeroinitializer, align 8, !dbg !4
143 @l1 = common global %struct.layout1 zeroinitializer, align 4, !dbg !18
144 @l2 = common global %struct.layout2 zeroinitializer, align 1, !dbg !25
145 @l3 = common global %struct.layout3 zeroinitializer, align 4, !dbg !35
148 !llvm.module.flags = !{!45, !46}
151 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.7.0 (trunk 240791) (llvm/trunk 240790)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !2, globals: !3, imports: !2)
152 !1 = !DIFile(filename: "/llvm/tools/clang/test/CodeGen/<stdin>", directory: "/llvm/_build.ninja.release")
154 !3 = !{!4, !18, !25, !35}
155 !4 = !DIGlobalVariable(name: "l0", scope: !0, file: !5, line: 88, type: !6, isLocal: false, isDefinition: true)
156 !5 = !DIFile(filename: "/llvm/tools/clang/test/CodeGen/debug-info-packed-struct.c", directory: "/llvm/_build.ninja.release")
157 !6 = !DICompositeType(tag: DW_TAG_structure_type, name: "layout0", file: !5, line: 15, size: 192, elements: !7)
159 !8 = !DIDerivedType(tag: DW_TAG_member, name: "l0_ofs0", scope: !6, file: !5, line: 16, baseType: !9, size: 8)
160 !9 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
161 !10 = !DIDerivedType(tag: DW_TAG_member, name: "l0_ofs8", scope: !6, file: !5, line: 17, baseType: !11, size: 64, offset: 64)
162 !11 = !DICompositeType(tag: DW_TAG_structure_type, name: "size8", file: !5, line: 11, size: 64, elements: !12)
164 !13 = !DIDerivedType(tag: DW_TAG_member, name: "i", scope: !11, file: !5, line: 12, baseType: !14, size: 4)
165 !14 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
166 !15 = !DIDerivedType(tag: DW_TAG_member, name: "l", scope: !11, file: !5, line: 13, baseType: !16, size: 60, offset: 4)
167 !16 = !DIBasicType(name: "long long int", size: 64, encoding: DW_ATE_signed)
168 !17 = !DIDerivedType(tag: DW_TAG_member, name: "l0_ofs16", scope: !6, file: !5, line: 18, baseType: !14, size: 1, offset: 128)
169 !18 = !DIGlobalVariable(name: "l1", scope: !0, file: !5, line: 89, type: !19, isLocal: false, isDefinition: true)
170 !19 = !DICompositeType(tag: DW_TAG_structure_type, name: "layout1", file: !5, line: 34, size: 96, elements: !20)
171 !20 = !{!21, !22, !24}
172 !21 = !DIDerivedType(tag: DW_TAG_member, name: "l1_ofs0", scope: !19, file: !5, line: 35, baseType: !9, size: 8)
173 !22 = !DIDerivedType(tag: DW_TAG_member, name: "l1_ofs1", scope: !19, file: !5, line: 36, baseType: !23, size: 64, offset: 8)
174 !23 = !DICompositeType(tag: DW_TAG_structure_type, name: "size8_anon", file: !5, line: 30, size: 64, elements: !2)
175 !24 = !DIDerivedType(tag: DW_TAG_member, name: "l1_ofs9", scope: !19, file: !5, line: 37, baseType: !14, size: 1, offset: 72)
176 !25 = !DIGlobalVariable(name: "l2", scope: !0, file: !5, line: 90, type: !26, isLocal: false, isDefinition: true)
177 !26 = !DICompositeType(tag: DW_TAG_structure_type, name: "layout2", file: !5, line: 54, size: 80, elements: !27)
178 !27 = !{!28, !29, !34}
179 !28 = !DIDerivedType(tag: DW_TAG_member, name: "l2_ofs0", scope: !26, file: !5, line: 55, baseType: !9, size: 8)
180 !29 = !DIDerivedType(tag: DW_TAG_member, name: "l2_ofs1", scope: !26, file: !5, line: 56, baseType: !30, size: 64, offset: 8)
181 !30 = !DICompositeType(tag: DW_TAG_structure_type, name: "size8_pack1", file: !5, line: 50, size: 64, elements: !31)
183 !32 = !DIDerivedType(tag: DW_TAG_member, name: "i", scope: !30, file: !5, line: 51, baseType: !14, size: 4)
184 !33 = !DIDerivedType(tag: DW_TAG_member, name: "l", scope: !30, file: !5, line: 52, baseType: !16, size: 60, offset: 4)
185 !34 = !DIDerivedType(tag: DW_TAG_member, name: "l2_ofs9", scope: !26, file: !5, line: 57, baseType: !14, size: 1, offset: 72)
186 !35 = !DIGlobalVariable(name: "l3", scope: !0, file: !5, line: 91, type: !36, isLocal: false, isDefinition: true)
187 !36 = !DICompositeType(tag: DW_TAG_structure_type, name: "layout3", file: !5, line: 76, size: 128, elements: !37)
188 !37 = !{!38, !39, !44}
189 !38 = !DIDerivedType(tag: DW_TAG_member, name: "l3_ofs0", scope: !36, file: !5, line: 77, baseType: !9, size: 8)
190 !39 = !DIDerivedType(tag: DW_TAG_member, name: "l3_ofs4", scope: !36, file: !5, line: 78, baseType: !40, size: 64, offset: 32)
191 !40 = !DICompositeType(tag: DW_TAG_structure_type, name: "size8_pack4", file: !5, line: 72, size: 64, elements: !41)
193 !42 = !DIDerivedType(tag: DW_TAG_member, name: "i", scope: !40, file: !5, line: 73, baseType: !14, size: 4)
194 !43 = !DIDerivedType(tag: DW_TAG_member, name: "l", scope: !40, file: !5, line: 74, baseType: !16, size: 60, offset: 4)
195 !44 = !DIDerivedType(tag: DW_TAG_member, name: "l3_ofs12", scope: !36, file: !5, line: 79, baseType: !14, size: 1, offset: 96)
196 !45 = !{i32 2, !"Dwarf Version", i32 2}
197 !46 = !{i32 2, !"Debug Info Version", i32 3}
198 !47 = !{!"clang version 3.7.0 (trunk 240791) (llvm/trunk 240790)"}