Lines Matching refs:M

107 void promoteTypeIds(Module &M, StringRef ModuleId) {  in promoteTypeIds()  argument
117 GlobalMD = MDString::get(M.getContext(), NewName); in promoteTypeIds()
121 MetadataAsValue::get(M.getContext(), GlobalMD)); in promoteTypeIds()
126 M.getFunction(Intrinsic::getName(Intrinsic::type_test))) { in promoteTypeIds()
134 M.getFunction(Intrinsic::getName(Intrinsic::public_type_test))) { in promoteTypeIds()
142 M.getFunction(Intrinsic::getName(Intrinsic::type_checked_load))) { in promoteTypeIds()
149 if (Function *TypeCheckedLoadRelativeFunc = M.getFunction( in promoteTypeIds()
157 for (GlobalObject &GO : M.global_objects()) { in promoteTypeIds()
170 *MDNode::get(M.getContext(), {MD->getOperand(0), I->second})); in promoteTypeIds()
177 void simplifyExternals(Module &M) { in simplifyExternals() argument
179 FunctionType::get(Type::getVoidTy(M.getContext()), false); in simplifyExternals()
181 for (Function &F : llvm::make_early_inc_range(M)) { in simplifyExternals()
194 F.getAddressSpace(), "", &M); in simplifyExternals()
197 NewF->setAttributes(AttributeList::get(M.getContext(), in simplifyExternals()
205 for (GlobalIFunc &I : llvm::make_early_inc_range(M.ifuncs())) { in simplifyExternals()
212 for (GlobalVariable &GV : llvm::make_early_inc_range(M.globals())) { in simplifyExternals()
221 filterModule(Module *M, in filterModule() argument
224 for (GlobalValue &GV : M->global_values()) in filterModule()
263 static bool enableUnifiedLTO(Module &M) { in enableUnifiedLTO() argument
266 mdconst::extract_or_null<ConstantInt>(M.getModuleFlag("UnifiedLTO"))) in enableUnifiedLTO()
277 function_ref<AAResults &(Function &)> AARGetter, Module &M) { in splitAndWriteThinLTOBitcode() argument
278 std::string ModuleId = getUniqueModuleId(&M); in splitAndWriteThinLTOBitcode()
280 assert(!enableUnifiedLTO(M)); in splitAndWriteThinLTOBitcode()
283 ProfileSummaryInfo PSI(M); in splitAndWriteThinLTOBitcode()
284 M.addModuleFlag(Module::Error, "ThinLTO", uint32_t(0)); in splitAndWriteThinLTOBitcode()
285 ModuleSummaryIndex Index = buildModuleSummaryIndex(M, nullptr, &PSI); in splitAndWriteThinLTOBitcode()
286 WriteBitcodeToFile(M, OS, /*ShouldPreserveUseListOrder=*/false, &Index, in splitAndWriteThinLTOBitcode()
292 WriteBitcodeToFile(M, *ThinLinkOS, /*ShouldPreserveUseListOrder=*/false, in splitAndWriteThinLTOBitcode()
298 promoteTypeIds(M, ModuleId); in splitAndWriteThinLTOBitcode()
331 for (GlobalVariable &GV : M.globals()) in splitAndWriteThinLTOBitcode()
354 CloneModule(M, VMap, [&](const GlobalValue *GV) -> bool { in splitAndWriteThinLTOBitcode()
370 cloneUsedGlobalVariables(M, *MergedM, /*CompilerUsed*/ false); in splitAndWriteThinLTOBitcode()
371 cloneUsedGlobalVariables(M, *MergedM, /*CompilerUsed*/ true); in splitAndWriteThinLTOBitcode()
383 for (auto &F : M) in splitAndWriteThinLTOBitcode()
389 filterModule(&M, [&](const GlobalValue *GV) { in splitAndWriteThinLTOBitcode()
399 promoteInternals(*MergedM, M, ModuleId, CfiFunctions); in splitAndWriteThinLTOBitcode()
400 promoteInternals(M, *MergedM, ModuleId, CfiFunctions); in splitAndWriteThinLTOBitcode()
431 for (auto &A : M.aliases()) { in splitAndWriteThinLTOBitcode()
456 ModuleSymbolTable::CollectAsmSymvers(M, [&](StringRef Name, StringRef Alias) { in splitAndWriteThinLTOBitcode()
457 Function *F = M.getFunction(Name); in splitAndWriteThinLTOBitcode()
474 ProfileSummaryInfo PSI(M); in splitAndWriteThinLTOBitcode()
475 ModuleSummaryIndex Index = buildModuleSummaryIndex(M, nullptr, &PSI); in splitAndWriteThinLTOBitcode()
490 W.writeModule(M, /*ShouldPreserveUseListOrder=*/false, &Index, in splitAndWriteThinLTOBitcode()
503 StripDebugInfo(M); in splitAndWriteThinLTOBitcode()
504 W2.writeThinLinkBitcode(M, Index, ModHash); in splitAndWriteThinLTOBitcode()
514 bool enableSplitLTOUnit(Module &M) { in enableSplitLTOUnit() argument
517 M.getModuleFlag("EnableSplitLTOUnit"))) in enableSplitLTOUnit()
523 bool hasTypeMetadata(Module &M) { in hasTypeMetadata() argument
524 for (auto &GO : M.global_objects()) { in hasTypeMetadata()
533 Module &M, const ModuleSummaryIndex *Index) { in writeThinLTOBitcode() argument
537 if (hasTypeMetadata(M)) { in writeThinLTOBitcode()
538 if (enableSplitLTOUnit(M)) { in writeThinLTOBitcode()
539 splitAndWriteThinLTOBitcode(OS, ThinLinkOS, AARGetter, M); in writeThinLTOBitcode()
543 std::string ModuleId = getUniqueModuleId(&M); in writeThinLTOBitcode()
545 promoteTypeIds(M, ModuleId); in writeThinLTOBitcode()
554 ProfileSummaryInfo PSI(M); in writeThinLTOBitcode()
556 buildModuleSummaryIndex(M, nullptr, &PSI)); in writeThinLTOBitcode()
567 WriteBitcodeToFile(M, OS, /*ShouldPreserveUseListOrder=*/false, Index, in writeThinLTOBitcode()
573 writeThinLinkBitcodeToFile(M, *ThinLinkOS, *Index, ModHash); in writeThinLTOBitcode()
580 llvm::ThinLTOBitcodeWriterPass::run(Module &M, ModuleAnalysisManager &AM) { in run() argument
582 AM.getResult<FunctionAnalysisManagerModuleProxy>(M).getManager(); in run()
584 ScopedDbgInfoFormatSetter FormatSetter(M, M.IsNewDbgInfoFormat && in run()
586 if (M.IsNewDbgInfoFormat) in run()
587 M.removeDebugIntrinsicDeclarations(); in run()
594 M, &AM.getResult<ModuleSummaryIndexAnalysis>(M)); in run()