1 Pull in r198389 from upstream llvm trunk (by David Blaikie):
3 Revert "Reverting r193835 due to weirdness with Go..."
5 The cgo problem was that it wants dwarf2 which doesn't support direct
6 constant encoding of the location. So let's add support for dwarf2
7 encoding (using a location expression) of data member locations.
9 This reverts commit r198385.
11 Introduced here: http://svnweb.freebsd.org/changeset/base/261991
13 Index: lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
14 ===================================================================
15 --- lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
16 +++ lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
17 @@ -1890,10 +1890,14 @@ void CompileUnit::constructMemberDIE(DIE &Buffer,
18 // This is not a bitfield.
19 OffsetInBytes = DT.getOffsetInBits() >> 3;
21 - DIEBlock *MemLocationDie = new (DIEValueAllocator) DIEBlock();
22 - addUInt(MemLocationDie, dwarf::DW_FORM_data1, dwarf::DW_OP_plus_uconst);
23 - addUInt(MemLocationDie, dwarf::DW_FORM_udata, OffsetInBytes);
24 - addBlock(MemberDie, dwarf::DW_AT_data_member_location, MemLocationDie);
25 + if (DD->getDwarfVersion() <= 2) {
26 + DIEBlock *MemLocationDie = new (DIEValueAllocator) DIEBlock();
27 + addUInt(MemLocationDie, dwarf::DW_FORM_data1, dwarf::DW_OP_plus_uconst);
28 + addUInt(MemLocationDie, dwarf::DW_FORM_udata, OffsetInBytes);
29 + addBlock(MemberDie, dwarf::DW_AT_data_member_location, MemLocationDie);
31 + addUInt(MemberDie, dwarf::DW_AT_data_member_location, None,
36 Index: test/DebugInfo/X86/data_member_location.ll
37 ===================================================================
38 --- test/DebugInfo/X86/data_member_location.ll
39 +++ test/DebugInfo/X86/data_member_location.ll
41 ; RUN: llc -mtriple=x86_64-linux -O0 -o - -filetype=obj < %s | llvm-dwarfdump -debug-dump=info -| FileCheck %s
42 +; RUN: llc -mtriple=x86_64-linux -dwarf-version=2 -O0 -o - -filetype=obj < %s | llvm-dwarfdump -debug-dump=info -| FileCheck -check-prefix=DWARF2 %s
44 ; Generated from Clang with the following source:
48 ; CHECK: DW_AT_name {{.*}} "c"
50 -; CHECK: DW_AT_data_member_location {{.*}} (<0x02> 23 00 )
51 +; CHECK: DW_AT_data_member_location {{.*}} (0x00)
53 ; CHECK: DW_AT_name {{.*}} "i"
55 -; CHECK: DW_AT_data_member_location {{.*}} (<0x02> 23 04 )
56 +; CHECK: DW_AT_data_member_location {{.*}} (0x04)
58 +; DWARF2: DW_AT_name {{.*}} "c"
60 +; DWARF2: DW_AT_data_member_location {{.*}} (<0x02> 23 00 )
62 +; DWARF2: DW_AT_name {{.*}} "i"
64 +; DWARF2: DW_AT_data_member_location {{.*}} (<0x02> 23 04 )
66 %struct.foo = type { i8, i32 }
68 @f = global %struct.foo zeroinitializer, align 4
69 Index: test/DebugInfo/X86/concrete_out_of_line.ll
70 ===================================================================
71 --- test/DebugInfo/X86/concrete_out_of_line.ll
72 +++ test/DebugInfo/X86/concrete_out_of_line.ll
74 ; first check that we have a TAG_subprogram at a given offset and it has
77 -; CHECK: 0x0000011e: DW_TAG_subprogram [17]
78 +; CHECK: 0x0000011c: DW_TAG_subprogram [17]
79 ; CHECK-NEXT: DW_AT_specification
80 ; CHECK-NEXT: DW_AT_inline
84 ; and then that a TAG_subprogram refers to it with AT_abstract_origin.
86 -; CHECK: 0x0000015f: DW_TAG_subprogram [19]
87 -; CHECK-NEXT: DW_AT_abstract_origin [DW_FORM_ref4] (cu + 0x011e => {0x0000011e})
88 +; CHECK: 0x0000015d: DW_TAG_subprogram [19]
89 +; CHECK-NEXT: DW_AT_abstract_origin [DW_FORM_ref4] (cu + 0x011c => {0x0000011c})
91 define i32 @_ZN17nsAutoRefCnt7ReleaseEv() {
93 Index: test/DebugInfo/X86/generate-odr-hash.ll
94 ===================================================================
95 --- test/DebugInfo/X86/generate-odr-hash.ll
96 +++ test/DebugInfo/X86/generate-odr-hash.ll
98 ; REQUIRES: object-emission
100 -; Fail while investigating problem with non-block representations of member offsets.
103 ; RUN: llc %s -o %t -filetype=obj -O0 -generate-odr-hash -mtriple=x86_64-unknown-linux-gnu
104 ; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s