1//===- PassRegistry.def - Registry of passes --------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file is used as the registry of passes that are part of the core LLVM
10// libraries. This file describes both transformation passes and analyses
11// Analyses are registered while transformation passes have names registered
12// that can be used when providing a textual pass pipeline.
13//
14//===----------------------------------------------------------------------===//
15
16// NOTE: NO INCLUDE GUARD DESIRED!
17
18#ifndef MODULE_ANALYSIS
19#define MODULE_ANALYSIS(NAME, CREATE_PASS)
20#endif
21MODULE_ANALYSIS("callgraph", CallGraphAnalysis())
22MODULE_ANALYSIS("lcg", LazyCallGraphAnalysis())
23MODULE_ANALYSIS("module-summary", ModuleSummaryIndexAnalysis())
24MODULE_ANALYSIS("no-op-module", NoOpModuleAnalysis())
25MODULE_ANALYSIS("profile-summary", ProfileSummaryAnalysis())
26MODULE_ANALYSIS("stack-safety", StackSafetyGlobalAnalysis())
27MODULE_ANALYSIS("verify", VerifierAnalysis())
28MODULE_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis(PIC))
29MODULE_ANALYSIS("asan-globals-md", ASanGlobalsMetadataAnalysis())
30MODULE_ANALYSIS("inline-advisor", InlineAdvisorAnalysis())
31MODULE_ANALYSIS("ir-similarity", IRSimilarityAnalysis())
32
33#ifndef MODULE_ALIAS_ANALYSIS
34#define MODULE_ALIAS_ANALYSIS(NAME, CREATE_PASS)                               \
35  MODULE_ANALYSIS(NAME, CREATE_PASS)
36#endif
37MODULE_ALIAS_ANALYSIS("globals-aa", GlobalsAA())
38#undef MODULE_ALIAS_ANALYSIS
39#undef MODULE_ANALYSIS
40
41#ifndef MODULE_PASS
42#define MODULE_PASS(NAME, CREATE_PASS)
43#endif
44MODULE_PASS("always-inline", AlwaysInlinerPass())
45MODULE_PASS("attributor", AttributorPass())
46MODULE_PASS("annotation2metadata", Annotation2MetadataPass())
47MODULE_PASS("openmp-opt", OpenMPOptPass())
48MODULE_PASS("called-value-propagation", CalledValuePropagationPass())
49MODULE_PASS("canonicalize-aliases", CanonicalizeAliasesPass())
50MODULE_PASS("cg-profile", CGProfilePass())
51MODULE_PASS("check-debugify", NewPMCheckDebugifyPass())
52MODULE_PASS("constmerge", ConstantMergePass())
53MODULE_PASS("cross-dso-cfi", CrossDSOCFIPass())
54MODULE_PASS("deadargelim", DeadArgumentEliminationPass())
55MODULE_PASS("debugify", NewPMDebugifyPass())
56MODULE_PASS("elim-avail-extern", EliminateAvailableExternallyPass())
57MODULE_PASS("extract-blocks", BlockExtractorPass())
58MODULE_PASS("forceattrs", ForceFunctionAttrsPass())
59MODULE_PASS("function-import", FunctionImportPass())
60MODULE_PASS("function-specialization", FunctionSpecializationPass())
61MODULE_PASS("globaldce", GlobalDCEPass())
62MODULE_PASS("globalopt", GlobalOptPass())
63MODULE_PASS("globalsplit", GlobalSplitPass())
64MODULE_PASS("hotcoldsplit", HotColdSplittingPass())
65MODULE_PASS("inferattrs", InferFunctionAttrsPass())
66MODULE_PASS("inliner-wrapper", ModuleInlinerWrapperPass())
67MODULE_PASS("print<inline-advisor>", InlineAdvisorAnalysisPrinterPass(dbgs()))
68MODULE_PASS("inliner-wrapper-no-mandatory-first", ModuleInlinerWrapperPass(
69  getInlineParams(),
70  false))
71MODULE_PASS("insert-gcov-profiling", GCOVProfilerPass())
72MODULE_PASS("instrorderfile", InstrOrderFilePass())
73MODULE_PASS("instrprof", InstrProfiling())
74MODULE_PASS("internalize", InternalizePass())
75MODULE_PASS("invalidate<all>", InvalidateAllAnalysesPass())
76MODULE_PASS("ipsccp", IPSCCPPass())
77MODULE_PASS("iroutliner", IROutlinerPass())
78MODULE_PASS("print-ir-similarity", IRSimilarityAnalysisPrinterPass(dbgs()))
79MODULE_PASS("lowertypetests", LowerTypeTestsPass())
80MODULE_PASS("metarenamer", MetaRenamerPass())
81MODULE_PASS("mergefunc", MergeFunctionsPass())
82MODULE_PASS("name-anon-globals", NameAnonGlobalPass())
83MODULE_PASS("no-op-module", NoOpModulePass())
84MODULE_PASS("objc-arc-apelim", ObjCARCAPElimPass())
85MODULE_PASS("partial-inliner", PartialInlinerPass())
86MODULE_PASS("pgo-icall-prom", PGOIndirectCallPromotion())
87MODULE_PASS("pgo-instr-gen", PGOInstrumentationGen())
88MODULE_PASS("pgo-instr-use", PGOInstrumentationUse())
89MODULE_PASS("print-profile-summary", ProfileSummaryPrinterPass(dbgs()))
90MODULE_PASS("print-callgraph", CallGraphPrinterPass(dbgs()))
91MODULE_PASS("print", PrintModulePass(dbgs()))
92MODULE_PASS("print-lcg", LazyCallGraphPrinterPass(dbgs()))
93MODULE_PASS("print-lcg-dot", LazyCallGraphDOTPrinterPass(dbgs()))
94MODULE_PASS("print-must-be-executed-contexts", MustBeExecutedContextPrinterPass(dbgs()))
95MODULE_PASS("print-stack-safety", StackSafetyGlobalPrinterPass(dbgs()))
96MODULE_PASS("print<module-debuginfo>", ModuleDebugInfoPrinterPass(dbgs()))
97MODULE_PASS("rel-lookup-table-converter", RelLookupTableConverterPass())
98MODULE_PASS("rewrite-statepoints-for-gc", RewriteStatepointsForGC())
99MODULE_PASS("rewrite-symbols", RewriteSymbolPass())
100MODULE_PASS("rpo-function-attrs", ReversePostOrderFunctionAttrsPass())
101MODULE_PASS("sample-profile", SampleProfileLoaderPass())
102MODULE_PASS("scc-oz-module-inliner",
103  buildInlinerPipeline(OptimizationLevel::Oz, ThinOrFullLTOPhase::None))
104MODULE_PASS("strip", StripSymbolsPass())
105MODULE_PASS("strip-dead-debug-info", StripDeadDebugInfoPass())
106MODULE_PASS("pseudo-probe", SampleProfileProbePass(TM))
107MODULE_PASS("strip-dead-prototypes", StripDeadPrototypesPass())
108MODULE_PASS("strip-debug-declare", StripDebugDeclarePass())
109MODULE_PASS("strip-nondebug", StripNonDebugSymbolsPass())
110MODULE_PASS("strip-nonlinetable-debuginfo", StripNonLineTableDebugInfoPass())
111MODULE_PASS("synthetic-counts-propagation", SyntheticCountsPropagation())
112MODULE_PASS("verify", VerifierPass())
113MODULE_PASS("wholeprogramdevirt", WholeProgramDevirtPass())
114MODULE_PASS("dfsan", DataFlowSanitizerPass())
115MODULE_PASS("msan-module", ModuleMemorySanitizerPass({}))
116MODULE_PASS("module-inline", ModuleInlinerPass())
117MODULE_PASS("tsan-module", ModuleThreadSanitizerPass())
118MODULE_PASS("sancov-module", ModuleSanitizerCoveragePass())
119MODULE_PASS("memprof-module", ModuleMemProfilerPass())
120MODULE_PASS("poison-checking", PoisonCheckingPass())
121MODULE_PASS("pseudo-probe-update", PseudoProbeUpdatePass())
122#undef MODULE_PASS
123
124#ifndef MODULE_PASS_WITH_PARAMS
125#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS)
126#endif
127MODULE_PASS_WITH_PARAMS("loop-extract",
128                        "LoopExtractorPass",
129                        [](bool Single) {
130                          if (Single)
131                            return LoopExtractorPass(1);
132                          return LoopExtractorPass();
133                        },
134                        parseLoopExtractorPassOptions,
135                        "single")
136MODULE_PASS_WITH_PARAMS("hwasan",
137                        "HWAddressSanitizerPass",
138                        [](HWAddressSanitizerOptions Opts) {
139                          return HWAddressSanitizerPass(Opts);
140                        },
141                        parseHWASanPassOptions,
142                        "kernel;recover")
143MODULE_PASS_WITH_PARAMS("asan-module",
144                        "ModuleAddressSanitizerPass",
145                        [](AddressSanitizerOptions Opts) {
146                          return ModuleAddressSanitizerPass(Opts);
147                        },
148                        parseASanPassOptions,
149                        "kernel")
150#undef MODULE_PASS_WITH_PARAMS
151
152#ifndef CGSCC_ANALYSIS
153#define CGSCC_ANALYSIS(NAME, CREATE_PASS)
154#endif
155CGSCC_ANALYSIS("no-op-cgscc", NoOpCGSCCAnalysis())
156CGSCC_ANALYSIS("fam-proxy", FunctionAnalysisManagerCGSCCProxy())
157CGSCC_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis(PIC))
158#undef CGSCC_ANALYSIS
159
160#ifndef CGSCC_PASS
161#define CGSCC_PASS(NAME, CREATE_PASS)
162#endif
163CGSCC_PASS("argpromotion", ArgumentPromotionPass())
164CGSCC_PASS("invalidate<all>", InvalidateAllAnalysesPass())
165CGSCC_PASS("function-attrs", PostOrderFunctionAttrsPass())
166CGSCC_PASS("attributor-cgscc", AttributorCGSCCPass())
167CGSCC_PASS("openmp-opt-cgscc", OpenMPOptCGSCCPass())
168CGSCC_PASS("coro-split", CoroSplitPass())
169CGSCC_PASS("no-op-cgscc", NoOpCGSCCPass())
170#undef CGSCC_PASS
171
172#ifndef CGSCC_PASS_WITH_PARAMS
173#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS)
174#endif
175CGSCC_PASS_WITH_PARAMS("inline",
176                       "InlinerPass",
177                       [](bool OnlyMandatory) {
178                         return InlinerPass(OnlyMandatory);
179                       },
180                       parseInlinerPassOptions,
181                       "only-mandatory")
182#undef CGSCC_PASS_WITH_PARAMS
183
184#ifndef FUNCTION_ANALYSIS
185#define FUNCTION_ANALYSIS(NAME, CREATE_PASS)
186#endif
187FUNCTION_ANALYSIS("aa", AAManager())
188FUNCTION_ANALYSIS("assumptions", AssumptionAnalysis())
189FUNCTION_ANALYSIS("block-freq", BlockFrequencyAnalysis())
190FUNCTION_ANALYSIS("branch-prob", BranchProbabilityAnalysis())
191FUNCTION_ANALYSIS("cycles", CycleAnalysis())
192FUNCTION_ANALYSIS("domtree", DominatorTreeAnalysis())
193FUNCTION_ANALYSIS("postdomtree", PostDominatorTreeAnalysis())
194FUNCTION_ANALYSIS("demanded-bits", DemandedBitsAnalysis())
195FUNCTION_ANALYSIS("domfrontier", DominanceFrontierAnalysis())
196FUNCTION_ANALYSIS("func-properties", FunctionPropertiesAnalysis())
197FUNCTION_ANALYSIS("loops", LoopAnalysis())
198FUNCTION_ANALYSIS("lazy-value-info", LazyValueAnalysis())
199FUNCTION_ANALYSIS("da", DependenceAnalysis())
200FUNCTION_ANALYSIS("inliner-size-estimator", InlineSizeEstimatorAnalysis())
201FUNCTION_ANALYSIS("memdep", MemoryDependenceAnalysis())
202FUNCTION_ANALYSIS("memoryssa", MemorySSAAnalysis())
203FUNCTION_ANALYSIS("phi-values", PhiValuesAnalysis())
204FUNCTION_ANALYSIS("regions", RegionInfoAnalysis())
205FUNCTION_ANALYSIS("no-op-function", NoOpFunctionAnalysis())
206FUNCTION_ANALYSIS("opt-remark-emit", OptimizationRemarkEmitterAnalysis())
207FUNCTION_ANALYSIS("scalar-evolution", ScalarEvolutionAnalysis())
208FUNCTION_ANALYSIS("should-not-run-function-passes", ShouldNotRunFunctionPassesAnalysis())
209FUNCTION_ANALYSIS("should-run-extra-vector-passes", ShouldRunExtraVectorPasses())
210FUNCTION_ANALYSIS("stack-safety-local", StackSafetyAnalysis())
211FUNCTION_ANALYSIS("targetlibinfo", TargetLibraryAnalysis())
212FUNCTION_ANALYSIS("targetir",
213                  TM ? TM->getTargetIRAnalysis() : TargetIRAnalysis())
214FUNCTION_ANALYSIS("verify", VerifierAnalysis())
215FUNCTION_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis(PIC))
216FUNCTION_ANALYSIS("divergence", DivergenceAnalysis())
217
218#ifndef FUNCTION_ALIAS_ANALYSIS
219#define FUNCTION_ALIAS_ANALYSIS(NAME, CREATE_PASS)                             \
220  FUNCTION_ANALYSIS(NAME, CREATE_PASS)
221#endif
222FUNCTION_ALIAS_ANALYSIS("basic-aa", BasicAA())
223FUNCTION_ALIAS_ANALYSIS("cfl-anders-aa", CFLAndersAA())
224FUNCTION_ALIAS_ANALYSIS("cfl-steens-aa", CFLSteensAA())
225FUNCTION_ALIAS_ANALYSIS("objc-arc-aa", objcarc::ObjCARCAA())
226FUNCTION_ALIAS_ANALYSIS("scev-aa", SCEVAA())
227FUNCTION_ALIAS_ANALYSIS("scoped-noalias-aa", ScopedNoAliasAA())
228FUNCTION_ALIAS_ANALYSIS("tbaa", TypeBasedAA())
229#undef FUNCTION_ALIAS_ANALYSIS
230#undef FUNCTION_ANALYSIS
231
232#ifndef FUNCTION_PASS
233#define FUNCTION_PASS(NAME, CREATE_PASS)
234#endif
235FUNCTION_PASS("aa-eval", AAEvaluator())
236FUNCTION_PASS("adce", ADCEPass())
237FUNCTION_PASS("add-discriminators", AddDiscriminatorsPass())
238FUNCTION_PASS("aggressive-instcombine", AggressiveInstCombinePass())
239FUNCTION_PASS("assume-builder", AssumeBuilderPass())
240FUNCTION_PASS("assume-simplify", AssumeSimplifyPass())
241FUNCTION_PASS("alignment-from-assumptions", AlignmentFromAssumptionsPass())
242FUNCTION_PASS("annotation-remarks", AnnotationRemarksPass())
243FUNCTION_PASS("bdce", BDCEPass())
244FUNCTION_PASS("bounds-checking", BoundsCheckingPass())
245FUNCTION_PASS("break-crit-edges", BreakCriticalEdgesPass())
246FUNCTION_PASS("callsite-splitting", CallSiteSplittingPass())
247FUNCTION_PASS("consthoist", ConstantHoistingPass())
248FUNCTION_PASS("constraint-elimination", ConstraintEliminationPass())
249FUNCTION_PASS("chr", ControlHeightReductionPass())
250FUNCTION_PASS("coro-early", CoroEarlyPass())
251FUNCTION_PASS("coro-elide", CoroElidePass())
252FUNCTION_PASS("coro-cleanup", CoroCleanupPass())
253FUNCTION_PASS("correlated-propagation", CorrelatedValuePropagationPass())
254FUNCTION_PASS("dce", DCEPass())
255FUNCTION_PASS("dfa-jump-threading", DFAJumpThreadingPass())
256FUNCTION_PASS("div-rem-pairs", DivRemPairsPass())
257FUNCTION_PASS("dse", DSEPass())
258FUNCTION_PASS("dot-cfg", CFGPrinterPass())
259FUNCTION_PASS("dot-cfg-only", CFGOnlyPrinterPass())
260FUNCTION_PASS("dot-dom", DomTreePrinterPass())
261FUNCTION_PASS("dot-dom-only", DomTreeOnlyPrinterPass())
262FUNCTION_PASS("fix-irreducible", FixIrreduciblePass())
263FUNCTION_PASS("flattencfg", FlattenCFGPass())
264FUNCTION_PASS("make-guards-explicit", MakeGuardsExplicitPass())
265FUNCTION_PASS("gvn-hoist", GVNHoistPass())
266FUNCTION_PASS("gvn-sink", GVNSinkPass())
267FUNCTION_PASS("helloworld", HelloWorldPass())
268FUNCTION_PASS("infer-address-spaces", InferAddressSpacesPass())
269FUNCTION_PASS("instcombine", InstCombinePass())
270FUNCTION_PASS("instcount", InstCountPass())
271FUNCTION_PASS("instsimplify", InstSimplifyPass())
272FUNCTION_PASS("invalidate<all>", InvalidateAllAnalysesPass())
273FUNCTION_PASS("irce", IRCEPass())
274FUNCTION_PASS("float2int", Float2IntPass())
275FUNCTION_PASS("no-op-function", NoOpFunctionPass())
276FUNCTION_PASS("libcalls-shrinkwrap", LibCallsShrinkWrapPass())
277FUNCTION_PASS("lint", LintPass())
278FUNCTION_PASS("inject-tli-mappings", InjectTLIMappings())
279FUNCTION_PASS("instnamer", InstructionNamerPass())
280FUNCTION_PASS("loweratomic", LowerAtomicPass())
281FUNCTION_PASS("lower-expect", LowerExpectIntrinsicPass())
282FUNCTION_PASS("lower-guard-intrinsic", LowerGuardIntrinsicPass())
283FUNCTION_PASS("lower-constant-intrinsics", LowerConstantIntrinsicsPass())
284FUNCTION_PASS("lower-widenable-condition", LowerWidenableConditionPass())
285FUNCTION_PASS("guard-widening", GuardWideningPass())
286FUNCTION_PASS("load-store-vectorizer", LoadStoreVectorizerPass())
287FUNCTION_PASS("loop-simplify", LoopSimplifyPass())
288FUNCTION_PASS("loop-sink", LoopSinkPass())
289FUNCTION_PASS("lowerinvoke", LowerInvokePass())
290FUNCTION_PASS("lowerswitch", LowerSwitchPass())
291FUNCTION_PASS("mem2reg", PromotePass())
292FUNCTION_PASS("memcpyopt", MemCpyOptPass())
293FUNCTION_PASS("mergeicmps", MergeICmpsPass())
294FUNCTION_PASS("mergereturn", UnifyFunctionExitNodesPass())
295FUNCTION_PASS("nary-reassociate", NaryReassociatePass())
296FUNCTION_PASS("newgvn", NewGVNPass())
297FUNCTION_PASS("jump-threading", JumpThreadingPass())
298FUNCTION_PASS("partially-inline-libcalls", PartiallyInlineLibCallsPass())
299FUNCTION_PASS("lcssa", LCSSAPass())
300FUNCTION_PASS("loop-data-prefetch", LoopDataPrefetchPass())
301FUNCTION_PASS("loop-load-elim", LoopLoadEliminationPass())
302FUNCTION_PASS("loop-fusion", LoopFusePass())
303FUNCTION_PASS("loop-distribute", LoopDistributePass())
304FUNCTION_PASS("loop-versioning", LoopVersioningPass())
305FUNCTION_PASS("objc-arc", ObjCARCOptPass())
306FUNCTION_PASS("objc-arc-contract", ObjCARCContractPass())
307FUNCTION_PASS("objc-arc-expand", ObjCARCExpandPass())
308FUNCTION_PASS("pgo-memop-opt", PGOMemOPSizeOpt())
309FUNCTION_PASS("print", PrintFunctionPass(dbgs()))
310FUNCTION_PASS("print<assumptions>", AssumptionPrinterPass(dbgs()))
311FUNCTION_PASS("print<block-freq>", BlockFrequencyPrinterPass(dbgs()))
312FUNCTION_PASS("print<branch-prob>", BranchProbabilityPrinterPass(dbgs()))
313FUNCTION_PASS("print<cost-model>", CostModelPrinterPass(dbgs()))
314FUNCTION_PASS("print<cycles>", CycleInfoPrinterPass(dbgs()))
315FUNCTION_PASS("print<da>", DependenceAnalysisPrinterPass(dbgs()))
316FUNCTION_PASS("print<divergence>", DivergenceAnalysisPrinterPass(dbgs()))
317FUNCTION_PASS("print<domtree>", DominatorTreePrinterPass(dbgs()))
318FUNCTION_PASS("print<postdomtree>", PostDominatorTreePrinterPass(dbgs()))
319FUNCTION_PASS("print<delinearization>", DelinearizationPrinterPass(dbgs()))
320FUNCTION_PASS("print<demanded-bits>", DemandedBitsPrinterPass(dbgs()))
321FUNCTION_PASS("print<domfrontier>", DominanceFrontierPrinterPass(dbgs()))
322FUNCTION_PASS("print<func-properties>", FunctionPropertiesPrinterPass(dbgs()))
323FUNCTION_PASS("print<inline-cost>", InlineCostAnnotationPrinterPass(dbgs()))
324FUNCTION_PASS("print<inliner-size-estimator>",
325  InlineSizeEstimatorAnalysisPrinterPass(dbgs()))
326FUNCTION_PASS("print<loops>", LoopPrinterPass(dbgs()))
327FUNCTION_PASS("print<memoryssa>", MemorySSAPrinterPass(dbgs()))
328FUNCTION_PASS("print<memoryssa-walker>", MemorySSAWalkerPrinterPass(dbgs()))
329FUNCTION_PASS("print<phi-values>", PhiValuesPrinterPass(dbgs()))
330FUNCTION_PASS("print<regions>", RegionInfoPrinterPass(dbgs()))
331FUNCTION_PASS("print<scalar-evolution>", ScalarEvolutionPrinterPass(dbgs()))
332FUNCTION_PASS("print<stack-safety-local>", StackSafetyPrinterPass(dbgs()))
333// TODO: rename to print<foo> after NPM switch
334FUNCTION_PASS("print-alias-sets", AliasSetsPrinterPass(dbgs()))
335FUNCTION_PASS("print-predicateinfo", PredicateInfoPrinterPass(dbgs()))
336FUNCTION_PASS("print-mustexecute", MustExecutePrinterPass(dbgs()))
337FUNCTION_PASS("print-memderefs", MemDerefPrinterPass(dbgs()))
338FUNCTION_PASS("reassociate", ReassociatePass())
339FUNCTION_PASS("redundant-dbg-inst-elim", RedundantDbgInstEliminationPass())
340FUNCTION_PASS("reg2mem", RegToMemPass())
341FUNCTION_PASS("scalarize-masked-mem-intrin", ScalarizeMaskedMemIntrinPass())
342FUNCTION_PASS("scalarizer", ScalarizerPass())
343FUNCTION_PASS("separate-const-offset-from-gep", SeparateConstOffsetFromGEPPass())
344FUNCTION_PASS("sccp", SCCPPass())
345FUNCTION_PASS("sink", SinkingPass())
346FUNCTION_PASS("slp-vectorizer", SLPVectorizerPass())
347FUNCTION_PASS("slsr", StraightLineStrengthReducePass())
348FUNCTION_PASS("speculative-execution", SpeculativeExecutionPass())
349FUNCTION_PASS("sroa", SROAPass())
350FUNCTION_PASS("strip-gc-relocates", StripGCRelocates())
351FUNCTION_PASS("structurizecfg", StructurizeCFGPass())
352FUNCTION_PASS("tailcallelim", TailCallElimPass())
353FUNCTION_PASS("unify-loop-exits", UnifyLoopExitsPass())
354FUNCTION_PASS("vector-combine", VectorCombinePass())
355FUNCTION_PASS("verify", VerifierPass())
356FUNCTION_PASS("verify<domtree>", DominatorTreeVerifierPass())
357FUNCTION_PASS("verify<loops>", LoopVerifierPass())
358FUNCTION_PASS("verify<memoryssa>", MemorySSAVerifierPass())
359FUNCTION_PASS("verify<regions>", RegionInfoVerifierPass())
360FUNCTION_PASS("verify<safepoint-ir>", SafepointIRVerifierPass())
361FUNCTION_PASS("verify<scalar-evolution>", ScalarEvolutionVerifierPass())
362FUNCTION_PASS("view-cfg", CFGViewerPass())
363FUNCTION_PASS("view-cfg-only", CFGOnlyViewerPass())
364FUNCTION_PASS("transform-warning", WarnMissedTransformationsPass())
365FUNCTION_PASS("tsan", ThreadSanitizerPass())
366FUNCTION_PASS("memprof", MemProfilerPass())
367#undef FUNCTION_PASS
368
369#ifndef FUNCTION_PASS_WITH_PARAMS
370#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS)
371#endif
372FUNCTION_PASS_WITH_PARAMS("early-cse",
373                          "EarlyCSEPass",
374                           [](bool UseMemorySSA) {
375                             return EarlyCSEPass(UseMemorySSA);
376                           },
377                          parseEarlyCSEPassOptions,
378                          "memssa")
379FUNCTION_PASS_WITH_PARAMS("ee-instrument",
380                          "EntryExitInstrumenterPass",
381                           [](bool PostInlining) {
382                             return EntryExitInstrumenterPass(PostInlining);
383                           },
384                          parseEntryExitInstrumenterPassOptions,
385                          "post-inline")
386FUNCTION_PASS_WITH_PARAMS("lower-matrix-intrinsics",
387                          "LowerMatrixIntrinsicsPass",
388                           [](bool Minimal) {
389                             return LowerMatrixIntrinsicsPass(Minimal);
390                           },
391                          parseLowerMatrixIntrinsicsPassOptions,
392                          "minimal")
393FUNCTION_PASS_WITH_PARAMS("loop-unroll",
394                          "LoopUnrollPass",
395                           [](LoopUnrollOptions Opts) {
396                             return LoopUnrollPass(Opts);
397                           },
398                          parseLoopUnrollOptions,
399                          "O0;O1;O2;O3;full-unroll-max=N;"
400                          "no-partial;partial;"
401                          "no-peeling;peeling;"
402                          "no-profile-peeling;profile-peeling;"
403                          "no-runtime;runtime;"
404                          "no-upperbound;upperbound")
405FUNCTION_PASS_WITH_PARAMS("asan",
406                          "AddressSanitizerPass",
407                           [](AddressSanitizerOptions Opts) {
408                             return AddressSanitizerPass(Opts);
409                           },
410                          parseASanPassOptions,
411                          "kernel")
412FUNCTION_PASS_WITH_PARAMS("msan",
413                          "MemorySanitizerPass",
414                           [](MemorySanitizerOptions Opts) {
415                             return MemorySanitizerPass(Opts);
416                           },
417                          parseMSanPassOptions,
418                          "recover;kernel;eager-checks;track-origins=N")
419FUNCTION_PASS_WITH_PARAMS("simplifycfg",
420                          "SimplifyCFGPass",
421                           [](SimplifyCFGOptions Opts) {
422                             return SimplifyCFGPass(Opts);
423                           },
424                          parseSimplifyCFGOptions,
425                          "no-forward-switch-cond;forward-switch-cond;"
426                          "no-switch-range-to-icmp;switch-range-to-icmp;"
427                          "no-switch-to-lookup;switch-to-lookup;"
428                          "no-keep-loops;keep-loops;"
429                          "no-hoist-common-insts;hoist-common-insts;"
430                          "no-sink-common-insts;sink-common-insts;"
431                          "bonus-inst-threshold=N"
432                          )
433FUNCTION_PASS_WITH_PARAMS("loop-vectorize",
434                          "LoopVectorizePass",
435                           [](LoopVectorizeOptions Opts) {
436                             return LoopVectorizePass(Opts);
437                           },
438                          parseLoopVectorizeOptions,
439                          "no-interleave-forced-only;interleave-forced-only;"
440                          "no-vectorize-forced-only;vectorize-forced-only")
441FUNCTION_PASS_WITH_PARAMS("mldst-motion",
442                          "MergedLoadStoreMotionPass",
443                           [](MergedLoadStoreMotionOptions Opts) {
444                             return MergedLoadStoreMotionPass(Opts);
445                           },
446                          parseMergedLoadStoreMotionOptions,
447                          "no-split-footer-bb;split-footer-bb")
448FUNCTION_PASS_WITH_PARAMS("gvn",
449                          "GVNPass",
450                           [](GVNOptions Opts) {
451                             return GVNPass(Opts);
452                           },
453                          parseGVNOptions,
454                          "no-pre;pre;"
455                          "no-load-pre;load-pre;"
456                          "no-split-backedge-load-pre;split-backedge-load-pre;"
457                          "no-memdep;memdep")
458FUNCTION_PASS_WITH_PARAMS("print<stack-lifetime>",
459                          "StackLifetimePrinterPass",
460                           [](StackLifetime::LivenessType Type) {
461                             return StackLifetimePrinterPass(dbgs(), Type);
462                           },
463                          parseStackLifetimeOptions,
464                          "may;must")
465#undef FUNCTION_PASS_WITH_PARAMS
466
467#ifndef LOOPNEST_PASS
468#define LOOPNEST_PASS(NAME, CREATE_PASS)
469#endif
470LOOPNEST_PASS("lnicm", LNICMPass())
471LOOPNEST_PASS("loop-flatten", LoopFlattenPass())
472LOOPNEST_PASS("loop-interchange", LoopInterchangePass())
473LOOPNEST_PASS("loop-unroll-and-jam", LoopUnrollAndJamPass())
474LOOPNEST_PASS("no-op-loopnest", NoOpLoopNestPass())
475#undef LOOPNEST_PASS
476
477#ifndef LOOP_ANALYSIS
478#define LOOP_ANALYSIS(NAME, CREATE_PASS)
479#endif
480LOOP_ANALYSIS("no-op-loop", NoOpLoopAnalysis())
481LOOP_ANALYSIS("access-info", LoopAccessAnalysis())
482LOOP_ANALYSIS("ddg", DDGAnalysis())
483LOOP_ANALYSIS("iv-users", IVUsersAnalysis())
484LOOP_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis(PIC))
485#undef LOOP_ANALYSIS
486
487#ifndef LOOP_PASS
488#define LOOP_PASS(NAME, CREATE_PASS)
489#endif
490LOOP_PASS("canon-freeze", CanonicalizeFreezeInLoopsPass())
491LOOP_PASS("dot-ddg", DDGDotPrinterPass())
492LOOP_PASS("invalidate<all>", InvalidateAllAnalysesPass())
493LOOP_PASS("licm", LICMPass())
494LOOP_PASS("loop-idiom", LoopIdiomRecognizePass())
495LOOP_PASS("loop-instsimplify", LoopInstSimplifyPass())
496LOOP_PASS("loop-rotate", LoopRotatePass())
497LOOP_PASS("no-op-loop", NoOpLoopPass())
498LOOP_PASS("print", PrintLoopPass(dbgs()))
499LOOP_PASS("loop-deletion", LoopDeletionPass())
500LOOP_PASS("loop-simplifycfg", LoopSimplifyCFGPass())
501LOOP_PASS("loop-reduce", LoopStrengthReducePass())
502LOOP_PASS("indvars", IndVarSimplifyPass())
503LOOP_PASS("loop-unroll-full", LoopFullUnrollPass())
504LOOP_PASS("print-access-info", LoopAccessInfoPrinterPass(dbgs()))
505LOOP_PASS("print<ddg>", DDGAnalysisPrinterPass(dbgs()))
506LOOP_PASS("print<iv-users>", IVUsersPrinterPass(dbgs()))
507LOOP_PASS("print<loopnest>", LoopNestPrinterPass(dbgs()))
508LOOP_PASS("print<loop-cache-cost>", LoopCachePrinterPass(dbgs()))
509LOOP_PASS("loop-predication", LoopPredicationPass())
510LOOP_PASS("guard-widening", GuardWideningPass())
511LOOP_PASS("loop-bound-split", LoopBoundSplitPass())
512LOOP_PASS("loop-reroll", LoopRerollPass())
513LOOP_PASS("loop-versioning-licm", LoopVersioningLICMPass())
514#undef LOOP_PASS
515
516#ifndef LOOP_PASS_WITH_PARAMS
517#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS)
518#endif
519LOOP_PASS_WITH_PARAMS("simple-loop-unswitch",
520                      "SimpleLoopUnswitchPass",
521                      [](std::pair<bool, bool> Params) {
522                        return SimpleLoopUnswitchPass(Params.first, Params.second);
523                      },
524                      parseLoopUnswitchOptions,
525                      "nontrivial;no-nontrivial;trivial;no-trivial")
526#undef LOOP_PASS_WITH_PARAMS
527