llvm.org GIT mirror llvm / 3f04500
Temporarily revert r191792 as it is causing some LTO debug failures on platforms with relocations in debug info and also temporarily revert r191800 due to conflicts with the revert of r191792. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191967 91177308-0d34-0410-b5e6-96231b3b80d8 Eric Christopher 6 years ago
13 changed file(s) with 114 addition(s) and 402 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"
2524 #include "llvm/Support/Dwarf.h"
2625
2726 namespace llvm {
206205 /// Gets the parent scope for this scope node or returns a
207206 /// default constructed scope.
208207 DIScopeRef getContext() const;
209 /// If the scope node has a name, return that, else return an empty string.
210 StringRef getName() const;
211208 StringRef getFilename() const;
212209 StringRef getDirectory() const;
213210
244241 assert(DIDescriptor(Iter->second).isType() &&
245242 "MDNode in DITypeIdentifierMap should be a DIType.");
246243 return T(Iter->second);
247 }
248 StringRef getName() const {
249 if (!Val)
250 return StringRef();
251
252 if (const MDNode *MD = dyn_cast(Val))
253 return T(MD).getName();
254
255 const MDString *MS = cast(Val);
256 return MS->getString();
257244 }
258245 operator Value *() const { return const_cast(Val); }
259246 };
333320 return DbgNode && isType();
334321 }
335322
323 /// isUnsignedDIType - Return true if type encoding is unsigned.
324 bool isUnsignedDIType();
325
336326 /// replaceAllUsesWith - Replace all uses of debug info referenced by
337327 /// this descriptor.
338328 void replaceAllUsesWith(DIDescriptor &D);
360350 public:
361351 explicit DIDerivedType(const MDNode *N = 0) : DIType(N) {}
362352
363 DITypeRef getTypeDerivedFrom() const { return getFieldAs>(9); }
353 DIType getTypeDerivedFrom() const { return getFieldAs>(9); }
354
355 /// getOriginalTypeSize - If this type is derived from a base type then
356 /// return base type size.
357 uint64_t getOriginalTypeSize() const;
364358
365359 /// getObjCProperty - Return property node, if this ivar is
366360 /// associated with one.
112112 /// Climb up the parent chain to get the compile unit DIE to which this DIE
113113 /// belongs.
114114 DIE *DIE::getCompileUnit() {
115 DIE *Cu = checkCompileUnit();
116 assert(Cu && "We should not have orphaned DIEs.");
117 return Cu;
118 }
119
120 /// Climb up the parent chain to get the compile unit DIE this DIE belongs
121 /// to. Return NULL if DIE is not added to an owner yet.
122 DIE *DIE::checkCompileUnit() {
123115 DIE *p = this;
124116 while (p) {
125117 if (p->getTag() == dwarf::DW_TAG_compile_unit)
126118 return p;
127119 p = p->getParent();
128120 }
129 return NULL;
121 llvm_unreachable("We should not have orphaned DIEs.");
130122 }
131123
132124 DIEValue *DIE::findAttribute(uint16_t Attribute) {
151151 /// Climb up the parent chain to get the compile unit DIE this DIE belongs
152152 /// to.
153153 DIE *getCompileUnit();
154 /// Similar to getCompileUnit, returns null when DIE is not added to an
155 /// owner yet.
156 DIE *checkCompileUnit();
157154 void setTag(uint16_t Tag) { Abbrev.setTag(Tag); }
158155 void setOffset(unsigned O) { Offset = O; }
159156 void setSize(unsigned S) { Size = S; }
231231 ///
232232 void CompileUnit::addDIEEntry(DIE *Die, uint16_t Attribute, uint16_t Form,
233233 DIE *Entry) {
234 DD->addDIEEntry(Die, Attribute, Form, createDIEEntry(Entry));
234 Die->addValue(Attribute, Form, createDIEEntry(Entry));
235235 }
236236
237237 /// addBlock - Add block data.
523523
524524 if (Tag == dwarf::DW_TAG_pointer_type) {
525525 DIDerivedType DTy = DIDerivedType(Ty);
526 TmpTy = DD->resolve(DTy.getTypeDerivedFrom());
526 TmpTy = DTy.getTypeDerivedFrom();
527527 isPointer = true;
528528 }
529529
590590 }
591591
592592 /// isTypeSigned - Return true if the type is signed.
593 static bool isTypeSigned(DwarfDebug *DD, DIType Ty, int *SizeInBits) {
593 static bool isTypeSigned(DIType Ty, int *SizeInBits) {
594594 if (Ty.isDerivedType())
595 return isTypeSigned(DD, DD->resolve(DIDerivedType(Ty).getTypeDerivedFrom()),
596 SizeInBits);
595 return isTypeSigned(DIDerivedType(Ty).getTypeDerivedFrom(), SizeInBits);
597596 if (Ty.isBasicType())
598597 if (DIBasicType(Ty).getEncoding() == dwarf::DW_ATE_signed
599598 || DIBasicType(Ty).getEncoding() == dwarf::DW_ATE_signed_char) {
601600 return true;
602601 }
603602 return false;
604 }
605
606 /// Return true if type encoding is unsigned.
607 static bool isUnsignedDIType(DwarfDebug *DD, DIType Ty) {
608 DIDerivedType DTy(Ty);
609 if (DTy.isDerivedType())
610 return isUnsignedDIType(DD, DD->resolve(DTy.getTypeDerivedFrom()));
611
612 DIBasicType BTy(Ty);
613 if (BTy.isBasicType()) {
614 unsigned Encoding = BTy.getEncoding();
615 if (Encoding == dwarf::DW_ATE_unsigned ||
616 Encoding == dwarf::DW_ATE_unsigned_char ||
617 Encoding == dwarf::DW_ATE_boolean)
618 return true;
619 }
620 return false;
621 }
622
623 /// If this type is derived from a base type then return base type size.
624 static uint64_t getOriginalTypeSize(DwarfDebug *DD, DIDerivedType Ty) {
625 unsigned Tag = Ty.getTag();
626
627 if (Tag != dwarf::DW_TAG_member && Tag != dwarf::DW_TAG_typedef &&
628 Tag != dwarf::DW_TAG_const_type && Tag != dwarf::DW_TAG_volatile_type &&
629 Tag != dwarf::DW_TAG_restrict_type)
630 return Ty.getSizeInBits();
631
632 DIType BaseType = DD->resolve(Ty.getTypeDerivedFrom());
633
634 // If this type is not derived from any type then take conservative approach.
635 if (!BaseType.isValid())
636 return Ty.getSizeInBits();
637
638 // If this is a derived type, go ahead and get the base type, unless it's a
639 // reference then it's just the size of the field. Pointer types have no need
640 // of this since they're a different type of qualification on the type.
641 if (BaseType.getTag() == dwarf::DW_TAG_reference_type ||
642 BaseType.getTag() == dwarf::DW_TAG_rvalue_reference_type)
643 return Ty.getSizeInBits();
644
645 if (BaseType.isDerivedType())
646 return getOriginalTypeSize(DD, DIDerivedType(BaseType));
647
648 return BaseType.getSizeInBits();
649603 }
650604
651605 /// addConstantValue - Add constant value entry in variable DIE.
656610 // udata/sdata over dataN as suggested by the DWARF spec)
657611 assert(MO.isImm() && "Invalid machine operand!");
658612 int SizeInBits = -1;
659 bool SignedConstant = isTypeSigned(DD, Ty, &SizeInBits);
613 bool SignedConstant = isTypeSigned(Ty, &SizeInBits);
660614 uint16_t Form;
661615
662616 // If we're a signed constant definitely use sdata.
826780 DIType Ty(TyNode);
827781 if (!Ty.isType())
828782 return NULL;
829 DIE *TyDIE = DD->getTypeDIE(Ty);
783 DIE *TyDIE = getDIE(Ty);
830784 if (TyDIE)
831785 return TyDIE;
832786
833787 // Create new type.
834788 TyDIE = new DIE(dwarf::DW_TAG_base_type);
835 DD->insertTypeDIE(Ty, TyDIE);
789 insertDIE(Ty, TyDIE);
836790 if (Ty.isBasicType())
837791 constructTypeDIE(*TyDIE, DIBasicType(Ty));
838792 else if (Ty.isCompositeType())
868822 DIEEntry *Entry = getDIEEntry(Ty);
869823 // If it exists then use the existing value.
870824 if (Entry) {
871 DD->addDIEEntry(Entity, Attribute, dwarf::DW_FORM_ref4, Entry);
825 Entity->addValue(Attribute, dwarf::DW_FORM_ref4, Entry);
872826 return;
873827 }
874828
878832 // Set up proxy.
879833 Entry = createDIEEntry(Buffer);
880834 insertDIEEntry(Ty, Entry);
881 DD->addDIEEntry(Entity, Attribute, dwarf::DW_FORM_ref4, Entry);
835 Entity->addValue(Attribute, dwarf::DW_FORM_ref4, Entry);
882836
883837 // If this is a complete composite type then include it in the
884838 // list of global types.
980934 Buffer.setTag(Tag);
981935
982936 // Map to main type, void will not have a type.
983 DIType FromTy = DD->resolve(DTy.getTypeDerivedFrom());
937 DIType FromTy = DTy.getTypeDerivedFrom();
984938 if (FromTy)
985939 addType(&Buffer, FromTy);
986940
10581012 Buffer.addChild(ElemDie);
10591013 }
10601014 }
1061 DIType DTy = DD->resolve(CTy.getTypeDerivedFrom());
1015 DIType DTy = CTy.getTypeDerivedFrom();
10621016 if (DTy) {
10631017 addType(&Buffer, DTy);
10641018 addUInt(&Buffer, dwarf::DW_AT_enum_class, dwarf::DW_FORM_flag, 1);
11241078 DIDerivedType DDTy(Element);
11251079 if (DDTy.getTag() == dwarf::DW_TAG_friend) {
11261080 ElemDie = new DIE(dwarf::DW_TAG_friend);
1127 addType(ElemDie, DD->resolve(DDTy.getTypeDerivedFrom()),
1128 dwarf::DW_AT_friend);
1081 addType(ElemDie, DDTy.getTypeDerivedFrom(), dwarf::DW_AT_friend);
11291082 } else if (DDTy.isStaticMember())
11301083 ElemDie = createStaticMemberDIE(DDTy);
11311084 else
12661219 addString(ParamDIE, dwarf::DW_AT_name, VP.getName());
12671220 if (Value *Val = VP.getValue()) {
12681221 if (ConstantInt *CI = dyn_cast(Val))
1269 addConstantValue(ParamDIE, CI, isUnsignedDIType(DD, VP.getType()));
1222 addConstantValue(ParamDIE, CI, VP.getType().isUnsignedDIType());
12701223 else if (GlobalValue *GV = dyn_cast(Val)) {
12711224 // For declaration non-type template parameters (such as global values and
12721225 // functions)
13171270 if (!ContextDIE)
13181271 ContextDIE = CUDie.get();
13191272
1320 DIE *SPDie = DD->getSPDIE(SP);
1273 DIE *SPDie = getDIE(SP);
13211274 if (SPDie)
13221275 return SPDie;
13231276
13241277 SPDie = new DIE(dwarf::DW_TAG_subprogram);
13251278
13261279 // DW_TAG_inlined_subroutine may refer to this DIE.
1327 DD->insertSPDIE(SP, SPDie);
1280 insertDIE(SP, SPDie);
13281281
13291282 DISubprogram SPDecl = SP.getFunctionDeclaration();
13301283 DIE *DeclDie = NULL;
14711424 // But that class might not exist in the DWARF yet.
14721425 // Creating the class will create the static member decl DIE.
14731426 getOrCreateContextDIE(DD->resolve(SDMDecl.getContext()));
1474 VariableDIE = DD->getStaticMemberDIE(SDMDecl);
1427 VariableDIE = getDIE(SDMDecl);
14751428 assert(VariableDIE && "Static member decl has no context?");
14761429 IsStaticMember = true;
14771430 }
15601513 // emitting AT_const_value multiple times, we only add AT_const_value when
15611514 // it is not a static member.
15621515 if (!IsStaticMember)
1563 addConstantValue(VariableDIE, CI, isUnsignedDIType(DD, GTy));
1516 addConstantValue(VariableDIE, CI, GTy.isUnsignedDIType());
15641517 } else if (const ConstantExpr *CE = getMergedGlobalExpr(N->getOperand(11))) {
15651518 addToAccelTable = true;
15661519 // GV is a merged global.
16211574 addFlag(&Buffer, dwarf::DW_AT_GNU_vector);
16221575
16231576 // Emit the element type.
1624 addType(&Buffer, DD->resolve(CTy->getTypeDerivedFrom()));
1577 addType(&Buffer, CTy->getTypeDerivedFrom());
16251578
16261579 // Get an anonymous type for index type.
16271580 // FIXME: This type should be passed down from the front end
16651618 DIE *SPDie = CI->first;
16661619 const MDNode *N = CI->second;
16671620 if (!N) continue;
1668 DIE *NDie = DD->getTypeDIE(N);
1621 DIE *NDie = getDIE(N);
16691622 if (!NDie) continue;
16701623 addDIEEntry(SPDie, dwarf::DW_AT_containing_type, dwarf::DW_FORM_ref4, NDie);
16711624 }
17281681 addConstantFPValue(VariableDie, DVInsn->getOperand(0));
17291682 else if (DVInsn->getOperand(0).isCImm())
17301683 addConstantValue(VariableDie, DVInsn->getOperand(0).getCImm(),
1731 isUnsignedDIType(DD, DV->getType()));
1684 DV->getType().isUnsignedDIType());
17321685
17331686 DV->setDIE(VariableDie);
17341687 return VariableDie;
17561709 if (!Name.empty())
17571710 addString(MemberDie, dwarf::DW_AT_name, Name);
17581711
1759 addType(MemberDie, DD->resolve(DT.getTypeDerivedFrom()));
1712 addType(MemberDie, DT.getTypeDerivedFrom());
17601713
17611714 addSourceLine(MemberDie, DT);
17621715
17641717 addUInt(MemLocationDie, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_plus_uconst);
17651718
17661719 uint64_t Size = DT.getSizeInBits();
1767 uint64_t FieldSize = getOriginalTypeSize(DD, DT);
1720 uint64_t FieldSize = DT.getOriginalTypeSize();
17681721
17691722 if (Size != FieldSize) {
17701723 // Handle bitfield.
1771 addUInt(MemberDie, dwarf::DW_AT_byte_size, 0,
1772 getOriginalTypeSize(DD, DT)>>3);
1724 addUInt(MemberDie, dwarf::DW_AT_byte_size, 0, DT.getOriginalTypeSize()>>3);
17731725 addUInt(MemberDie, dwarf::DW_AT_bit_size, 0, DT.getSizeInBits());
17741726
17751727 uint64_t Offset = DT.getOffsetInBits();
18441796 return NULL;
18451797
18461798 DIE *StaticMemberDIE = new DIE(DT.getTag());
1847 DIType Ty = DD->resolve(DT.getTypeDerivedFrom());
1799 DIType Ty = DT.getTypeDerivedFrom();
18481800
18491801 addString(StaticMemberDIE, dwarf::DW_AT_name, DT.getName());
18501802 addType(StaticMemberDIE, Ty);
18651817 dwarf::DW_ACCESS_public);
18661818
18671819 if (const ConstantInt *CI = dyn_cast_or_null(DT.getConstant()))
1868 addConstantValue(StaticMemberDIE, CI, isUnsignedDIType(DD, Ty));
1820 addConstantValue(StaticMemberDIE, CI, Ty.isUnsignedDIType());
18691821 if (const ConstantFP *CFP = dyn_cast_or_null(DT.getConstant()))
18701822 addConstantFPValue(StaticMemberDIE, CFP);
18711823
1872 DD->insertStaticMemberDIE(DT, StaticMemberDIE);
1824 insertDIE(DT, StaticMemberDIE);
18731825 return StaticMemberDIE;
18741826 }
148148 uint16_t tag = Ty.getTag();
149149
150150 if (tag == dwarf::DW_TAG_pointer_type)
151 subType = DD->resolve(DIDerivedType(Ty).getTypeDerivedFrom());
151 subType = 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 (DD->resolve(DT.getTypeDerivedFrom()));
157 return (DT.getTypeDerivedFrom());
158158 }
159159 }
160160 return Ty;
363363 // scope then create and insert DIEs for these variables.
364364 DIE *DwarfDebug::updateSubprogramScopeDIE(CompileUnit *SPCU,
365365 const MDNode *SPNode) {
366 DIE *SPDie = getSPDIE(SPNode);
366 DIE *SPDie = SPCU->getDIE(SPNode);
367367
368368 assert(SPDie && "Unable to find subprogram DIE!");
369369 DISubprogram SP(SPNode);
517517 return NULL;
518518 DIScope DS(Scope->getScopeNode());
519519 DISubprogram InlinedSP = getDISubprogram(DS);
520 DIE *OriginDIE = getSPDIE(InlinedSP);
520 DIE *OriginDIE = TheCU->getDIE(InlinedSP);
521521 if (!OriginDIE) {
522522 DEBUG(dbgs() << "Unable to find original DIE for an inlined subprogram.");
523523 return NULL;
622622 else if (DS.isSubprogram()) {
623623 ProcessedSPNodes.insert(DS);
624624 if (Scope->isAbstractScope()) {
625 ScopeDIE = getSPDIE(DS);
625 ScopeDIE = TheCU->getDIE(DS);
626626 // Note down abstract DIE.
627627 if (ScopeDIE)
628628 AbstractSPDies.insert(std::make_pair(DS, ScopeDIE));
992992 CompileUnit *SPCU = CUMap.lookup(TheCU);
993993 assert(SPCU && "Unable to find Compile Unit!");
994994 constructSubprogramDIE(SPCU, SP);
995 DIE *ScopeDIE = getSPDIE(SP);
995 DIE *ScopeDIE = SPCU->getDIE(SP);
996996 for (unsigned vi = 0, ve = Variables.getNumElements(); vi != ve; ++vi) {
997997 DIVariable DV(Variables.getElement(vi));
998998 if (!DV.isVariable()) continue;
999 DbgVariable NewVar(DV, NULL, this);
999 DbgVariable NewVar(DV, NULL);
10001000 if (DIE *VariableDIE =
10011001 SPCU->constructVariableDIE(&NewVar, Scope->isAbstractScope()))
10021002 ScopeDIE->addChild(VariableDIE);
10631063 CUMap.begin()->second->addUInt(Die, dwarf::DW_AT_GNU_odr_signature,
10641064 dwarf::DW_FORM_data8,
10651065 Hash.computeDIEODRSignature(Die));
1066 }
1067
1068 // Process the worklist to add attributes with the correct form (ref_addr or
1069 // ref4).
1070 for (unsigned I = 0, E = DIEEntryWorklist.size(); I < E; I++) {
1071 addDIEEntry(DIEEntryWorklist[I].Die, DIEEntryWorklist[I].Attribute,
1072 dwarf::DW_FORM_ref4, DIEEntryWorklist[I].Entry);
1073 assert(E == DIEEntryWorklist.size() &&
1074 "We should not add to the worklist during finalization.");
10751066 }
10761067
10771068 // Handle anything that needs to be done on a per-cu basis.
12641255 if (!Scope)
12651256 return NULL;
12661257
1267 AbsDbgVariable = new DbgVariable(Var, NULL, this);
1258 AbsDbgVariable = new DbgVariable(Var, NULL);
12681259 addScopeVariable(Scope, AbsDbgVariable);
12691260 AbstractVariables[Var] = AbsDbgVariable;
12701261 return AbsDbgVariable;
13131304 continue;
13141305
13151306 DbgVariable *AbsDbgVariable = findAbstractVariable(DV, VP.second);
1316 DbgVariable *RegVar = new DbgVariable(DV, AbsDbgVariable, this);
1307 DbgVariable *RegVar = new DbgVariable(DV, AbsDbgVariable);
13171308 RegVar->setFrameIndex(VP.first);
13181309 if (!addCurrentFnArgument(MF, RegVar, Scope))
13191310 addScopeVariable(Scope, RegVar);
13981389 Processed.insert(DV);
13991390 assert(MInsn->isDebugValue() && "History must begin with debug value");
14001391 DbgVariable *AbsVar = findAbstractVariable(DV, MInsn->getDebugLoc());
1401 DbgVariable *RegVar = new DbgVariable(DV, AbsVar, this);
1392 DbgVariable *RegVar = new DbgVariable(DV, AbsVar);
14021393 if (!addCurrentFnArgument(MF, RegVar, Scope))
14031394 addScopeVariable(Scope, RegVar);
14041395 if (AbsVar)
14611452 if (!DV || !DV.isVariable() || !Processed.insert(DV))
14621453 continue;
14631454 if (LexicalScope *Scope = LScopes.findLexicalScope(DV.getContext()))
1464 addScopeVariable(Scope, new DbgVariable(DV, NULL, this));
1455 addScopeVariable(Scope, new DbgVariable(DV, NULL));
14651456 }
14661457 }
14671458
18571848 if (AbstractVariables.lookup(CleanDV))
18581849 continue;
18591850 if (LexicalScope *Scope = LScopes.findAbstractScope(DV.getContext()))
1860 addScopeVariable(Scope, new DbgVariable(DV, NULL, this));
1851 addScopeVariable(Scope, new DbgVariable(DV, NULL));
18611852 }
18621853 }
18631854 if (ProcessedSPNodes.count(AScope->getScopeNode()) == 0)
20632054 Asm->OutStreamer.AddComment(dwarf::AttributeString(Attr));
20642055
20652056 switch (Attr) {
2066 case dwarf::DW_AT_abstract_origin:
2067 case dwarf::DW_AT_type:
2068 case dwarf::DW_AT_friend:
2069 case dwarf::DW_AT_specification:
2070 case dwarf::DW_AT_containing_type: {
2057 case dwarf::DW_AT_abstract_origin: {
20712058 DIEEntry *E = cast(Values[i]);
20722059 DIE *Origin = E->getEntry();
20732060 unsigned Addr = Origin->getOffset();
30473034 InfoHolder.emitStrings(Asm->getObjFileLowering().getDwarfStrDWOSection(),
30483035 OffSec, StrSym);
30493036 }
3050
3051 /// When we don't know whether the correct form is ref4 or ref_addr, we create
3052 /// a worklist item and insert it to DIEEntryWorklist.
3053 void DwarfDebug::addDIEEntry(DIE *Die, uint16_t Attribute, uint16_t Form,
3054 DIEEntry *Entry) {
3055 /// Early exit when we only have a single CU.
3056 if (GlobalCUIndexCount == 1 || Form != dwarf::DW_FORM_ref4) {
3057 Die->addValue(Attribute, Form, Entry);
3058 return;
3059 }
3060 DIE *DieCU = Die->checkCompileUnit();
3061 DIE *EntryCU = Entry->getEntry()->checkCompileUnit();
3062 if (!DieCU || !EntryCU) {
3063 // Die or Entry is not added to an owner yet.
3064 insertDIEEntryWorklist(Die, Attribute, Entry);
3065 return;
3066 }
3067 Die->addValue(Attribute,
3068 EntryCU == DieCU ? dwarf::DW_FORM_ref4 : dwarf::DW_FORM_ref_addr,
3069 Entry);
3070 }
149149 DbgVariable *AbsVar; // Corresponding Abstract variable, if any.
150150 const MachineInstr *MInsn; // DBG_VALUE instruction of the variable.
151151 int FrameIndex;
152 DwarfDebug *DD;
153152 public:
154153 // AbsVar may be NULL.
155 DbgVariable(DIVariable V, DbgVariable *AV, DwarfDebug *DD)
154 DbgVariable(DIVariable V, DbgVariable *AV)
156155 : Var(V), TheDIE(0), DotDebugLocOffset(~0U), AbsVar(AV), MInsn(0),
157 FrameIndex(~0), DD(DD) {}
156 FrameIndex(~0) {}
158157
159158 // Accessors.
160159 DIVariable getVariable() const { return Var; }
327326 // Maps subprogram MDNode with its corresponding CompileUnit.
328327 DenseMap SPMap;
329328
330 /// Maps type MDNode with its corresponding DIE. These DIEs can be
331 /// shared across CUs, that is why we keep the map here instead
332 /// of in CompileUnit.
333 DenseMap MDTypeNodeToDieMap;
334 /// Maps subprogram MDNode with its corresponding DIE.
335 DenseMap MDSPNodeToDieMap;
336 /// Maps static member MDNode with its corresponding DIE.
337 DenseMap MDStaticMemberNodeToDieMap;
338
339 /// Specifies a worklist item. Sometimes, when we try to add an attribute to
340 /// a DIE, the DIE is not yet added to its owner yet, so we don't know whether
341 /// we should use ref_addr or ref4. We create a worklist that will be
342 /// processed during finalization to add attributes with the correct form
343 /// (ref_addr or ref4).
344 struct DIEEntryWorkItem {
345 DIE *Die;
346 uint16_t Attribute;
347 DIEEntry *Entry;
348 DIEEntryWorkItem(DIE *D, uint16_t A, DIEEntry *E) :
349 Die(D), Attribute(A), Entry(E) {
350 }
351 };
352 SmallVector DIEEntryWorklist;
353
354329 // Used to uniquely define abbreviations.
355330 FoldingSet AbbreviationsSet;
356331
685660 DwarfDebug(AsmPrinter *A, Module *M);
686661 ~DwarfDebug();
687662
688 void insertTypeDIE(const MDNode *TypeMD, DIE *Die) {
689 MDTypeNodeToDieMap.insert(std::make_pair(TypeMD, Die));
690 }
691 DIE *getTypeDIE(const MDNode *TypeMD) {
692 return MDTypeNodeToDieMap.lookup(TypeMD);
693 }
694 void insertSPDIE(const MDNode *SPMD, DIE *Die) {
695 MDSPNodeToDieMap.insert(std::make_pair(SPMD, Die));
696 }
697 DIE *getSPDIE(const MDNode *SPMD) {
698 return MDSPNodeToDieMap.lookup(SPMD);
699 }
700 void insertStaticMemberDIE(const MDNode *StaticMD, DIE *Die) {
701 MDStaticMemberNodeToDieMap.insert(std::make_pair(StaticMD, Die));
702 }
703 DIE *getStaticMemberDIE(const MDNode *StaticMD) {
704 return MDStaticMemberNodeToDieMap.lookup(StaticMD);
705 }
706 void insertDIEEntryWorklist(DIE *Die, uint16_t Attribute, DIEEntry *Entry) {
707 DIEEntryWorklist.push_back(DIEEntryWorkItem(Die, Attribute, Entry));
708 }
709
710663 /// \brief Emit all Dwarf sections that should come prior to the
711664 /// content.
712665 void beginModule();
769722 return Ref.resolve(TypeIdentifierMap);
770723 }
771724
772 /// When we don't know whether the correct form is ref4 or ref_addr, we create
773 /// a worklist item and insert it to DIEEntryWorklist.
774 void addDIEEntry(DIE *Die, uint16_t Attribute, uint16_t Form,
775 DIEEntry *Entry);
776
777725 /// isSubprogramContext - Return true if Context is either a subprogram
778726 /// or another context nested inside a subprogram.
779727 bool isSubprogramContext(const MDNode *Context);
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.getRef()
305 PointeeTy
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
370387 /// Verify - Verify that a compile unit is well formed.
371388 bool DICompileUnit::Verify() const {
372389 if (!isCompileUnit())
475492
476493 /// Verify - Verify that a derived type descriptor is well formed.
477494 bool DIDerivedType::Verify() const {
478 // Make sure DerivedFrom @ field 9 is TypeRef.
479 if (!fieldIsTypeRef(DbgNode, 9))
495 // Make sure DerivedFrom @ field 9 is MDNode.
496 if (!fieldIsMDNode(DbgNode, 9))
480497 return false;
481498 if (getTag() == dwarf::DW_TAG_ptr_to_member_type)
482499 // Make sure ClassType @ field 10 is a TypeRef.
492509 if (!isCompositeType())
493510 return false;
494511
495 // Make sure DerivedFrom @ field 9 and ContainingType @ field 12 are TypeRef.
496 if (!fieldIsTypeRef(DbgNode, 9))
512 // Make sure DerivedFrom @ field 9 and ContainingType @ field 12 are MDNodes.
513 if (!fieldIsMDNode(DbgNode, 9))
497514 return false;
498515 if (!fieldIsTypeRef(DbgNode, 12))
499516 return false;
501518 // Make sure the type identifier at field 14 is MDString, it can be null.
502519 if (!fieldIsMDString(DbgNode, 14))
503520 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;
504527
505528 return DbgNode->getNumOperands() == 15;
506529 }
612635 bool DIImportedEntity::Verify() const {
613636 return isImportedEntity() &&
614637 (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();
615667 }
616668
617669 /// getObjCProperty - Return property node, if this ivar is associated with one.
755807 return DIScopeRef(NULL);
756808 }
757809
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
771810 StringRef DIScope::getFilename() const {
772811 if (!DbgNode)
773812 return StringRef();
902941 if (T.isCompositeType())
903942 return DICompositeType(T);
904943
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 }
944 if (T.isDerivedType())
945 return getDICompositeType(DIDerivedType(T).getTypeDerivedFrom());
913946
914947 return DICompositeType();
915948 }
10101043 processScope(DT.getContext().resolve(TypeIdentifierMap));
10111044 if (DT.isCompositeType()) {
10121045 DICompositeType DCT(DT);
1013 processType(DCT.getTypeDerivedFrom().resolve(TypeIdentifierMap));
1046 processType(DCT.getTypeDerivedFrom());
10141047 DIArray DA = DCT.getTypeArray();
10151048 for (unsigned i = 0, e = DA.getNumElements(); i != e; ++i) {
10161049 DIDescriptor D = DA.getElement(i);
10211054 }
10221055 } else if (DT.isDerivedType()) {
10231056 DIDerivedType DDT(DT);
1024 processType(DDT.getTypeDerivedFrom().resolve(TypeIdentifierMap));
1057 processType(DDT.getTypeDerivedFrom());
10251058 }
10261059 }
10271060
+0
-83
test/Linker/Inputs/type-unique-simple2-a.ll less more
None ; 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
-66
test/Linker/Inputs/type-unique-simple2-b.ll less more
None ; 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}
None ; REQUIRES: object-emission
0 ; RUN: llvm-link %s %p/type-unique-simple-b.ll -S -o - | FileCheck %s
11
2 ; RUN: llvm-link %s %p/type-unique-simple-b.ll -S -o %t
3 ; RUN: cat %t | FileCheck %s -check-prefix=LINK
4 ; RUN: llc -filetype=obj -O0 < %t > %t2
5 ; RUN: llvm-dwarfdump -debug-dump=info %t2 | FileCheck %s
6 ; CHECK: 0x[[INT:.*]]: DW_TAG_base_type
7 ; CHECK-NEXT: DW_AT_name {{.*}} = "int"
8 ; CHECK-NOT: DW_TAG_base_type
9 ; CHECK: 0x[[BASE:.*]]: DW_TAG_structure_type
10 ; CHECK-NEXT: DW_AT_name {{.*}} = "Base"
2 ; CHECK: DW_TAG_structure_type
113 ; CHECK-NOT: DW_TAG_structure_type
12 ; CHECK: DW_TAG_formal_parameter
13 ; CHECK: DW_AT_type [DW_FORM_ref_addr] {{.*}}[[INT]])
14 ; CHECK: DW_TAG_variable
15 ; CHECK: DW_AT_type [DW_FORM_ref_addr] {{.*}}[[BASE]])
16
17 ; LINK: DW_TAG_structure_type
18 ; LINK-NOT: DW_TAG_structure_type
194 ; Content of header files:
205 ; struct Base {
216 ; int a;
+0
-6
test/Linker/type-unique-simple2.ll less more
None ; 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
4 ; RUN: llc -filetype=obj -O0 < %t > %t2
5 ; RUN: llvm-dwarfdump -debug-dump=info %t2 | FileCheck %S/Inputs/type-unique-simple2-a.ll
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, null, 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, i32 0, 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 ]