[llvm] [CodeGen] Let `PassBuilder` support machine passes (PR #76320)
Akshat Oke via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 24 22:29:57 PDT 2024
================
@@ -1877,6 +1894,33 @@ Error PassBuilder::parseLoopPass(LoopPassManager &LPM,
inconvertibleErrorCode());
}
+Error PassBuilder::parseMachinePass(MachineFunctionPassManager &MFPM,
+ const PipelineElement &E) {
+ StringRef Name = E.Name;
+ if (!E.InnerPipeline.empty())
+ return make_error<StringError>("invalid pipeline",
+ inconvertibleErrorCode());
+
+#define MACHINE_MODULE_PASS(NAME, PASS_NAME, CONSTRUCTOR) \
+ if (Name == NAME) { \
+ MFPM.addPass(PASS_NAME()); \
+ return Error::success(); \
+ }
----------------
optimisan wrote:
I see, yes. To summarize, Machine module passes are Module passes that modify `MachineFunction`s via `MAM.getResult<Function...Proxy>(M)..getResult<MachineFunctionAnalysis>(F)`.
https://github.com/llvm/llvm-project/pull/76320
More information about the llvm-commits
mailing list