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