[llvm] [Passes] Move machine function pass registries to PassRegistry.def (PR #203659)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 12 18:51:27 PDT 2026


https://github.com/paperchalice created https://github.com/llvm/llvm-project/pull/203659

Let PassRegistry.def store all pass registries, dummy pass registries still need to live in MachinePassRegistry.def.

>From 3084b593cb42bd274564b74d608ebb346f484b74 Mon Sep 17 00:00:00 2001
From: PaperChalice <liujunchang97 at outlook.com>
Date: Sat, 13 Jun 2026 09:46:42 +0800
Subject: [PATCH] [Passes] Move machine function pass registries to
 PassRegistry.def

---
 .../llvm/Passes/MachinePassRegistry.def       | 238 ------------------
 llvm/lib/Passes/PassBuilder.cpp               |  20 +-
 llvm/lib/Passes/PassRegistry.def              | 209 +++++++++++++++
 3 files changed, 218 insertions(+), 249 deletions(-)

diff --git a/llvm/include/llvm/Passes/MachinePassRegistry.def b/llvm/include/llvm/Passes/MachinePassRegistry.def
index a297c08fac1b2..3871f5d334997 100644
--- a/llvm/include/llvm/Passes/MachinePassRegistry.def
+++ b/llvm/include/llvm/Passes/MachinePassRegistry.def
@@ -13,244 +13,6 @@
 
 // NOTE: NO INCLUDE GUARD DESIRED!
 
-#ifndef MODULE_ANALYSIS
-#define MODULE_ANALYSIS(NAME, CREATE_PASS)
-#endif
-MODULE_ANALYSIS("collector-metadata", CollectorMetadataAnalysis())
-MODULE_ANALYSIS("machine-module-info", MachineModuleAnalysis())
-MODULE_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis(PIC))
-#undef MODULE_ANALYSIS
-
-#ifndef MODULE_PASS
-#define MODULE_PASS(NAME, CREATE_PASS)
-#endif
-MODULE_PASS("global-merge", GlobalMergePass(TM, GlobalMergeOptions()))
-MODULE_PASS("jmc-instrumenter", JMCInstrumenterPass())
-MODULE_PASS("lower-emutls", LowerEmuTLSPass())
-MODULE_PASS("mir-strip-debug", StripDebugMachineModulePass())
-MODULE_PASS("pre-isel-intrinsic-lowering", PreISelIntrinsicLoweringPass())
-MODULE_PASS("print<regusage>", PhysicalRegisterUsageInfoPrinterPass(errs()))
-MODULE_PASS("shadow-stack-gc-lowering", ShadowStackGCLoweringPass())
-MODULE_PASS("global-merge-func", GlobalMergeFuncPass())
-#undef MODULE_PASS
-
-#ifndef FUNCTION_ANALYSIS
-#define FUNCTION_ANALYSIS(NAME, CREATE_PASS)
-#endif
-FUNCTION_ANALYSIS("gc-function", GCFunctionAnalysis())
-FUNCTION_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis(PIC))
-FUNCTION_ANALYSIS("ssp-layout", SSPLayoutAnalysis())
-FUNCTION_ANALYSIS("target-ir", TargetIRAnalysis(std::move(TM.getTargetIRAnalysis())))
-#undef FUNCTION_ANALYSIS
-
-#ifndef LOOP_PASS
-#define LOOP_PASS(NAME, CREATE_PASS)
-#endif
-LOOP_PASS("loop-reduce", LoopStrengthReducePass())
-LOOP_PASS("loop-term-fold", LoopTermFoldPass())
-#undef LOOP_PASS
-
-#ifndef MACHINE_MODULE_PASS
-#define MACHINE_MODULE_PASS(NAME, CREATE_PASS)
-#endif
-#undef MACHINE_MODULE_PASS
-
-#ifndef MACHINE_FUNCTION_ANALYSIS
-#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS)
-#endif
-// LiveVariables currently requires pure SSA form.
-// FIXME: Once TwoAddressInstruction pass no longer uses kill flags,
-// LiveVariables can be removed completely, and LiveIntervals can be directly
-// computed. (We still either need to regenerate kill flags after regalloc, or
-// preferably fix the scavenger to not depend on them).
-MACHINE_FUNCTION_ANALYSIS("edge-bundles", EdgeBundlesAnalysis())
-MACHINE_FUNCTION_ANALYSIS("gisel-cse-analysis", GISelCSEAnalysis(TM))
-MACHINE_FUNCTION_ANALYSIS("gisel-value-tracking", GISelValueTrackingAnalysis())
-MACHINE_FUNCTION_ANALYSIS("livedebugvars", LiveDebugVariablesAnalysis())
-MACHINE_FUNCTION_ANALYSIS("live-intervals", LiveIntervalsAnalysis())
-MACHINE_FUNCTION_ANALYSIS("live-reg-matrix", LiveRegMatrixAnalysis())
-MACHINE_FUNCTION_ANALYSIS("live-stacks", LiveStacksAnalysis())
-MACHINE_FUNCTION_ANALYSIS("live-vars", LiveVariablesAnalysis())
-MACHINE_FUNCTION_ANALYSIS("machine-block-freq", MachineBlockFrequencyAnalysis())
-MACHINE_FUNCTION_ANALYSIS("machine-block-hash", MachineBlockHashInfoAnalysis())
-MACHINE_FUNCTION_ANALYSIS("machine-branch-prob",
-                          MachineBranchProbabilityAnalysis())
-MACHINE_FUNCTION_ANALYSIS("machine-cycles", MachineCycleAnalysis())
-MACHINE_FUNCTION_ANALYSIS("machine-dom-frontier", MachineDominanceFrontierAnalysis())
-MACHINE_FUNCTION_ANALYSIS("machine-dom-tree", MachineDominatorTreeAnalysis())
-MACHINE_FUNCTION_ANALYSIS("machine-loops", MachineLoopAnalysis())
-MACHINE_FUNCTION_ANALYSIS("machine-opt-remark-emitter",
-                          MachineOptimizationRemarkEmitterAnalysis())
-MACHINE_FUNCTION_ANALYSIS("machine-post-dom-tree",
-                          MachinePostDominatorTreeAnalysis())
-MACHINE_FUNCTION_ANALYSIS("machine-trace-metrics", MachineTraceMetricsAnalysis())
-MACHINE_FUNCTION_ANALYSIS("machine-uniformity", MachineUniformityAnalysis())
-MACHINE_FUNCTION_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis(PIC))
-MACHINE_FUNCTION_ANALYSIS("reaching-def", ReachingDefAnalysis())
-MACHINE_FUNCTION_ANALYSIS("regalloc-evict", RegAllocEvictionAdvisorAnalysis())
-MACHINE_FUNCTION_ANALYSIS("regalloc-priority", RegAllocPriorityAdvisorAnalysis())
-MACHINE_FUNCTION_ANALYSIS("slot-indexes", SlotIndexesAnalysis())
-MACHINE_FUNCTION_ANALYSIS("spill-code-placement", SpillPlacementAnalysis())
-MACHINE_FUNCTION_ANALYSIS("virtregmap", VirtRegMapAnalysis())
-// MACHINE_FUNCTION_ANALYSIS("lazy-machine-bfi",
-// LazyMachineBlockFrequencyInfoAnalysis())
-// MACHINE_FUNCTION_ANALYSIS("machine-loops", MachineLoopInfoAnalysis())
-// MACHINE_FUNCTION_ANALYSIS("machine-post-dom-tree",
-// MachinePostDominatorTreeAnalysis())
-// MACHINE_FUNCTION_ANALYSIS("machine-region-info",
-// MachineRegionInfoPassAnalysis())
-// MACHINE_FUNCTION_ANALYSIS("gc-analysis",
-// GCMachineCodeAnalysisPass())
-#undef MACHINE_FUNCTION_ANALYSIS
-
-#ifndef MACHINE_FUNCTION_PASS
-#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS)
-#endif
-MACHINE_FUNCTION_PASS("block-placement-stats", MachineBlockPlacementStatsPass())
-MACHINE_FUNCTION_PASS("branch-relaxation", BranchRelaxationPass())
-MACHINE_FUNCTION_PASS("break-false-deps", BreakFalseDepsPass())
-MACHINE_FUNCTION_PASS("dead-mi-elimination", DeadMachineInstructionElimPass())
-MACHINE_FUNCTION_PASS("detect-dead-lanes", DetectDeadLanesPass())
-MACHINE_FUNCTION_PASS("dot-machine-cfg", MachineCFGPrinterPass())
-MACHINE_FUNCTION_PASS("early-ifcvt", EarlyIfConverterPass())
-MACHINE_FUNCTION_PASS("early-machinelicm", EarlyMachineLICMPass())
-MACHINE_FUNCTION_PASS("early-tailduplication", EarlyTailDuplicatePass())
-MACHINE_FUNCTION_PASS("fentry-insert", FEntryInserterPass())
-MACHINE_FUNCTION_PASS("finalize-isel", FinalizeISelPass())
-MACHINE_FUNCTION_PASS("finalizebundle-test", FinalizeBundleTestPass())
-MACHINE_FUNCTION_PASS("fixup-statepoint-caller-saved", FixupStatepointCallerSavedPass())
-MACHINE_FUNCTION_PASS("init-undef", InitUndefPass())
-MACHINE_FUNCTION_PASS("kcfi", MachineKCFIPass())
-MACHINE_FUNCTION_PASS("gc-empty-basic-blocks", GCEmptyBasicBlocksPass())
-MACHINE_FUNCTION_PASS("localstackalloc", LocalStackSlotAllocationPass())
-MACHINE_FUNCTION_PASS("machine-cp", MachineCopyPropagationPass())
-MACHINE_FUNCTION_PASS("machine-cse", MachineCSEPass())
-MACHINE_FUNCTION_PASS("machine-latecleanup", MachineLateInstrsCleanupPass())
-MACHINE_FUNCTION_PASS("machine-sanmd", MachineSanitizerBinaryMetadataPass())
-MACHINE_FUNCTION_PASS("machine-scheduler", MachineSchedulerPass(TM))
-MACHINE_FUNCTION_PASS("machinelicm", MachineLICMPass())
-MACHINE_FUNCTION_PASS("no-op-machine-function", NoOpMachineFunctionPass())
-MACHINE_FUNCTION_PASS("opt-phis", OptimizePHIsPass())
-MACHINE_FUNCTION_PASS("patchable-function", PatchableFunctionPass())
-MACHINE_FUNCTION_PASS("peephole-opt", PeepholeOptimizerPass())
-MACHINE_FUNCTION_PASS("phi-node-elimination", PHIEliminationPass())
-MACHINE_FUNCTION_PASS("post-RA-hazard-rec", PostRAHazardRecognizerPass())
-MACHINE_FUNCTION_PASS("post-RA-sched", PostRASchedulerPass(TM))
-MACHINE_FUNCTION_PASS("postra-machine-sink", PostRAMachineSinkingPass())
-MACHINE_FUNCTION_PASS("postmisched", PostMachineSchedulerPass(TM))
-MACHINE_FUNCTION_PASS("post-ra-pseudos", ExpandPostRAPseudosPass())
-MACHINE_FUNCTION_PASS("print", PrintMIRPass())
-MACHINE_FUNCTION_PASS("print<gisel-value-tracking>", GISelValueTrackingPrinterPass(errs()))
-MACHINE_FUNCTION_PASS("print<livedebugvars>", LiveDebugVariablesPrinterPass(errs()))
-MACHINE_FUNCTION_PASS("print<live-intervals>", LiveIntervalsPrinterPass(errs()))
-MACHINE_FUNCTION_PASS("print<live-stacks>", LiveStacksPrinterPass(errs()))
-MACHINE_FUNCTION_PASS("print<live-vars>", LiveVariablesPrinterPass(errs()))
-MACHINE_FUNCTION_PASS("print<machine-block-freq>",
-                      MachineBlockFrequencyPrinterPass(errs()))
-MACHINE_FUNCTION_PASS("print<machine-block-hash>",
-                      MachineBlockHashInfoPrinterPass(errs()))
-MACHINE_FUNCTION_PASS("print<machine-branch-prob>",
-                      MachineBranchProbabilityPrinterPass(errs()))
-MACHINE_FUNCTION_PASS("print<machine-cycles>", MachineCycleInfoPrinterPass(errs()))
-MACHINE_FUNCTION_PASS("print<machine-dom-tree>",
-                      MachineDominatorTreePrinterPass(errs()))
-MACHINE_FUNCTION_PASS("print<machine-loops>", MachineLoopPrinterPass(errs()))
-MACHINE_FUNCTION_PASS("print<machine-post-dom-tree>",
-                      MachinePostDominatorTreePrinterPass(errs()))
-MACHINE_FUNCTION_PASS("print<machine-uniformity>",
-                      MachineUniformityPrinterPass(errs()))
-MACHINE_FUNCTION_PASS("print<reaching-def>", ReachingDefPrinterPass(errs()))
-MACHINE_FUNCTION_PASS("print<slot-indexes>", SlotIndexesPrinterPass(errs()))
-MACHINE_FUNCTION_PASS("print<virtregmap>", VirtRegMapPrinterPass(errs()))
-MACHINE_FUNCTION_PASS("process-imp-defs", ProcessImplicitDefsPass())
-MACHINE_FUNCTION_PASS("prolog-epilog", PrologEpilogInserterPass())
-MACHINE_FUNCTION_PASS("reg-usage-collector", RegUsageInfoCollectorPass())
-MACHINE_FUNCTION_PASS("reg-usage-propagation", RegUsageInfoPropagationPass())
-MACHINE_FUNCTION_PASS("register-coalescer", RegisterCoalescerPass())
-MACHINE_FUNCTION_PASS("rename-independent-subregs", RenameIndependentSubregsPass())
-MACHINE_FUNCTION_PASS("remove-loads-into-fake-uses", RemoveLoadsIntoFakeUsesPass())
-MACHINE_FUNCTION_PASS("remove-redundant-debug-values", RemoveRedundantDebugValuesPass())
-MACHINE_FUNCTION_PASS("require-all-machine-function-properties",
-                      RequireAllMachineFunctionPropertiesPass())
-MACHINE_FUNCTION_PASS("shrink-wrap", ShrinkWrapPass())
-MACHINE_FUNCTION_PASS("stack-coloring", StackColoringPass())
-MACHINE_FUNCTION_PASS("stack-frame-layout", StackFrameLayoutAnalysisPass())
-MACHINE_FUNCTION_PASS("stack-slot-coloring", StackSlotColoringPass())
-MACHINE_FUNCTION_PASS("tailduplication", TailDuplicatePass())
-MACHINE_FUNCTION_PASS("trigger-verifier-error", TriggerVerifierErrorPass())
-MACHINE_FUNCTION_PASS("two-address-instruction", TwoAddressInstructionPass())
-MACHINE_FUNCTION_PASS("unpack-mi-bundles", UnpackMachineBundlesPass())
-MACHINE_FUNCTION_PASS("unreachable-mbb-elimination", 
-                      UnreachableMachineBlockElimPass())
-MACHINE_FUNCTION_PASS("verify", MachineVerifierPass())
-MACHINE_FUNCTION_PASS("verify<machine-trace-metrics>", MachineTraceMetricsVerifierPass())
-MACHINE_FUNCTION_PASS("xray-instrumentation", XRayInstrumentationPass())
-#undef MACHINE_FUNCTION_PASS
-
-#ifndef MACHINE_FUNCTION_PASS_WITH_PARAMS
-#define MACHINE_FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER,    \
-                                          PARAMS)
-#endif
-
-MACHINE_FUNCTION_PASS_WITH_PARAMS(
-    "block-placement", "MachineBlockPlacementPass",
-    [](bool AllowTailMerge) {
-      // Default is true.
-      return MachineBlockPlacementPass(AllowTailMerge);
-    },
-    parseMachineBlockPlacementPassOptions, "no-tail-merge;tail-merge")
-
-MACHINE_FUNCTION_PASS_WITH_PARAMS(
-    "branch-folder", "BranchFolderPass",
-    [](bool EnableTailMerge) { return BranchFolderPass(EnableTailMerge); },
-    [](StringRef Params) {
-      return parseSinglePassOption(Params, "enable-tail-merge",
-                                   "BranchFolderPass");
-    },
-    "enable-tail-merge")
-
-MACHINE_FUNCTION_PASS_WITH_PARAMS(
-    "live-debug-values", "LiveDebugValuesPass",
-    [](bool ShouldEmitDebugEntryValues) {
-      return LiveDebugValuesPass(ShouldEmitDebugEntryValues);
-    },
-    [](StringRef Params) {
-      return parseSinglePassOption(Params, "emit-debug-entry-values",
-                                   "LiveDebugValuesPass");
-    },
-    "emit-debug-entry-values")
-
-MACHINE_FUNCTION_PASS_WITH_PARAMS(
-    "machine-sink", "MachineSinkingPass",
-    [](bool EnableSinkAndFold) {
-      return MachineSinkingPass(EnableSinkAndFold);
-    },
-    parseMachineSinkingPassOptions, "enable-sink-fold")
-
-MACHINE_FUNCTION_PASS_WITH_PARAMS(
-    "regallocfast", "RegAllocFastPass",
-    [](RegAllocFastPass::Options Opts) { return RegAllocFastPass(Opts); },
-    [PB = this](StringRef Params) {
-      return parseRegAllocFastPassOptions(*PB, Params);
-    },
-    "filter=reg-filter;no-clear-vregs")
-
-// 'all' is the default filter.
-MACHINE_FUNCTION_PASS_WITH_PARAMS(
-    "greedy", "RAGreedyPass",
-    [](RAGreedyPass::Options Opts) { return RAGreedyPass(Opts); },
-    [PB = this](StringRef Params) {
-      return parseRegAllocGreedyFilterFunc(*PB, Params);
-    }, "reg-filter"
-)
-
-MACHINE_FUNCTION_PASS_WITH_PARAMS(
-    "virt-reg-rewriter", "VirtRegRewriterPass",
-    [](bool ClearVirtRegs) { return VirtRegRewriterPass(ClearVirtRegs); },
-    parseVirtRegRewriterPassOptions, "no-clear-vregs;clear-vregs")
-
-#undef MACHINE_FUNCTION_PASS_WITH_PARAMS
-
 // After a pass is converted to new pass manager, its entry should be moved from
 // dummy table to the normal one. For example, for a machine function pass,
 // DUMMY_MACHINE_FUNCTION_PASS to MACHINE_FUNCTION_PASS.
diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp
index 0f288a2124b7b..e57437d27dd1d 100644
--- a/llvm/lib/Passes/PassBuilder.cpp
+++ b/llvm/lib/Passes/PassBuilder.cpp
@@ -603,8 +603,6 @@ PassBuilder::PassBuilder(TargetMachine *TM, PipelineTuningOptions PTO,
   PIC->addClassToPassName(CLASS, NAME);
 #define CGSCC_ANALYSIS(NAME, CREATE_PASS)                                      \
   PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
-#include "PassRegistry.def"
-
 #define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS)                           \
   PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
 #define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS)                               \
@@ -612,7 +610,7 @@ PassBuilder::PassBuilder(TargetMachine *TM, PipelineTuningOptions PTO,
 #define MACHINE_FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER,    \
                                           PARAMS)                              \
   PIC->addClassToPassName(CLASS, NAME);
-#include "llvm/Passes/MachinePassRegistry.def"
+#include "PassRegistry.def"
     });
   }
 
@@ -751,7 +749,7 @@ void PassBuilder::registerMachineFunctionAnalyses(
 
 #define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS)                           \
   MFAM.registerPass([&] { return CREATE_PASS; });
-#include "llvm/Passes/MachinePassRegistry.def"
+#include "PassRegistry.def"
 
   for (auto &C : MachineFunctionAnalysisRegistrationCallbacks)
     C(MFAM);
@@ -1951,7 +1949,7 @@ static bool isMachineFunctionPassName(StringRef Name, CallbacksT &Callbacks) {
   if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">")           \
     return true;
 
-#include "llvm/Passes/MachinePassRegistry.def"
+#include "PassRegistry.def"
 
   return callbacksAcceptPassName<MachineFunctionPassManager>(Name, Callbacks);
 }
@@ -2594,7 +2592,7 @@ Error PassBuilder::parseMachinePass(MachineFunctionPassManager &MFPM,
                  std::remove_reference_t<decltype(CREATE_PASS)>>());           \
     return Error::success();                                                   \
   }
-#include "llvm/Passes/MachinePassRegistry.def"
+#include "PassRegistry.def"
 
   for (auto &C : MachineFunctionPipelineParsingCallbacks)
     if (C(Name, MFPM, E.InnerPipeline))
@@ -2987,21 +2985,21 @@ void PassBuilder::printPassNames(raw_ostream &OS) {
   OS << "Machine module passes (WIP):\n";
   static constexpr char MachineModulePassNames[] = {"\0"
 #define MACHINE_MODULE_PASS(NAME, CREATE_PASS) NAME "\0"
-#include "llvm/Passes/MachinePassRegistry.def"
+#include "PassRegistry.def"
   };
   printPassNameList(StringTable(MachineModulePassNames), OS);
 
-  OS << "Machine function passes (WIP):\n";
+  OS << "Machine function passes:\n";
   static constexpr char MachineFunctionPassNames[] = {"\0"
 #define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) NAME "\0"
-#include "llvm/Passes/MachinePassRegistry.def"
+#include "PassRegistry.def"
   };
   printPassNameList(StringTable(MachineFunctionPassNames), OS);
 
-  OS << "Machine function analyses (WIP):\n";
+  OS << "Machine function analyses:\n";
   static constexpr char MachineFunctionAnalysisNames[] = {"\0"
 #define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
-#include "llvm/Passes/MachinePassRegistry.def"
+#include "PassRegistry.def"
   };
   printPassNameList(StringTable(MachineFunctionAnalysisNames), OS);
 }
diff --git a/llvm/lib/Passes/PassRegistry.def b/llvm/lib/Passes/PassRegistry.def
index 8f70c7cefa408..813da24132506 100644
--- a/llvm/lib/Passes/PassRegistry.def
+++ b/llvm/lib/Passes/PassRegistry.def
@@ -31,6 +31,7 @@ MODULE_ANALYSIS("ir-similarity", IRSimilarityAnalysis())
 MODULE_ANALYSIS("last-run-tracking", LastRunTrackingAnalysis())
 MODULE_ANALYSIS("lcg", LazyCallGraphAnalysis())
 MODULE_ANALYSIS("libcall-lowering-info", LibcallLoweringModuleAnalysis())
+MODULE_ANALYSIS("machine-module-info", MachineModuleAnalysis())
 MODULE_ANALYSIS("module-summary", ModuleSummaryIndexAnalysis())
 MODULE_ANALYSIS("no-op-module", NoOpModuleAnalysis())
 MODULE_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis(PIC))
@@ -830,6 +831,214 @@ LOOP_PASS_WITH_PARAMS(
     parseLoopUnswitchOptions, "nontrivial;no-nontrivial;trivial;no-trivial")
 #undef LOOP_PASS_WITH_PARAMS
 
+#ifndef MACHINE_MODULE_PASS
+#define MACHINE_MODULE_PASS(NAME, CREATE_PASS)
+#endif
+#undef MACHINE_MODULE_PASS
+
+#ifndef MACHINE_FUNCTION_ANALYSIS
+#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS)
+#endif
+// LiveVariables currently requires pure SSA form.
+// FIXME: Once TwoAddressInstruction pass no longer uses kill flags,
+// LiveVariables can be removed completely, and LiveIntervals can be directly
+// computed. (We still either need to regenerate kill flags after regalloc, or
+// preferably fix the scavenger to not depend on them).
+MACHINE_FUNCTION_ANALYSIS("edge-bundles", EdgeBundlesAnalysis())
+MACHINE_FUNCTION_ANALYSIS("gisel-cse-analysis", GISelCSEAnalysis(TM))
+MACHINE_FUNCTION_ANALYSIS("gisel-value-tracking", GISelValueTrackingAnalysis())
+MACHINE_FUNCTION_ANALYSIS("livedebugvars", LiveDebugVariablesAnalysis())
+MACHINE_FUNCTION_ANALYSIS("live-intervals", LiveIntervalsAnalysis())
+MACHINE_FUNCTION_ANALYSIS("live-reg-matrix", LiveRegMatrixAnalysis())
+MACHINE_FUNCTION_ANALYSIS("live-stacks", LiveStacksAnalysis())
+MACHINE_FUNCTION_ANALYSIS("live-vars", LiveVariablesAnalysis())
+MACHINE_FUNCTION_ANALYSIS("machine-block-freq", MachineBlockFrequencyAnalysis())
+MACHINE_FUNCTION_ANALYSIS("machine-block-hash", MachineBlockHashInfoAnalysis())
+MACHINE_FUNCTION_ANALYSIS("machine-branch-prob",
+                          MachineBranchProbabilityAnalysis())
+MACHINE_FUNCTION_ANALYSIS("machine-cycles", MachineCycleAnalysis())
+MACHINE_FUNCTION_ANALYSIS("machine-dom-frontier",
+                          MachineDominanceFrontierAnalysis())
+MACHINE_FUNCTION_ANALYSIS("machine-dom-tree", MachineDominatorTreeAnalysis())
+MACHINE_FUNCTION_ANALYSIS("machine-loops", MachineLoopAnalysis())
+MACHINE_FUNCTION_ANALYSIS("machine-opt-remark-emitter",
+                          MachineOptimizationRemarkEmitterAnalysis())
+MACHINE_FUNCTION_ANALYSIS("machine-post-dom-tree",
+                          MachinePostDominatorTreeAnalysis())
+MACHINE_FUNCTION_ANALYSIS("machine-trace-metrics",
+                          MachineTraceMetricsAnalysis())
+MACHINE_FUNCTION_ANALYSIS("machine-uniformity", MachineUniformityAnalysis())
+MACHINE_FUNCTION_ANALYSIS("pass-instrumentation",
+                          PassInstrumentationAnalysis(PIC))
+MACHINE_FUNCTION_ANALYSIS("reaching-def", ReachingDefAnalysis())
+MACHINE_FUNCTION_ANALYSIS("regalloc-evict", RegAllocEvictionAdvisorAnalysis())
+MACHINE_FUNCTION_ANALYSIS("regalloc-priority",
+                          RegAllocPriorityAdvisorAnalysis())
+MACHINE_FUNCTION_ANALYSIS("slot-indexes", SlotIndexesAnalysis())
+MACHINE_FUNCTION_ANALYSIS("spill-code-placement", SpillPlacementAnalysis())
+MACHINE_FUNCTION_ANALYSIS("virtregmap", VirtRegMapAnalysis())
+// MACHINE_FUNCTION_ANALYSIS("machine-region-info",
+// MachineRegionInfoPassAnalysis())
+// MACHINE_FUNCTION_ANALYSIS("gc-analysis",
+// GCMachineCodeAnalysisPass())
+#undef MACHINE_FUNCTION_ANALYSIS
+
+#ifndef MACHINE_FUNCTION_PASS
+#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS)
+#endif
+MACHINE_FUNCTION_PASS("block-placement-stats", MachineBlockPlacementStatsPass())
+MACHINE_FUNCTION_PASS("branch-relaxation", BranchRelaxationPass())
+MACHINE_FUNCTION_PASS("break-false-deps", BreakFalseDepsPass())
+MACHINE_FUNCTION_PASS("dead-mi-elimination", DeadMachineInstructionElimPass())
+MACHINE_FUNCTION_PASS("detect-dead-lanes", DetectDeadLanesPass())
+MACHINE_FUNCTION_PASS("dot-machine-cfg", MachineCFGPrinterPass())
+MACHINE_FUNCTION_PASS("early-ifcvt", EarlyIfConverterPass())
+MACHINE_FUNCTION_PASS("early-machinelicm", EarlyMachineLICMPass())
+MACHINE_FUNCTION_PASS("early-tailduplication", EarlyTailDuplicatePass())
+MACHINE_FUNCTION_PASS("fentry-insert", FEntryInserterPass())
+MACHINE_FUNCTION_PASS("finalize-isel", FinalizeISelPass())
+MACHINE_FUNCTION_PASS("finalizebundle-test", FinalizeBundleTestPass())
+MACHINE_FUNCTION_PASS("fixup-statepoint-caller-saved",
+                      FixupStatepointCallerSavedPass())
+MACHINE_FUNCTION_PASS("init-undef", InitUndefPass())
+MACHINE_FUNCTION_PASS("kcfi", MachineKCFIPass())
+MACHINE_FUNCTION_PASS("gc-empty-basic-blocks", GCEmptyBasicBlocksPass())
+MACHINE_FUNCTION_PASS("localstackalloc", LocalStackSlotAllocationPass())
+MACHINE_FUNCTION_PASS("machine-cp", MachineCopyPropagationPass())
+MACHINE_FUNCTION_PASS("machine-cse", MachineCSEPass())
+MACHINE_FUNCTION_PASS("machine-latecleanup", MachineLateInstrsCleanupPass())
+MACHINE_FUNCTION_PASS("machine-sanmd", MachineSanitizerBinaryMetadataPass())
+MACHINE_FUNCTION_PASS("machine-scheduler", MachineSchedulerPass(TM))
+MACHINE_FUNCTION_PASS("machinelicm", MachineLICMPass())
+MACHINE_FUNCTION_PASS("no-op-machine-function", NoOpMachineFunctionPass())
+MACHINE_FUNCTION_PASS("opt-phis", OptimizePHIsPass())
+MACHINE_FUNCTION_PASS("patchable-function", PatchableFunctionPass())
+MACHINE_FUNCTION_PASS("peephole-opt", PeepholeOptimizerPass())
+MACHINE_FUNCTION_PASS("phi-node-elimination", PHIEliminationPass())
+MACHINE_FUNCTION_PASS("post-RA-hazard-rec", PostRAHazardRecognizerPass())
+MACHINE_FUNCTION_PASS("post-RA-sched", PostRASchedulerPass(TM))
+MACHINE_FUNCTION_PASS("postra-machine-sink", PostRAMachineSinkingPass())
+MACHINE_FUNCTION_PASS("postmisched", PostMachineSchedulerPass(TM))
+MACHINE_FUNCTION_PASS("post-ra-pseudos", ExpandPostRAPseudosPass())
+MACHINE_FUNCTION_PASS("print", PrintMIRPass())
+MACHINE_FUNCTION_PASS("print<gisel-value-tracking>",
+                      GISelValueTrackingPrinterPass(errs()))
+MACHINE_FUNCTION_PASS("print<livedebugvars>",
+                      LiveDebugVariablesPrinterPass(errs()))
+MACHINE_FUNCTION_PASS("print<live-intervals>", LiveIntervalsPrinterPass(errs()))
+MACHINE_FUNCTION_PASS("print<live-stacks>", LiveStacksPrinterPass(errs()))
+MACHINE_FUNCTION_PASS("print<live-vars>", LiveVariablesPrinterPass(errs()))
+MACHINE_FUNCTION_PASS("print<machine-block-freq>",
+                      MachineBlockFrequencyPrinterPass(errs()))
+MACHINE_FUNCTION_PASS("print<machine-block-hash>",
+                      MachineBlockHashInfoPrinterPass(errs()))
+MACHINE_FUNCTION_PASS("print<machine-branch-prob>",
+                      MachineBranchProbabilityPrinterPass(errs()))
+MACHINE_FUNCTION_PASS("print<machine-cycles>",
+                      MachineCycleInfoPrinterPass(errs()))
+MACHINE_FUNCTION_PASS("print<machine-dom-tree>",
+                      MachineDominatorTreePrinterPass(errs()))
+MACHINE_FUNCTION_PASS("print<machine-loops>", MachineLoopPrinterPass(errs()))
+MACHINE_FUNCTION_PASS("print<machine-post-dom-tree>",
+                      MachinePostDominatorTreePrinterPass(errs()))
+MACHINE_FUNCTION_PASS("print<machine-uniformity>",
+                      MachineUniformityPrinterPass(errs()))
+MACHINE_FUNCTION_PASS("print<reaching-def>", ReachingDefPrinterPass(errs()))
+MACHINE_FUNCTION_PASS("print<slot-indexes>", SlotIndexesPrinterPass(errs()))
+MACHINE_FUNCTION_PASS("print<virtregmap>", VirtRegMapPrinterPass(errs()))
+MACHINE_FUNCTION_PASS("process-imp-defs", ProcessImplicitDefsPass())
+MACHINE_FUNCTION_PASS("prolog-epilog", PrologEpilogInserterPass())
+MACHINE_FUNCTION_PASS("reg-usage-collector", RegUsageInfoCollectorPass())
+MACHINE_FUNCTION_PASS("reg-usage-propagation", RegUsageInfoPropagationPass())
+MACHINE_FUNCTION_PASS("register-coalescer", RegisterCoalescerPass())
+MACHINE_FUNCTION_PASS("rename-independent-subregs",
+                      RenameIndependentSubregsPass())
+MACHINE_FUNCTION_PASS("remove-loads-into-fake-uses",
+                      RemoveLoadsIntoFakeUsesPass())
+MACHINE_FUNCTION_PASS("remove-redundant-debug-values",
+                      RemoveRedundantDebugValuesPass())
+MACHINE_FUNCTION_PASS("require-all-machine-function-properties",
+                      RequireAllMachineFunctionPropertiesPass())
+MACHINE_FUNCTION_PASS("shrink-wrap", ShrinkWrapPass())
+MACHINE_FUNCTION_PASS("stack-coloring", StackColoringPass())
+MACHINE_FUNCTION_PASS("stack-frame-layout", StackFrameLayoutAnalysisPass())
+MACHINE_FUNCTION_PASS("stack-slot-coloring", StackSlotColoringPass())
+MACHINE_FUNCTION_PASS("tailduplication", TailDuplicatePass())
+MACHINE_FUNCTION_PASS("trigger-verifier-error", TriggerVerifierErrorPass())
+MACHINE_FUNCTION_PASS("two-address-instruction", TwoAddressInstructionPass())
+MACHINE_FUNCTION_PASS("unpack-mi-bundles", UnpackMachineBundlesPass())
+MACHINE_FUNCTION_PASS("unreachable-mbb-elimination",
+                      UnreachableMachineBlockElimPass())
+MACHINE_FUNCTION_PASS("verify", MachineVerifierPass())
+MACHINE_FUNCTION_PASS("verify<machine-trace-metrics>",
+                      MachineTraceMetricsVerifierPass())
+MACHINE_FUNCTION_PASS("xray-instrumentation", XRayInstrumentationPass())
+#undef MACHINE_FUNCTION_PASS
+
+#ifndef MACHINE_FUNCTION_PASS_WITH_PARAMS
+#define MACHINE_FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER,    \
+                                          PARAMS)
+#endif
+
+MACHINE_FUNCTION_PASS_WITH_PARAMS(
+    "block-placement", "MachineBlockPlacementPass",
+    [](bool AllowTailMerge) {
+      // Default is true.
+      return MachineBlockPlacementPass(AllowTailMerge);
+    },
+    parseMachineBlockPlacementPassOptions, "no-tail-merge;tail-merge")
+
+MACHINE_FUNCTION_PASS_WITH_PARAMS(
+    "branch-folder", "BranchFolderPass",
+    [](bool EnableTailMerge) { return BranchFolderPass(EnableTailMerge); },
+    [](StringRef Params) {
+      return parseSinglePassOption(Params, "enable-tail-merge",
+                                   "BranchFolderPass");
+    },
+    "enable-tail-merge")
+
+MACHINE_FUNCTION_PASS_WITH_PARAMS(
+    "live-debug-values", "LiveDebugValuesPass",
+    [](bool ShouldEmitDebugEntryValues) {
+      return LiveDebugValuesPass(ShouldEmitDebugEntryValues);
+    },
+    [](StringRef Params) {
+      return parseSinglePassOption(Params, "emit-debug-entry-values",
+                                   "LiveDebugValuesPass");
+    },
+    "emit-debug-entry-values")
+
+MACHINE_FUNCTION_PASS_WITH_PARAMS(
+    "machine-sink", "MachineSinkingPass",
+    [](bool EnableSinkAndFold) {
+      return MachineSinkingPass(EnableSinkAndFold);
+    },
+    parseMachineSinkingPassOptions, "enable-sink-fold")
+
+MACHINE_FUNCTION_PASS_WITH_PARAMS(
+    "regallocfast", "RegAllocFastPass",
+    [](RegAllocFastPass::Options Opts) { return RegAllocFastPass(Opts); },
+    [PB = this](StringRef Params) {
+      return parseRegAllocFastPassOptions(*PB, Params);
+    },
+    "filter=reg-filter;no-clear-vregs")
+
+// 'all' is the default filter.
+MACHINE_FUNCTION_PASS_WITH_PARAMS(
+    "greedy", "RAGreedyPass",
+    [](RAGreedyPass::Options Opts) { return RAGreedyPass(Opts); },
+    [PB = this](StringRef Params) {
+      return parseRegAllocGreedyFilterFunc(*PB, Params);
+    },
+    "reg-filter")
+
+MACHINE_FUNCTION_PASS_WITH_PARAMS(
+    "virt-reg-rewriter", "VirtRegRewriterPass",
+    [](bool ClearVirtRegs) { return VirtRegRewriterPass(ClearVirtRegs); },
+    parseVirtRegRewriterPassOptions, "no-clear-vregs;clear-vregs")
+
+#undef MACHINE_FUNCTION_PASS_WITH_PARAMS
+
 #ifdef MODULE_CALLBACK
 MODULE_CALLBACK("pipeline-start-callbacks", invokePipelineStartEPCallbacks)
 #endif



More information about the llvm-commits mailing list