• Home
  • Raw
  • Download

Lines Matching +full:helper +full:- +full:module +full:- +full:transforms

1 //===-ThinLTOCodeGenerator.cpp - LLVM Link Time Optimizer -----------------===//
8 //===----------------------------------------------------------------------===//
13 //===----------------------------------------------------------------------===//
46 #include "llvm/Transforms/IPO.h"
47 #include "llvm/Transforms/IPO/FunctionImport.h"
48 #include "llvm/Transforms/IPO/Internalize.h"
49 #include "llvm/Transforms/IPO/PassManagerBuilder.h"
50 #include "llvm/Transforms/ObjCARC.h"
51 #include "llvm/Transforms/Utils/FunctionImportUtils.h"
60 // Flags -discard-value-names, defined in LTOCodeGenerator.cpp
75 // Simple helper to save temporary files for debug.
76 static void saveTempBitcode(const Module &TheModule, StringRef TempDir, in saveTempBitcode()
95 auto Linkage = Summary->linkage(); in getFirstDefinitionForLinker()
100 return StrongDefForLinker->get(); in getFirstDefinitionForLinker()
105 auto Linkage = Summary->linkage(); in getFirstDefinitionForLinker()
111 return FirstDefForLinker->get(); in getFirstDefinitionForLinker()
142 static void promoteModule(Module &TheModule, const ModuleSummaryIndex &Index) { in promoteModule()
148 crossImportIntoModule(Module &TheModule, const ModuleSummaryIndex &Index, in crossImportIntoModule()
156 static void optimizeModule(Module &TheModule, TargetMachine &TM) { in optimizeModule()
194 std::unique_ptr<MemoryBuffer> codegenModule(Module &TheModule, in codegenModule()
218 /// Manage caching for a single Module.
223 // Create a cache entry. This compute a unique hash for the Module considering
237 // This is based on the current compiler version, the module itself, the in ModuleCacheEntry()
238 // export list, the hash for every single module in the import list, the in ModuleCacheEntry()
239 // list of ResolvedODR for the module, and the list of preserved symbols. in ModuleCacheEntry()
249 // Include the hash for the current module in ModuleCacheEntry()
256 // Include the hash for every module we import functions from in ModuleCacheEntry()
307 OS << OutputBuffer->getBuffer(); in write()
317 OS << OutputBuffer->getBuffer(); in write()
331 ProcessThinLTOModule(Module &TheModule, ModuleSummaryIndex &Index, in ProcessThinLTOModule()
341 // "Benchmark"-like optimization: single-source case in ProcessThinLTOModule()
347 // Apply summary-based LinkOnce/Weak resolution decisions. in ProcessThinLTOModule()
354 // Be friendly and don't nuke totally the module when the client didn't in ProcessThinLTOModule()
357 // Apply summary-based internalization decisions. in ProcessThinLTOModule()
367 // Save temps: after cross-module import. in ProcessThinLTOModule()
392 /// at least one copy kept) and a compile-time optimization (to drop duplicate
407 return Prevailing->second == S; in resolveWeakForLinkerInIndex()
440 // First module added, so initialize the triple and some options in addModule()
462 // we're conservatively considering cross-references as preserved. in crossReferenceSymbol()
480 return std::unique_ptr<TargetMachine>(TheTarget->createTargetMachine( in create()
487 * "thin-link".
502 auto Index = (*ObjOrErr)->takeIndex(); in linkCombinedIndex()
504 CombinedIndex->mergeFrom(std::move(Index), ++NextModuleId); in linkCombinedIndex()
516 void ThinLTOCodeGenerator::promote(Module &TheModule, in promote()
520 // Collect for each module the list of function it defines (GUID -> Summary). in promote()
541 * Perform cross-module importing for the module identified by ModuleIdentifier.
543 void ThinLTOCodeGenerator::crossModuleImport(Module &TheModule, in crossModuleImport()
548 // Collect for each module the list of function it defines (GUID -> Summary). in crossModuleImport()
563 * Compute the list of summaries needed for importing into module.
570 // Collect for each module the list of function it defines (GUID -> Summary). in gatherImportedSummariesForModule()
586 * Emit the list of files needed for importing into module.
593 // Collect for each module the list of function it defines (GUID -> Summary). in emitImports()
612 void ThinLTOCodeGenerator::internalize(Module &TheModule, in internalize()
622 // Collect for each module the list of function it defines (GUID -> Summary). in internalize()
633 // Be friendly and don't nuke totally the module when the client didn't in internalize()
642 ExportList->second.count(GUID)) || in internalize()
651 * Perform post-importing ThinLTO optimizations.
653 void ThinLTOCodeGenerator::optimize(Module &TheModule) { in optimize()
663 std::unique_ptr<MemoryBuffer> ThinLTOCodeGenerator::codegen(Module &TheModule) { in codegen()
681 // Parse module now in run()
710 // Prepare the module map. in run()
714 // Collect for each module the list of function it defines (GUID -> Summary). in run()
716 Index->collectDefinedGVSummariesPerModule(ModuleToDefinedGVSummaries); in run()
718 // Collect the import/export lists for all modules from the call-graph in the in run()
743 ExportList->second.count(GUID)) || in run()
747 // Use global summary-based analysis to identify symbols that can be in run()
752 // Make sure that every module has an entry in the ExportLists and in run()
760 // is to sort them per size so that the largest module get schedule as soon as in run()
761 // possible. This is purely a compile-time optimization. in run()
783 // The module may be cached, this helps handling it. in run()
806 // Parse module now in run()