llvm.org GIT mirror llvm / c664d76
Debug Info: In DIBuilder, the derived-from field of a DW_TAG_pointer_type is updated to use DITypeRef. Move isUnsignedDIType and getOriginalTypeSize from DebugInfo.h to be static helper functions in DwarfCompileUnit. We already have a static helper function "isTypeSigned" in DwarfCompileUnit, and a pointer to DwarfDebug is added to resolve the derived-from field. All three functions need to go across link for derived-from fields, so we need to get hold of a type identifier map. A pointer to DwarfDebug is also added to DbgVariable in order to resolve the derived-from field. Debug info verifier is updated to check a derived-from field is a TypeRef. Verifier will not go across link for derived-from fields, in debug info finder, we go across the link to add derived-from fields to types. Function getDICompositeType is only used by dragonegg and since dragonegg does not generate identifier for types, we use an empty map to resolve the derived-from field. When printing a derived-from field, we use DITypeRef::getName to either return the type identifier or getName of the DIType. A paired commit at clang is required due to changes to DIBuilder. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192018 91177308-0d34-0410-b5e6-96231b3b80d8 Manman Ren 6 years ago
10 changed file(s) with 271 addition(s) and 96 deletion(s). Raw diff Collapse all Expand all
2121 #include "llvm/ADT/SmallPtrSet.h"
2222 #include "llvm/ADT/SmallVector.h"
2323 #include "llvm/ADT/StringRef.h"
24 #include "llvm/IR/Metadata.h"
2425 #include "llvm/Support/Dwarf.h"
2526
2627 namespace llvm {
203204 /// Gets the parent scope for this scope node or returns a
204205 /// default constructed scope.
205206 DIScopeRef getContext() const;
207 /// If the scope node has a name, return that, else return an empty string.
208 StringRef getName() const;
206209 StringRef getFilename() const;
207210 StringRef getDirectory() const;
208211
226229
227230 public:
228231 T resolve(const DITypeIdentifierMap &Map) const;
232 StringRef getName() const {
233 if (!Val)
234 return StringRef();
235
236 if (const MDNode *MD = dyn_cast(Val))
237 return T(MD).getName();
238
239 const MDString *MS = cast(Val);
240 return MS->getString();
241 }
229242 operator Value *() const { return const_cast(Val); }
230243 };
231244
299312 bool isStaticMember() const { return (getFlags() & FlagStaticMember) != 0; }
300313 bool isValid() const { return DbgNode && isType(); }
301314
302 /// isUnsignedDIType - Return true if type encoding is unsigned.
303 bool isUnsignedDIType();
304
305315 /// replaceAllUsesWith - Replace all uses of debug info referenced by
306316 /// this descriptor.
307317 void replaceAllUsesWith(DIDescriptor &D);
329339 public:
330340 explicit DIDerivedType(const MDNode *N = 0) : DIType(N) {}
331341
332 DIType getTypeDerivedFrom() const { return getFieldAs(9); }
333
334 /// getOriginalTypeSize - If this type is derived from a base type then
335 /// return base type size.
336 uint64_t getOriginalTypeSize() const;
342 DITypeRef getTypeDerivedFrom() const { return getFieldAs(9); }
337343
338344 /// getObjCProperty - Return property node, if this ivar is
339345 /// associated with one.
519519
520520 if (Tag == dwarf::DW_TAG_pointer_type) {
521521 DIDerivedType DTy = DIDerivedType(Ty);
522 TmpTy = DTy.getTypeDerivedFrom();
522 TmpTy = DD->resolve(DTy.getTypeDerivedFrom());
523523 isPointer = true;
524524 }
525525
586586 }
587587
588588 /// isTypeSigned - Return true if the type is signed.
589 static bool isTypeSigned(DIType Ty, int *SizeInBits) {
589 static bool isTypeSigned(DwarfDebug *DD, DIType Ty, int *SizeInBits) {
590590 if (Ty.isDerivedType())
591 return isTypeSigned(DIDerivedType(Ty).getTypeDerivedFrom(), SizeInBits);
591 return isTypeSigned(DD, DD->resolve(DIDerivedType(Ty).getTypeDerivedFrom()),
592 SizeInBits);
592593 if (Ty.isBasicType())
593594 if (DIBasicType(Ty).getEncoding() == dwarf::DW_ATE_signed
594595 || DIBasicType(Ty).getEncoding() == dwarf::DW_ATE_signed_char) {
596597 return true;
597598 }
598599 return false;
600 }
601
602 /// Return true if type encoding is unsigned.
603 static bool isUnsignedDIType(DwarfDebug *DD, DIType Ty) {
604 DIDerivedType DTy(Ty);
605 if (DTy.isDerivedType())
606 return isUnsignedDIType(DD, DD->resolve(DTy.getTypeDerivedFrom()));
607
608 DIBasicType BTy(Ty);
609 if (BTy.isBasicType()) {
610 unsigned Encoding = BTy.getEncoding();
611 if (Encoding == dwarf::DW_ATE_unsigned ||
612 Encoding == dwarf::DW_ATE_unsigned_char ||
613 Encoding == dwarf::DW_ATE_boolean)
614 return true;
615 }
616 return false;
617 }
618
619 /// If this type is derived from a base type then return base type size.
620 static uint64_t getOriginalTypeSize(DwarfDebug *DD, DIDerivedType Ty) {
621 unsigned Tag = Ty.getTag();
622
623 if (Tag != dwarf::DW_TAG_member && Tag != dwarf::DW_TAG_typedef &&
624 Tag != dwarf::DW_TAG_const_type && Tag != dwarf::DW_TAG_volatile_type &&
625 Tag != dwarf::DW_TAG_restrict_type)
626 return Ty.getSizeInBits();
627
628 DIType BaseType = DD->resolve(Ty.getTypeDerivedFrom());
629
630 // If this type is not derived from any type then take conservative approach.
631 if (!BaseType.isValid())
632 return Ty.getSizeInBits();
633
634 // If this is a derived type, go ahead and get the base type, unless it's a
635 // reference then it's just the size of the field. Pointer types have no need
636 // of this since they're a different type of qualification on the type.
637 if (BaseType.getTag() == dwarf::DW_TAG_reference_type ||
638 BaseType.getTag() == dwarf::DW_TAG_rvalue_reference_type)
639 return Ty.getSizeInBits();
640
641 if (BaseType.isDerivedType())
642 return getOriginalTypeSize(DD, DIDerivedType(BaseType));
643
644 return BaseType.getSizeInBits();
599645 }
600646
601647 /// addConstantValue - Add constant value entry in variable DIE.
606652 // udata/sdata over dataN as suggested by the DWARF spec)
607653 assert(MO.isImm() && "Invalid machine operand!");
608654 int SizeInBits = -1;
609 bool SignedConstant = isTypeSigned(Ty, &SizeInBits);
655 bool SignedConstant = isTypeSigned(DD, Ty, &SizeInBits);
610656 uint16_t Form;
611657
612658 // If we're a signed constant definitely use sdata.
922968 uint16_t Tag = Buffer.getTag();
923969
924970 // Map to main type, void will not have a type.
925 DIType FromTy = DTy.getTypeDerivedFrom();
971 DIType FromTy = DD->resolve(DTy.getTypeDerivedFrom());
926972 if (FromTy)
927973 addType(&Buffer, FromTy);
928974
9971043 Buffer.addChild(ElemDie);
9981044 }
9991045 }
1000 DIType DTy = CTy.getTypeDerivedFrom();
1046 DIType DTy = DD->resolve(CTy.getTypeDerivedFrom());
10011047 if (DTy) {
10021048 addType(&Buffer, DTy);
10031049 addFlag(&Buffer, dwarf::DW_AT_enum_class);
10631109 DIDerivedType DDTy(Element);
10641110 if (DDTy.getTag() == dwarf::DW_TAG_friend) {
10651111 ElemDie = new DIE(dwarf::DW_TAG_friend);
1066 addType(ElemDie, DDTy.getTypeDerivedFrom(), dwarf::DW_AT_friend);
1112 addType(ElemDie, DD->resolve(DDTy.getTypeDerivedFrom()),
1113 dwarf::DW_AT_friend);
10671114 } else if (DDTy.isStaticMember())
10681115 ElemDie = createStaticMemberDIE(DDTy);
10691116 else
12041251 addString(ParamDIE, dwarf::DW_AT_name, VP.getName());
12051252 if (Value *Val = VP.getValue()) {
12061253 if (ConstantInt *CI = dyn_cast(Val))
1207 addConstantValue(ParamDIE, CI, VP.getType().isUnsignedDIType());
1254 addConstantValue(ParamDIE, CI, isUnsignedDIType(DD, VP.getType()));
12081255 else if (GlobalValue *GV = dyn_cast(Val)) {
12091256 // For declaration non-type template parameters (such as global values and
12101257 // functions)
14981545 // emitting AT_const_value multiple times, we only add AT_const_value when
14991546 // it is not a static member.
15001547 if (!IsStaticMember)
1501 addConstantValue(VariableDIE, CI, GTy.isUnsignedDIType());
1548 addConstantValue(VariableDIE, CI, isUnsignedDIType(DD, GTy));
15021549 } else if (const ConstantExpr *CE = getMergedGlobalExpr(N->getOperand(11))) {
15031550 addToAccelTable = true;
15041551 // GV is a merged global.
15581605 addFlag(&Buffer, dwarf::DW_AT_GNU_vector);
15591606
15601607 // Emit the element type.
1561 addType(&Buffer, CTy->getTypeDerivedFrom());
1608 addType(&Buffer, DD->resolve(CTy->getTypeDerivedFrom()));
15621609
15631610 // Get an anonymous type for index type.
15641611 // FIXME: This type should be passed down from the front end
16621709 addConstantFPValue(VariableDie, DVInsn->getOperand(0));
16631710 else if (DVInsn->getOperand(0).isCImm())
16641711 addConstantValue(VariableDie, DVInsn->getOperand(0).getCImm(),
1665 DV->getType().isUnsignedDIType());
1712 isUnsignedDIType(DD, DV->getType()));
16661713
16671714 DV->setDIE(VariableDie);
16681715 return VariableDie;
16901737 if (!Name.empty())
16911738 addString(MemberDie, dwarf::DW_AT_name, Name);
16921739
1693 addType(MemberDie, DT.getTypeDerivedFrom());
1740 addType(MemberDie, DD->resolve(DT.getTypeDerivedFrom()));
16941741
16951742 addSourceLine(MemberDie, DT);
16961743
16981745 addUInt(MemLocationDie, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_plus_uconst);
16991746
17001747 uint64_t Size = DT.getSizeInBits();
1701 uint64_t FieldSize = DT.getOriginalTypeSize();
1748 uint64_t FieldSize = getOriginalTypeSize(DD, DT);
17021749
17031750 if (Size != FieldSize) {
17041751 // Handle bitfield.
1705 addUInt(MemberDie, dwarf::DW_AT_byte_size, 0, DT.getOriginalTypeSize()>>3);
1752 addUInt(MemberDie, dwarf::DW_AT_byte_size, 0,
1753 getOriginalTypeSize(DD, DT)>>3);
17061754 addUInt(MemberDie, dwarf::DW_AT_bit_size, 0, DT.getSizeInBits());
17071755
17081756 uint64_t Offset = DT.getOffsetInBits();
17771825 return NULL;
17781826
17791827 DIE *StaticMemberDIE = new DIE(DT.getTag());
1780 DIType Ty = DT.getTypeDerivedFrom();
1828 DIType Ty = DD->resolve(DT.getTypeDerivedFrom());
17811829
17821830 addString(StaticMemberDIE, dwarf::DW_AT_name, DT.getName());
17831831 addType(StaticMemberDIE, Ty);
17981846 dwarf::DW_ACCESS_public);
17991847
18001848 if (const ConstantInt *CI = dyn_cast_or_null(DT.getConstant()))
1801 addConstantValue(StaticMemberDIE, CI, Ty.isUnsignedDIType());
1849 addConstantValue(StaticMemberDIE, CI, isUnsignedDIType(DD, Ty));
18021850 if (const ConstantFP *CFP = dyn_cast_or_null(DT.getConstant()))
18031851 addConstantFPValue(StaticMemberDIE, CFP);
18041852
148148 uint16_t tag = Ty.getTag();
149149
150150 if (tag == dwarf::DW_TAG_pointer_type)
151 subType = DIDerivedType(Ty).getTypeDerivedFrom();
151 subType = DD->resolve(DIDerivedType(Ty).getTypeDerivedFrom());
152152
153153 DIArray Elements = DICompositeType(subType).getTypeArray();
154154 for (unsigned i = 0, N = Elements.getNumElements(); i < N; ++i) {
155155 DIDerivedType DT = DIDerivedType(Elements.getElement(i));
156156 if (getName() == DT.getName())
157 return (DT.getTypeDerivedFrom());
157 return (DD->resolve(DT.getTypeDerivedFrom()));
158158 }
159159 }
160160 return Ty;
991991 for (unsigned vi = 0, ve = Variables.getNumElements(); vi != ve; ++vi) {
992992 DIVariable DV(Variables.getElement(vi));
993993 if (!DV.isVariable()) continue;
994 DbgVariable NewVar(DV, NULL);
994 DbgVariable NewVar(DV, NULL, this);
995995 if (DIE *VariableDIE =
996996 SPCU->constructVariableDIE(&NewVar, Scope->isAbstractScope()))
997997 ScopeDIE->addChild(VariableDIE);
12501250 if (!Scope)
12511251 return NULL;
12521252
1253 AbsDbgVariable = new DbgVariable(Var, NULL);
1253 AbsDbgVariable = new DbgVariable(Var, NULL, this);
12541254 addScopeVariable(Scope, AbsDbgVariable);
12551255 AbstractVariables[Var] = AbsDbgVariable;
12561256 return AbsDbgVariable;
12991299 continue;
13001300
13011301 DbgVariable *AbsDbgVariable = findAbstractVariable(DV, VP.second);
1302 DbgVariable *RegVar = new DbgVariable(DV, AbsDbgVariable);
1302 DbgVariable *RegVar = new DbgVariable(DV, AbsDbgVariable, this);
13031303 RegVar->setFrameIndex(VP.first);
13041304 if (!addCurrentFnArgument(MF, RegVar, Scope))
13051305 addScopeVariable(Scope, RegVar);
13841384 Processed.insert(DV);
13851385 assert(MInsn->isDebugValue() && "History must begin with debug value");
13861386 DbgVariable *AbsVar = findAbstractVariable(DV, MInsn->getDebugLoc());
1387 DbgVariable *RegVar = new DbgVariable(DV, AbsVar);
1387 DbgVariable *RegVar = new DbgVariable(DV, AbsVar, this);
13881388 if (!addCurrentFnArgument(MF, RegVar, Scope))
13891389 addScopeVariable(Scope, RegVar);
13901390 if (AbsVar)
14471447 if (!DV || !DV.isVariable() || !Processed.insert(DV))
14481448 continue;
14491449 if (LexicalScope *Scope = LScopes.findLexicalScope(DV.getContext()))
1450 addScopeVariable(Scope, new DbgVariable(DV, NULL));
1450 addScopeVariable(Scope, new DbgVariable(DV, NULL, this));
14511451 }
14521452 }
14531453
18431843 if (AbstractVariables.lookup(CleanDV))
18441844 continue;
18451845 if (LexicalScope *Scope = LScopes.findAbstractScope(DV.getContext()))
1846 addScopeVariable(Scope, new DbgVariable(DV, NULL));
1846 addScopeVariable(Scope, new DbgVariable(DV, NULL, this));
18471847 }
18481848 }
18491849 if (ProcessedSPNodes.count(AScope->getScopeNode()) == 0)
149149 DbgVariable *AbsVar; // Corresponding Abstract variable, if any.
150150 const MachineInstr *MInsn; // DBG_VALUE instruction of the variable.
151151 int FrameIndex;
152 DwarfDebug *DD;
152153 public:
153154 // AbsVar may be NULL.
154 DbgVariable(DIVariable V, DbgVariable *AV)
155 DbgVariable(DIVariable V, DbgVariable *AV, DwarfDebug *DD)
155156 : Var(V), TheDIE(0), DotDebugLocOffset(~0U), AbsVar(AV), MInsn(0),
156 FrameIndex(~0) {}
157 FrameIndex(~0), DD(DD) {}
157158
158159 // Accessors.
159160 DIVariable getVariable() const { return Var; }
302302 ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits),
303303 ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Offset
304304 ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Flags
305 PointeeTy
305 PointeeTy.getRef()
306306 };
307307 return DIDerivedType(MDNode::get(VMContext, Elts));
308308 }
367367 }
368368 }
369369
370 /// isUnsignedDIType - Return true if type encoding is unsigned.
371 bool DIType::isUnsignedDIType() {
372 DIDerivedType DTy(DbgNode);
373 if (DTy.Verify())
374 return DTy.getTypeDerivedFrom().isUnsignedDIType();
375
376 DIBasicType BTy(DbgNode);
377 if (BTy.Verify()) {
378 unsigned Encoding = BTy.getEncoding();
379 if (Encoding == dwarf::DW_ATE_unsigned ||
380 Encoding == dwarf::DW_ATE_unsigned_char ||
381 Encoding == dwarf::DW_ATE_boolean)
382 return true;
383 }
384 return false;
385 }
386
387370 /// Verify - Verify that a compile unit is well formed.
388371 bool DICompileUnit::Verify() const {
389372 if (!isCompileUnit())
492475
493476 /// Verify - Verify that a derived type descriptor is well formed.
494477 bool DIDerivedType::Verify() const {
495 // Make sure DerivedFrom @ field 9 is MDNode.
496 if (!fieldIsMDNode(DbgNode, 9))
478 // Make sure DerivedFrom @ field 9 is TypeRef.
479 if (!fieldIsTypeRef(DbgNode, 9))
497480 return false;
498481 if (getTag() == dwarf::DW_TAG_ptr_to_member_type)
499482 // Make sure ClassType @ field 10 is a TypeRef.
509492 if (!isCompositeType())
510493 return false;
511494
512 // Make sure DerivedFrom @ field 9 and ContainingType @ field 12 are MDNodes.
513 if (!fieldIsMDNode(DbgNode, 9))
495 // Make sure DerivedFrom @ field 9 and ContainingType @ field 12 are TypeRef.
496 if (!fieldIsTypeRef(DbgNode, 9))
514497 return false;
515498 if (!fieldIsTypeRef(DbgNode, 12))
516499 return false;
518501 // Make sure the type identifier at field 14 is MDString, it can be null.
519502 if (!fieldIsMDString(DbgNode, 14))
520503 return false;
521
522 // If this is an array type verify that we have a DIType in the derived type
523 // field as that's the type of our element.
524 if (getTag() == dwarf::DW_TAG_array_type)
525 if (!DIType(getTypeDerivedFrom()))
526 return false;
527504
528505 return DbgNode->getNumOperands() == 15;
529506 }
635612 bool DIImportedEntity::Verify() const {
636613 return isImportedEntity() &&
637614 (DbgNode->getNumOperands() == 4 || DbgNode->getNumOperands() == 5);
638 }
639
640 /// getOriginalTypeSize - If this type is derived from a base type then
641 /// return base type size.
642 uint64_t DIDerivedType::getOriginalTypeSize() const {
643 uint16_t Tag = getTag();
644
645 if (Tag != dwarf::DW_TAG_member && Tag != dwarf::DW_TAG_typedef &&
646 Tag != dwarf::DW_TAG_const_type && Tag != dwarf::DW_TAG_volatile_type &&
647 Tag != dwarf::DW_TAG_restrict_type)
648 return getSizeInBits();
649
650 DIType BaseType = getTypeDerivedFrom();
651
652 // If this type is not derived from any type then take conservative approach.
653 if (!BaseType.isValid())
654 return getSizeInBits();
655
656 // If this is a derived type, go ahead and get the base type, unless it's a
657 // reference then it's just the size of the field. Pointer types have no need
658 // of this since they're a different type of qualification on the type.
659 if (BaseType.getTag() == dwarf::DW_TAG_reference_type ||
660 BaseType.getTag() == dwarf::DW_TAG_rvalue_reference_type)
661 return getSizeInBits();
662
663 if (BaseType.isDerivedType())
664 return DIDerivedType(BaseType).getOriginalTypeSize();
665
666 return BaseType.getSizeInBits();
667615 }
668616
669617 /// getObjCProperty - Return property node, if this ivar is associated with one.
807755 return DIScopeRef(NULL);
808756 }
809757
758 // If the scope node has a name, return that, else return an empty string.
759 StringRef DIScope::getName() const {
760 if (isType())
761 return DIType(DbgNode).getName();
762 if (isSubprogram())
763 return DISubprogram(DbgNode).getName();
764 if (isNameSpace())
765 return DINameSpace(DbgNode).getName();
766 assert((isLexicalBlock() || isLexicalBlockFile() || isFile() ||
767 isCompileUnit()) && "Unhandled type of scope.");
768 return StringRef();
769 }
770
810771 StringRef DIScope::getFilename() const {
811772 if (!DbgNode)
812773 return StringRef();
941902 if (T.isCompositeType())
942903 return DICompositeType(T);
943904
944 if (T.isDerivedType())
945 return getDICompositeType(DIDerivedType(T).getTypeDerivedFrom());
905 if (T.isDerivedType()) {
906 // This function is currently used by dragonegg and dragonegg does
907 // not generate identifier for types, so using an empty map to resolve
908 // DerivedFrom should be fine.
909 DITypeIdentifierMap EmptyMap;
910 return getDICompositeType(DIDerivedType(T).getTypeDerivedFrom()
911 .resolve(EmptyMap));
912 }
946913
947914 return DICompositeType();
948915 }
10431010 processScope(DT.getContext().resolve(TypeIdentifierMap));
10441011 if (DT.isCompositeType()) {
10451012 DICompositeType DCT(DT);
1046 processType(DCT.getTypeDerivedFrom());
1013 processType(DCT.getTypeDerivedFrom().resolve(TypeIdentifierMap));
10471014 DIArray DA = DCT.getTypeArray();
10481015 for (unsigned i = 0, e = DA.getNumElements(); i != e; ++i) {
10491016 DIDescriptor D = DA.getElement(i);
10541021 }
10551022 } else if (DT.isDerivedType()) {
10561023 DIDerivedType DDT(DT);
1057 processType(DDT.getTypeDerivedFrom());
1024 processType(DDT.getTypeDerivedFrom().resolve(TypeIdentifierMap));
10581025 }
10591026 }
10601027
0 ; CHECK: 0x[[INT:.*]]: DW_TAG_base_type
1 ; CHECK-NEXT: DW_AT_name {{.*}} = "int"
2 ; CHECK-NOT: DW_TAG_base_type
3 ; CHECK: 0x[[BASE:.*]]: DW_TAG_structure_type
4 ; CHECK-NEXT: DW_AT_name {{.*}} = "Base"
5 ; CHECK-NOT: DW_TAG_structure_type
6 ; CHECK: DW_TAG_formal_parameter
7 ; CHECK: DW_AT_type [DW_FORM_ref_addr] {{.*}}[[INT]])
8 ; CHECK: DW_TAG_variable
9 ; CHECK: DW_AT_type [DW_FORM_ref_addr] {{.*}}[[BASE]])
10
11 ; LINK: DW_TAG_structure_type
12 ; LINK-NOT: DW_TAG_structure_type
13
14 ; Content of header files:
15 ; struct Base {
16 ; int a;
17 ; Base *b;
18 ; };
19 ; Content of foo.cpp:
20 ;
21 ; #include "a.hpp"
22 ; void f(int a) {
23 ; Base t;
24 ; }
25 ; Content of bar.cpp:
26 ;
27 ; #include "a.hpp"
28 ; void f(int);
29 ; void g(int a) {
30 ; Base t;
31 ; }
32 ; int main() {
33 ; f(0);
34 ; g(1);
35 ; return 0;
36 ; }
37 ; ModuleID = 'foo.cpp'
38
39 %struct.Base = type { i32, %struct.Base* }
40
41 ; Function Attrs: nounwind ssp uwtable
42 define void @_Z1fi(i32 %a) #0 {
43 entry:
44 %a.addr = alloca i32, align 4
45 %t = alloca %struct.Base, align 8
46 store i32 %a, i32* %a.addr, align 4
47 call void @llvm.dbg.declare(metadata !{i32* %a.addr}, metadata !17), !dbg !18
48 call void @llvm.dbg.declare(metadata !{%struct.Base* %t}, metadata !19), !dbg !20
49 ret void, !dbg !21
50 }
51
52 ; Function Attrs: nounwind readnone
53 declare void @llvm.dbg.declare(metadata, metadata) #1
54
55 attributes #0 = { nounwind ssp uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
56 attributes #1 = { nounwind readnone }
57
58 !llvm.dbg.cu = !{!0}
59 !llvm.module.flags = !{!16}
60
61 !0 = metadata !{i32 786449, metadata !1, i32 4, metadata !"clang version 3.4 (http://llvm.org/git/clang.git 8a3f9e46cb988d2c664395b21910091e3730ae82) (http://llvm.org/git/llvm.git 4699e9549358bc77824a59114548eecc3f7c523c)", i1 false, metadata !"", i32 0, metadata !2, metadata !3, metadata !11, metadata !2, metadata !2, metadata !""} ; [ DW_TAG_compile_unit ] [foo.cpp] [DW_LANG_C_plus_plus]
62 !1 = metadata !{metadata !"foo.cpp", metadata !"."}
63 !2 = metadata !{i32 0}
64 !3 = metadata !{metadata !4}
65 !4 = metadata !{i32 786451, metadata !5, null, metadata !"Base", i32 1, i64 128, i64 64, i32 0, i32 0, null, metadata !6, i32 0, null, null, metadata !"_ZTS4Base"} ; [ DW_TAG_structure_type ] [Base] [line 1, size 128, align 64, offset 0] [def] [from ]
66 !5 = metadata !{metadata !"./a.hpp", metadata !"."}
67 !6 = metadata !{metadata !7, metadata !9}
68 !7 = metadata !{i32 786445, metadata !5, metadata !"_ZTS4Base", metadata !"a", i32 2, i64 32, i64 32, i64 0, i32 0, metadata !8} ; [ DW_TAG_member ] [a] [line 2, size 32, align 32, offset 0] [from int]
69 !8 = metadata !{i32 786468, null, null, metadata !"int", 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]
70 !9 = metadata !{i32 786445, metadata !5, metadata !"_ZTS4Base", metadata !"b", i32 3, i64 64, i64 64, i64 64, i32 0, metadata !10} ; [ DW_TAG_member ] [b] [line 3, size 64, align 64, offset 64] [from ]
71 !10 = metadata !{i32 786447, null, null, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 0, metadata !"_ZTS4Base"}
72 !11 = metadata !{metadata !12}
73 !12 = metadata !{i32 786478, metadata !1, metadata !13, metadata !"f", metadata !"f", metadata !"_Z1fi", i32 3, metadata !14, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, void (i32)* @_Z1fi, null, null, metadata !2, i32 3} ; [ DW_TAG_subprogram ] [line 3] [def] [f]
74 !13 = metadata !{i32 786473, metadata !1} ; [ DW_TAG_file_type ] [foo.cpp]
75 !14 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !15, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
76 !15 = metadata !{null, metadata !8}
77 !16 = metadata !{i32 2, metadata !"Dwarf Version", i32 2}
78 !17 = metadata !{i32 786689, metadata !12, metadata !"a", metadata !13, i32 16777219, metadata !8, i32 0, i32 0} ; [ DW_TAG_arg_variable ] [a] [line 3]
79 !18 = metadata !{i32 3, i32 0, metadata !12, null}
80 !19 = metadata !{i32 786688, metadata !12, metadata !"t", metadata !13, i32 4, metadata !4, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [t] [line 4]
81 !20 = metadata !{i32 4, i32 0, metadata !12, null}
82 !21 = metadata !{i32 5, i32 0, metadata !12, null}
0 ; ModuleID = 'bar.cpp'
1
2 %struct.Base = type { i32, %struct.Base* }
3
4 ; Function Attrs: nounwind ssp uwtable
5 define void @_Z1gi(i32 %a) #0 {
6 entry:
7 %a.addr = alloca i32, align 4
8 %t = alloca %struct.Base, align 8
9 store i32 %a, i32* %a.addr, align 4
10 call void @llvm.dbg.declare(metadata !{i32* %a.addr}, metadata !20), !dbg !21
11 call void @llvm.dbg.declare(metadata !{%struct.Base* %t}, metadata !22), !dbg !23
12 ret void, !dbg !24
13 }
14
15 ; Function Attrs: nounwind readnone
16 declare void @llvm.dbg.declare(metadata, metadata) #1
17
18 ; Function Attrs: ssp uwtable
19 define i32 @main() #2 {
20 entry:
21 %retval = alloca i32, align 4
22 store i32 0, i32* %retval
23 call void @_Z1fi(i32 0), !dbg !25
24 call void @_Z1gi(i32 1), !dbg !26
25 ret i32 0, !dbg !27
26 }
27
28 declare void @_Z1fi(i32) #3
29
30 attributes #0 = { nounwind ssp uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
31 attributes #1 = { nounwind readnone }
32 attributes #2 = { ssp uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
33 attributes #3 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
34
35 !llvm.dbg.cu = !{!0}
36 !llvm.module.flags = !{!19}
37
38 !0 = metadata !{i32 786449, metadata !1, i32 4, metadata !"clang version 3.4 (http://llvm.org/git/clang.git 8a3f9e46cb988d2c664395b21910091e3730ae82) (http://llvm.org/git/llvm.git 4699e9549358bc77824a59114548eecc3f7c523c)", i1 false, metadata !"", i32 0, metadata !2, metadata !3, metadata !11, metadata !2, metadata !2, metadata !""} ; [ DW_TAG_compile_unit ] [bar.cpp] [DW_LANG_C_plus_plus]
39 !1 = metadata !{metadata !"bar.cpp", metadata !"."}
40 !2 = metadata !{i32 0}
41 !3 = metadata !{metadata !4}
42 !4 = metadata !{i32 786451, metadata !5, null, metadata !"Base", i32 1, i64 128, i64 64, i32 0, i32 0, null, metadata !6, i32 0, null, null, metadata !"_ZTS4Base"} ; [ DW_TAG_structure_type ] [Base] [line 1, size 128, align 64, offset 0] [def] [from ]
43 !5 = metadata !{metadata !"./a.hpp", metadata !"."}
44 !6 = metadata !{metadata !7, metadata !9}
45 !7 = metadata !{i32 786445, metadata !5, metadata !"_ZTS4Base", metadata !"a", i32 2, i64 32, i64 32, i64 0, i32 0, metadata !8} ; [ DW_TAG_member ] [a] [line 2, size 32, align 32, offset 0] [from int]
46 !8 = metadata !{i32 786468, null, null, metadata !"int", 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]
47 !9 = metadata !{i32 786445, metadata !5, metadata !"_ZTS4Base", metadata !"b", i32 3, i64 64, i64 64, i64 64, i32 0, metadata !10} ; [ DW_TAG_member ] [b] [line 3, size 64, align 64, offset 64] [from ]
48 !10 = metadata !{i32 786447, null, null, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 0, metadata !"_ZTS4Base"}
49 !11 = metadata !{metadata !12, metadata !16}
50 !12 = metadata !{i32 786478, metadata !1, metadata !13, metadata !"g", metadata !"g", metadata !"_Z1gi", i32 4, metadata !14, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, void (i32)* @_Z1gi, null, null, metadata !2, i32 4} ; [ DW_TAG_subprogram ] [line 4] [def] [g]
51 !13 = metadata !{i32 786473, metadata !1} ; [ DW_TAG_file_type ] [bar.cpp]
52 !14 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !15, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
53 !15 = metadata !{null, metadata !8}
54 !16 = metadata !{i32 786478, metadata !1, metadata !13, metadata !"main", metadata !"main", metadata !"", i32 7, metadata !17, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, i32 ()* @main, null, null, metadata !2, i32 7} ; [ DW_TAG_subprogram ] [line 7] [def] [main]
55 !17 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !18, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
56 !18 = metadata !{metadata !8}
57 !19 = metadata !{i32 2, metadata !"Dwarf Version", i32 2}
58 !20 = metadata !{i32 786689, metadata !12, metadata !"a", metadata !13, i32 16777220, metadata !8, i32 0, i32 0} ; [ DW_TAG_arg_variable ] [a] [line 4]
59 !21 = metadata !{i32 4, i32 0, metadata !12, null}
60 !22 = metadata !{i32 786688, metadata !12, metadata !"t", metadata !13, i32 5, metadata !4, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [t] [line 5]
61 !23 = metadata !{i32 5, i32 0, metadata !12, null}
62 !24 = metadata !{i32 6, i32 0, metadata !12, null}
63 !25 = metadata !{i32 8, i32 0, metadata !16, null} ; [ DW_TAG_imported_declaration ]
64 !26 = metadata !{i32 9, i32 0, metadata !16, null}
65 !27 = metadata !{i32 10, i32 0, metadata !16, null}
0 ; REQUIRES: object-emission
1
2 ; RUN: llvm-link %S/Inputs/type-unique-simple2-a.ll %S/Inputs/type-unique-simple2-b.ll -S -o %t
3 ; RUN: cat %t | FileCheck %S/Inputs/type-unique-simple2-a.ll -check-prefix=LINK
3737 !0 = metadata !{i32 589870, metadata !25, metadata !1, metadata !"idamax", metadata !"idamax", metadata !"", i32 112, metadata !3, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 false, null, null, null, null, i32 0} ; [ DW_TAG_subprogram ]
3838 !1 = metadata !{i32 589865, metadata !25} ; [ DW_TAG_file_type ]
3939 !2 = metadata !{i32 589841, metadata !25, i32 12, metadata !"clang version 2.9 (trunk 127169)", i1 true, metadata !"", i32 0, metadata !8, metadata !8, metadata !8, null, null, metadata !""} ; [ DW_TAG_compile_unit ]
40 !3 = metadata !{i32 589845, metadata !25, metadata !1, metadata !"", i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !4, i32 0, i32 0} ; [ DW_TAG_subroutine_type ]
40 !3 = metadata !{i32 589845, metadata !25, metadata !1, metadata !"", i32 0, i64 0, i64 0, i32 0, i32 0, null, metadata !4, i32 0, i32 0} ; [ DW_TAG_subroutine_type ]
4141 !4 = metadata !{metadata !5}
4242 !5 = metadata !{i32 589860, null, metadata !2, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
4343 !6 = metadata !{i32 589870, metadata !25, metadata !1, metadata !"dscal", metadata !"dscal", metadata !"", i32 206, metadata !7, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 false, null, null, null, null, i32 0} ; [ DW_TAG_subprogram ]