Adrian Prantl | 35e441e | 2015-06-26 21:27:16 +0000 | [diff] [blame] | 1 | ; Generated from tools/clang/test/CodeGen/debug-info-packed-struct.c |
| 2 | ; ModuleID = 'llvm/tools/clang/test/CodeGen/debug-info-packed-struct.c' |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 3 | source_filename = "test/DebugInfo/X86/debug-info-packed-struct.ll" |
Adrian Prantl | 35e441e | 2015-06-26 21:27:16 +0000 | [diff] [blame] | 4 | target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" |
| 5 | target triple = "x86_64-apple-darwin" |
Adrian Prantl | 35e441e | 2015-06-26 21:27:16 +0000 | [diff] [blame] | 6 | ; RUN: %llc_dwarf -O0 -filetype=obj -o %t.o %s |
Adrian Prantl | 16aa4cf | 2017-09-11 23:05:20 +0000 | [diff] [blame] | 7 | ; RUN: llvm-dwarfdump -v -debug-info %t.o | FileCheck %s |
Adrian Prantl | 35e441e | 2015-06-26 21:27:16 +0000 | [diff] [blame] | 8 | ; REQUIRES: object-emission |
| 9 | |
Adrian Prantl | 2004d3b | 2015-06-27 00:01:33 +0000 | [diff] [blame] | 10 | ; // --------------------------------------------------------------------- |
| 11 | ; // Not packed. |
| 12 | ; // --------------------------------------------------------------------- |
| 13 | ; struct size8 { |
| 14 | ; int i : 4; |
| 15 | ; long long l : 60; |
| 16 | ; }; |
| 17 | ; struct layout0 { |
| 18 | ; char l0_ofs0; |
| 19 | ; struct size8 l0_ofs8; |
| 20 | ; int l0_ofs16 : 1; |
| 21 | ; } l0; |
| 22 | |
Adrian Prantl | 35e441e | 2015-06-26 21:27:16 +0000 | [diff] [blame] | 23 | %struct.layout0 = type { i8, %struct.size8, i8 } |
| 24 | %struct.size8 = type { i64 } |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 25 | %struct.layout1 = type <{ i8, %struct.size8_anon, i8, [2 x i8] }> |
| 26 | %struct.size8_anon = type { i64 } |
Adrian Prantl | 35e441e | 2015-06-26 21:27:16 +0000 | [diff] [blame] | 27 | ; CHECK: DW_TAG_structure_type |
| 28 | ; CHECK: DW_AT_name {{.*}} "layout0" |
| 29 | ; CHECK: DW_AT_byte_size {{.*}} (0x18) |
| 30 | ; CHECK: DW_TAG_member |
| 31 | ; CHECK: DW_AT_name {{.*}} "l0_ofs0" |
Reid Kleckner | a058736 | 2017-08-29 21:41:21 +0000 | [diff] [blame] | 32 | ; CHECK: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x0) |
Adrian Prantl | 35e441e | 2015-06-26 21:27:16 +0000 | [diff] [blame] | 33 | ; CHECK: DW_TAG_member |
| 34 | ; CHECK: DW_AT_name {{.*}} "l0_ofs8" |
Reid Kleckner | a058736 | 2017-08-29 21:41:21 +0000 | [diff] [blame] | 35 | ; CHECK: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x8) |
Adrian Prantl | 35e441e | 2015-06-26 21:27:16 +0000 | [diff] [blame] | 36 | ; CHECK: DW_TAG_member |
| 37 | ; CHECK: DW_AT_name {{.*}} "l0_ofs16" |
| 38 | ; CHECK: DW_AT_bit_size {{.*}} (0x01) |
| 39 | ; CHECK: DW_AT_bit_offset {{.*}} (0x1f) |
Reid Kleckner | a058736 | 2017-08-29 21:41:21 +0000 | [diff] [blame] | 40 | ; CHECK: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x10) |
Adrian Prantl | 35e441e | 2015-06-26 21:27:16 +0000 | [diff] [blame] | 41 | |
Adrian Prantl | 2004d3b | 2015-06-27 00:01:33 +0000 | [diff] [blame] | 42 | ; // --------------------------------------------------------------------- |
| 43 | ; // Implicitly packed. |
| 44 | ; // --------------------------------------------------------------------- |
| 45 | ; struct size8_anon { |
| 46 | ; int : 4; |
| 47 | ; long long : 60; |
| 48 | ; }; |
| 49 | ; struct layout1 { |
| 50 | ; char l1_ofs0; |
| 51 | ; struct size8_anon l1_ofs1; |
| 52 | ; int l1_ofs9 : 1; |
| 53 | ; } l1; |
| 54 | |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 55 | %struct.layout2 = type <{ i8, %struct.size8_pack1, i8 }> |
| 56 | %struct.size8_pack1 = type { i64 } |
| 57 | %struct.layout3 = type <{ i8, [3 x i8], %struct.size8_pack4, i8, [3 x i8] }> |
| 58 | %struct.size8_pack4 = type { i64 } |
Adrian Prantl | 35e441e | 2015-06-26 21:27:16 +0000 | [diff] [blame] | 59 | |
| 60 | ; CHECK: DW_TAG_structure_type |
| 61 | ; CHECK: DW_AT_name {{.*}} "layout1" |
| 62 | ; CHECK: DW_AT_byte_size {{.*}} (0x0c) |
| 63 | ; CHECK: DW_TAG_member |
| 64 | ; CHECK: DW_AT_name {{.*}} "l1_ofs0" |
Reid Kleckner | a058736 | 2017-08-29 21:41:21 +0000 | [diff] [blame] | 65 | ; CHECK: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x0) |
Adrian Prantl | 35e441e | 2015-06-26 21:27:16 +0000 | [diff] [blame] | 66 | ; CHECK: DW_TAG_member |
| 67 | ; CHECK: DW_AT_name {{.*}} "l1_ofs1" |
Reid Kleckner | a058736 | 2017-08-29 21:41:21 +0000 | [diff] [blame] | 68 | ; CHECK: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x1) |
Adrian Prantl | 35e441e | 2015-06-26 21:27:16 +0000 | [diff] [blame] | 69 | ; CHECK: DW_TAG_member |
| 70 | ; CHECK: DW_AT_name {{.*}} "l1_ofs9" |
| 71 | ; CHECK: DW_AT_byte_size {{.*}} (0x04) |
| 72 | ; CHECK: DW_AT_bit_size {{.*}} (0x01) |
| 73 | ; CHECK: DW_AT_bit_offset {{.*}} (0x17) |
Reid Kleckner | a058736 | 2017-08-29 21:41:21 +0000 | [diff] [blame] | 74 | ; CHECK: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x8) |
Adrian Prantl | 35e441e | 2015-06-26 21:27:16 +0000 | [diff] [blame] | 75 | |
Adrian Prantl | 2004d3b | 2015-06-27 00:01:33 +0000 | [diff] [blame] | 76 | ; // --------------------------------------------------------------------- |
| 77 | ; // Explicitly packed. |
| 78 | ; // --------------------------------------------------------------------- |
| 79 | ; #pragma pack(1) |
| 80 | ; struct size8_pack1 { |
| 81 | ; int i : 4; |
| 82 | ; long long l : 60; |
| 83 | ; }; |
| 84 | ; struct layout2 { |
| 85 | ; char l2_ofs0; |
| 86 | ; struct size8_pack1 l2_ofs1; |
| 87 | ; int l2_ofs9 : 1; |
| 88 | ; } l2; |
| 89 | ; #pragma pack() |
| 90 | |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 91 | @l0 = common global %struct.layout0 zeroinitializer, align 8, !dbg !0 |
| 92 | @l1 = common global %struct.layout1 zeroinitializer, align 4, !dbg !6 |
Adrian Prantl | 35e441e | 2015-06-26 21:27:16 +0000 | [diff] [blame] | 93 | ; CHECK: DW_TAG_structure_type |
| 94 | ; CHECK: DW_AT_name {{.*}} "layout2" |
| 95 | ; CHECK: DW_AT_byte_size {{.*}} (0x0a) |
| 96 | ; CHECK: DW_TAG_member |
| 97 | ; CHECK: DW_AT_name {{.*}} "l2_ofs0" |
Reid Kleckner | a058736 | 2017-08-29 21:41:21 +0000 | [diff] [blame] | 98 | ; CHECK: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x0) |
Adrian Prantl | 35e441e | 2015-06-26 21:27:16 +0000 | [diff] [blame] | 99 | ; CHECK: DW_TAG_member |
| 100 | ; CHECK: DW_AT_name {{.*}} "l2_ofs1" |
Reid Kleckner | a058736 | 2017-08-29 21:41:21 +0000 | [diff] [blame] | 101 | ; CHECK: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x1) |
Adrian Prantl | 35e441e | 2015-06-26 21:27:16 +0000 | [diff] [blame] | 102 | ; CHECK: DW_TAG_member |
| 103 | ; CHECK: DW_AT_name {{.*}} "l2_ofs9" |
| 104 | ; CHECK: DW_AT_byte_size {{.*}} (0x04) |
| 105 | ; CHECK: DW_AT_bit_size {{.*}} (0x01) |
| 106 | ; CHECK: DW_AT_bit_offset {{.*}} (0x17) |
Reid Kleckner | a058736 | 2017-08-29 21:41:21 +0000 | [diff] [blame] | 107 | ; CHECK: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x8) |
Adrian Prantl | 35e441e | 2015-06-26 21:27:16 +0000 | [diff] [blame] | 108 | |
Adrian Prantl | 2004d3b | 2015-06-27 00:01:33 +0000 | [diff] [blame] | 109 | ; // --------------------------------------------------------------------- |
| 110 | ; // Explicitly packed with different alignment. |
| 111 | ; // --------------------------------------------------------------------- |
| 112 | ; #pragma pack(4) |
| 113 | ; struct size8_pack4 { |
| 114 | ; int i : 4; |
| 115 | ; long long l : 60; |
| 116 | ; }; |
| 117 | ; struct layout3 { |
| 118 | ; char l3_ofs0; |
| 119 | ; struct size8_pack4 l3_ofs4; |
| 120 | ; int l3_ofs12 : 1; |
| 121 | ; } l 3; |
| 122 | ; #pragma pack() |
| 123 | |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 124 | @l2 = common global %struct.layout2 zeroinitializer, align 1, !dbg !17 |
| 125 | @l3 = common global %struct.layout3 zeroinitializer, align 4, !dbg !29 |
Adrian Prantl | 35e441e | 2015-06-26 21:27:16 +0000 | [diff] [blame] | 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" |
Reid Kleckner | a058736 | 2017-08-29 21:41:21 +0000 | [diff] [blame] | 131 | ; CHECK: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x0) |
Adrian Prantl | 35e441e | 2015-06-26 21:27:16 +0000 | [diff] [blame] | 132 | ; CHECK: DW_TAG_member |
| 133 | ; CHECK: DW_AT_name {{.*}} "l3_ofs4" |
Reid Kleckner | a058736 | 2017-08-29 21:41:21 +0000 | [diff] [blame] | 134 | ; CHECK: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x4) |
Adrian Prantl | 35e441e | 2015-06-26 21:27:16 +0000 | [diff] [blame] | 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) |
Reid Kleckner | a058736 | 2017-08-29 21:41:21 +0000 | [diff] [blame] | 140 | ; CHECK: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0xc) |
Adrian Prantl | 35e441e | 2015-06-26 21:27:16 +0000 | [diff] [blame] | 141 | |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 142 | !llvm.dbg.cu = !{!2} |
| 143 | !llvm.module.flags = !{!49, !50} |
| 144 | !llvm.ident = !{!51} |
Adrian Prantl | 35e441e | 2015-06-26 21:27:16 +0000 | [diff] [blame] | 145 | |
Adrian Prantl | 0578221 | 2017-08-30 18:06:51 +0000 | [diff] [blame] | 146 | !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 147 | !1 = !DIGlobalVariable(name: "l0", scope: !2, file: !8, line: 88, type: !40, isLocal: false, isDefinition: true) |
| 148 | !2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 3.7.0 (trunk 240791) (llvm/trunk 240790)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, retainedTypes: !4, globals: !5, imports: !4) |
| 149 | !3 = !DIFile(filename: "/llvm/tools/clang/test/CodeGen/<stdin>", directory: "/llvm/_build.ninja.release") |
| 150 | !4 = !{} |
| 151 | !5 = !{!0, !6, !17, !29} |
Adrian Prantl | 0578221 | 2017-08-30 18:06:51 +0000 | [diff] [blame] | 152 | !6 = !DIGlobalVariableExpression(var: !7, expr: !DIExpression()) |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 153 | !7 = !DIGlobalVariable(name: "l1", scope: !2, file: !8, line: 89, type: !9, isLocal: false, isDefinition: true) |
| 154 | !8 = !DIFile(filename: "/llvm/tools/clang/test/CodeGen/debug-info-packed-struct.c", directory: "/llvm/_build.ninja.release") |
| 155 | !9 = !DICompositeType(tag: DW_TAG_structure_type, name: "layout1", file: !8, line: 34, size: 96, elements: !10) |
| 156 | !10 = !{!11, !13, !15} |
| 157 | !11 = !DIDerivedType(tag: DW_TAG_member, name: "l1_ofs0", scope: !9, file: !8, line: 35, baseType: !12, size: 8) |
| 158 | !12 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char) |
| 159 | !13 = !DIDerivedType(tag: DW_TAG_member, name: "l1_ofs1", scope: !9, file: !8, line: 36, baseType: !14, size: 64, offset: 8) |
| 160 | !14 = !DICompositeType(tag: DW_TAG_structure_type, name: "size8_anon", file: !8, line: 30, size: 64, elements: !4) |
| 161 | !15 = !DIDerivedType(tag: DW_TAG_member, name: "l1_ofs9", scope: !9, file: !8, line: 37, baseType: !16, size: 1, offset: 72) |
| 162 | !16 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) |
Adrian Prantl | 0578221 | 2017-08-30 18:06:51 +0000 | [diff] [blame] | 163 | !17 = !DIGlobalVariableExpression(var: !18, expr: !DIExpression()) |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 164 | !18 = !DIGlobalVariable(name: "l2", scope: !2, file: !8, line: 90, type: !19, isLocal: false, isDefinition: true) |
| 165 | !19 = !DICompositeType(tag: DW_TAG_structure_type, name: "layout2", file: !8, line: 54, size: 80, elements: !20) |
| 166 | !20 = !{!21, !22, !28} |
| 167 | !21 = !DIDerivedType(tag: DW_TAG_member, name: "l2_ofs0", scope: !19, file: !8, line: 55, baseType: !12, size: 8) |
| 168 | !22 = !DIDerivedType(tag: DW_TAG_member, name: "l2_ofs1", scope: !19, file: !8, line: 56, baseType: !23, size: 64, offset: 8) |
| 169 | !23 = !DICompositeType(tag: DW_TAG_structure_type, name: "size8_pack1", file: !8, line: 50, size: 64, elements: !24) |
| 170 | !24 = !{!25, !26} |
| 171 | !25 = !DIDerivedType(tag: DW_TAG_member, name: "i", scope: !23, file: !8, line: 51, baseType: !16, size: 4) |
| 172 | !26 = !DIDerivedType(tag: DW_TAG_member, name: "l", scope: !23, file: !8, line: 52, baseType: !27, size: 60, offset: 4) |
| 173 | !27 = !DIBasicType(name: "long long int", size: 64, encoding: DW_ATE_signed) |
| 174 | !28 = !DIDerivedType(tag: DW_TAG_member, name: "l2_ofs9", scope: !19, file: !8, line: 57, baseType: !16, size: 1, offset: 72) |
Adrian Prantl | 0578221 | 2017-08-30 18:06:51 +0000 | [diff] [blame] | 175 | !29 = !DIGlobalVariableExpression(var: !30, expr: !DIExpression()) |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 176 | !30 = !DIGlobalVariable(name: "l3", scope: !2, file: !8, line: 91, type: !31, isLocal: false, isDefinition: true) |
| 177 | !31 = !DICompositeType(tag: DW_TAG_structure_type, name: "layout3", file: !8, line: 76, size: 128, elements: !32) |
| 178 | !32 = !{!33, !34, !39} |
| 179 | !33 = !DIDerivedType(tag: DW_TAG_member, name: "l3_ofs0", scope: !31, file: !8, line: 77, baseType: !12, size: 8) |
| 180 | !34 = !DIDerivedType(tag: DW_TAG_member, name: "l3_ofs4", scope: !31, file: !8, line: 78, baseType: !35, size: 64, offset: 32) |
| 181 | !35 = !DICompositeType(tag: DW_TAG_structure_type, name: "size8_pack4", file: !8, line: 72, size: 64, elements: !36) |
| 182 | !36 = !{!37, !38} |
| 183 | !37 = !DIDerivedType(tag: DW_TAG_member, name: "i", scope: !35, file: !8, line: 73, baseType: !16, size: 4) |
| 184 | !38 = !DIDerivedType(tag: DW_TAG_member, name: "l", scope: !35, file: !8, line: 74, baseType: !27, size: 60, offset: 4) |
| 185 | !39 = !DIDerivedType(tag: DW_TAG_member, name: "l3_ofs12", scope: !31, file: !8, line: 79, baseType: !16, size: 1, offset: 96) |
| 186 | !40 = !DICompositeType(tag: DW_TAG_structure_type, name: "layout0", file: !8, line: 15, size: 192, elements: !41) |
| 187 | !41 = !{!42, !43, !48} |
| 188 | !42 = !DIDerivedType(tag: DW_TAG_member, name: "l0_ofs0", scope: !40, file: !8, line: 16, baseType: !12, size: 8) |
| 189 | !43 = !DIDerivedType(tag: DW_TAG_member, name: "l0_ofs8", scope: !40, file: !8, line: 17, baseType: !44, size: 64, offset: 64) |
| 190 | !44 = !DICompositeType(tag: DW_TAG_structure_type, name: "size8", file: !8, line: 11, size: 64, elements: !45) |
| 191 | !45 = !{!46, !47} |
| 192 | !46 = !DIDerivedType(tag: DW_TAG_member, name: "i", scope: !44, file: !8, line: 12, baseType: !16, size: 4) |
| 193 | !47 = !DIDerivedType(tag: DW_TAG_member, name: "l", scope: !44, file: !8, line: 13, baseType: !27, size: 60, offset: 4) |
| 194 | !48 = !DIDerivedType(tag: DW_TAG_member, name: "l0_ofs16", scope: !40, file: !8, line: 18, baseType: !16, size: 1, offset: 128) |
| 195 | !49 = !{i32 2, !"Dwarf Version", i32 2} |
| 196 | !50 = !{i32 2, !"Debug Info Version", i32 3} |
| 197 | !51 = !{!"clang version 3.7.0 (trunk 240791) (llvm/trunk 240790)"} |
Adrian Prantl | 35e441e | 2015-06-26 21:27:16 +0000 | [diff] [blame] | 198 | |