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