[llvm] [NewPM] Add `FunctionToMachineFunctionPassAdaptor` (PR #88711)
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 15 10:12:31 PDT 2024
================
@@ -100,13 +125,50 @@ ModuleToMachineFunctionPassAdaptor::run(Module &M, ModuleAnalysisManager &AM) {
return PA;
}
+PreservedAnalyses
+FunctionToMachineFunctionPassAdaptor::run(Function &F,
+ FunctionAnalysisManager &FAM) {
+ // Do not codegen any 'available_externally' functions at all, they have
+ // definitions outside the translation unit.
+ if (F.isDeclaration() || F.hasAvailableExternallyLinkage())
+ return PreservedAnalyses::all();
+
+ auto &MF = FAM.getResult<MachineFunctionAnalysis>(F).getMF();
+ auto &MFAM = FAM.getResult<MachineFunctionAnalysisManagerFunctionProxy>(F)
+ .getManager();
+ auto PI = FAM.getResult<PassInstrumentationAnalysis>(F);
+ PreservedAnalyses PA = PreservedAnalyses::all();
+
+ if (!PI.runBeforePass<MachineFunction>(*Pass, MF))
+ return PreservedAnalyses::all();
+ PreservedAnalyses PassPA = Pass->run(MF, MFAM);
+ MFAM.invalidate(MF, PassPA);
+ if (Pass->name() != FreeMachineFunctionPass::name()) {
----------------
aeubanks wrote:
oh I see you mentioned that in the commit descriptiong
https://github.com/llvm/llvm-project/pull/88711
More information about the llvm-commits
mailing list