[llvm] [CodeGen] Let `PassBuilder` support machine passes (PR #76320)

Akshat Oke via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 24 02:24:16 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:

What does a machine module pass mean? If it's to mean module pass but for codegen, isn't `MFPM.addPass()` wrong as it assumes the MACHINE_MODULE_PASS pass to be a `MachineFunction` pass?

@paperchalice 

https://github.com/llvm/llvm-project/pull/76320


More information about the llvm-commits mailing list