Lines Matching full:die

42                                        DwarfCompileUnit &CU, DIELoc &DIE)
43 : DwarfExpression(AP.getDwarfVersion(), CU), AP(AP), OutDIE(DIE) {}
180 /// Check whether the DIE for this MDNode can be shared across CUs.
182 // When the MDNode can be part of the type system, the DIE can be shared
184 // Combining type units and cross-CU DIE sharing is lower value (since
185 // cross-CU DIE sharing is used in LTO and removes type redundancy at that
196 DIE *DwarfUnit::getDIE(const DINode *D) const {
202 void DwarfUnit::insertDIE(const DINode *Desc, DIE *D) {
210 void DwarfUnit::insertDIE(DIE *D) {
214 void DwarfUnit::addFlag(DIE &Die, dwarf::Attribute Attribute) {
216 addAttribute(Die, Attribute, dwarf::DW_FORM_flag_present, DIEInteger(1));
218 addAttribute(Die, Attribute, dwarf::DW_FORM_flag, DIEInteger(1));
221 void DwarfUnit::addUInt(DIEValueList &Die, dwarf::Attribute Attribute,
227 addAttribute(Die, Attribute, *Form, DIEInteger(Integer));
235 void DwarfUnit::addSInt(DIEValueList &Die, dwarf::Attribute Attribute,
239 addAttribute(Die, Attribute, *Form, DIEInteger(Integer));
242 void DwarfUnit::addSInt(DIELoc &Die, std::optional<dwarf::Form> Form,
244 addSInt(Die, (dwarf::Attribute)0, Form, Integer);
247 void DwarfUnit::addString(DIE &Die, dwarf::Attribute Attribute,
253 addAttribute(Die, Attribute, dwarf::DW_FORM_string,
277 addAttribute(Die, Attribute, IxForm, DIEString(StringPoolEntry));
280 void DwarfUnit::addLabel(DIEValueList &Die, dwarf::Attribute Attribute,
282 addAttribute(Die, Attribute, Form, DIELabel(Label));
285 void DwarfUnit::addLabel(DIELoc &Die, dwarf::Form Form, const MCSymbol *Label) {
286 addLabel(Die, (dwarf::Attribute)0, Form, Label);
289 void DwarfUnit::addSectionOffset(DIE &Die, dwarf::Attribute Attribute,
291 addUInt(Die, Attribute, DD->getDwarfSectionOffsetForm(), Integer);
307 void DwarfUnit::addPoolOpAddress(DIEValueList &Die, const MCSymbol *Label) {
318 addUInt(Die, dwarf::DW_FORM_data1, dwarf::DW_OP_addrx);
319 addUInt(Die, dwarf::DW_FORM_addrx, Index);
321 addUInt(Die, dwarf::DW_FORM_data1, dwarf::DW_OP_GNU_addr_index);
322 addUInt(Die, dwarf::DW_FORM_GNU_addr_index, Index);
326 addUInt(Die, dwarf::DW_FORM_data1, dwarf::DW_OP_const4u);
327 addLabelDelta(Die, (dwarf::Attribute)0, Label, Base);
328 addUInt(Die, dwarf::DW_FORM_data1, dwarf::DW_OP_plus);
332 void DwarfUnit::addOpAddress(DIELoc &Die, const MCSymbol *Sym) {
334 addPoolOpAddress(Die, Sym);
339 addPoolOpAddress(Die, Sym);
343 addUInt(Die, dwarf::DW_FORM_data1, dwarf::DW_OP_addr);
344 addLabel(Die, dwarf::DW_FORM_addr, Sym);
347 void DwarfUnit::addLabelDelta(DIEValueList &Die, dwarf::Attribute Attribute,
349 addAttribute(Die, Attribute, dwarf::DW_FORM_data4,
353 void DwarfUnit::addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIE &Entry) {
354 addDIEEntry(Die, Attribute, DIEEntry(Entry));
357 void DwarfUnit::addDIETypeSignature(DIE &Die, uint64_t Signature) {
362 addFlag(Die, dwarf::DW_AT_declaration);
364 addAttribute(Die, dwarf::DW_AT_signature, dwarf::DW_FORM_ref_sig8,
368 void DwarfUnit::addDIEEntry(DIE &Die, dwarf::Attribute Attribute,
370 const DIEUnit *CU = Die.getUnit();
373 // We assume that Die belongs to this CU, if it is not linked to any CU yet.
379 addAttribute(Die, Attribute,
384 DIE &DwarfUnit::createAndAddDIE(dwarf::Tag Tag, DIE &Parent, const DINode *N) {
385 DIE &Die = Parent.addChild(DIE::get(DIEValueAllocator, Tag));
387 insertDIE(N, &Die);
388 return Die;
391 void DwarfUnit::addBlock(DIE &Die, dwarf::Attribute Attribute, DIELoc *Loc) {
394 addAttribute(Die, Attribute, Loc->BestForm(DD->getDwarfVersion()), Loc);
397 void DwarfUnit::addBlock(DIE &Die, dwarf::Attribute Attribute, dwarf::Form Form,
401 addAttribute(Die, Attribute, Form, Block);
404 void DwarfUnit::addBlock(DIE &Die, dwarf::Attribute Attribute,
406 addBlock(Die, Attribute, Block->BestForm(), Block);
409 void DwarfUnit::addSourceLine(DIE &Die, unsigned Line, const DIFile *File) {
414 addUInt(Die, dwarf::DW_AT_decl_file, std::nullopt, FileID);
415 addUInt(Die, dwarf::DW_AT_decl_line, std::nullopt, Line);
418 void DwarfUnit::addSourceLine(DIE &Die, const DILocalVariable *V) {
421 addSourceLine(Die, V->getLine(), V->getFile());
424 void DwarfUnit::addSourceLine(DIE &Die, const DIGlobalVariable *G) {
427 addSourceLine(Die, G->getLine(), G->getFile());
430 void DwarfUnit::addSourceLine(DIE &Die, const DISubprogram *SP) {
433 addSourceLine(Die, SP->getLine(), SP->getFile());
436 void DwarfUnit::addSourceLine(DIE &Die, const DILabel *L) {
439 addSourceLine(Die, L->getLine(), L->getFile());
442 void DwarfUnit::addSourceLine(DIE &Die, const DIType *Ty) {
445 addSourceLine(Die, Ty->getLine(), Ty->getFile());
448 void DwarfUnit::addSourceLine(DIE &Die, const DIObjCProperty *Ty) {
451 addSourceLine(Die, Ty->getLine(), Ty->getFile());
454 void DwarfUnit::addConstantFPValue(DIE &Die, const ConstantFP *CFP) {
456 addConstantValue(Die, CFP->getValueAPF().bitcastToAPInt(), true);
459 void DwarfUnit::addConstantValue(DIE &Die, const ConstantInt *CI,
461 addConstantValue(Die, CI->getValue(), Ty);
464 void DwarfUnit::addConstantValue(DIE &Die, uint64_t Val, const DIType *Ty) {
465 addConstantValue(Die, DD->isUnsignedDIType(Ty), Val);
468 void DwarfUnit::addConstantValue(DIE &Die, bool Unsigned, uint64_t Val) {
471 addUInt(Die, dwarf::DW_AT_const_value,
475 void DwarfUnit::addConstantValue(DIE &Die, const APInt &Val, const DIType *Ty) {
476 addConstantValue(Die, Val, DD->isUnsignedDIType(Ty));
479 void DwarfUnit::addConstantValue(DIE &Die, const APInt &Val, bool Unsigned) {
482 addConstantValue(Die, Unsigned,
505 addBlock(Die, dwarf::DW_AT_const_value, Block);
508 void DwarfUnit::addLinkageName(DIE &Die, StringRef LinkageName) {
510 addString(Die,
516 void DwarfUnit::addTemplateParams(DIE &Buffer, DINodeArray TParams) {
527 void DwarfUnit::addThrownTypes(DIE &Die, DINodeArray ThrownTypes) {
529 DIE &TT = createAndAddDIE(dwarf::DW_TAG_thrown_type, Die);
534 void DwarfUnit::addAccess(DIE &Die, DINode::DIFlags Flags) {
536 addUInt(Die, dwarf::DW_AT_accessibility, dwarf::DW_FORM_data1,
539 addUInt(Die, dwarf::DW_AT_accessibility, dwarf::DW_FORM_data1,
542 addUInt(Die, dwarf::DW_AT_accessibility, dwarf::DW_FORM_data1,
546 DIE *DwarfUnit::getOrCreateContextDIE(const DIScope *Context) {
560 DIE *DwarfUnit::createTypeDIE(const DICompositeType *Ty) {
562 DIE *ContextDIE = getOrCreateContextDIE(Context);
564 if (DIE *TyDIE = getDIE(Ty))
568 DIE &TyDIE = createAndAddDIE(Ty->getTag(), *ContextDIE, Ty);
576 DIE *DwarfUnit::createTypeDIE(const DIScope *Context, DIE &ContextDIE,
579 DIE &TyDIE = createAndAddDIE(Ty->getTag(), ContextDIE, Ty);
612 DIE *DwarfUnit::getOrCreateTypeDIE(const MDNode *TyNode) {
626 // Construct the context before querying for the existence of the DIE in case
627 // such construction creates the DIE.
629 DIE *ContextDIE = getOrCreateContextDIE(Context);
632 if (DIE *TyDIE = getDIE(Ty))
640 const DIType *Ty, const DIE &TyDIE) {
661 void DwarfUnit::addGlobalType(const DIType *Ty, const DIE &TyDIE,
668 void DwarfUnit::addType(DIE &Entity, const DIType *Ty,
708 void DwarfUnit::constructTypeDIE(DIE &Buffer, const DIBasicType *BTy) {
732 void DwarfUnit::constructTypeDIE(DIE &Buffer, const DIStringType *STy) {
773 void DwarfUnit::constructTypeDIE(DIE &Buffer, const DIDerivedType *DTy) {
791 // attribute in DW_TAG_typedef DIE.
841 void DwarfUnit::constructSubprogramArguments(DIE &Buffer, DITypeRefArray Args) {
848 DIE &Arg = createAndAddDIE(dwarf::DW_TAG_formal_parameter, Buffer);
856 void DwarfUnit::constructTypeDIE(DIE &Buffer, const DISubroutineType *CTy) {
886 void DwarfUnit::addAnnotation(DIE &Buffer, DINodeArray Annotations) {
895 DIE &AnnotationDie = createAndAddDIE(dwarf::DW_TAG_LLVM_annotation, Buffer);
907 void DwarfUnit::constructTypeDIE(DIE &Buffer, const DICompositeType *CTy) {
935 DIE &DiscMember = constructMemberDIE(Buffer, Discriminator);
954 DIE &ElemDie = createAndAddDIE(dwarf::DW_TAG_friend, Buffer);
961 DIE &Variant = createAndAddDIE(dwarf::DW_TAG_variant, Buffer);
976 DIE &ElemDie = createAndAddDIE(Property->getTag(), Buffer);
993 DIE &VariantPart = createAndAddDIE(Composite->getTag(), Buffer);
1000 DIE &ItemDie = createAndAddDIE(dwarf::DW_TAG_namelist_item, Buffer);
1085 DIE &Buffer, const DITemplateTypeParameter *TP) {
1086 DIE &ParamDIE =
1098 DIE &Buffer, const DITemplateValueParameter *VP) {
1099 DIE &ParamDIE = createAndAddDIE(VP->getTag(), Buffer);
1135 DIE *DwarfUnit::getOrCreateNameSpace(const DINamespace *NS) {
1136 // Construct the context before querying for the existence of the DIE in case
1137 // such construction creates the DIE.
1138 DIE *ContextDIE = getOrCreateContextDIE(NS->getScope());
1140 if (DIE *NDie = getDIE(NS))
1142 DIE &NDie = createAndAddDIE(dwarf::DW_TAG_namespace, *ContextDIE, NS);
1156 DIE *DwarfUnit::getOrCreateModule(const DIModule *M) {
1157 // Construct the context before querying for the existence of the DIE in case
1158 // such construction creates the DIE.
1159 DIE *ContextDIE = getOrCreateContextDIE(M->getScope());
1161 if (DIE *MDie = getDIE(M))
1163 DIE &MDie = createAndAddDIE(dwarf::DW_TAG_module, *ContextDIE, M);
1187 DIE *DwarfUnit::getOrCreateSubprogramDIE(const DISubprogram *SP, bool Minimal) {
1188 // Construct the context before querying for the existence of the DIE in case
1189 // such construction creates the DIE (as is the case for member function
1191 DIE *ContextDIE =
1194 if (DIE *SPDie = getDIE(SP))
1199 // Add subprogram definitions to the CU die directly.
1206 // DW_TAG_inlined_subroutine may refer to this DIE.
1207 DIE &SPDie = createAndAddDIE(dwarf::DW_TAG_subprogram, *ContextDIE, SP);
1220 DIE &SPDie, bool Minimal) {
1221 DIE *DeclDie = nullptr;
1234 assert(DeclDie && "This DIE should've already been constructed when the "
1235 "definition DIE was created in "
1272 void DwarfUnit::applySubprogramAttributes(const DISubprogram *SP, DIE &SPDie,
1386 void DwarfUnit::constructSubrangeDIE(DIE &Buffer, const DISubrange *SR,
1387 DIE *IndexTy) {
1388 DIE &DW_Subrange = createAndAddDIE(dwarf::DW_TAG_subrange_type, Buffer);
1427 void DwarfUnit::constructGenericSubrangeDIE(DIE &Buffer,
1429 DIE *IndexTy) {
1430 DIE &DwGenericSubrange =
1465 DIE *DwarfUnit::getIndexTyDie() {
1510 void DwarfUnit::constructArrayTypeDIE(DIE &Buffer, const DICompositeType *CTy) {
1568 DIE *IdxTy = getIndexTyDie();
1584 void DwarfUnit::constructEnumTypeDIE(DIE &Buffer, const DICompositeType *CTy) {
1603 DIE &Enumerator = createAndAddDIE(dwarf::DW_TAG_enumerator, Buffer);
1615 DIE &SPDie = *P.first;
1619 DIE *NDie = getDIE(D);
1626 DIE &DwarfUnit::constructMemberDIE(DIE &Buffer, const DIDerivedType *DT) {
1627 DIE &MemberDie = createAndAddDIE(DT->getTag(), Buffer);
1735 if (DIE *PDie = getDIE(PNode))
1745 DIE *DwarfUnit::getOrCreateStaticMemberDIE(const DIDerivedType *DT) {
1749 // Construct the context before querying for the existence of the DIE in case
1750 // such construction creates the DIE.
1751 DIE *ContextDIE = getOrCreateContextDIE(DT->getScope());
1755 if (DIE *StaticMemberDIE = getDIE(DT))
1758 DIE &StaticMemberDIE = createAndAddDIE(DT->getTag(), *ContextDIE, DT);
1832 Asm->OutStreamer->AddComment("Type DIE Offset");
1833 // In a skeleton type unit there is no type DIE so emit a zero offset.
1837 void DwarfUnit::addSectionDelta(DIE &Die, dwarf::Attribute Attribute,
1839 addAttribute(Die, Attribute, DD->getDwarfSectionOffsetForm(),
1843 void DwarfUnit::addSectionLabel(DIE &Die, dwarf::Attribute Attribute,
1846 addLabel(Die, Attribute, DD->getDwarfSectionOffsetForm(), Label);
1848 addSectionDelta(Die, Attribute, Label, Sec);
1857 void DwarfTypeUnit::addGlobalName(StringRef Name, const DIE &Die,
1862 void DwarfTypeUnit::addGlobalTypeImpl(const DIType *Ty, const DIE &Die,
1891 void DwarfTypeUnit::finishNonUnitTypeDIE(DIE& D, const DICompositeType *CTy) {