[llvm] 1dbc2aa - [PassBuilder] Parse machine function analyses inside require/invalidate (#96634)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 26 02:10:51 PDT 2024
Author: paperchalice
Date: 2024-06-26T17:10:48+08:00
New Revision: 1dbc2aad68f29f9d6306f6329610e1eca8afb3fe
URL: https://github.com/llvm/llvm-project/commit/1dbc2aad68f29f9d6306f6329610e1eca8afb3fe
DIFF: https://github.com/llvm/llvm-project/commit/1dbc2aad68f29f9d6306f6329610e1eca8afb3fe.diff
LOG: [PassBuilder] Parse machine function analyses inside require/invalidate (#96634)
Now we have several machine function analyses but forgot to support them
in `parseMachinePass`.
Added:
Modified:
llvm/lib/Passes/PassBuilder.cpp
llvm/test/tools/llc/new-pm/pipeline.mir
Removed:
################################################################################
diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp
index e2f0515f5275e..a87d0b5955b83 100644
--- a/llvm/lib/Passes/PassBuilder.cpp
+++ b/llvm/lib/Passes/PassBuilder.cpp
@@ -1910,6 +1910,18 @@ Error PassBuilder::parseMachinePass(MachineFunctionPassManager &MFPM,
MFPM.addPass(CREATE_PASS(Params.get())); \
return Error::success(); \
}
+#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
+ if (Name == "require<" NAME ">") { \
+ MFPM.addPass( \
+ RequireAnalysisPass<std::remove_reference_t<decltype(CREATE_PASS)>, \
+ MachineFunction>()); \
+ return Error::success(); \
+ } \
+ if (Name == "invalidate<" NAME ">") { \
+ MFPM.addPass(InvalidateAnalysisPass< \
+ std::remove_reference_t<decltype(CREATE_PASS)>>()); \
+ return Error::success(); \
+ }
#include "llvm/Passes/MachinePassRegistry.def"
for (auto &C : MachineFunctionPipelineParsingCallbacks)
diff --git a/llvm/test/tools/llc/new-pm/pipeline.mir b/llvm/test/tools/llc/new-pm/pipeline.mir
index 6baa710060f05..ee058f763b779 100644
--- a/llvm/test/tools/llc/new-pm/pipeline.mir
+++ b/llvm/test/tools/llc/new-pm/pipeline.mir
@@ -1,7 +1,10 @@
# RUN: llc -mtriple=x86_64-pc-linux-gnu -x mir -passes=no-op-machine-function --print-pipeline-passes -filetype=null < %s | FileCheck %s --match-full-lines
+# RUN: llc -mtriple=x86_64-pc-linux-gnu -x mir -passes='require<machine-dom-tree>,print<machine-dom-tree>' -print-pipeline-passes < %s | FileCheck --check-prefix=ANALYSIS %s
# CHECK: function(machine-function(no-op-machine-function)),PrintMIRPreparePass,function(machine-function(print))
+# ANALYSIS: require<machine-dom-tree>,print<machine-dom-tree>
+
---
name: f
body: |
More information about the llvm-commits
mailing list