llvm.org GIT mirror llvm / fd1cd57
Revert "Add some support for dealing with an object pointer on arguments." This should be done on the subprogram, not the variable itself. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163734 91177308-0d34-0410-b5e6-96231b3b80d8 Eric Christopher 7 years ago
7 changed file(s) with 1 addition(s) and 130 deletion(s). Raw diff Collapse all Expand all
345345
346346 /// createArtificialType - Create a new DIType with "artificial" flag set.
347347 DIType createArtificialType(DIType Ty);
348
349 /// createObjectPointerType - Create a new DIType with the "object pointer"
350 /// flag set.
351 DIType createObjectPointerType(DIType Ty);
352348
353349 /// createTemporaryType - Create a temporary forward-declared type.
354350 DIType createTemporaryType();
5959 FlagArtificial = 1 << 6,
6060 FlagExplicit = 1 << 7,
6161 FlagPrototyped = 1 << 8,
62 FlagObjcClassComplete = 1 << 9,
63 FlagObjectPointer = 1 << 10
62 FlagObjcClassComplete = 1 << 9
6463 };
6564 protected:
6665 const MDNode *DbgNode;
287286 bool isArtificial() const {
288287 return (getFlags() & FlagArtificial) != 0;
289288 }
290 bool isObjectPointer() const {
291 return (getFlags() & FlagObjectPointer) != 0;
292 }
293289 bool isObjcClassComplete() const {
294290 return (getFlags() & FlagObjcClassComplete) != 0;
295291 }
647643 return (getUnsignedField(6) & FlagArtificial) != 0;
648644 }
649645
650 bool isObjectPointer() const {
651 return (getUnsignedField(6) & FlagObjectPointer) != 0;
652 }
653
654646 /// getInlinedAt - If this variable is inlined then return inline location.
655647 MDNode *getInlinedAt() const;
656648
11081108 addType(Arg, ATy);
11091109 if (ATy.isArtificial())
11101110 addFlag(Arg, dwarf::DW_AT_artificial);
1111 if (ATy.isObjectPointer())
1112 addFlag(Arg, dwarf::DW_AT_object_pointer);
11131111 SPDie->addChild(Arg);
11141112 }
11151113 }
13491347
13501348 if (DV->isArtificial())
13511349 addFlag(VariableDie, dwarf::DW_AT_artificial);
1352 if (DV->isObjectPointer())
1353 addFlag(VariableDie, dwarf::DW_AT_object_pointer);
13541350
13551351 if (isScopeAbstract) {
13561352 DV->setDIE(VariableDie);
329329 SPCU->addType(Arg, ATy);
330330 if (ATy.isArtificial())
331331 SPCU->addFlag(Arg, dwarf::DW_AT_artificial);
332 if (ATy.isObjectPointer())
333 SPCU->addFlag(Arg, dwarf::DW_AT_object_pointer);
334332 SPDie->addChild(Arg);
335333 }
336334 DIE *SPDeclDie = SPDie;
163163 return true;
164164 return false;
165165 }
166
167 bool isObjectPointer() const {
168 if (Var.isObjectPointer())
169 return true;
170 if (Var.getTag() == dwarf::DW_TAG_arg_variable
171 && getType().isObjectPointer())
172 return true;
173 return false;
174 }
175
176166 bool variableHasComplexAddress() const {
177167 assert(Var.Verify() && "Invalid complex DbgVariable!");
178168 return Var.hasComplexAddress();
635635
636636 // Flags are stored at this slot.
637637 Elts[8] = ConstantInt::get(Type::getInt32Ty(VMContext), CurFlags);
638
639 return DIType(MDNode::get(VMContext, Elts));
640 }
641
642 /// createArtificialType - Create a new DIType with "artificial" flag set.
643 DIType DIBuilder::createObjectPointerType(DIType Ty) {
644 if (Ty.isObjectPointer())
645 return Ty;
646
647 SmallVector Elts;
648 MDNode *N = Ty;
649 assert (N && "Unexpected input DIType!");
650 for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) {
651 if (Value *V = N->getOperand(i))
652 Elts.push_back(V);
653 else
654 Elts.push_back(Constant::getNullValue(Type::getInt32Ty(VMContext)));
655 }
656
657 unsigned CurFlags = Ty.getFlags();
658 CurFlags = CurFlags | (DIType::FlagObjectPointer | DIType::FlagArtificial);
659
660 // Flags are stored at this slot.
661 Elts[8] = ConstantInt::get(Type::getInt32Ty(VMContext), CurFlags);
662638
663639 return DIType(MDNode::get(VMContext, Elts));
664640 }
+0
-77
test/DebugInfo/X86/DW_AT_object_pointer.ll less more
None ; RUN: llc -mtriple=x86_64-apple-darwin %s -o %t -filetype=obj
1 ; RUN: llvm-dwarfdump %t | FileCheck %s
2
3 ; CHECK: DW_AT_object_pointer [DW_FORM_flag] (0x01)
4
5 %class.A = type { i32 }
6
7 define i32 @_Z3foov() nounwind uwtable ssp {
8 entry:
9 %a = alloca %class.A, align 4
10 call void @llvm.dbg.declare(metadata !{%class.A* %a}, metadata !21), !dbg !23
11 call void @_ZN1AC1Ev(%class.A* %a), !dbg !24
12 %m_a = getelementptr inbounds %class.A* %a, i32 0, i32 0, !dbg !25
13 %0 = load i32* %m_a, align 4, !dbg !25
14 ret i32 %0, !dbg !25
15 }
16
17 declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
18
19 define linkonce_odr void @_ZN1AC1Ev(%class.A* %this) unnamed_addr nounwind uwtable ssp align 2 {
20 entry:
21 %this.addr = alloca %class.A*, align 8
22 store %class.A* %this, %class.A** %this.addr, align 8
23 call void @llvm.dbg.declare(metadata !{%class.A** %this.addr}, metadata !26), !dbg !28
24 %this1 = load %class.A** %this.addr
25 call void @_ZN1AC2Ev(%class.A* %this1), !dbg !29
26 ret void, !dbg !29
27 }
28
29 define linkonce_odr void @_ZN1AC2Ev(%class.A* %this) unnamed_addr nounwind uwtable ssp align 2 {
30 entry:
31 %this.addr = alloca %class.A*, align 8
32 store %class.A* %this, %class.A** %this.addr, align 8
33 call void @llvm.dbg.declare(metadata !{%class.A** %this.addr}, metadata !30), !dbg !31
34 %this1 = load %class.A** %this.addr
35 %m_a = getelementptr inbounds %class.A* %this1, i32 0, i32 0, !dbg !32
36 store i32 0, i32* %m_a, align 4, !dbg !32
37 ret void, !dbg !34
38 }
39
40 !llvm.dbg.cu = !{!0}
41
42 !0 = metadata !{i32 786449, i32 0, i32 4, metadata !"bar.cpp", metadata !"/Users/echristo/debug-tests", metadata !"clang version 3.2 (trunk 163586) (llvm/trunk 163570)", i1 true, i1 false, metadata !"", i32 0, metadata !1, metadata !1, metadata !3, metadata !1} ; [ DW_TAG_compile_unit ] [/Users/echristo/debug-tests/bar.cpp] [DW_LANG_C_plus_plus]
43 !1 = metadata !{metadata !2}
44 !2 = metadata !{i32 0}
45 !3 = metadata !{metadata !4}
46 !4 = metadata !{metadata !5, metadata !10, metadata !20}
47 !5 = metadata !{i32 786478, i32 0, metadata !6, metadata !"foo", metadata !"foo", metadata !"_Z3foov", metadata !6, i32 7, metadata !7, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, i32 ()* @_Z3foov, null, null, metadata !1, i32 7} ; [ DW_TAG_subprogram ] [line 7] [def] [foo]
48 !6 = metadata !{i32 786473, metadata !"bar.cpp", metadata !"/Users/echristo/debug-tests", null} ; [ DW_TAG_file_type ]
49 !7 = metadata !{i32 786453, i32 0, metadata !"", i32 0, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !8, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
50 !8 = metadata !{metadata !9}
51 !9 = metadata !{i32 786468, null, metadata !"int", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
52 !10 = metadata !{i32 786478, i32 0, null, metadata !"A", metadata !"A", metadata !"_ZN1AC1Ev", metadata !6, i32 3, metadata !11, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, void (%class.A*)* @_ZN1AC1Ev, null, metadata !17, metadata !1, i32 3} ; [ DW_TAG_subprogram ] [line 3] [def] [A]
53 !11 = metadata !{i32 786453, i32 0, metadata !"", i32 0, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !12, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
54 !12 = metadata !{null, metadata !13}
55 !13 = metadata !{i32 786447, i32 0, metadata !"", i32 0, i32 0, i64 64, i64 64, i64 0, i32 1088, metadata !14} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from A]
56 !14 = metadata !{i32 786434, null, metadata !"A", metadata !6, i32 1, i64 32, i64 32, i32 0, i32 0, null, metadata !15, i32 0, null, null} ; [ DW_TAG_class_type ] [A] [line 1, size 32, align 32, offset 0] [from ]
57 !15 = metadata !{metadata !16, metadata !17}
58 !16 = metadata !{i32 786445, metadata !14, metadata !"m_a", metadata !6, i32 4, i64 32, i64 32, i64 0, i32 0, metadata !9} ; [ DW_TAG_member ] [m_a] [line 4, size 32, align 32, offset 0] [from int]
59 !17 = metadata !{i32 786478, i32 0, metadata !14, metadata !"A", metadata !"A", metadata !"", metadata !6, i32 3, metadata !11, i1 false, i1 false, i32 0, i32 0, null, i32 256, i1 false, null, null, i32 0, metadata !18, i32 3} ; [ DW_TAG_subprogram ] [line 3] [A]
60 !18 = metadata !{metadata !19}
61 !19 = metadata !{i32 786468} ; [ DW_TAG_base_type ] [line 0, size 0, align 0, offset 0]
62 !20 = metadata !{i32 786478, i32 0, null, metadata !"A", metadata !"A", metadata !"_ZN1AC2Ev", metadata !6, i32 3, metadata !11, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, void (%class.A*)* @_ZN1AC2Ev, null, metadata !17, metadata !1, i32 3} ; [ DW_TAG_subprogram ] [line 3] [def] [A]
63 !21 = metadata !{i32 786688, metadata !22, metadata !"a", metadata !6, i32 8, metadata !14, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [a] [line 8]
64 !22 = metadata !{i32 786443, metadata !5, i32 7, i32 11, metadata !6, i32 0} ; [ DW_TAG_lexical_block ] [/Users/echristo/debug-tests/bar.cpp]
65 !23 = metadata !{i32 8, i32 5, metadata !22, null}
66 !24 = metadata !{i32 8, i32 6, metadata !22, null}
67 !25 = metadata !{i32 9, i32 3, metadata !22, null}
68 !26 = metadata !{i32 786689, metadata !10, metadata !"this", metadata !6, i32 16777219, metadata !27, i32 1088, i32 0} ; [ DW_TAG_arg_variable ] [this] [line 3]
69 !27 = metadata !{i32 786447, null, metadata !"", null, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !14} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from A]
70 !28 = metadata !{i32 3, i32 3, metadata !10, null}
71 !29 = metadata !{i32 3, i32 18, metadata !10, null}
72 !30 = metadata !{i32 786689, metadata !20, metadata !"this", metadata !6, i32 16777219, metadata !27, i32 1088, i32 0} ; [ DW_TAG_arg_variable ] [this] [line 3]
73 !31 = metadata !{i32 3, i32 3, metadata !20, null}
74 !32 = metadata !{i32 3, i32 9, metadata !33, null}
75 !33 = metadata !{i32 786443, metadata !20, i32 3, i32 7, metadata !6, i32 1} ; [ DW_TAG_lexical_block ] [/Users/echristo/debug-tests/bar.cpp]
76 !34 = metadata !{i32 3, i32 18, metadata !33, null}