xref: /freebsd/contrib/llvm-project/llvm/lib/Passes/PassRegistry.def (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
10b57cec5SDimitry Andric//===- PassRegistry.def - Registry of passes --------------------*- C++ -*-===//
20b57cec5SDimitry Andric//
30b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric//
70b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric//
90b57cec5SDimitry Andric// This file is used as the registry of passes that are part of the core LLVM
100b57cec5SDimitry Andric// libraries. This file describes both transformation passes and analyses
110b57cec5SDimitry Andric// Analyses are registered while transformation passes have names registered
120b57cec5SDimitry Andric// that can be used when providing a textual pass pipeline.
130b57cec5SDimitry Andric//
140b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
150b57cec5SDimitry Andric
160b57cec5SDimitry Andric// NOTE: NO INCLUDE GUARD DESIRED!
170b57cec5SDimitry Andric
180b57cec5SDimitry Andric#ifndef MODULE_ANALYSIS
190b57cec5SDimitry Andric#define MODULE_ANALYSIS(NAME, CREATE_PASS)
200b57cec5SDimitry Andric#endif
210b57cec5SDimitry AndricMODULE_ANALYSIS("callgraph", CallGraphAnalysis())
225f757f3fSDimitry AndricMODULE_ANALYSIS("collector-metadata", CollectorMetadataAnalysis())
235f757f3fSDimitry AndricMODULE_ANALYSIS("inline-advisor", InlineAdvisorAnalysis())
245f757f3fSDimitry AndricMODULE_ANALYSIS("ir-similarity", IRSimilarityAnalysis())
250b57cec5SDimitry AndricMODULE_ANALYSIS("lcg", LazyCallGraphAnalysis())
260b57cec5SDimitry AndricMODULE_ANALYSIS("module-summary", ModuleSummaryIndexAnalysis())
270b57cec5SDimitry AndricMODULE_ANALYSIS("no-op-module", NoOpModuleAnalysis())
285f757f3fSDimitry AndricMODULE_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis(PIC))
290b57cec5SDimitry AndricMODULE_ANALYSIS("profile-summary", ProfileSummaryAnalysis())
300b57cec5SDimitry AndricMODULE_ANALYSIS("stack-safety", StackSafetyGlobalAnalysis())
310b57cec5SDimitry AndricMODULE_ANALYSIS("verify", VerifierAnalysis())
320b57cec5SDimitry Andric
330b57cec5SDimitry Andric#ifndef MODULE_ALIAS_ANALYSIS
340b57cec5SDimitry Andric#define MODULE_ALIAS_ANALYSIS(NAME, CREATE_PASS)                               \
350b57cec5SDimitry Andric  MODULE_ANALYSIS(NAME, CREATE_PASS)
360b57cec5SDimitry Andric#endif
370b57cec5SDimitry AndricMODULE_ALIAS_ANALYSIS("globals-aa", GlobalsAA())
380b57cec5SDimitry Andric#undef MODULE_ALIAS_ANALYSIS
390b57cec5SDimitry Andric#undef MODULE_ANALYSIS
400b57cec5SDimitry Andric
410b57cec5SDimitry Andric#ifndef MODULE_PASS
420b57cec5SDimitry Andric#define MODULE_PASS(NAME, CREATE_PASS)
430b57cec5SDimitry Andric#endif
440b57cec5SDimitry AndricMODULE_PASS("always-inline", AlwaysInlinerPass())
45e8d8bef9SDimitry AndricMODULE_PASS("annotation2metadata", Annotation2MetadataPass())
465f757f3fSDimitry AndricMODULE_PASS("attributor", AttributorPass())
475f757f3fSDimitry AndricMODULE_PASS("attributor-light", AttributorLightPass())
480b57cec5SDimitry AndricMODULE_PASS("called-value-propagation", CalledValuePropagationPass())
490b57cec5SDimitry AndricMODULE_PASS("canonicalize-aliases", CanonicalizeAliasesPass())
5004eeddc0SDimitry AndricMODULE_PASS("check-debugify", NewPMCheckDebugifyPass())
510b57cec5SDimitry AndricMODULE_PASS("constmerge", ConstantMergePass())
5281ad6265SDimitry AndricMODULE_PASS("coro-cleanup", CoroCleanupPass())
535f757f3fSDimitry AndricMODULE_PASS("coro-early", CoroEarlyPass())
540b57cec5SDimitry AndricMODULE_PASS("cross-dso-cfi", CrossDSOCFIPass())
550b57cec5SDimitry AndricMODULE_PASS("deadargelim", DeadArgumentEliminationPass())
5604eeddc0SDimitry AndricMODULE_PASS("debugify", NewPMDebugifyPass())
575f757f3fSDimitry AndricMODULE_PASS("dfsan", DataFlowSanitizerPass())
5881ad6265SDimitry AndricMODULE_PASS("dot-callgraph", CallGraphDOTPrinterPass())
595f757f3fSDimitry AndricMODULE_PASS("dxil-upgrade", DXILUpgradePass())
600b57cec5SDimitry AndricMODULE_PASS("elim-avail-extern", EliminateAvailableExternallyPass())
61bdd1243dSDimitry AndricMODULE_PASS("extract-blocks", BlockExtractorPass({}, false))
62*0fca6ea1SDimitry AndricMODULE_PASS("expand-variadics", ExpandVariadicsPass(ExpandVariadicsMode::Disable))
630b57cec5SDimitry AndricMODULE_PASS("forceattrs", ForceFunctionAttrsPass())
640b57cec5SDimitry AndricMODULE_PASS("function-import", FunctionImportPass())
650b57cec5SDimitry AndricMODULE_PASS("globalopt", GlobalOptPass())
660b57cec5SDimitry AndricMODULE_PASS("globalsplit", GlobalSplitPass())
675f757f3fSDimitry AndricMODULE_PASS("hipstdpar-interpose-alloc", HipStdParAllocationInterpositionPass())
685f757f3fSDimitry AndricMODULE_PASS("hipstdpar-select-accelerator-code",
695f757f3fSDimitry Andric            HipStdParAcceleratorCodeSelectionPass())
700b57cec5SDimitry AndricMODULE_PASS("hotcoldsplit", HotColdSplittingPass())
710b57cec5SDimitry AndricMODULE_PASS("inferattrs", InferFunctionAttrsPass())
725f757f3fSDimitry AndricMODULE_PASS("inliner-ml-advisor-release",
735f757f3fSDimitry Andric            ModuleInlinerWrapperPass(getInlineParams(), true, {},
745f757f3fSDimitry Andric                                     InliningAdvisorMode::Release, 0))
755ffd83dbSDimitry AndricMODULE_PASS("inliner-wrapper", ModuleInlinerWrapperPass())
765f757f3fSDimitry AndricMODULE_PASS("inliner-wrapper-no-mandatory-first",
775f757f3fSDimitry Andric            ModuleInlinerWrapperPass(getInlineParams(), false))
780b57cec5SDimitry AndricMODULE_PASS("insert-gcov-profiling", GCOVProfilerPass())
790b57cec5SDimitry AndricMODULE_PASS("instrorderfile", InstrOrderFilePass())
805f757f3fSDimitry AndricMODULE_PASS("instrprof", InstrProfilingLoweringPass())
81*0fca6ea1SDimitry AndricMODULE_PASS("ctx-instr-lower", PGOCtxProfLoweringPass())
820b57cec5SDimitry AndricMODULE_PASS("invalidate<all>", InvalidateAllAnalysesPass())
83e8d8bef9SDimitry AndricMODULE_PASS("iroutliner", IROutlinerPass())
845f757f3fSDimitry AndricMODULE_PASS("jmc-instrumenter", JMCInstrumenterPass())
85cb14a3feSDimitry AndricMODULE_PASS("lower-emutls", LowerEmuTLSPass())
8681ad6265SDimitry AndricMODULE_PASS("lower-global-dtors", LowerGlobalDtorsPass())
87bdd1243dSDimitry AndricMODULE_PASS("lower-ifunc", LowerIFuncPass())
88e8d8bef9SDimitry AndricMODULE_PASS("lowertypetests", LowerTypeTestsPass())
89*0fca6ea1SDimitry AndricMODULE_PASS("pgo-force-function-attrs", PGOForceFunctionAttrsPass(PGOOpt ? PGOOpt->ColdOptType : PGOOptions::ColdFuncOpt::Default))
905f757f3fSDimitry AndricMODULE_PASS("memprof-context-disambiguation", MemProfContextDisambiguation())
915f757f3fSDimitry AndricMODULE_PASS("memprof-module", ModuleMemProfilerPass())
92480093f4SDimitry AndricMODULE_PASS("mergefunc", MergeFunctionsPass())
935f757f3fSDimitry AndricMODULE_PASS("metarenamer", MetaRenamerPass())
945f757f3fSDimitry AndricMODULE_PASS("module-inline", ModuleInlinerPass())
950b57cec5SDimitry AndricMODULE_PASS("name-anon-globals", NameAnonGlobalPass())
960b57cec5SDimitry AndricMODULE_PASS("no-op-module", NoOpModulePass())
97*0fca6ea1SDimitry AndricMODULE_PASS("nsan", NumericalStabilitySanitizerPass())
98e8d8bef9SDimitry AndricMODULE_PASS("objc-arc-apelim", ObjCARCAPElimPass())
995f757f3fSDimitry AndricMODULE_PASS("openmp-opt", OpenMPOptPass())
1005f757f3fSDimitry AndricMODULE_PASS("openmp-opt-postlink",
1015f757f3fSDimitry Andric            OpenMPOptPass(ThinOrFullLTOPhase::FullLTOPostLink))
1020b57cec5SDimitry AndricMODULE_PASS("partial-inliner", PartialInlinerPass())
1030b57cec5SDimitry AndricMODULE_PASS("pgo-icall-prom", PGOIndirectCallPromotion())
1040b57cec5SDimitry AndricMODULE_PASS("pgo-instr-gen", PGOInstrumentationGen())
1050b57cec5SDimitry AndricMODULE_PASS("pgo-instr-use", PGOInstrumentationUse())
1065f757f3fSDimitry AndricMODULE_PASS("poison-checking", PoisonCheckingPass())
107*0fca6ea1SDimitry AndricMODULE_PASS("pre-isel-intrinsic-lowering", PreISelIntrinsicLoweringPass(*TM))
1085f757f3fSDimitry AndricMODULE_PASS("print", PrintModulePass(dbgs()))
1090b57cec5SDimitry AndricMODULE_PASS("print-callgraph", CallGraphPrinterPass(dbgs()))
110bdd1243dSDimitry AndricMODULE_PASS("print-callgraph-sccs", CallGraphSCCsPrinterPass(dbgs()))
1115f757f3fSDimitry AndricMODULE_PASS("print-ir-similarity", IRSimilarityAnalysisPrinterPass(dbgs()))
1120b57cec5SDimitry AndricMODULE_PASS("print-lcg", LazyCallGraphPrinterPass(dbgs()))
1130b57cec5SDimitry AndricMODULE_PASS("print-lcg-dot", LazyCallGraphDOTPrinterPass(dbgs()))
1145f757f3fSDimitry AndricMODULE_PASS("print-must-be-executed-contexts",
1155f757f3fSDimitry Andric            MustBeExecutedContextPrinterPass(dbgs()))
1165f757f3fSDimitry AndricMODULE_PASS("print-profile-summary", ProfileSummaryPrinterPass(dbgs()))
1170b57cec5SDimitry AndricMODULE_PASS("print-stack-safety", StackSafetyGlobalPrinterPass(dbgs()))
1185f757f3fSDimitry AndricMODULE_PASS("print<inline-advisor>", InlineAdvisorAnalysisPrinterPass(dbgs()))
119e8d8bef9SDimitry AndricMODULE_PASS("print<module-debuginfo>", ModuleDebugInfoPrinterPass(dbgs()))
1205f757f3fSDimitry AndricMODULE_PASS("pseudo-probe", SampleProfileProbePass(TM))
1215f757f3fSDimitry AndricMODULE_PASS("pseudo-probe-update", PseudoProbeUpdatePass())
12281ad6265SDimitry AndricMODULE_PASS("recompute-globalsaa", RecomputeGlobalsAAPass())
123fe6060f1SDimitry AndricMODULE_PASS("rel-lookup-table-converter", RelLookupTableConverterPass())
1240b57cec5SDimitry AndricMODULE_PASS("rewrite-statepoints-for-gc", RewriteStatepointsForGC())
1250b57cec5SDimitry AndricMODULE_PASS("rewrite-symbols", RewriteSymbolPass())
126e8d8bef9SDimitry AndricMODULE_PASS("rpo-function-attrs", ReversePostOrderFunctionAttrsPass())
1270b57cec5SDimitry AndricMODULE_PASS("sample-profile", SampleProfileLoaderPass())
1285f757f3fSDimitry AndricMODULE_PASS("sancov-module", SanitizerCoveragePass())
1295f757f3fSDimitry AndricMODULE_PASS("sanmd-module", SanitizerBinaryMetadataPass())
1305ffd83dbSDimitry AndricMODULE_PASS("scc-oz-module-inliner",
1315f757f3fSDimitry Andric            buildInlinerPipeline(OptimizationLevel::Oz,
1325f757f3fSDimitry Andric                                 ThinOrFullLTOPhase::None))
1331db9f3b2SDimitry AndricMODULE_PASS("shadow-stack-gc-lowering", ShadowStackGCLoweringPass())
134e8d8bef9SDimitry AndricMODULE_PASS("strip", StripSymbolsPass())
135e8d8bef9SDimitry AndricMODULE_PASS("strip-dead-debug-info", StripDeadDebugInfoPass())
1360b57cec5SDimitry AndricMODULE_PASS("strip-dead-prototypes", StripDeadPrototypesPass())
137e8d8bef9SDimitry AndricMODULE_PASS("strip-debug-declare", StripDebugDeclarePass())
138e8d8bef9SDimitry AndricMODULE_PASS("strip-nondebug", StripNonDebugSymbolsPass())
139e8d8bef9SDimitry AndricMODULE_PASS("strip-nonlinetable-debuginfo", StripNonLineTableDebugInfoPass())
1400b57cec5SDimitry AndricMODULE_PASS("synthetic-counts-propagation", SyntheticCountsPropagation())
141*0fca6ea1SDimitry AndricMODULE_PASS("trigger-crash-module", TriggerCrashModulePass())
1425f757f3fSDimitry AndricMODULE_PASS("trigger-verifier-error", TriggerVerifierErrorPass())
1435f757f3fSDimitry AndricMODULE_PASS("tsan-module", ModuleThreadSanitizerPass())
1440b57cec5SDimitry AndricMODULE_PASS("verify", VerifierPass())
14581ad6265SDimitry AndricMODULE_PASS("view-callgraph", CallGraphViewerPass())
146e8d8bef9SDimitry AndricMODULE_PASS("wholeprogramdevirt", WholeProgramDevirtPass())
1470b57cec5SDimitry Andric#undef MODULE_PASS
1480b57cec5SDimitry Andric
149349cc55cSDimitry Andric#ifndef MODULE_PASS_WITH_PARAMS
150349cc55cSDimitry Andric#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS)
151349cc55cSDimitry Andric#endif
1525f757f3fSDimitry AndricMODULE_PASS_WITH_PARAMS(
1535f757f3fSDimitry Andric    "asan", "AddressSanitizerPass",
1545f757f3fSDimitry Andric    [](AddressSanitizerOptions Opts) { return AddressSanitizerPass(Opts); },
1555f757f3fSDimitry Andric    parseASanPassOptions, "kernel")
1565f757f3fSDimitry AndricMODULE_PASS_WITH_PARAMS(
1577a6dacacSDimitry Andric    "cg-profile", "CGProfilePass",
1587a6dacacSDimitry Andric    [](bool InLTOPostLink) { return CGProfilePass(InLTOPostLink);},
1597a6dacacSDimitry Andric    parseCGProfilePassOptions, "in-lto-post-link")
1607a6dacacSDimitry AndricMODULE_PASS_WITH_PARAMS(
1617a6dacacSDimitry Andric    "global-merge", "GlobalMergePass",
1627a6dacacSDimitry Andric    [TM = TM](GlobalMergeOptions Opts) { return GlobalMergePass(TM, Opts); },
1637a6dacacSDimitry Andric    parseGlobalMergeOptions,
1647a6dacacSDimitry Andric    "group-by-use;ignore-single-use;max-offset=N;merge-const;merge-external;"
1657a6dacacSDimitry Andric    "no-group-by-use;no-ignore-single-use;no-merge-const;no-merge-external;"
1667a6dacacSDimitry Andric    "size-only")
1677a6dacacSDimitry AndricMODULE_PASS_WITH_PARAMS(
1687a6dacacSDimitry Andric    "embed-bitcode", "EmbedBitcodePass",
1697a6dacacSDimitry Andric    [](EmbedBitcodeOptions Opts) { return EmbedBitcodePass(Opts); },
1707a6dacacSDimitry Andric    parseEmbedBitcodePassOptions, "thinlto;emit-summary")
1717a6dacacSDimitry AndricMODULE_PASS_WITH_PARAMS(
1725f757f3fSDimitry Andric    "globaldce", "GlobalDCEPass",
1735f757f3fSDimitry Andric    [](bool InLTOPostLink) { return GlobalDCEPass(InLTOPostLink); },
1745f757f3fSDimitry Andric    parseGlobalDCEPassOptions, "in-lto-post-link")
1755f757f3fSDimitry AndricMODULE_PASS_WITH_PARAMS(
1765f757f3fSDimitry Andric    "hwasan", "HWAddressSanitizerPass",
1775f757f3fSDimitry Andric    [](HWAddressSanitizerOptions Opts) { return HWAddressSanitizerPass(Opts); },
1785f757f3fSDimitry Andric    parseHWASanPassOptions, "kernel;recover")
1795f757f3fSDimitry AndricMODULE_PASS_WITH_PARAMS(
180*0fca6ea1SDimitry Andric    "internalize", "InternalizePass",
181*0fca6ea1SDimitry Andric    [](SmallVector<std::string, 0> PreservedGVs) {
182*0fca6ea1SDimitry Andric      if (PreservedGVs.empty())
183*0fca6ea1SDimitry Andric        return InternalizePass();
184*0fca6ea1SDimitry Andric      auto MustPreserveGV = [=](const GlobalValue &GV) {
185*0fca6ea1SDimitry Andric        for (auto &PreservedGV : PreservedGVs)
186*0fca6ea1SDimitry Andric          if (GV.getName() == PreservedGV)
187*0fca6ea1SDimitry Andric            return true;
188*0fca6ea1SDimitry Andric        return false;
189*0fca6ea1SDimitry Andric      };
190*0fca6ea1SDimitry Andric      return InternalizePass(MustPreserveGV);
191*0fca6ea1SDimitry Andric    },
192*0fca6ea1SDimitry Andric    parseInternalizeGVs, "preserve-gv=GV")
193*0fca6ea1SDimitry AndricMODULE_PASS_WITH_PARAMS(
1945f757f3fSDimitry Andric    "ipsccp", "IPSCCPPass", [](IPSCCPOptions Opts) { return IPSCCPPass(Opts); },
1955f757f3fSDimitry Andric    parseIPSCCPOptions, "no-func-spec;func-spec")
1965f757f3fSDimitry AndricMODULE_PASS_WITH_PARAMS(
1975f757f3fSDimitry Andric    "loop-extract", "LoopExtractorPass",
198349cc55cSDimitry Andric    [](bool Single) {
199349cc55cSDimitry Andric      if (Single)
200349cc55cSDimitry Andric        return LoopExtractorPass(1);
201349cc55cSDimitry Andric      return LoopExtractorPass();
202349cc55cSDimitry Andric    },
2035f757f3fSDimitry Andric    parseLoopExtractorPassOptions, "single")
2045f757f3fSDimitry AndricMODULE_PASS_WITH_PARAMS(
2055f757f3fSDimitry Andric    "memprof-use", "MemProfUsePass",
2065f757f3fSDimitry Andric    [](std::string Opts) { return MemProfUsePass(Opts); },
2075f757f3fSDimitry Andric    parseMemProfUsePassOptions, "profile-filename=S")
2085f757f3fSDimitry AndricMODULE_PASS_WITH_PARAMS(
2095f757f3fSDimitry Andric    "msan", "MemorySanitizerPass",
2105f757f3fSDimitry Andric    [](MemorySanitizerOptions Opts) { return MemorySanitizerPass(Opts); },
2115f757f3fSDimitry Andric    parseMSanPassOptions, "recover;kernel;eager-checks;track-origins=N")
2125f757f3fSDimitry AndricMODULE_PASS_WITH_PARAMS(
2135f757f3fSDimitry Andric    "print<structural-hash>", "StructuralHashPrinterPass",
2145f757f3fSDimitry Andric    [](bool EnableDetailedStructuralHash) {
2155f757f3fSDimitry Andric      return StructuralHashPrinterPass(dbgs(), EnableDetailedStructuralHash);
21606c3fb27SDimitry Andric    },
2175f757f3fSDimitry Andric    parseStructuralHashPrinterPassOptions, "detailed")
218349cc55cSDimitry Andric#undef MODULE_PASS_WITH_PARAMS
219349cc55cSDimitry Andric
2200b57cec5SDimitry Andric#ifndef CGSCC_ANALYSIS
2210b57cec5SDimitry Andric#define CGSCC_ANALYSIS(NAME, CREATE_PASS)
2220b57cec5SDimitry Andric#endif
2230b57cec5SDimitry AndricCGSCC_ANALYSIS("no-op-cgscc", NoOpCGSCCAnalysis())
2240b57cec5SDimitry AndricCGSCC_ANALYSIS("fam-proxy", FunctionAnalysisManagerCGSCCProxy())
2250b57cec5SDimitry AndricCGSCC_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis(PIC))
2260b57cec5SDimitry Andric#undef CGSCC_ANALYSIS
2270b57cec5SDimitry Andric
2280b57cec5SDimitry Andric#ifndef CGSCC_PASS
2290b57cec5SDimitry Andric#define CGSCC_PASS(NAME, CREATE_PASS)
2300b57cec5SDimitry Andric#endif
2310b57cec5SDimitry AndricCGSCC_PASS("argpromotion", ArgumentPromotionPass())
2325ffd83dbSDimitry AndricCGSCC_PASS("attributor-cgscc", AttributorCGSCCPass())
2335f757f3fSDimitry AndricCGSCC_PASS("attributor-light-cgscc", AttributorLightCGSCCPass())
2345f757f3fSDimitry AndricCGSCC_PASS("invalidate<all>", InvalidateAllAnalysesPass())
2350b57cec5SDimitry AndricCGSCC_PASS("no-op-cgscc", NoOpCGSCCPass())
2365f757f3fSDimitry AndricCGSCC_PASS("openmp-opt-cgscc", OpenMPOptCGSCCPass())
2370b57cec5SDimitry Andric#undef CGSCC_PASS
2380b57cec5SDimitry Andric
239349cc55cSDimitry Andric#ifndef CGSCC_PASS_WITH_PARAMS
240349cc55cSDimitry Andric#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS)
241349cc55cSDimitry Andric#endif
2425f757f3fSDimitry AndricCGSCC_PASS_WITH_PARAMS(
2435f757f3fSDimitry Andric    "coro-split", "CoroSplitPass",
2445f757f3fSDimitry Andric    [](bool OptimizeFrame) { return CoroSplitPass(OptimizeFrame); },
2455f757f3fSDimitry Andric    parseCoroSplitPassOptions, "reuse-storage")
2465f757f3fSDimitry AndricCGSCC_PASS_WITH_PARAMS(
2475f757f3fSDimitry Andric    "function-attrs", "PostOrderFunctionAttrsPass",
24806c3fb27SDimitry Andric    [](bool SkipNonRecursive) {
24906c3fb27SDimitry Andric      return PostOrderFunctionAttrsPass(SkipNonRecursive);
25006c3fb27SDimitry Andric    },
2515f757f3fSDimitry Andric    parsePostOrderFunctionAttrsPassOptions, "skip-non-recursive-function-attrs")
2525f757f3fSDimitry AndricCGSCC_PASS_WITH_PARAMS(
2535f757f3fSDimitry Andric    "inline", "InlinerPass",
2545f757f3fSDimitry Andric    [](bool OnlyMandatory) { return InlinerPass(OnlyMandatory); },
2555f757f3fSDimitry Andric    parseInlinerPassOptions, "only-mandatory")
256349cc55cSDimitry Andric#undef CGSCC_PASS_WITH_PARAMS
257349cc55cSDimitry Andric
2580b57cec5SDimitry Andric#ifndef FUNCTION_ANALYSIS
2590b57cec5SDimitry Andric#define FUNCTION_ANALYSIS(NAME, CREATE_PASS)
2600b57cec5SDimitry Andric#endif
2610b57cec5SDimitry AndricFUNCTION_ANALYSIS("aa", AAManager())
2625f757f3fSDimitry AndricFUNCTION_ANALYSIS("access-info", LoopAccessAnalysis())
2630b57cec5SDimitry AndricFUNCTION_ANALYSIS("assumptions", AssumptionAnalysis())
2641db9f3b2SDimitry AndricFUNCTION_ANALYSIS("bb-sections-profile-reader", BasicBlockSectionsProfileReaderAnalysis(TM))
2650b57cec5SDimitry AndricFUNCTION_ANALYSIS("block-freq", BlockFrequencyAnalysis())
2660b57cec5SDimitry AndricFUNCTION_ANALYSIS("branch-prob", BranchProbabilityAnalysis())
2670eae32dcSDimitry AndricFUNCTION_ANALYSIS("cycles", CycleAnalysis())
2685f757f3fSDimitry AndricFUNCTION_ANALYSIS("da", DependenceAnalysis())
269297eecfbSDimitry AndricFUNCTION_ANALYSIS("debug-ata", DebugAssignmentTrackingAnalysis())
2700b57cec5SDimitry AndricFUNCTION_ANALYSIS("demanded-bits", DemandedBitsAnalysis())
2710b57cec5SDimitry AndricFUNCTION_ANALYSIS("domfrontier", DominanceFrontierAnalysis())
2725f757f3fSDimitry AndricFUNCTION_ANALYSIS("domtree", DominatorTreeAnalysis())
273e8d8bef9SDimitry AndricFUNCTION_ANALYSIS("func-properties", FunctionPropertiesAnalysis())
274*0fca6ea1SDimitry AndricFUNCTION_ANALYSIS(
275*0fca6ea1SDimitry Andric    "machine-function-info",
276*0fca6ea1SDimitry Andric    MachineFunctionAnalysis(static_cast<const LLVMTargetMachine *>(TM)))
2775f757f3fSDimitry AndricFUNCTION_ANALYSIS("gc-function", GCFunctionAnalysis())
2785ffd83dbSDimitry AndricFUNCTION_ANALYSIS("inliner-size-estimator", InlineSizeEstimatorAnalysis())
2795f757f3fSDimitry AndricFUNCTION_ANALYSIS("lazy-value-info", LazyValueAnalysis())
2805f757f3fSDimitry AndricFUNCTION_ANALYSIS("loops", LoopAnalysis())
2810b57cec5SDimitry AndricFUNCTION_ANALYSIS("memdep", MemoryDependenceAnalysis())
2820b57cec5SDimitry AndricFUNCTION_ANALYSIS("memoryssa", MemorySSAAnalysis())
2830b57cec5SDimitry AndricFUNCTION_ANALYSIS("no-op-function", NoOpFunctionAnalysis())
2840b57cec5SDimitry AndricFUNCTION_ANALYSIS("opt-remark-emit", OptimizationRemarkEmitterAnalysis())
2855f757f3fSDimitry AndricFUNCTION_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis(PIC))
2865f757f3fSDimitry AndricFUNCTION_ANALYSIS("phi-values", PhiValuesAnalysis())
2875f757f3fSDimitry AndricFUNCTION_ANALYSIS("postdomtree", PostDominatorTreeAnalysis())
2885f757f3fSDimitry AndricFUNCTION_ANALYSIS("regions", RegionInfoAnalysis())
2890b57cec5SDimitry AndricFUNCTION_ANALYSIS("scalar-evolution", ScalarEvolutionAnalysis())
2905f757f3fSDimitry AndricFUNCTION_ANALYSIS("should-not-run-function-passes",
2915f757f3fSDimitry Andric                  ShouldNotRunFunctionPassesAnalysis())
2925f757f3fSDimitry AndricFUNCTION_ANALYSIS("should-run-extra-vector-passes",
2935f757f3fSDimitry Andric                  ShouldRunExtraVectorPasses())
2941db9f3b2SDimitry AndricFUNCTION_ANALYSIS("ssp-layout", SSPLayoutAnalysis())
2950b57cec5SDimitry AndricFUNCTION_ANALYSIS("stack-safety-local", StackSafetyAnalysis())
296*0fca6ea1SDimitry AndricFUNCTION_ANALYSIS("target-ir",
2970b57cec5SDimitry Andric                  TM ? TM->getTargetIRAnalysis() : TargetIRAnalysis())
298*0fca6ea1SDimitry AndricFUNCTION_ANALYSIS("target-lib-info", TargetLibraryAnalysis())
299bdd1243dSDimitry AndricFUNCTION_ANALYSIS("uniformity", UniformityInfoAnalysis())
3005f757f3fSDimitry AndricFUNCTION_ANALYSIS("verify", VerifierAnalysis())
3010b57cec5SDimitry Andric
3020b57cec5SDimitry Andric#ifndef FUNCTION_ALIAS_ANALYSIS
3030b57cec5SDimitry Andric#define FUNCTION_ALIAS_ANALYSIS(NAME, CREATE_PASS)                             \
3040b57cec5SDimitry Andric  FUNCTION_ANALYSIS(NAME, CREATE_PASS)
3050b57cec5SDimitry Andric#endif
3060b57cec5SDimitry AndricFUNCTION_ALIAS_ANALYSIS("basic-aa", BasicAA())
307e8d8bef9SDimitry AndricFUNCTION_ALIAS_ANALYSIS("objc-arc-aa", objcarc::ObjCARCAA())
3080b57cec5SDimitry AndricFUNCTION_ALIAS_ANALYSIS("scev-aa", SCEVAA())
3090b57cec5SDimitry AndricFUNCTION_ALIAS_ANALYSIS("scoped-noalias-aa", ScopedNoAliasAA())
310e8d8bef9SDimitry AndricFUNCTION_ALIAS_ANALYSIS("tbaa", TypeBasedAA())
3110b57cec5SDimitry Andric#undef FUNCTION_ALIAS_ANALYSIS
3120b57cec5SDimitry Andric#undef FUNCTION_ANALYSIS
3130b57cec5SDimitry Andric
3140b57cec5SDimitry Andric#ifndef FUNCTION_PASS
3150b57cec5SDimitry Andric#define FUNCTION_PASS(NAME, CREATE_PASS)
3160b57cec5SDimitry Andric#endif
3170b57cec5SDimitry AndricFUNCTION_PASS("aa-eval", AAEvaluator())
3180b57cec5SDimitry AndricFUNCTION_PASS("adce", ADCEPass())
3190b57cec5SDimitry AndricFUNCTION_PASS("add-discriminators", AddDiscriminatorsPass())
3200b57cec5SDimitry AndricFUNCTION_PASS("aggressive-instcombine", AggressiveInstCombinePass())
3210b57cec5SDimitry AndricFUNCTION_PASS("alignment-from-assumptions", AlignmentFromAssumptionsPass())
322e8d8bef9SDimitry AndricFUNCTION_PASS("annotation-remarks", AnnotationRemarksPass())
3235f757f3fSDimitry AndricFUNCTION_PASS("assume-builder", AssumeBuilderPass())
3245f757f3fSDimitry AndricFUNCTION_PASS("assume-simplify", AssumeSimplifyPass())
325*0fca6ea1SDimitry AndricFUNCTION_PASS("atomic-expand", AtomicExpandPass(TM))
3260b57cec5SDimitry AndricFUNCTION_PASS("bdce", BDCEPass())
3270b57cec5SDimitry AndricFUNCTION_PASS("bounds-checking", BoundsCheckingPass())
3280b57cec5SDimitry AndricFUNCTION_PASS("break-crit-edges", BreakCriticalEdgesPass())
329*0fca6ea1SDimitry AndricFUNCTION_PASS("callbr-prepare", CallBrPreparePass())
3300b57cec5SDimitry AndricFUNCTION_PASS("callsite-splitting", CallSiteSplittingPass())
3310b57cec5SDimitry AndricFUNCTION_PASS("chr", ControlHeightReductionPass())
3321db9f3b2SDimitry AndricFUNCTION_PASS("codegenprepare", CodeGenPreparePass(TM))
3335f757f3fSDimitry AndricFUNCTION_PASS("consthoist", ConstantHoistingPass())
3345f757f3fSDimitry AndricFUNCTION_PASS("constraint-elimination", ConstraintEliminationPass())
3355ffd83dbSDimitry AndricFUNCTION_PASS("coro-elide", CoroElidePass())
3360b57cec5SDimitry AndricFUNCTION_PASS("correlated-propagation", CorrelatedValuePropagationPass())
3375f757f3fSDimitry AndricFUNCTION_PASS("count-visits", CountVisitsPass())
3380b57cec5SDimitry AndricFUNCTION_PASS("dce", DCEPass())
3395f757f3fSDimitry AndricFUNCTION_PASS("declare-to-assign", llvm::AssignmentTrackingPass())
340fe6060f1SDimitry AndricFUNCTION_PASS("dfa-jump-threading", DFAJumpThreadingPass())
3410b57cec5SDimitry AndricFUNCTION_PASS("div-rem-pairs", DivRemPairsPass())
3420b57cec5SDimitry AndricFUNCTION_PASS("dot-cfg", CFGPrinterPass())
3430b57cec5SDimitry AndricFUNCTION_PASS("dot-cfg-only", CFGOnlyPrinterPass())
34481ad6265SDimitry AndricFUNCTION_PASS("dot-dom", DomPrinter())
34581ad6265SDimitry AndricFUNCTION_PASS("dot-dom-only", DomOnlyPrinter())
34681ad6265SDimitry AndricFUNCTION_PASS("dot-post-dom", PostDomPrinter())
34781ad6265SDimitry AndricFUNCTION_PASS("dot-post-dom-only", PostDomOnlyPrinter())
3485f757f3fSDimitry AndricFUNCTION_PASS("dse", DSEPass())
3495f757f3fSDimitry AndricFUNCTION_PASS("dwarf-eh-prepare", DwarfEHPreparePass(TM))
3505f757f3fSDimitry AndricFUNCTION_PASS("expand-large-div-rem", ExpandLargeDivRemPass(TM))
3515f757f3fSDimitry AndricFUNCTION_PASS("expand-large-fp-convert", ExpandLargeFpConvertPass(TM))
3525f757f3fSDimitry AndricFUNCTION_PASS("expand-memcmp", ExpandMemCmpPass(TM))
353e8d8bef9SDimitry AndricFUNCTION_PASS("fix-irreducible", FixIrreduciblePass())
354*0fca6ea1SDimitry AndricFUNCTION_PASS("flatten-cfg", FlattenCFGPass())
3555f757f3fSDimitry AndricFUNCTION_PASS("float2int", Float2IntPass())
3561db9f3b2SDimitry AndricFUNCTION_PASS("gc-lowering", GCLoweringPass())
3575f757f3fSDimitry AndricFUNCTION_PASS("guard-widening", GuardWideningPass())
3580b57cec5SDimitry AndricFUNCTION_PASS("gvn-hoist", GVNHoistPass())
359e8d8bef9SDimitry AndricFUNCTION_PASS("gvn-sink", GVNSinkPass())
360e8d8bef9SDimitry AndricFUNCTION_PASS("helloworld", HelloWorldPass())
3615f757f3fSDimitry AndricFUNCTION_PASS("indirectbr-expand", IndirectBrExpandPass(TM))
362e8d8bef9SDimitry AndricFUNCTION_PASS("infer-address-spaces", InferAddressSpacesPass())
3635f757f3fSDimitry AndricFUNCTION_PASS("infer-alignment", InferAlignmentPass())
3645f757f3fSDimitry AndricFUNCTION_PASS("inject-tli-mappings", InjectTLIMappings())
365e8d8bef9SDimitry AndricFUNCTION_PASS("instcount", InstCountPass())
3665f757f3fSDimitry AndricFUNCTION_PASS("instnamer", InstructionNamerPass())
3670b57cec5SDimitry AndricFUNCTION_PASS("instsimplify", InstSimplifyPass())
3685f757f3fSDimitry AndricFUNCTION_PASS("interleaved-access", InterleavedAccessPass(TM))
3695f757f3fSDimitry AndricFUNCTION_PASS("interleaved-load-combine", InterleavedLoadCombinePass(TM))
3700b57cec5SDimitry AndricFUNCTION_PASS("invalidate<all>", InvalidateAllAnalysesPass())
3715ffd83dbSDimitry AndricFUNCTION_PASS("irce", IRCEPass())
3725f757f3fSDimitry AndricFUNCTION_PASS("jump-threading", JumpThreadingPass())
373*0fca6ea1SDimitry AndricFUNCTION_PASS("jump-table-to-switch", JumpTableToSwitchPass());
3745f757f3fSDimitry AndricFUNCTION_PASS("kcfi", KCFIPass())
3755f757f3fSDimitry AndricFUNCTION_PASS("lcssa", LCSSAPass())
3760b57cec5SDimitry AndricFUNCTION_PASS("libcalls-shrinkwrap", LibCallsShrinkWrapPass())
377e8d8bef9SDimitry AndricFUNCTION_PASS("lint", LintPass())
3780b57cec5SDimitry AndricFUNCTION_PASS("load-store-vectorizer", LoadStoreVectorizerPass())
3795f757f3fSDimitry AndricFUNCTION_PASS("loop-data-prefetch", LoopDataPrefetchPass())
3805f757f3fSDimitry AndricFUNCTION_PASS("loop-distribute", LoopDistributePass())
3815f757f3fSDimitry AndricFUNCTION_PASS("loop-fusion", LoopFusePass())
3825f757f3fSDimitry AndricFUNCTION_PASS("loop-load-elim", LoopLoadEliminationPass())
3830b57cec5SDimitry AndricFUNCTION_PASS("loop-simplify", LoopSimplifyPass())
3840b57cec5SDimitry AndricFUNCTION_PASS("loop-sink", LoopSinkPass())
3855f757f3fSDimitry AndricFUNCTION_PASS("loop-versioning", LoopVersioningPass())
386*0fca6ea1SDimitry AndricFUNCTION_PASS("lower-allow-check", LowerAllowCheckPass())
387*0fca6ea1SDimitry AndricFUNCTION_PASS("lower-atomic", LowerAtomicPass())
3885f757f3fSDimitry AndricFUNCTION_PASS("lower-constant-intrinsics", LowerConstantIntrinsicsPass())
3895f757f3fSDimitry AndricFUNCTION_PASS("lower-expect", LowerExpectIntrinsicPass())
3905f757f3fSDimitry AndricFUNCTION_PASS("lower-guard-intrinsic", LowerGuardIntrinsicPass())
391*0fca6ea1SDimitry AndricFUNCTION_PASS("lower-invoke", LowerInvokePass())
392*0fca6ea1SDimitry AndricFUNCTION_PASS("lower-switch", LowerSwitchPass())
3935f757f3fSDimitry AndricFUNCTION_PASS("lower-widenable-condition", LowerWidenableConditionPass())
3945f757f3fSDimitry AndricFUNCTION_PASS("make-guards-explicit", MakeGuardsExplicitPass())
3950b57cec5SDimitry AndricFUNCTION_PASS("mem2reg", PromotePass())
3960b57cec5SDimitry AndricFUNCTION_PASS("memcpyopt", MemCpyOptPass())
3975f757f3fSDimitry AndricFUNCTION_PASS("memprof", MemProfilerPass())
3980b57cec5SDimitry AndricFUNCTION_PASS("mergeicmps", MergeICmpsPass())
399e8d8bef9SDimitry AndricFUNCTION_PASS("mergereturn", UnifyFunctionExitNodesPass())
40006c3fb27SDimitry AndricFUNCTION_PASS("move-auto-init", MoveAutoInitPass())
4010b57cec5SDimitry AndricFUNCTION_PASS("nary-reassociate", NaryReassociatePass())
4020b57cec5SDimitry AndricFUNCTION_PASS("newgvn", NewGVNPass())
4035f757f3fSDimitry AndricFUNCTION_PASS("no-op-function", NoOpFunctionPass())
404e8d8bef9SDimitry AndricFUNCTION_PASS("objc-arc", ObjCARCOptPass())
405e8d8bef9SDimitry AndricFUNCTION_PASS("objc-arc-contract", ObjCARCContractPass())
406e8d8bef9SDimitry AndricFUNCTION_PASS("objc-arc-expand", ObjCARCExpandPass())
407bdd1243dSDimitry AndricFUNCTION_PASS("pa-eval", PAEvalPass())
4085f757f3fSDimitry AndricFUNCTION_PASS("partially-inline-libcalls", PartiallyInlineLibCallsPass())
4090b57cec5SDimitry AndricFUNCTION_PASS("pgo-memop-opt", PGOMemOPSizeOpt())
41006c3fb27SDimitry AndricFUNCTION_PASS("place-safepoints", PlaceSafepointsPass())
4110b57cec5SDimitry AndricFUNCTION_PASS("print", PrintFunctionPass(dbgs()))
4125f757f3fSDimitry Andric// TODO: rename to print<foo> after NPM switch
4135f757f3fSDimitry AndricFUNCTION_PASS("print-alias-sets", AliasSetsPrinterPass(dbgs()))
4145f757f3fSDimitry AndricFUNCTION_PASS("print-cfg-sccs", CFGSCCPrinterPass(dbgs()))
4155f757f3fSDimitry AndricFUNCTION_PASS("print-memderefs", MemDerefPrinterPass(dbgs()))
4165f757f3fSDimitry AndricFUNCTION_PASS("print-mustexecute", MustExecutePrinterPass(dbgs()))
4175f757f3fSDimitry AndricFUNCTION_PASS("print-predicateinfo", PredicateInfoPrinterPass(dbgs()))
4185f757f3fSDimitry AndricFUNCTION_PASS("print<access-info>", LoopAccessInfoPrinterPass(dbgs()))
4190b57cec5SDimitry AndricFUNCTION_PASS("print<assumptions>", AssumptionPrinterPass(dbgs()))
4200b57cec5SDimitry AndricFUNCTION_PASS("print<block-freq>", BlockFrequencyPrinterPass(dbgs()))
4210b57cec5SDimitry AndricFUNCTION_PASS("print<branch-prob>", BranchProbabilityPrinterPass(dbgs()))
422349cc55cSDimitry AndricFUNCTION_PASS("print<cost-model>", CostModelPrinterPass(dbgs()))
4230eae32dcSDimitry AndricFUNCTION_PASS("print<cycles>", CycleInfoPrinterPass(dbgs()))
4240b57cec5SDimitry AndricFUNCTION_PASS("print<da>", DependenceAnalysisPrinterPass(dbgs()))
425297eecfbSDimitry AndricFUNCTION_PASS("print<debug-ata>", DebugAssignmentTrackingPrinterPass(dbgs()))
426e8d8bef9SDimitry AndricFUNCTION_PASS("print<delinearization>", DelinearizationPrinterPass(dbgs()))
4270b57cec5SDimitry AndricFUNCTION_PASS("print<demanded-bits>", DemandedBitsPrinterPass(dbgs()))
4280b57cec5SDimitry AndricFUNCTION_PASS("print<domfrontier>", DominanceFrontierPrinterPass(dbgs()))
4295f757f3fSDimitry AndricFUNCTION_PASS("print<domtree>", DominatorTreePrinterPass(dbgs()))
430e8d8bef9SDimitry AndricFUNCTION_PASS("print<func-properties>", FunctionPropertiesPrinterPass(dbgs()))
4315ffd83dbSDimitry AndricFUNCTION_PASS("print<inline-cost>", InlineCostAnnotationPrinterPass(dbgs()))
432e8d8bef9SDimitry AndricFUNCTION_PASS("print<inliner-size-estimator>",
433e8d8bef9SDimitry Andric              InlineSizeEstimatorAnalysisPrinterPass(dbgs()))
4345f757f3fSDimitry AndricFUNCTION_PASS("print<lazy-value-info>", LazyValueInfoPrinterPass(dbgs()))
4350b57cec5SDimitry AndricFUNCTION_PASS("print<loops>", LoopPrinterPass(dbgs()))
436349cc55cSDimitry AndricFUNCTION_PASS("print<memoryssa-walker>", MemorySSAWalkerPrinterPass(dbgs()))
4370b57cec5SDimitry AndricFUNCTION_PASS("print<phi-values>", PhiValuesPrinterPass(dbgs()))
4385f757f3fSDimitry AndricFUNCTION_PASS("print<postdomtree>", PostDominatorTreePrinterPass(dbgs()))
4390b57cec5SDimitry AndricFUNCTION_PASS("print<regions>", RegionInfoPrinterPass(dbgs()))
4400b57cec5SDimitry AndricFUNCTION_PASS("print<scalar-evolution>", ScalarEvolutionPrinterPass(dbgs()))
4410b57cec5SDimitry AndricFUNCTION_PASS("print<stack-safety-local>", StackSafetyPrinterPass(dbgs()))
442bdd1243dSDimitry AndricFUNCTION_PASS("print<uniformity>", UniformityInfoPrinterPass(dbgs()))
4430b57cec5SDimitry AndricFUNCTION_PASS("reassociate", ReassociatePass())
444e8d8bef9SDimitry AndricFUNCTION_PASS("redundant-dbg-inst-elim", RedundantDbgInstEliminationPass())
445e8d8bef9SDimitry AndricFUNCTION_PASS("reg2mem", RegToMemPass())
4465f757f3fSDimitry AndricFUNCTION_PASS("safe-stack", SafeStackPass(TM))
447e8d8bef9SDimitry AndricFUNCTION_PASS("scalarize-masked-mem-intrin", ScalarizeMaskedMemIntrinPass())
4480b57cec5SDimitry AndricFUNCTION_PASS("scalarizer", ScalarizerPass())
4490b57cec5SDimitry AndricFUNCTION_PASS("sccp", SCCPPass())
4505f757f3fSDimitry AndricFUNCTION_PASS("select-optimize", SelectOptimizePass(TM))
4515f757f3fSDimitry AndricFUNCTION_PASS("separate-const-offset-from-gep",
4525f757f3fSDimitry Andric              SeparateConstOffsetFromGEPPass())
4530b57cec5SDimitry AndricFUNCTION_PASS("sink", SinkingPass())
4545f757f3fSDimitry AndricFUNCTION_PASS("sjlj-eh-prepare", SjLjEHPreparePass(TM))
4550b57cec5SDimitry AndricFUNCTION_PASS("slp-vectorizer", SLPVectorizerPass())
456e8d8bef9SDimitry AndricFUNCTION_PASS("slsr", StraightLineStrengthReducePass())
4571db9f3b2SDimitry AndricFUNCTION_PASS("stack-protector", StackProtectorPass(TM))
458e8d8bef9SDimitry AndricFUNCTION_PASS("strip-gc-relocates", StripGCRelocates())
459e8d8bef9SDimitry AndricFUNCTION_PASS("structurizecfg", StructurizeCFGPass())
4600b57cec5SDimitry AndricFUNCTION_PASS("tailcallelim", TailCallElimPass())
4615f757f3fSDimitry AndricFUNCTION_PASS("tlshoist", TLSVariableHoistPass())
4625f757f3fSDimitry AndricFUNCTION_PASS("transform-warning", WarnMissedTransformationsPass())
463*0fca6ea1SDimitry AndricFUNCTION_PASS("trigger-crash-function", TriggerCrashFunctionPass())
4645f757f3fSDimitry AndricFUNCTION_PASS("trigger-verifier-error", TriggerVerifierErrorPass())
4655f757f3fSDimitry AndricFUNCTION_PASS("tsan", ThreadSanitizerPass())
466bdd1243dSDimitry AndricFUNCTION_PASS("typepromotion", TypePromotionPass(TM))
467e8d8bef9SDimitry AndricFUNCTION_PASS("unify-loop-exits", UnifyLoopExitsPass())
4685ffd83dbSDimitry AndricFUNCTION_PASS("vector-combine", VectorCombinePass())
4690b57cec5SDimitry AndricFUNCTION_PASS("verify", VerifierPass())
4700b57cec5SDimitry AndricFUNCTION_PASS("verify<domtree>", DominatorTreeVerifierPass())
4710b57cec5SDimitry AndricFUNCTION_PASS("verify<loops>", LoopVerifierPass())
4720b57cec5SDimitry AndricFUNCTION_PASS("verify<memoryssa>", MemorySSAVerifierPass())
4730b57cec5SDimitry AndricFUNCTION_PASS("verify<regions>", RegionInfoVerifierPass())
4740b57cec5SDimitry AndricFUNCTION_PASS("verify<safepoint-ir>", SafepointIRVerifierPass())
475480093f4SDimitry AndricFUNCTION_PASS("verify<scalar-evolution>", ScalarEvolutionVerifierPass())
4760b57cec5SDimitry AndricFUNCTION_PASS("view-cfg", CFGViewerPass())
4770b57cec5SDimitry AndricFUNCTION_PASS("view-cfg-only", CFGOnlyViewerPass())
4785f757f3fSDimitry AndricFUNCTION_PASS("view-dom", DomViewer())
4795f757f3fSDimitry AndricFUNCTION_PASS("view-dom-only", DomOnlyViewer())
4805f757f3fSDimitry AndricFUNCTION_PASS("view-post-dom", PostDomViewer())
4815f757f3fSDimitry AndricFUNCTION_PASS("view-post-dom-only", PostDomOnlyViewer())
4825f757f3fSDimitry AndricFUNCTION_PASS("wasm-eh-prepare", WasmEHPreparePass())
4830b57cec5SDimitry Andric#undef FUNCTION_PASS
4840b57cec5SDimitry Andric
4850b57cec5SDimitry Andric#ifndef FUNCTION_PASS_WITH_PARAMS
486fe6060f1SDimitry Andric#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS)
4870b57cec5SDimitry Andric#endif
4885f757f3fSDimitry AndricFUNCTION_PASS_WITH_PARAMS(
4895f757f3fSDimitry Andric    "cfguard", "CFGuardPass",
4905f757f3fSDimitry Andric    [](CFGuardPass::Mechanism M) { return CFGuardPass(M); },
4915f757f3fSDimitry Andric    parseCFGuardPassOptions, "check;dispatch")
4925f757f3fSDimitry AndricFUNCTION_PASS_WITH_PARAMS(
4935f757f3fSDimitry Andric    "early-cse", "EarlyCSEPass",
4945f757f3fSDimitry Andric    [](bool UseMemorySSA) { return EarlyCSEPass(UseMemorySSA); },
4955f757f3fSDimitry Andric    parseEarlyCSEPassOptions, "memssa")
4965f757f3fSDimitry AndricFUNCTION_PASS_WITH_PARAMS(
4975f757f3fSDimitry Andric    "ee-instrument", "EntryExitInstrumenterPass",
4985f757f3fSDimitry Andric    [](bool PostInlining) { return EntryExitInstrumenterPass(PostInlining); },
4995f757f3fSDimitry Andric    parseEntryExitInstrumenterPassOptions, "post-inline")
5005f757f3fSDimitry AndricFUNCTION_PASS_WITH_PARAMS(
5015f757f3fSDimitry Andric    "function-simplification", "",
50206c3fb27SDimitry Andric    [this](OptimizationLevel OL) {
50306c3fb27SDimitry Andric      return buildFunctionSimplificationPipeline(OL, ThinOrFullLTOPhase::None);
50406c3fb27SDimitry Andric    },
5055f757f3fSDimitry Andric    parseFunctionSimplificationPipelineOptions, "O1;O2;O3;Os;Oz")
5065f757f3fSDimitry AndricFUNCTION_PASS_WITH_PARAMS(
5075f757f3fSDimitry Andric    "gvn", "GVNPass", [](GVNOptions Opts) { return GVNPass(Opts); },
5085f757f3fSDimitry Andric    parseGVNOptions,
5095f757f3fSDimitry Andric    "no-pre;pre;no-load-pre;load-pre;no-split-backedge-load-pre;"
5105f757f3fSDimitry Andric    "split-backedge-load-pre;no-memdep;memdep")
5115f757f3fSDimitry AndricFUNCTION_PASS_WITH_PARAMS(
5125f757f3fSDimitry Andric    "hardware-loops", "HardwareLoopsPass",
5135f757f3fSDimitry Andric    [](HardwareLoopOptions Opts) { return HardwareLoopsPass(Opts); },
5145f757f3fSDimitry Andric    parseHardwareLoopOptions,
5155f757f3fSDimitry Andric    "force-hardware-loops;force-hardware-loop-phi;force-nested-hardware-loop;"
5165f757f3fSDimitry Andric    "force-hardware-loop-guard;hardware-loop-decrement=N;"
5175f757f3fSDimitry Andric    "hardware-loop-counter-bitwidth=N")
5185f757f3fSDimitry AndricFUNCTION_PASS_WITH_PARAMS(
5195f757f3fSDimitry Andric    "instcombine", "InstCombinePass",
5205f757f3fSDimitry Andric    [](InstCombineOptions Opts) { return InstCombinePass(Opts); },
5215f757f3fSDimitry Andric    parseInstCombineOptions,
5225f757f3fSDimitry Andric    "no-use-loop-info;use-loop-info;no-verify-fixpoint;verify-fixpoint;"
5235f757f3fSDimitry Andric    "max-iterations=N")
5245f757f3fSDimitry AndricFUNCTION_PASS_WITH_PARAMS(
5255f757f3fSDimitry Andric    "loop-unroll", "LoopUnrollPass",
5265f757f3fSDimitry Andric    [](LoopUnrollOptions Opts) { return LoopUnrollPass(Opts); },
5275f757f3fSDimitry Andric    parseLoopUnrollOptions,
5285f757f3fSDimitry Andric    "O0;O1;O2;O3;full-unroll-max=N;no-partial;partial;no-peeling;peeling;"
5295f757f3fSDimitry Andric    "no-profile-peeling;profile-peeling;no-runtime;runtime;no-upperbound;"
5305f757f3fSDimitry Andric    "upperbound")
5315f757f3fSDimitry AndricFUNCTION_PASS_WITH_PARAMS(
5325f757f3fSDimitry Andric    "loop-vectorize", "LoopVectorizePass",
5335f757f3fSDimitry Andric    [](LoopVectorizeOptions Opts) { return LoopVectorizePass(Opts); },
5345f757f3fSDimitry Andric    parseLoopVectorizeOptions,
5355f757f3fSDimitry Andric    "no-interleave-forced-only;interleave-forced-only;no-vectorize-forced-only;"
5365f757f3fSDimitry Andric    "vectorize-forced-only")
5375f757f3fSDimitry AndricFUNCTION_PASS_WITH_PARAMS(
5385f757f3fSDimitry Andric    "lower-matrix-intrinsics", "LowerMatrixIntrinsicsPass",
5395f757f3fSDimitry Andric    [](bool Minimal) { return LowerMatrixIntrinsicsPass(Minimal); },
5405f757f3fSDimitry Andric    parseLowerMatrixIntrinsicsPassOptions, "minimal")
5415f757f3fSDimitry AndricFUNCTION_PASS_WITH_PARAMS(
5425f757f3fSDimitry Andric    "mldst-motion", "MergedLoadStoreMotionPass",
5435f757f3fSDimitry Andric    [](MergedLoadStoreMotionOptions Opts) {
5445f757f3fSDimitry Andric      return MergedLoadStoreMotionPass(Opts);
5455f757f3fSDimitry Andric    },
5465f757f3fSDimitry Andric    parseMergedLoadStoreMotionOptions, "no-split-footer-bb;split-footer-bb")
5475f757f3fSDimitry AndricFUNCTION_PASS_WITH_PARAMS(
5485f757f3fSDimitry Andric    "print<da>", "DependenceAnalysisPrinterPass",
5495f757f3fSDimitry Andric    [](bool NormalizeResults) {
5505f757f3fSDimitry Andric      return DependenceAnalysisPrinterPass(dbgs(), NormalizeResults);
5515f757f3fSDimitry Andric    },
5525f757f3fSDimitry Andric    parseDependenceAnalysisPrinterOptions, "normalized-results")
5535f757f3fSDimitry AndricFUNCTION_PASS_WITH_PARAMS(
5545f757f3fSDimitry Andric    "print<memoryssa>", "MemorySSAPrinterPass",
55506c3fb27SDimitry Andric    [](bool NoEnsureOptimizedUses) {
55606c3fb27SDimitry Andric      return MemorySSAPrinterPass(dbgs(), !NoEnsureOptimizedUses);
55706c3fb27SDimitry Andric    },
5585f757f3fSDimitry Andric    parseMemorySSAPrinterPassOptions, "no-ensure-optimized-uses")
5595f757f3fSDimitry AndricFUNCTION_PASS_WITH_PARAMS(
5605f757f3fSDimitry Andric    "print<stack-lifetime>", "StackLifetimePrinterPass",
5615f757f3fSDimitry Andric    [](StackLifetime::LivenessType Type) {
5625f757f3fSDimitry Andric      return StackLifetimePrinterPass(dbgs(), Type);
5635f757f3fSDimitry Andric    },
5645f757f3fSDimitry Andric    parseStackLifetimeOptions, "may;must")
5655f757f3fSDimitry AndricFUNCTION_PASS_WITH_PARAMS(
5665f757f3fSDimitry Andric    "separate-const-offset-from-gep", "SeparateConstOffsetFromGEPPass",
5675f757f3fSDimitry Andric    [](bool LowerGEP) { return SeparateConstOffsetFromGEPPass(LowerGEP); },
5685f757f3fSDimitry Andric    parseSeparateConstOffsetFromGEPPassOptions, "lower-gep")
5695f757f3fSDimitry AndricFUNCTION_PASS_WITH_PARAMS(
5705f757f3fSDimitry Andric    "simplifycfg", "SimplifyCFGPass",
5715f757f3fSDimitry Andric    [](SimplifyCFGOptions Opts) { return SimplifyCFGPass(Opts); },
5725f757f3fSDimitry Andric    parseSimplifyCFGOptions,
5735f757f3fSDimitry Andric    "no-forward-switch-cond;forward-switch-cond;no-switch-range-to-icmp;"
5745f757f3fSDimitry Andric    "switch-range-to-icmp;no-switch-to-lookup;switch-to-lookup;no-keep-loops;"
5755f757f3fSDimitry Andric    "keep-loops;no-hoist-common-insts;hoist-common-insts;no-sink-common-insts;"
5765f757f3fSDimitry Andric    "sink-common-insts;bonus-inst-threshold=N")
5775f757f3fSDimitry AndricFUNCTION_PASS_WITH_PARAMS(
5785f757f3fSDimitry Andric    "speculative-execution", "SpeculativeExecutionPass",
5795f757f3fSDimitry Andric    [](bool OnlyIfDivergentTarget) {
5805f757f3fSDimitry Andric      return SpeculativeExecutionPass(OnlyIfDivergentTarget);
5815f757f3fSDimitry Andric    },
5825f757f3fSDimitry Andric    parseSpeculativeExecutionPassOptions, "only-if-divergent-target")
5835f757f3fSDimitry AndricFUNCTION_PASS_WITH_PARAMS(
5845f757f3fSDimitry Andric    "sroa", "SROAPass",
5855f757f3fSDimitry Andric    [](SROAOptions PreserveCFG) { return SROAPass(PreserveCFG); },
5865f757f3fSDimitry Andric    parseSROAOptions, "preserve-cfg;modify-cfg")
5875f757f3fSDimitry AndricFUNCTION_PASS_WITH_PARAMS(
5885f757f3fSDimitry Andric    "win-eh-prepare", "WinEHPreparePass",
5895f757f3fSDimitry Andric    [](bool DemoteCatchSwitchPHIOnly) {
5905f757f3fSDimitry Andric      return WinEHPreparePass(DemoteCatchSwitchPHIOnly);
5915f757f3fSDimitry Andric    },
5925f757f3fSDimitry Andric    parseWinEHPrepareOptions, "demote-catchswitch-only")
5930b57cec5SDimitry Andric#undef FUNCTION_PASS_WITH_PARAMS
5940b57cec5SDimitry Andric
595349cc55cSDimitry Andric#ifndef LOOPNEST_PASS
596349cc55cSDimitry Andric#define LOOPNEST_PASS(NAME, CREATE_PASS)
597349cc55cSDimitry Andric#endif
598349cc55cSDimitry AndricLOOPNEST_PASS("loop-flatten", LoopFlattenPass())
599349cc55cSDimitry AndricLOOPNEST_PASS("loop-interchange", LoopInterchangePass())
600349cc55cSDimitry AndricLOOPNEST_PASS("loop-unroll-and-jam", LoopUnrollAndJamPass())
601349cc55cSDimitry AndricLOOPNEST_PASS("no-op-loopnest", NoOpLoopNestPass())
602349cc55cSDimitry Andric#undef LOOPNEST_PASS
603349cc55cSDimitry Andric
6040b57cec5SDimitry Andric#ifndef LOOP_ANALYSIS
6050b57cec5SDimitry Andric#define LOOP_ANALYSIS(NAME, CREATE_PASS)
6060b57cec5SDimitry Andric#endif
6078bcb0991SDimitry AndricLOOP_ANALYSIS("ddg", DDGAnalysis())
608e8d8bef9SDimitry AndricLOOP_ANALYSIS("iv-users", IVUsersAnalysis())
6095f757f3fSDimitry AndricLOOP_ANALYSIS("no-op-loop", NoOpLoopAnalysis())
6100b57cec5SDimitry AndricLOOP_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis(PIC))
611*0fca6ea1SDimitry AndricLOOP_ANALYSIS("should-run-extra-simple-loop-unswitch",
612*0fca6ea1SDimitry Andric                  ShouldRunExtraSimpleLoopUnswitch())
613*0fca6ea1SDimitry Andric
6140b57cec5SDimitry Andric#undef LOOP_ANALYSIS
6150b57cec5SDimitry Andric
6160b57cec5SDimitry Andric#ifndef LOOP_PASS
6170b57cec5SDimitry Andric#define LOOP_PASS(NAME, CREATE_PASS)
6180b57cec5SDimitry Andric#endif
6195ffd83dbSDimitry AndricLOOP_PASS("canon-freeze", CanonicalizeFreezeInLoopsPass())
620e8d8bef9SDimitry AndricLOOP_PASS("dot-ddg", DDGDotPrinterPass())
6215f757f3fSDimitry AndricLOOP_PASS("guard-widening", GuardWideningPass())
6225f757f3fSDimitry AndricLOOP_PASS("indvars", IndVarSimplifyPass())
6230b57cec5SDimitry AndricLOOP_PASS("invalidate<all>", InvalidateAllAnalysesPass())
6245f757f3fSDimitry AndricLOOP_PASS("loop-bound-split", LoopBoundSplitPass())
6255f757f3fSDimitry AndricLOOP_PASS("loop-deletion", LoopDeletionPass())
6260b57cec5SDimitry AndricLOOP_PASS("loop-idiom", LoopIdiomRecognizePass())
627*0fca6ea1SDimitry AndricLOOP_PASS("loop-idiom-vectorize", LoopIdiomVectorizePass())
6280b57cec5SDimitry AndricLOOP_PASS("loop-instsimplify", LoopInstSimplifyPass())
6295f757f3fSDimitry AndricLOOP_PASS("loop-predication", LoopPredicationPass())
6305f757f3fSDimitry AndricLOOP_PASS("loop-reduce", LoopStrengthReducePass())
6315f757f3fSDimitry AndricLOOP_PASS("loop-simplifycfg", LoopSimplifyCFGPass())
6325f757f3fSDimitry AndricLOOP_PASS("loop-unroll-full", LoopFullUnrollPass())
6335f757f3fSDimitry AndricLOOP_PASS("loop-versioning-licm", LoopVersioningLICMPass())
6340b57cec5SDimitry AndricLOOP_PASS("no-op-loop", NoOpLoopPass())
6350b57cec5SDimitry AndricLOOP_PASS("print", PrintLoopPass(dbgs()))
6368bcb0991SDimitry AndricLOOP_PASS("print<ddg>", DDGAnalysisPrinterPass(dbgs()))
637e8d8bef9SDimitry AndricLOOP_PASS("print<iv-users>", IVUsersPrinterPass(dbgs()))
6388bcb0991SDimitry AndricLOOP_PASS("print<loop-cache-cost>", LoopCachePrinterPass(dbgs()))
6395f757f3fSDimitry AndricLOOP_PASS("print<loopnest>", LoopNestPrinterPass(dbgs()))
6400b57cec5SDimitry Andric#undef LOOP_PASS
6410b57cec5SDimitry Andric
6420b57cec5SDimitry Andric#ifndef LOOP_PASS_WITH_PARAMS
643fe6060f1SDimitry Andric#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS)
6440b57cec5SDimitry Andric#endif
6455f757f3fSDimitry AndricLOOP_PASS_WITH_PARAMS(
6465f757f3fSDimitry Andric    "licm", "LICMPass", [](LICMOptions Params) { return LICMPass(Params); },
6475f757f3fSDimitry Andric    parseLICMOptions, "allowspeculation")
6485f757f3fSDimitry AndricLOOP_PASS_WITH_PARAMS(
6495f757f3fSDimitry Andric    "lnicm", "LNICMPass", [](LICMOptions Params) { return LNICMPass(Params); },
6505f757f3fSDimitry Andric    parseLICMOptions, "allowspeculation")
6515f757f3fSDimitry AndricLOOP_PASS_WITH_PARAMS(
6525f757f3fSDimitry Andric    "loop-rotate", "LoopRotatePass",
65306c3fb27SDimitry Andric    [](std::pair<bool, bool> Params) {
65406c3fb27SDimitry Andric      return LoopRotatePass(Params.first, Params.second);
65506c3fb27SDimitry Andric    },
65606c3fb27SDimitry Andric    parseLoopRotateOptions,
6575f757f3fSDimitry Andric    "no-header-duplication;header-duplication;"
6585f757f3fSDimitry Andric    "no-prepare-for-lto;prepare-for-lto")
6595f757f3fSDimitry AndricLOOP_PASS_WITH_PARAMS(
6605f757f3fSDimitry Andric    "simple-loop-unswitch", "SimpleLoopUnswitchPass",
6615f757f3fSDimitry Andric    [](std::pair<bool, bool> Params) {
6625f757f3fSDimitry Andric      return SimpleLoopUnswitchPass(Params.first, Params.second);
6635f757f3fSDimitry Andric    },
6645f757f3fSDimitry Andric    parseLoopUnswitchOptions, "nontrivial;no-nontrivial;trivial;no-trivial")
6650b57cec5SDimitry Andric#undef LOOP_PASS_WITH_PARAMS
666