Lines Matching +full:hash +full:- +full:accelerator
1 //=== DWARFLinkerImpl.cpp -------------------------------------------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
38 if (!File.Dwarf->compile_units().empty()) in LinkContext()
39 CompileUnits.reserve(File.Dwarf->getNumCompileUnits()); in LinkContext()
42 Format.Version = File.Dwarf->getMaxVersion(); in LinkContext()
43 Format.AddrSize = File.Dwarf->getCUAddrSize(); in LinkContext()
44 Endianness = File.Dwarf->isLittleEndian() ? llvm::endianness::little in LinkContext()
67 if (ObjectContexts.back()->InputDWARFFile.Dwarf) { in addObjectFile()
69 ObjectContexts.back()->InputDWARFFile.Dwarf->compile_units()) { in addObjectFile()
70 DWARFDie CUDie = CU->getUnitDIE(); in addObjectFile()
80 ObjectContexts.back()->registerModuleReference(CUDie, Loader, in addObjectFile()
110 if (Context->InputDWARFFile.Dwarf == nullptr) { in link()
111 Context->setOutputFormat(Context->getFormParams(), GlobalEndianness); in link()
116 outs() << "DEBUG MAP OBJECT: " << Context->InputDWARFFile.FileName in link()
120 Context->InputDWARFFile.Dwarf->compile_units()) { in link()
125 OrigCU->getUnitDIE().dump(outs(), 0, DumpOpts); in link()
131 verifyInput(Context->InputDWARFFile); in link()
134 GlobalEndianness = Context->getEndianness(); in link()
136 std::max(GlobalFormat.AddrSize, Context->getFormParams().AddrSize); in link()
138 Context->setOutputFormat(Context->getFormParams(), GlobalEndianness); in link()
144 Context->InputDWARFFile.Dwarf->compile_units()) { in link()
145 DWARFDie UnitDie = OrigCU->getUnitDIE(); in link()
187 if (Error Err = Context->link(ArtificialTypeUnit.get())) in link()
188 GlobalData.error(std::move(Err), Context->InputDWARFFile.FileName); in link()
190 Context->InputDWARFFile.unload(); in link()
197 if (Error Err = Context->link(ArtificialTypeUnit.get())) in link()
198 GlobalData.error(std::move(Err), Context->InputDWARFFile.FileName); in link()
200 Context->InputDWARFFile.unload(); in link()
206 if (ArtificialTypeUnit != nullptr && !ArtificialTypeUnit->getTypePool() in link()
208 ->getValue() in link()
210 ->Children.empty()) { in link()
212 if (Error Err = ArtificialTypeUnit->finishCloningAndEmit( in link()
231 if (!File.Dwarf->verify(OS, DumpOpts.noImplicitRecursion())) { in verifyInput()
245 "set number of threads to 1 to make --verbose to work properly.", ""); in validateAndUpdateOptions()
248 // Do not do types deduplication in case --update. in validateAndUpdateOptions()
323 if (!Quiet && GlobalData.getOptions().Verbose && (Cached->second != DwoId)) in isClangModuleRef()
325 Twine("hash mismatch: this object file was built against a " in isClangModuleRef()
342 /// hash.
384 // Don't use the cached binary holder because we have no thread-safety in loadClangModule()
398 for (const auto &CU : ErrOrObj->Dwarf->compile_units()) { in loadClangModule()
401 auto ChildCUDie = CU->getUnitDIE(); in loadClangModule()
419 Twine("hash mismatch: this object file was built against a " in loadClangModule()
434 getUnitForOffset, CU->getFormParams(), getEndianness()); in loadClangModule()
441 ModulesCompileUnits.back().Unit->loadLineTable(); in loadClangModule()
453 InputDWARFFile.Dwarf->getDebugMacinfo(); in link()
454 InputDWARFFile.Dwarf->getDebugMacro(); in link()
464 !InputDWARFFile.Addresses->hasValidRelocs()) { in link()
474 for (const auto &OrigCU : InputDWARFFile.Dwarf->compile_units()) { in link()
476 auto CUDie = OrigCU->getUnitDIE(); in link()
486 getUnitForOffset, OrigCU->getFormParams(), getEndianness())); in link()
489 CompileUnits.back()->loadLineTable(); in link()
495 // Link self-sufficient compile units and discover inter-connected compile in link()
501 // Link all inter-connected units. in link()
505 if (Error Err = finiteLoop([&]() -> Expected<bool> { in link()
508 // Load inter-connected units. in link()
510 if (CU->isInterconnectedCU()) { in link()
511 CU->maybeResetToLoadedStage(); in link()
517 // Do liveness analysis for inter-connected units. in link()
528 if (Error Err = finiteLoop([&]() -> Expected<bool> { in link()
539 if (CU->isInterconnectedCU() && in link()
540 CU->getStage() == CompileUnit::Stage::LivenessAnalysisDone) in link()
541 CU->setStage(CompileUnit::Stage::UpdateDependenciesCompleteness); in link()
550 // Clone inter-connected units. in link()
556 // Update patches for inter-connected units. in link()
597 if (Error Err = finiteLoop([&]() -> Expected<bool> { in linkSingleCompileUnit()
615 // will collect top-level errors, which are suppressed. Module in linkSingleCompileUnit()
632 "Flag indicating new inter-connections is not set"); in linkSingleCompileUnit()
645 if (Error Err = finiteLoop([&]() -> Expected<bool> { in linkSingleCompileUnit()
661 CU.assignTypeNames(ArtificialTypeUnit->getTypePool())) in linkSingleCompileUnit()
671 CU.getContaingFile().Addresses->hasValidRelocs()) { in linkSingleCompileUnit()
714 << InputDWARFFile.Dwarf->getDWARFObj().getLocSection().Data; in emitInvariantSections()
716 << InputDWARFFile.Dwarf->getDWARFObj().getLoclistsSection().Data; in emitInvariantSections()
718 << InputDWARFFile.Dwarf->getDWARFObj().getRangesSection().Data; in emitInvariantSections()
720 << InputDWARFFile.Dwarf->getDWARFObj().getRnglistsSection().Data; in emitInvariantSections()
722 << InputDWARFFile.Dwarf->getDWARFObj().getArangesSection(); in emitInvariantSections()
724 << InputDWARFFile.Dwarf->getDWARFObj().getFrameSection().Data; in emitInvariantSections()
726 << InputDWARFFile.Dwarf->getDWARFObj().getAddrSection().Data; in emitInvariantSections()
738 const DWARFObject &InputDWARFObj = InputDWARFFile.Dwarf->getDWARFObj(); in cloneAndEmitDebugFrame()
746 for (auto CurRange : Unit->getFunctionRanges()) in cloneAndEmitDebugFrame()
779 // The -4 is to account for the CIEId we just read. in cloneAndEmitDebugFrame()
780 InputOffset += InitialLength - 4; in cloneAndEmitDebugFrame()
813 OffsetToCIERecord = IteratorInserted.first->getValue(); in cloneAndEmitDebugFrame()
830 unsigned FDERemainingBytes = InitialLength - (4 + SrcAddrSize); in cloneAndEmitDebugFrame()
831 emitFDE(OffsetToCIERecord, SrcAddrSize, Loc + Range->Value, in cloneAndEmitDebugFrame()
889 for (std::unique_ptr<CompileUnit> &CU : Context->CompileUnits) in printStatistic()
891 CU->tryGetSectionDescriptor(DebugSectionKind::DebugInfo)) in printStatistic()
892 AllDebugInfoSectionsSize += (*DebugInfo)->getContents().size(); in printStatistic()
894 SizeByObject[Context->InputDWARFFile.FileName].Input = in printStatistic()
895 Context->OriginalDebugInfoSize; in printStatistic()
896 SizeByObject[Context->InputDWARFFile.FileName].Output = in printStatistic()
908 auto ComputePercentange = [](int64_t Input, int64_t Output) -> float { in printStatistic()
909 const float Difference = Output - Input; in printStatistic()
918 const char *FormatStr = "{0,-45} {1,10}b {2,10}b {3,8:P}\n"; in printStatistic()
922 outs() << "----------------------------------------------------------------" in printStatistic()
923 "---------------\n"; in printStatistic()
926 outs() << "----------------------------------------------------------------" in printStatistic()
927 "---------------\n"; in printStatistic()
938 outs() << "----------------------------------------------------------------" in printStatistic()
939 "---------------\n"; in printStatistic()
942 outs() << "----------------------------------------------------------------" in printStatistic()
943 "---------------\n\n"; in printStatistic()
968 if (!Entry->isIndexed()) { in assignOffsetsToStrings()
969 Entry->Offset = CurDebugStrOffset; in assignOffsetsToStrings()
970 CurDebugStrOffset += Entry->String.size() + 1; in assignOffsetsToStrings()
971 Entry->Index = CurDebugStrIndex++; in assignOffsetsToStrings()
979 if (!Entry->isIndexed()) { in assignOffsetsToStrings()
980 Entry->Offset = CurDebugLineStrOffset; in assignOffsetsToStrings()
981 CurDebugLineStrOffset += Entry->String.size() + 1; in assignOffsetsToStrings()
982 Entry->Index = CurDebugLineStrIndex++; in assignOffsetsToStrings()
1001 // We use already allocated string patches and accelerator entries: in forEachOutputString()
1006 CU->forEach([&](SectionDescriptor &OutSection) { in forEachOutputString()
1016 CU->forEachAcceleratorRecord([&](DwarfUnit::AccelInfo &Info) { in forEachOutputString()
1022 ArtificialTypeUnit->forEach([&](SectionDescriptor &OutSection) { in forEachOutputString()
1057 for (LinkContext::RefModuleUnit &ModuleUnit : Context->ModulesCompileUnits) in forEachObjectSectionsSet()
1058 if (ModuleUnit.Unit->getStage() != CompileUnit::Stage::Skipped) in forEachObjectSectionsSet()
1067 for (std::unique_ptr<CompileUnit> &CU : Context->CompileUnits) in forEachObjectSectionsSet()
1068 if (CU->getStage() != CompileUnit::Stage::Skipped) in forEachObjectSectionsSet()
1080 for (LinkContext::RefModuleUnit &ModuleUnit : Context->ModulesCompileUnits) in forEachCompileAndTypeUnit()
1081 if (ModuleUnit.Unit->getStage() != CompileUnit::Stage::Skipped) in forEachCompileAndTypeUnit()
1086 for (std::unique_ptr<CompileUnit> &CU : Context->CompileUnits) in forEachCompileAndTypeUnit()
1087 if (CU->getStage() != CompileUnit::Stage::Skipped) in forEachCompileAndTypeUnit()
1095 for (LinkContext::RefModuleUnit &ModuleUnit : Context->ModulesCompileUnits) in forEachCompileUnit()
1096 if (ModuleUnit.Unit->getStage() != CompileUnit::Stage::Skipped) in forEachCompileUnit()
1101 for (std::unique_ptr<CompileUnit> &CU : Context->CompileUnits) in forEachCompileUnit()
1102 if (CU->getStage() != CompileUnit::Stage::Skipped) in forEachCompileUnit()
1143 // Emit apple accelerator sections. in emitCommonSectionsAndWriteCompileUnitsToTheOutput()
1165 // Emit zero length string. Accelerator tables does not work correctly in emitStringSections()
1177 assert(StringToEmit->isIndexed()); in emitStringSections()
1182 if (StringToEmit->Offset >= DebugStrNextOffset) { in emitStringSections()
1184 StringToEmit->Offset + StringToEmit->String.size() + 1; in emitStringSections()
1187 .emitInplaceString(StringToEmit->String); in emitStringSections()
1193 assert(StringToEmit->isIndexed()); in emitStringSections()
1198 if (StringToEmit->Offset >= DebugLineStrNextOffset) { in emitStringSections()
1200 StringToEmit->Offset + StringToEmit->String.size() + 1; in emitStringSections()
1203 .emitInplaceString(StringToEmit->String); in emitStringSections()
1217 CU->forEachAcceleratorRecord([&](const DwarfUnit::AccelInfo &Info) { in emitAppleAcceleratorSections()
1221 llvm_unreachable("Unknown accelerator record"); in emitAppleAcceleratorSections()
1226 CU->getSectionDescriptor(DebugSectionKind::DebugInfo).StartOffset + in emitAppleAcceleratorSections()
1232 CU->getSectionDescriptor(DebugSectionKind::DebugInfo).StartOffset + in emitAppleAcceleratorSections()
1238 CU->getSectionDescriptor(DebugSectionKind::DebugInfo).StartOffset + in emitAppleAcceleratorSections()
1244 CU->getSectionDescriptor(DebugSectionKind::DebugInfo).StartOffset + in emitAppleAcceleratorSections()
1256 // FIXME: we use AsmPrinter to emit accelerator sections. in emitAppleAcceleratorSections()
1257 // It might be beneficial to directly emit accelerator data in emitAppleAcceleratorSections()
1277 // FIXME: we use AsmPrinter to emit accelerator sections. in emitAppleAcceleratorSections()
1278 // It might be beneficial to directly emit accelerator data in emitAppleAcceleratorSections()
1298 // FIXME: we use AsmPrinter to emit accelerator sections. in emitAppleAcceleratorSections()
1299 // It might be beneficial to directly emit accelerator data in emitAppleAcceleratorSections()
1319 // FIXME: we use AsmPrinter to emit accelerator sections. in emitAppleAcceleratorSections()
1320 // It might be beneficial to directly emit accelerator data in emitAppleAcceleratorSections()
1350 CU->forEachAcceleratorRecord([&](const DwarfUnit::AccelInfo &Info) { in emitDWARFv5DebugNamesSection()
1359 DebugNames->addName(*DebugStrStrings.getExistingEntry(Info.String), in emitDWARFv5DebugNamesSection()
1361 Info.Tag, CU->getUniqueID(), in emitDWARFv5DebugNamesSection()
1362 CU->getTag() == dwarf::DW_TAG_type_unit); in emitDWARFv5DebugNamesSection()
1372 CU->getOrCreateSectionDescriptor(DebugSectionKind::DebugInfo) in emitDWARFv5DebugNamesSection()
1374 CUidToIdx[CU->getUniqueID()] = Id++; in emitDWARFv5DebugNamesSection()
1379 // FIXME: we use AsmPrinter to emit accelerator sections. in emitDWARFv5DebugNamesSection()
1380 // It might be beneficial to directly emit accelerator data in emitDWARFv5DebugNamesSection()