llvm.org GIT mirror llvm / 1df4f64
Revert r285181 "DebugInfo: support for DWARFv5 DW_AT_alignment attribute". The commit broke the builds. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285183 91177308-0d34-0410-b5e6-96231b3b80d8 Vassil Vassilev 2 years ago
10 changed file(s) with 28 addition(s) and 412 deletion(s). Raw diff Collapse all Expand all
385385
386386 .. code-block:: c
387387
388 _Alignas(8) int MyGlobal = 100;
388 int MyGlobal = 100;
389389
390390 a C/C++ front-end would generate the following descriptors:
391391
394394 ;;
395395 ;; Define the global itself.
396396 ;;
397 @MyGlobal = global i32 100, align 8, !dbg !0
397 @MyGlobal = global i32 100, align 4
398398
399399 ;;
400400 ;; List of debug info of globals
401401 ;;
402 !llvm.dbg.cu = !{!1}
402 !llvm.dbg.cu = !{!0}
403403
404404 ;; Some unrelated metadata.
405405 !llvm.module.flags = !{!6, !7}
406 !llvm.ident = !{!8}
407
408 ;; Define the global variable itself
409 !0 = distinct !DIGlobalVariable(name: "MyGlobal", scope: !1, file: !2, line: 1, type: !5, isLocal: false, isDefinition: true, align: 64)
410406
411407 ;; Define the compile unit.
412 !1 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2,
413 producer: "clang version 4.0.0 (http://llvm.org/git/clang.git ae4deadbea242e8ea517eef662c30443f75bd086) (http://llvm.org/git/llvm.git 818b4c1539df3e51dc7e62c89ead4abfd348827d)",
414 isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug,
415 enums: !3, globals: !4)
408 !0 = !DICompileUnit(language: DW_LANG_C99, file: !1,
409 producer:
410 "clang version 3.7.0 (trunk 231150) (llvm/trunk 231154)",
411 isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug,
412 enums: !2, retainedTypes: !2, subprograms: !2, globals:
413 !3, imports: !2)
416414
417415 ;;
418416 ;; Define the file
419417 ;;
420 !2 = !DIFile(filename: "/dev/stdin",
418 !1 = !DIFile(filename: "/dev/stdin",
421419 directory: "/Users/dexonsmith/data/llvm/debug-info")
422420
423421 ;; An empty array.
424 !3 = !{}
422 !2 = !{}
425423
426424 ;; The Array of Global Variables
427 !4 = !{!0}
425 !3 = !{!4}
426
427 ;;
428 ;; Define the global variable itself.
429 ;;
430 !4 = !DIGlobalVariable(name: "MyGlobal", scope: !0, file: !1, line: 1,
431 type: !5, isLocal: false, isDefinition: true,
432 variable: i32* @MyGlobal)
428433
429434 ;;
430435 ;; Define the type
431436 ;;
432 !5 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
437 !5 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
433438
434439 ;; Dwarf version to output.
435 !6 = !{i32 2, !"Dwarf Version", i32 4}
440 !6 = !{i32 2, !"Dwarf Version", i32 2}
436441
437442 ;; Debug info schema version.
438443 !7 = !{i32 2, !"Debug Info Version", i32 3}
439
440 ;; Compiler identification
441 !8 = !{!"clang version 4.0.0 (http://llvm.org/git/clang.git ae4deadbea242e8ea517eef662c30443f75bd086) (http://llvm.org/git/llvm.git 818b4c1539df3e51dc7e62c89ead4abfd348827d)"}
442
443
444 The align value in DIGlobalVariable description specifies variable alignment in
445 case it was forced by C11 _Alignas(), C++11 alignas() keywords or compiler
446 attribute __attribute__((aligned ())). In other case (when this field is missing)
447 alignment is considered default. This is used when producing DWARF output
448 for DW_AT_alignment value.
449444
450445 C/C++ function information
451446 --------------------------
18411841 StringRef getName() const { return getStringOperand(1); }
18421842 DIFile *getFile() const { return cast_or_null(getRawFile()); }
18431843 DITypeRef getType() const { return DITypeRef(getRawType()); }
1844 DIAlignment getAlignInBits() const { return AlignInBits; }
1845 DIAlignment getAlignInBytes() const { return getAlignInBits() / CHAR_BIT; }
1844 uint64_t getAlignInBits() const { return AlignInBits; }
1845 uint64_t getAlignInBytes() const { return getAlignInBits() / CHAR_BIT; }
18461846
18471847 StringRef getFilename() const {
18481848 if (auto *F = getFile())
197197 DW_AT_rvalue_reference = 0x78,
198198 DW_AT_macros = 0x79,
199199 DW_AT_noreturn = 0x87,
200 DW_AT_alignment = 0x88,
201200
202201 DW_AT_lo_user = 0x2000,
203202 DW_AT_hi_user = 0x3fff,
116116 addFlag(*VariableDIE, dwarf::DW_AT_declaration);
117117 else
118118 addGlobalName(GV->getName(), *VariableDIE, DeclContext);
119
120 if (DIAlignment AlignInBytes = GV->getAlignInBytes())
121 addUInt(*VariableDIE, dwarf::DW_AT_alignment, dwarf::DW_FORM_udata,
122 AlignInBytes);
123119
124120 // Add location.
125121 bool addToAccelTable = false;
774770 StringRef Name = Var.getName();
775771 if (!Name.empty())
776772 addString(VariableDie, dwarf::DW_AT_name, Name);
777 const auto *DIVar = Var.getVariable();
778 if (DIVar)
779 if (DIAlignment AlignInBytes = DIVar->getAlignInBytes())
780 addUInt(VariableDie, dwarf::DW_AT_alignment, dwarf::DW_FORM_udata,
781 AlignInBytes);
782
783 addSourceLine(VariableDie, DIVar);
773 addSourceLine(VariableDie, Var.getVariable());
784774 addType(VariableDie, Var.getType());
785775 if (Var.isArtificial())
786776 addFlag(VariableDie, dwarf::DW_AT_artificial);
10061006 if (RLang)
10071007 addUInt(Buffer, dwarf::DW_AT_APPLE_runtime_class, dwarf::DW_FORM_data1,
10081008 RLang);
1009
1010 // Add align info if available.
1011 if (uint64_t AlignInBytes = CTy->getAlignInBytes())
1012 addUInt(Buffer, dwarf::DW_AT_alignment, dwarf::DW_FORM_udata,
1013 AlignInBytes);
10141009 }
10151010 }
10161011
13981393 } else {
13991394 uint64_t Size = DT->getSizeInBits();
14001395 uint64_t FieldSize = DD->getBaseTypeSize(DT);
1401 uint64_t AlignInBytes = DT->getAlignInBytes();
14021396 uint64_t OffsetInBytes;
14031397
14041398 bool IsBitfield = FieldSize && Size != FieldSize;
14361430 } else {
14371431 // This is not a bitfield.
14381432 OffsetInBytes = DT->getOffsetInBits() / 8;
1439 if (AlignInBytes)
1440 addUInt(MemberDie, dwarf::DW_AT_alignment, dwarf::DW_FORM_udata,
1441 AlignInBytes);
14421433 }
14431434
14441435 if (DD->getDwarfVersion() <= 2) {
15151506 if (const ConstantFP *CFP = dyn_cast_or_null(DT->getConstant()))
15161507 addConstantFPValue(StaticMemberDIE, CFP);
15171508
1518 if (uint64_t AlignInBytes = DT->getAlignInBytes())
1519 addUInt(StaticMemberDIE, dwarf::DW_AT_alignment, dwarf::DW_FORM_udata,
1520 AlignInBytes);
1521
15221509 return &StaticMemberDIE;
15231510 }
15241511
148148 case DW_AT_reference: return "DW_AT_reference";
149149 case DW_AT_rvalue_reference: return "DW_AT_rvalue_reference";
150150 case DW_AT_noreturn: return "DW_AT_noreturn";
151 case DW_AT_alignment:
152 return "DW_AT_alignment";
153151 case DW_AT_MIPS_loop_begin: return "DW_AT_MIPS_loop_begin";
154152 case DW_AT_MIPS_tail_loop_begin: return "DW_AT_MIPS_tail_loop_begin";
155153 case DW_AT_MIPS_epilog_begin: return "DW_AT_MIPS_epilog_begin";
+0
-83
test/DebugInfo/X86/align_c11.ll less more
None ; RUN: %llc_dwarf -filetype=obj < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s
1 ; REQUIRES: object-emission
2
3 ; Generated by clang -c -g -std=c11 -S -emit-llvm from the following C11 source
4 ;
5 ; // every object of type struct data will be aligned to 128-byte boundary
6 ; struct data {
7 ; char x;
8 ; _Alignas(128) char arr[2];
9 ; };
10 ;
11 ; _Alignas(2048) struct data d; // this instance of data is aligned even stricter
12 ; int foo(void)
13 ; {
14 ; struct data local_data;
15 ; return 0;
16 ; }
17
18 ; CHECK: DW_TAG_variable
19 ; CHECK-NOT: DW_TAG
20 ; CHECK: DW_AT_name{{.*}}"d"
21 ; CHECK-NOT: DW_TAG
22 ; CHECK: DW_AT_alignment{{.*}}2048
23 ; CHECK: DW_TAG_structure_type
24 ; CHECK: DW_TAG_member
25 ; CHECK: DW_TAG_member
26 ; CHECK-NOT: DW_TAG
27 ; CHECK: DW_AT_name{{.*}}"arr"
28 ; CHECK-NOT: DW_TAG
29 ; CHECK: DW_AT_alignment{{.*}}128
30
31 ; ModuleID = 'test.c'
32 source_filename = "test.c"
33 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
34 target triple = "x86_64-unknown-linux-gnu"
35
36 %struct.data = type { i8, [127 x i8], [2 x i8], [126 x i8] }
37
38 @d = common global %struct.data zeroinitializer, align 2048, !dbg !0
39
40 ; Function Attrs: nounwind uwtable
41 define i32 @foo() #0 !dbg !17 {
42 entry:
43 %local_data = alloca %struct.data, align 128
44 call void @llvm.dbg.declare(metadata %struct.data* %local_data, metadata !21, metadata !22), !dbg !23
45 ret i32 0, !dbg !24
46 }
47
48 ; Function Attrs: nounwind readnone
49 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
50
51 attributes #0 = { nounwind uwtable }
52 attributes #1 = { nounwind readnone }
53
54 !llvm.dbg.cu = !{!1}
55 !llvm.module.flags = !{!14, !15}
56 !llvm.ident = !{!16}
57
58 !0 = distinct !DIGlobalVariable(name: "d", scope: !1, file: !5, line: 7, type: !6, isLocal: false, isDefinition: true, align: 16384)
59 !1 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2, producer: "clang version 4.0.0 (http://llvm.org/git/clang.git 9ce5220b821054019059c2ac4a9b132c7723832d) (http://llvm.org/git/llvm.git 9a6298be89ce0359b151c0a37af2776a12c69e85)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !3, globals: !4)
60 !2 = !DIFile(filename: "test.c", directory: "/tmp")
61 !3 = !{}
62 !4 = !{!0}
63 !5 = !DIFile(filename: "test.c", directory: "/tmp")
64 !6 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "data", file: !5, line: 2, size: 2048, elements: !7)
65 !7 = !{!8, !10}
66 !8 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !6, file: !5, line: 3, baseType: !9, size: 8)
67 !9 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
68 !10 = !DIDerivedType(tag: DW_TAG_member, name: "arr", scope: !6, file: !5, line: 4, baseType: !11, size: 16, align: 1024, offset: 1024)
69 !11 = !DICompositeType(tag: DW_TAG_array_type, baseType: !9, size: 16, elements: !12)
70 !12 = !{!13}
71 !13 = !DISubrange(count: 2)
72 !14 = !{i32 2, !"Dwarf Version", i32 4}
73 !15 = !{i32 2, !"Debug Info Version", i32 3}
74 !16 = !{!"clang version 4.0.0 (http://llvm.org/git/clang.git 9ce5220b821054019059c2ac4a9b132c7723832d) (http://llvm.org/git/llvm.git 9a6298be89ce0359b151c0a37af2776a12c69e85)"}
75 !17 = distinct !DISubprogram(name: "foo", scope: !5, file: !5, line: 8, type: !18, isLocal: false, isDefinition: true, scopeLine: 9, flags: DIFlagPrototyped, isOptimized: false, unit: !1, variables: !3)
76 !18 = !DISubroutineType(types: !19)
77 !19 = !{!20}
78 !20 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
79 !21 = !DILocalVariable(name: "local_data", scope: !17, file: !5, line: 10, type: !6)
80 !22 = !DIExpression()
81 !23 = !DILocation(line: 10, column: 17, scope: !17)
82 !24 = !DILocation(line: 11, column: 5, scope: !17)
+0
-172
test/DebugInfo/X86/align_cpp11.ll less more
None ; RUN: %llc_dwarf -filetype=obj < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s
1 ; REQUIRES: object-emission
2
3 ; Generated by clang++ -c -g -std=c++11 -S -emit-llvm from the following C++11 source
4 ; struct S {
5 ; char x;
6 ; alignas(128) char xx;
7 ; };
8 ;
9 ; class alignas(64) C0 {
10 ; };
11 ;
12 ; class C1 {
13 ; alignas(64) static void *p;
14 ; };
15 ;
16 ; enum alignas(16) E {
17 ; A,
18 ; B,
19 ; C,
20 ; };
21 ;
22 ; C0 c0;
23 ;
24 ; alignas(2048) S s;
25 ;
26 ; void foo()
27 ; {
28 ; S ss;
29 ; E e;
30 ; C1 c1;
31 ; alignas(32) int i = 42;
32 ; auto Lambda = [i](){};
33 ; }
34
35 ; CHECK: DW_TAG_class_type
36 ; CHECK-NOT: DW_TAG
37 ; CHECK: DW_AT_name{{.*}}"C0"
38 ; CHECK-NOT: DW_TAG
39 ; CHECK: DW_AT_alignment{{.*}}64
40
41 ; CHECK: DW_TAG_variable
42 ; CHECK-NOT: DW_TAG
43 ; CHECK: DW_AT_name{{.*}}"s"
44 ; CHECK-NOT: DW_TAG
45 ; CHECK: DW_AT_alignment{{.*}}2048
46
47 ; CHECK: DW_TAG_structure_type
48 ; CHECK: DW_TAG_member
49 ; CHECK: DW_AT_name{{.*}}"xx"
50 ; CHECK-NOT: DW_TAG
51 ; CHECK: DW_AT_alignment{{.*}}128
52
53 ; CHECK: DW_TAG_enumeration_type
54 ; CHECK-NOT: DW_TAG
55 ; CHECK: DW_AT_alignment{{.*}}16
56
57 ; CHECK: DW_TAG_variable
58 ; CHECK: DW_AT_name{{.*}}"i"
59 ; CHECK-NOT: DW_TAG
60 ; CHECK: DW_AT_alignment{{.*}}32
61 ; CHECK: DW_TAG_class_type
62 ; CHECK: DW_TAG_member
63 ; CHECK-NOT: DW_TAG
64 ; CHECK: DW_AT_name{{.*}}"i"
65 ; CHECK-NOT: DW_TAG
66 ; CHECK: DW_AT_alignment{{.*}}32
67
68 ; CHECK: DW_TAG_class_type
69 ; CHECK-NOT: DW_TAG
70 ; CHECK: DW_AT_name{{.*}}"C1"
71 ; CHECK: DW_TAG_member
72 ; CHECK-NOT: DW_TAG
73 ; CHECK: DW_AT_name{{.*}}"p"
74 ; CHECK-NOT: DW_TAG
75 ; CHECK: DW_AT_alignment{{.*}}64
76
77 ; ModuleID = 'test.cpp'
78 source_filename = "test.cpp"
79 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
80 target triple = "x86_64-unknown-linux-gnu"
81
82 %class.C0 = type { [64 x i8] }
83 %struct.S = type { i8, [127 x i8], i8, [127 x i8] }
84 %class.C1 = type { i8 }
85 %class.anon = type { i32 }
86
87 @c0 = global %class.C0 zeroinitializer, align 64, !dbg !0
88 @s = global %struct.S zeroinitializer, align 2048, !dbg !11
89
90 ; Function Attrs: nounwind uwtable
91 define void @_Z3foov() #0 !dbg !22 {
92 entry:
93 %ss = alloca %struct.S, align 128
94 %e = alloca i32, align 16
95 %c1 = alloca %class.C1, align 1
96 %i = alloca i32, align 32
97 %Lambda = alloca %class.anon, align 4
98 call void @llvm.dbg.declare(metadata %struct.S* %ss, metadata !25, metadata !26), !dbg !27
99 call void @llvm.dbg.declare(metadata i32* %e, metadata !28, metadata !26), !dbg !29
100 call void @llvm.dbg.declare(metadata %class.C1* %c1, metadata !30, metadata !26), !dbg !35
101 call void @llvm.dbg.declare(metadata i32* %i, metadata !36, metadata !26), !dbg !38
102 store i32 42, i32* %i, align 32, !dbg !38
103 call void @llvm.dbg.declare(metadata %class.anon* %Lambda, metadata !39, metadata !26), !dbg !48
104 %0 = getelementptr inbounds %class.anon, %class.anon* %Lambda, i32 0, i32 0, !dbg !49
105 %1 = load i32, i32* %i, align 32, !dbg !50
106 store i32 %1, i32* %0, align 4, !dbg !49
107 ret void, !dbg !51
108 }
109
110 ; Function Attrs: nounwind readnone
111 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
112
113 attributes #0 = { nounwind uwtable }
114 attributes #1 = { nounwind readnone }
115
116 !llvm.dbg.cu = !{!1}
117 !llvm.module.flags = !{!19, !20}
118 !llvm.ident = !{!21}
119
120 !0 = distinct !DIGlobalVariable(name: "c0", scope: !1, file: !5, line: 19, type: !17, isLocal: false, isDefinition: true)
121 !1 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !2, producer: "clang version 4.0.0 (http://llvm.org/git/clang.git 9ce5220b821054019059c2ac4a9b132c7723832d) (http://llvm.org/git/llvm.git 9a6298be89ce0359b151c0a37af2776a12c69e85)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !3, globals: !10)
122 !2 = !DIFile(filename: "test.cpp", directory: "/tmp")
123 !3 = !{!4}
124 !4 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "E", file: !5, line: 13, size: 32, align: 128, elements: !6, identifier: "_ZTS1E")
125 !5 = !DIFile(filename: "./test.cpp", directory: "/tmp")
126 !6 = !{!7, !8, !9}
127 !7 = !DIEnumerator(name: "A", value: 0)
128 !8 = !DIEnumerator(name: "B", value: 1)
129 !9 = !DIEnumerator(name: "C", value: 2)
130 !10 = !{!0, !11}
131 !11 = distinct !DIGlobalVariable(name: "s", scope: !1, file: !5, line: 21, type: !12, isLocal: false, isDefinition: true, align: 16384)
132 !12 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S", file: !5, line: 1, size: 2048, elements: !13, identifier: "_ZTS1S")
133 !13 = !{!14, !16}
134 !14 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !12, file: !5, line: 2, baseType: !15, size: 8)
135 !15 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
136 !16 = !DIDerivedType(tag: DW_TAG_member, name: "xx", scope: !12, file: !5, line: 3, baseType: !15, size: 8, align: 1024, offset: 1024)
137 !17 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "C0", file: !5, line: 6, size: 512, align: 512, elements: !18, identifier: "_ZTS2C0")
138 !18 = !{}
139 !19 = !{i32 2, !"Dwarf Version", i32 4}
140 !20 = !{i32 2, !"Debug Info Version", i32 3}
141 !21 = !{!"clang version 4.0.0 (http://llvm.org/git/clang.git 9ce5220b821054019059c2ac4a9b132c7723832d) (http://llvm.org/git/llvm.git 9a6298be89ce0359b151c0a37af2776a12c69e85)"}
142 !22 = distinct !DISubprogram(name: "foo", linkageName: "_Z3foov", scope: !5, file: !5, line: 23, type: !23, isLocal: false, isDefinition: true, scopeLine: 24, flags: DIFlagPrototyped, isOptimized: false, unit: !1, variables: !18)
143 !23 = !DISubroutineType(types: !24)
144 !24 = !{null}
145 !25 = !DILocalVariable(name: "ss", scope: !22, file: !5, line: 25, type: !12)
146 !26 = !DIExpression()
147 !27 = !DILocation(line: 25, column: 7, scope: !22)
148 !28 = !DILocalVariable(name: "e", scope: !22, file: !5, line: 26, type: !4)
149 !29 = !DILocation(line: 26, column: 7, scope: !22)
150 !30 = !DILocalVariable(name: "c1", scope: !22, file: !5, line: 27, type: !31)
151 !31 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "C1", file: !5, line: 9, size: 8, elements: !32, identifier: "_ZTS2C1")
152 !32 = !{!33}
153 !33 = !DIDerivedType(tag: DW_TAG_member, name: "p", scope: !31, file: !5, line: 10, baseType: !34, align: 512, flags: DIFlagStaticMember)
154 !34 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64)
155 !35 = !DILocation(line: 27, column: 8, scope: !22)
156 !36 = !DILocalVariable(name: "i", scope: !22, file: !5, line: 28, type: !37, align: 256)
157 !37 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
158 !38 = !DILocation(line: 28, column: 21, scope: !22)
159 !39 = !DILocalVariable(name: "Lambda", scope: !22, file: !5, line: 29, type: !40)
160 !40 = distinct !DICompositeType(tag: DW_TAG_class_type, scope: !22, file: !5, line: 29, size: 32, elements: !41)
161 !41 = !{!42, !43}
162 !42 = !DIDerivedType(tag: DW_TAG_member, name: "i", scope: !40, file: !5, line: 29, baseType: !37, size: 32, align: 256)
163 !43 = !DISubprogram(name: "operator()", scope: !40, file: !5, line: 29, type: !44, isLocal: false, isDefinition: false, scopeLine: 29, flags: DIFlagPublic | DIFlagPrototyped, isOptimized: false)
164 !44 = !DISubroutineType(types: !45)
165 !45 = !{null, !46}
166 !46 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !47, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
167 !47 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !40)
168 !48 = !DILocation(line: 29, column: 10, scope: !22)
169 !49 = !DILocation(line: 29, column: 19, scope: !22)
170 !50 = !DILocation(line: 29, column: 20, scope: !22)
171 !51 = !DILocation(line: 30, column: 1, scope: !22)
+0
-98
test/DebugInfo/X86/align_objc.ll less more
None ; RUN: %llc_dwarf -filetype=obj < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s
1 ; REQUIRES: object-emission
2
3 ; typedef struct __attribute__((aligned (128))) {
4 ; char c;
5 ; } S0;
6 ;
7 ; typedef struct {
8 ; __attribute__((aligned (64))) char c;
9 ; } S1;
10 ;
11 ; S0 s0;
12 ;
13 ; void f() {
14 ; S1 s1;
15 ; __attribute__((aligned (32))) int i;
16 ; }
17
18 ; CHECK: DW_TAG_typedef
19 ; CHECK-NOT: DW_TAG
20 ; CHECK: DW_AT_name{{.*}}"S0"
21 ; CHECK: DW_TAG_structure_type
22 ; CHECK-NOT: DW_TAG
23 ; CHECK: DW_AT_alignment{{.*}}128
24
25 ; CHECK: DW_TAG_variable
26 ; CHECK: DW_AT_name{{.*}}"i"
27 ; CHECK-NOT: DW_TAG
28 ; CHECK: DW_AT_alignment{{.*}}32
29
30 ; CHECK: DW_TAG_typedef
31 ; CHECK-NOT: DW_TAG
32 ; CHECK: DW_AT_name{{.*}}"S1"
33 ; CHECK: DW_TAG_structure_type
34 ; CHECK: DW_TAG_member
35 ; CHECK-NOT: DW_TAG
36 ; CHECK: DW_AT_name{{.*}}"c"
37 ; CHECK-NOT: DW_TAG
38 ; CHECK: DW_AT_alignment{{.*}}64
39
40 ; ModuleID = 'test.m'
41 source_filename = "test.m"
42 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
43 target triple = "x86_64-unknown-linux-gnu"
44
45 %struct.S0 = type { i8, [127 x i8] }
46 %struct.S1 = type { i8, [63 x i8] }
47
48 @s0 = common global %struct.S0 zeroinitializer, align 128, !dbg !0
49
50 ; Function Attrs: nounwind uwtable
51 define void @f() #0 !dbg !14 {
52 entry:
53 %s1 = alloca %struct.S1, align 64
54 %i = alloca i32, align 32
55 call void @llvm.dbg.declare(metadata %struct.S1* %s1, metadata !17, metadata !22), !dbg !23
56 call void @llvm.dbg.declare(metadata i32* %i, metadata !24, metadata !22), !dbg !26
57 ret void, !dbg !27
58 }
59
60 ; Function Attrs: nounwind readnone
61 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
62
63 attributes #0 = { nounwind uwtable }
64 attributes #1 = { nounwind readnone }
65
66 !llvm.dbg.cu = !{!1}
67 !llvm.module.flags = !{!11, !12}
68 !llvm.ident = !{!13}
69
70 !0 = distinct !DIGlobalVariable(name: "s0", scope: !1, file: !5, line: 10, type: !6, isLocal: false, isDefinition: true)
71 !1 = distinct !DICompileUnit(language: DW_LANG_ObjC, file: !2, producer: "clang version 4.0.0 (http://llvm.org/git/clang.git 9ce5220b821054019059c2ac4a9b132c7723832d) (http://llvm.org/git/llvm.git 9a6298be89ce0359b151c0a37af2776a12c69e85)", isOptimized: false, runtimeVersion: 1, emissionKind: FullDebug, enums: !3, globals: !4)
72 !2 = !DIFile(filename: "test.m", directory: "/tmp")
73 !3 = !{}
74 !4 = !{!0}
75 !5 = !DIFile(filename: "test.m", directory: "/tmp")
76 !6 = !DIDerivedType(tag: DW_TAG_typedef, name: "S0", file: !5, line: 3, baseType: !7)
77 !7 = distinct !DICompositeType(tag: DW_TAG_structure_type, file: !5, line: 1, size: 1024, align: 1024, elements: !8)
78 !8 = !{!9}
79 !9 = !DIDerivedType(tag: DW_TAG_member, name: "c", scope: !7, file: !5, line: 2, baseType: !10, size: 8)
80 !10 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
81 !11 = !{i32 2, !"Dwarf Version", i32 4}
82 !12 = !{i32 2, !"Debug Info Version", i32 3}
83 !13 = !{!"clang version 4.0.0 (http://llvm.org/git/clang.git 9ce5220b821054019059c2ac4a9b132c7723832d) (http://llvm.org/git/llvm.git 9a6298be89ce0359b151c0a37af2776a12c69e85)"}
84 !14 = distinct !DISubprogram(name: "f", scope: !5, file: !5, line: 12, type: !15, isLocal: false, isDefinition: true, scopeLine: 12, isOptimized: false, unit: !1, variables: !3)
85 !15 = !DISubroutineType(types: !16)
86 !16 = !{null}
87 !17 = !DILocalVariable(name: "s1", scope: !14, file: !5, line: 13, type: !18)
88 !18 = !DIDerivedType(tag: DW_TAG_typedef, name: "S1", file: !5, line: 8, baseType: !19)
89 !19 = distinct !DICompositeType(tag: DW_TAG_structure_type, file: !5, line: 6, size: 512, elements: !20)
90 !20 = !{!21}
91 !21 = !DIDerivedType(tag: DW_TAG_member, name: "c", scope: !19, file: !5, line: 7, baseType: !10, size: 8, align: 512)
92 !22 = !DIExpression()
93 !23 = !DILocation(line: 13, column: 6, scope: !14)
94 !24 = !DILocalVariable(name: "i", scope: !14, file: !5, line: 14, type: !25, align: 256)
95 !25 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
96 !26 = !DILocation(line: 14, column: 37, scope: !14)
97 !27 = !DILocation(line: 15, column: 1, scope: !14)
101101 !4 = !DIFile(filename: "dwarf-public-names.cpp", directory: "/usr2/kparzysz/s.hex/t")
102102 !5 = !DISubroutineType(types: !6)
103103 !6 = !{null, !7}
104 !7 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !8)
105 !8 = !DICompositeType(tag: DW_TAG_structure_type, name: "C", line: 1, size: 8, file: !37, elements: !9)
104 !7 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !8)
105 !8 = !DICompositeType(tag: DW_TAG_structure_type, name: "C", line: 1, size: 8, align: 8, file: !37, elements: !9)
106106 !9 = !{!10, !12, !14}
107107 !10 = !DIDerivedType(tag: DW_TAG_member, name: "static_member_variable", line: 4, flags: DIFlagStaticMember, file: !37, scope: !8, baseType: !11)
108 !11 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, encoding: DW_ATE_signed)
108 !11 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
109109 !12 = !DISubprogram(name: "member_function", linkageName: "_ZN1C15member_functionEv", line: 2, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !4, scope: !8, type: !5, variables: !13)
110110 !13 = !{} ; previously: invalid DW_TAG_base_type
111111 !14 = !DISubprogram(name: "static_member_function", linkageName: "_ZN1C22static_member_functionEv", line: 3, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 3, file: !4, scope: !8, type: !15, variables: !17)
123123 !26 = !DIGlobalVariable(name: "global_variable", line: 17, isLocal: false, isDefinition: true, scope: null, file: !4, type: !8)
124124 !27 = !DIGlobalVariable(name: "global_namespace_variable", linkageName: "_ZN2ns25global_namespace_variableE", line: 27, isLocal: false, isDefinition: true, scope: !21, file: !4, type: !11)
125125 !28 = !DILocalVariable(name: "this", line: 9, arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !3, file: !4, type: !29)
126 !29 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, baseType: !8)
126 !29 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !8)
127127 !30 = !DILocation(line: 9, scope: !3)
128128 !31 = !DILocation(line: 10, scope: !3)
129129 !32 = !DILocation(line: 11, scope: !3)