Lines Matching defs:Mod

236 static void runNewPMPasses(const Config &Conf, Module &Mod, TargetMachine *TM,
271 StandardInstrumentations SI(Mod.getContext(), Conf.DebugPassManager,
351 MPM.run(Mod, MAM);
354 static bool isEmptyModule(const Module &Mod) {
358 return Mod.empty() && Mod.global_empty() && Mod.named_metadata_empty() &&
359 Mod.getModuleInlineAsm().empty();
362 bool lto::opt(const Config &Conf, TargetMachine *TM, unsigned Task, Module &Mod,
379 llvm::embedBitcodeInModule(Mod, llvm::MemoryBufferRef(),
388 if (!isEmptyModule(Mod)) {
390 runNewPMPasses(Conf, Mod, TM, Conf.OptLevel, IsThinLTO, ExportSummary,
393 return !Conf.PostOptModuleHook || Conf.PostOptModuleHook(Task, Mod);
397 AddStreamFn AddStream, unsigned Task, Module &Mod,
399 if (Conf.PreCodeGenModuleHook && !Conf.PreCodeGenModuleHook(Task, Mod))
403 llvm::embedBitcodeInModule(Mod, llvm::MemoryBufferRef(),
431 AddStream(Task, Mod.getModuleIdentifier());
438 TargetLibraryInfoImpl TLII(Triple(Mod.getTargetTriple()));
445 if (!isEmptyModule(Mod))
454 CodeGenPasses.run(Mod);
462 unsigned ParallelCodeGenParallelismLevel, Module &Mod,
503 if (!TM->splitModule(Mod, ParallelCodeGenParallelismLevel,
505 SplitModule(Mod, ParallelCodeGenParallelismLevel, HandleModulePartition,
516 Module &Mod) {
518 Mod.setTargetTriple(C.OverrideTriple);
519 else if (Mod.getTargetTriple().empty())
520 Mod.setTargetTriple(C.DefaultTriple);
523 const Target *T = TargetRegistry::lookupTarget(Mod.getTargetTriple(), Msg);
541 unsigned ParallelCodeGenParallelismLevel, Module &Mod,
543 Expected<const Target *> TOrErr = initAndLookupTarget(C, Mod);
547 std::unique_ptr<TargetMachine> TM = createTargetMachine(C, *TOrErr, Mod);
551 if (!opt(C, TM.get(), 0, Mod, /*IsThinLTO=*/false,
558 codegen(C, TM.get(), AddStream, 0, Mod, CombinedIndex);
560 splitCodeGen(C, TM.get(), AddStream, ParallelCodeGenParallelismLevel, Mod,
566 static void dropDeadSymbols(Module &Mod, const GVSummaryMapTy &DefinedGlobals,
569 for (auto &GV : Mod.global_values())
588 Module &Mod, const ModuleSummaryIndex &CombinedIndex,
594 Expected<const Target *> TOrErr = initAndLookupTarget(Conf, Mod);
598 std::unique_ptr<TargetMachine> TM = createTargetMachine(Conf, *TOrErr, Mod);
602 Mod.getContext(), Conf.RemarksFilename, Conf.RemarksPasses,
611 Mod.setPartialSampleProfileRatio(CombinedIndex);
617 codegen(Conf, TM.get(), AddStream, Task, Mod, CombinedIndex);
621 if (Conf.PreOptModuleHook && !Conf.PreOptModuleHook(Task, Mod))
625 [&](Module &Mod, TargetMachine *TM,
628 if (!opt(Conf, TM, Task, Mod, /*IsThinLTO=*/true,
638 cgdata::saveModuleForTwoRounds(Mod, Task, IRAddStream);
640 codegen(Conf, TM, AddStream, Task, Mod, CombinedIndex);
645 return OptimizeAndCodegen(Mod, TM.get(), std::move(DiagnosticOutputFile));
652 Mod.getPIELevel() == PIELevel::Default;
653 renameModuleForThinLTO(Mod, CombinedIndex, ClearDSOLocalOnDeclarations);
655 dropDeadSymbols(Mod, DefinedGlobals, CombinedIndex);
657 thinLTOFinalizeInModule(Mod, DefinedGlobals, /*PropagateAttrs=*/true);
659 if (Conf.PostPromoteModuleHook && !Conf.PostPromoteModuleHook(Task, Mod))
663 thinLTOInternalizeModule(Mod, DefinedGlobals);
666 !Conf.PostInternalizeModuleHook(Task, Mod))
670 assert(Mod.getContext().isODRUniquingDebugTypes() &&
675 return I->second.getLazyModule(Mod.getContext(),
695 BMOrErr->getLazyModule(Mod.getContext(),
705 if (Error Err = Importer.importFunctions(Mod, ImportList).takeError())
709 updateMemProfAttributes(Mod, CombinedIndex);
710 updatePublicTypeTestCalls(Mod, CombinedIndex.withWholeProgramVisibility());
712 if (Conf.PostImportModuleHook && !Conf.PostImportModuleHook(Task, Mod))
715 return OptimizeAndCodegen(Mod, TM.get(), std::move(DiagnosticOutputFile));