Lines Matching +full:keep +full:- +full:a +full:- +full:live
1 //=== DependencyTracker.cpp -----------------------------------------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
16 /// A broken link in the keep chain. By recording both the parent and the child
26 /// Verify the keep chain by looking for DIEs that are kept but who's parent
58 "Found invalid link in keep chain"); in verifyKeepChain()
64 "Live subprogram is not marked as kept"); in verifyKeepChain()
75 "Found invalid link in keep chain"); in verifyKeepChain()
103 report_fatal_error("invalid keep chain"); in verifyKeepChain()
112 // Search for live root DIEs. in resolveDependenciesAndMarkLiveness()
118 // Mark live DIEs as kept. in resolveDependenciesAndMarkLiveness()
138 Entry.CU->getFirstChildEntry(Entry.DieEntry); in collectRootsToKeep()
139 CurChild && CurChild->getAbbreviationDeclarationPtr(); in collectRootsToKeep()
140 CurChild = Entry.CU->getSiblingEntry(CurChild)) { in collectRootsToKeep()
142 CompileUnit::DIEInfo &ChildInfo = Entry.CU->getDIEInfo(CurChild); in collectRootsToKeep()
146 switch (CurChild->getTag()) { in collectRootsToKeep()
150 // Keep label referencing live address. in collectRootsToKeep()
151 // Keep label which is child of live parent entry. in collectRootsToKeep()
161 // Keep subprogram referencing live address. in collectRootsToKeep()
177 // Keep variable referencing live address. in collectRootsToKeep()
191 // Always keep base types. in collectRootsToKeep()
199 // Always keep DIEs having DW_AT_import attribute. in collectRootsToKeep()
200 if (Entry.DieEntry->getTag() == dwarf::DW_TAG_compile_unit) { in collectRootsToKeep()
253 RootEntry.CU->getDIEInfo(RootEntry.DieEntry); in updateDependenciesCompleteness()
257 ReferencedByEntry.CU->getDIEInfo(ReferencedByEntry.DieEntry); in updateDependenciesCompleteness()
274 CompileUnit::DIEInfo &Info = Entry.CU->getDIEInfo(Entry.DieEntry); in setPlainDwarfPlacementRec()
284 Entry.CU->getFirstChildEntry(Entry.DieEntry); in setPlainDwarfPlacementRec()
285 CurChild && CurChild->getAbbreviationDeclarationPtr(); in setPlainDwarfPlacementRec()
286 CurChild = Entry.CU->getSiblingEntry(CurChild)) in setPlainDwarfPlacementRec()
291 switch (Entry->getTag()) { in isNamespaceLikeEntry()
326 return isAlreadyMarked(Entry.CU->getDIEInfo(Entry.DieEntry), NewPlacement); in isAlreadyMarked()
331 if (Entry.DieEntry->getAbbreviationDeclarationPtr() == nullptr) in markParentsAsKeepingChildren()
334 CompileUnit::DIEInfo &Info = Entry.CU->getDIEInfo(Entry.DieEntry); in markParentsAsKeepingChildren()
341 // Mark parents as 'Keep*Children'. in markParentsAsKeepingChildren()
342 std::optional<uint32_t> ParentIdx = Entry.DieEntry->getParentIdx(); in markParentsAsKeepingChildren()
345 Entry.CU->getDebugInfoEntry(*ParentIdx); in markParentsAsKeepingChildren()
346 CompileUnit::DIEInfo &ParentInfo = Entry.CU->getDIEInfo(*ParentIdx); in markParentsAsKeepingChildren()
381 ParentIdx = ParentEntry->getParentIdx(); in markParentsAsKeepingChildren()
387 // a) changed to another.
394 CompileUnit::DIEInfo &EntryInfo = Entry.CU->getDIEInfo(Entry.DieEntry); in getFinalPlacementForEntry()
399 if (Entry.DieEntry->getTag() == dwarf::DW_TAG_variable) { in getFinalPlacementForEntry()
432 if (Entry.DieEntry->getAbbreviationDeclarationPtr() == nullptr) in markDIEEntryAsKeptRec()
435 CompileUnit::DIEInfo &Info = Entry.CU->getDIEInfo(Entry.DieEntry); in markDIEEntryAsKeptRec()
453 // Set keep children property for parents. in markDIEEntryAsKeptRec()
457 Entry.DieEntry->getTag() == dwarf::DW_TAG_subprogram ? Entry : RootEntry; in markDIEEntryAsKeptRec()
472 if (Entry.DieEntry->getTag() == dwarf::DW_TAG_subprogram && in markDIEEntryAsKeptRec()
474 // Subprograms is a special case. As it can be root for type DIEs in markDIEEntryAsKeptRec()
476 // a) Non removable children(like DW_TAG_formal_parameter) should always in markDIEEntryAsKeptRec()
484 Entry.CU->getFirstChildEntry(Entry.DieEntry); in markDIEEntryAsKeptRec()
485 CurChild && CurChild->getAbbreviationDeclarationPtr(); in markDIEEntryAsKeptRec()
486 CurChild = Entry.CU->getSiblingEntry(CurChild)) { in markDIEEntryAsKeptRec()
487 CompileUnit::DIEInfo ChildInfo = Entry.CU->getDIEInfo(CurChild); in markDIEEntryAsKeptRec()
489 switch (CurChild->getTag()) { in markDIEEntryAsKeptRec()
539 Entry.CU->getFirstChildEntry(Entry.DieEntry); in markDIEEntryAsKeptRec()
540 CurChild && CurChild->getAbbreviationDeclarationPtr(); in markDIEEntryAsKeptRec()
541 CurChild = Entry.CU->getSiblingEntry(CurChild)) { in markDIEEntryAsKeptRec()
542 CompileUnit::DIEInfo ChildInfo = Entry.CU->getDIEInfo(CurChild); in markDIEEntryAsKeptRec()
543 switch (CurChild->getTag()) { in markDIEEntryAsKeptRec()
566 switch (DIEEntry->getTag()) { in isTypeTableCandidate()
616 const auto *Abbrev = Entry.DieEntry->getAbbreviationDeclarationPtr(); in maybeAddReferencedRoots()
620 DWARFUnit &Unit = Entry.CU->getOrigUnit(); in maybeAddReferencedRoots()
623 Entry.DieEntry->getOffset() + getULEB128Size(Abbrev->getCode()); in maybeAddReferencedRoots()
626 for (const auto &AttrSpec : Abbrev->attributes()) { in maybeAddReferencedRoots()
637 std::optional<UnitEntryPairTy> RefDie = Entry.CU->resolveDIEReference( in maybeAddReferencedRoots()
642 Entry.CU->warn("cann't find referenced DIE", Entry.DieEntry); in maybeAddReferencedRoots()
646 if (!RefDie->DieEntry) { in maybeAddReferencedRoots()
648 RefDie->CU->setInterconnectedCU(); in maybeAddReferencedRoots()
649 Entry.CU->setInterconnectedCU(); in maybeAddReferencedRoots()
654 assert((Entry.CU->getUniqueID() == RefDie->CU->getUniqueID() || in maybeAddReferencedRoots()
656 "Inter-CU reference while inter-CU processing is not started"); in maybeAddReferencedRoots()
658 CompileUnit::DIEInfo &RefInfo = RefDie->CU->getDIEInfo(RefDie->DieEntry); in maybeAddReferencedRoots()
673 if (isNamespaceLikeEntry(RefDie->DieEntry)) { in maybeAddReferencedRoots()
698 switch (Entry.DieEntry->getTag()) { in getRootForSpecifiedEntry()
711 std::optional<uint32_t> ParentIdx = Result.DieEntry->getParentIdx(); in getRootForSpecifiedEntry()
716 Result.CU->getDebugInfoEntry(*ParentIdx); in getRootForSpecifiedEntry()
727 DWARFDie DIE = Entry.CU->getDIE(Entry.DieEntry); in isLiveVariableEntry()
728 CompileUnit::DIEInfo &Info = Entry.CU->getDIEInfo(DIE); in isLiveVariableEntry()
734 Abbrev->findAttributeIndex(dwarf::DW_AT_const_value)) { in isLiveVariableEntry()
737 // See if there is a relocation to a valid debug map entry inside this in isLiveVariableEntry()
739 // check if the variable has a location expression address. However, we in isLiveVariableEntry()
740 // don't want a static variable in a function to force us to keep the in isLiveVariableEntry()
743 Entry.CU->getContaingFile().Addresses->getVariableRelocAdjustment( in isLiveVariableEntry()
744 DIE, Entry.CU->getGlobalData().getOptions().Verbose); in isLiveVariableEntry()
753 !Entry.CU->getGlobalData().getOptions().KeepFunctionForStatic) in isLiveVariableEntry()
759 if (Entry.CU->getGlobalData().getOptions().Verbose) { in isLiveVariableEntry()
763 DumpOpts.Verbose = Entry.CU->getGlobalData().getOptions().Verbose; in isLiveVariableEntry()
771 DWARFDie DIE = Entry.CU->getDIE(Entry.DieEntry); in isLiveSubprogramEntry()
772 CompileUnit::DIEInfo &Info = Entry.CU->getDIEInfo(Entry.DieEntry); in isLiveSubprogramEntry()
786 Entry.CU->getContaingFile().Addresses->getSubprogramRelocAdjustment( in isLiveSubprogramEntry()
787 DIE, Entry.CU->getGlobalData().getOptions().Verbose); in isLiveSubprogramEntry()
796 Entry.CU->warn("function without high_pc. Range will be discarded.", in isLiveSubprogramEntry()
802 Entry.CU->warn("low_pc greater than high_pc. Range will be discarded.", in isLiveSubprogramEntry()
807 if (Entry.CU->hasLabelAt(*LowPc)) in isLiveSubprogramEntry()
810 // FIXME: dsymutil-classic compat. dsymutil-classic doesn't consider in isLiveSubprogramEntry()
813 // where a label marking the end of a function will have a PC == CU's in isLiveSubprogramEntry()
815 if (dwarf::toAddress(Entry.CU->find(Entry.DieEntry, dwarf::DW_AT_high_pc)) in isLiveSubprogramEntry()
819 Entry.CU->addLabelLowPc(*LowPc, *RelocAdjustment); in isLiveSubprogramEntry()
824 if (Entry.CU->getGlobalData().getOptions().Verbose) { in isLiveSubprogramEntry()
828 DumpOpts.Verbose = Entry.CU->getGlobalData().getOptions().Verbose; in isLiveSubprogramEntry()
835 Entry.CU->addFunctionRange(*LowPc, *HighPc, *RelocAdjustment); in isLiveSubprogramEntry()