[llvm] [NewPM] Teach llc -passes to handle target machine analysis (PR #191704)

via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 12 06:36:02 PDT 2026


================
@@ -151,6 +159,16 @@ PB.registerPipelineParsingCallback([=](StringRef Name, FunctionPassManager &PM,
   return false;
 });
 
+PB.registerPipelineParsingCallback([=](StringRef Name,
+                                       MachineFunctionPassManager &PM,
+                                       ArrayRef<PassBuilder::PipelineElement>) {
+#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS)                           \
+  ADD_ANALYSIS_PASS(NAME, CREATE_PASS)
+#include GET_PASS_REGISTRY
+#undef MACHINE_FUNCTION_ANALYSIS
+  return false;
+});
+
----------------
paperchalice wrote:

This is implementation is for machine function analysis only, target like DirectX has some IR analyses, so it is worth to support other IR kinds.
Maybe we could introduce something like `<IRUnit>PassManager::IRUnitT` to simplifiy it, but this is out of scope for this pr.

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


More information about the llvm-commits mailing list