Lines Matching defs:TheModule
96 static void saveTempBitcode(const Module &TheModule, StringRef TempDir,
107 WriteBitcodeToFile(TheModule, OS, /* ShouldPreserveUseListOrder */ true);
163 static void promoteModule(Module &TheModule, const ModuleSummaryIndex &Index,
165 if (renameModuleForThinLTO(TheModule, Index, ClearDSOLocalOnDeclarations))
181 static void verifyLoadedModule(Module &TheModule) {
183 if (verifyModule(TheModule, &dbgs(), &BrokenDebugInfo))
186 TheModule.getContext().diagnose(ThinLTODiagnosticInfo(
188 StripDebugInfo(TheModule);
216 crossImportIntoModule(Module &TheModule, const ModuleSummaryIndex &Index,
222 return loadModuleFromInput(Input, TheModule.getContext(),
227 Expected<bool> Result = Importer.importFunctions(TheModule, ImportList);
230 SMDiagnostic Err = SMDiagnostic(TheModule.getModuleIdentifier(),
237 verifyLoadedModule(TheModule);
240 static void optimizeModule(Module &TheModule, TargetMachine &TM,
250 StandardInstrumentations SI(TheModule.getContext(), DebugPassManager);
293 MPM.run(TheModule, MAM);
329 std::unique_ptr<MemoryBuffer> codegenModule(Module &TheModule,
348 PM.run(TheModule);
433 ProcessThinLTOModule(Module &TheModule, ModuleSummaryIndex &Index,
451 TheModule.getPIELevel() == PIELevel::Default;
454 promoteModule(TheModule, Index, ClearDSOLocalOnDeclarations);
457 thinLTOFinalizeInModule(TheModule, DefinedGlobals, /*PropagateAttrs=*/true);
460 saveTempBitcode(TheModule, SaveTempsDir, count, ".1.promoted.bc");
467 thinLTOInternalizeModule(TheModule, DefinedGlobals);
471 saveTempBitcode(TheModule, SaveTempsDir, count, ".2.internalized.bc");
474 crossImportIntoModule(TheModule, Index, ModuleMap, ImportList,
480 updatePublicTypeTestCalls(TheModule,
484 saveTempBitcode(TheModule, SaveTempsDir, count, ".3.imported.bc");
486 optimizeModule(TheModule, TM, OptLevel, Freestanding, DebugPassManager,
489 saveTempBitcode(TheModule, SaveTempsDir, count, ".4.opt.bc");
496 ProfileSummaryInfo PSI(TheModule);
497 auto Index = buildModuleSummaryIndex(TheModule, nullptr, &PSI);
498 WriteBitcodeToFile(TheModule, OS, true, &Index);
504 return codegenModule(TheModule, TM);
676 void ThinLTOCodeGenerator::promote(Module &TheModule, ModuleSummaryIndex &Index,
679 auto ModuleIdentifier = TheModule.getModuleIdentifier();
687 File, PreservedSymbols, Triple(TheModule.getTargetTriple()));
711 thinLTOFinalizeInModule(TheModule,
722 promoteModule(TheModule, Index, /*ClearDSOLocalOnDeclarations=*/false);
728 void ThinLTOCodeGenerator::crossModuleImport(Module &TheModule,
740 File, PreservedSymbols, Triple(TheModule.getTargetTriple()));
757 auto &ImportList = ImportLists[TheModule.getModuleIdentifier()];
760 crossImportIntoModule(TheModule, Index, ModuleMap, ImportList,
768 Module &TheModule, ModuleSummaryIndex &Index,
772 auto ModuleIdentifier = TheModule.getModuleIdentifier();
780 File, PreservedSymbols, Triple(TheModule.getTargetTriple()));
806 void ThinLTOCodeGenerator::emitImports(Module &TheModule, StringRef OutputName,
810 auto ModuleIdentifier = TheModule.getModuleIdentifier();
818 File, PreservedSymbols, Triple(TheModule.getTargetTriple()));
856 void ThinLTOCodeGenerator::internalize(Module &TheModule,
859 initTMBuilder(TMBuilder, Triple(TheModule.getTargetTriple()));
861 auto ModuleIdentifier = TheModule.getModuleIdentifier();
905 promoteModule(TheModule, Index, /*ClearDSOLocalOnDeclarations=*/false);
908 thinLTOFinalizeInModule(TheModule,
912 thinLTOInternalizeModule(TheModule,
919 void ThinLTOCodeGenerator::optimize(Module &TheModule) {
920 initTMBuilder(TMBuilder, Triple(TheModule.getTargetTriple()));
923 optimizeModule(TheModule, *TMBuilder.create(), OptLevel, Freestanding,
996 auto TheModule = loadModuleFromInput(Mod.get(), Context, false,
1000 auto OutputBuffer = codegenModule(*TheModule, *TMBuilder.create());
1181 auto TheModule = loadModuleFromInput(Mod.get(), Context, false,
1185 saveTempBitcode(*TheModule, SaveTempsDir, count, ".0.original.bc");
1190 *TheModule, *Index, ModuleMap, *TMBuilder.create(), ImportList,