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("globalopt", GlobalOptPass())
64MODULE_PASS("globalsplit", GlobalSplitPass())
65MODULE_PASS("hotcoldsplit", HotColdSplittingPass())
66MODULE_PASS("inferattrs", InferFunctionAttrsPass())
67MODULE_PASS("inliner-wrapper", ModuleInlinerWrapperPass())
68MODULE_PASS("inliner-ml-advisor-release", ModuleInlinerWrapperPass(getInlineParams(), true, {}, InliningAdvisorMode::Release, 0))
69MODULE_PASS("print<inline-advisor>", InlineAdvisorAnalysisPrinterPass(dbgs()))
70MODULE_PASS("inliner-wrapper-no-mandatory-first", ModuleInlinerWrapperPass(
71  getInlineParams(),
72  false))
73MODULE_PASS("insert-gcov-profiling", GCOVProfilerPass())
74MODULE_PASS("instrorderfile", InstrOrderFilePass())
75MODULE_PASS("instrprof", InstrProfiling())
76MODULE_PASS("internalize", InternalizePass())
77MODULE_PASS("invalidate<all>", InvalidateAllAnalysesPass())
78MODULE_PASS("iroutliner", IROutlinerPass())
79MODULE_PASS("print-ir-similarity", IRSimilarityAnalysisPrinterPass(dbgs()))
80MODULE_PASS("lower-global-dtors", LowerGlobalDtorsPass())
81MODULE_PASS("lower-ifunc", LowerIFuncPass())
82MODULE_PASS("lowertypetests", LowerTypeTestsPass())
83MODULE_PASS("metarenamer", MetaRenamerPass())
84MODULE_PASS("mergefunc", MergeFunctionsPass())
85MODULE_PASS("name-anon-globals", NameAnonGlobalPass())
86MODULE_PASS("no-op-module", NoOpModulePass())
87MODULE_PASS("objc-arc-apelim", ObjCARCAPElimPass())
88MODULE_PASS("partial-inliner", PartialInlinerPass())
89MODULE_PASS("memprof-context-disambiguation", MemProfContextDisambiguation())
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("globaldce",
145                        "GlobalDCEPass",
146                        [](bool InLTOPostLink) {
147                          return GlobalDCEPass(InLTOPostLink);
148                        },
149                        parseGlobalDCEPassOptions,
150                        "in-lto-post-link")
151MODULE_PASS_WITH_PARAMS("hwasan",
152                        "HWAddressSanitizerPass",
153                        [](HWAddressSanitizerOptions Opts) {
154                          return HWAddressSanitizerPass(Opts);
155                        },
156                        parseHWASanPassOptions,
157                        "kernel;recover")
158MODULE_PASS_WITH_PARAMS("asan",
159                        "AddressSanitizerPass",
160                        [](AddressSanitizerOptions Opts) {
161                          return AddressSanitizerPass(Opts);
162                        },
163                        parseASanPassOptions,
164                        "kernel")
165MODULE_PASS_WITH_PARAMS("msan",
166                        "MemorySanitizerPass",
167                        [](MemorySanitizerOptions Opts) {
168                          return MemorySanitizerPass(Opts);
169                        },
170                        parseMSanPassOptions,
171                        "recover;kernel;eager-checks;track-origins=N")
172MODULE_PASS_WITH_PARAMS("ipsccp",
173                        "IPSCCPPass",
174                        [](IPSCCPOptions Opts) {
175                          return IPSCCPPass(Opts);
176                        },
177                        parseIPSCCPOptions,
178                        "no-func-spec;func-spec")
179MODULE_PASS_WITH_PARAMS("embed-bitcode",
180                         "EmbedBitcodePass",
181                        [](EmbedBitcodeOptions Opts) {
182                          return EmbedBitcodePass(Opts);
183                        },
184                        parseEmbedBitcodePassOptions,
185                        "thinlto;emit-summary")
186MODULE_PASS_WITH_PARAMS("memprof-use",
187                         "MemProfUsePass",
188                        [](std::string Opts) {
189                          return MemProfUsePass(Opts);
190                        },
191                        parseMemProfUsePassOptions,
192                        "profile-filename=S")
193#undef MODULE_PASS_WITH_PARAMS
194
195#ifndef CGSCC_ANALYSIS
196#define CGSCC_ANALYSIS(NAME, CREATE_PASS)
197#endif
198CGSCC_ANALYSIS("no-op-cgscc", NoOpCGSCCAnalysis())
199CGSCC_ANALYSIS("fam-proxy", FunctionAnalysisManagerCGSCCProxy())
200CGSCC_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis(PIC))
201#undef CGSCC_ANALYSIS
202
203#ifndef CGSCC_PASS
204#define CGSCC_PASS(NAME, CREATE_PASS)
205#endif
206CGSCC_PASS("argpromotion", ArgumentPromotionPass())
207CGSCC_PASS("invalidate<all>", InvalidateAllAnalysesPass())
208CGSCC_PASS("attributor-cgscc", AttributorCGSCCPass())
209CGSCC_PASS("openmp-opt-cgscc", OpenMPOptCGSCCPass())
210CGSCC_PASS("no-op-cgscc", NoOpCGSCCPass())
211#undef CGSCC_PASS
212
213#ifndef CGSCC_PASS_WITH_PARAMS
214#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS)
215#endif
216CGSCC_PASS_WITH_PARAMS("inline",
217                       "InlinerPass",
218                       [](bool OnlyMandatory) {
219                         return InlinerPass(OnlyMandatory);
220                       },
221                       parseInlinerPassOptions,
222                       "only-mandatory")
223CGSCC_PASS_WITH_PARAMS("coro-split",
224                       "CoroSplitPass",
225                       [](bool OptimizeFrame) {
226                         return CoroSplitPass(OptimizeFrame);
227                       },
228                       parseCoroSplitPassOptions,
229                       "reuse-storage")
230CGSCC_PASS_WITH_PARAMS("function-attrs",
231                       "PostOrderFunctionAttrsPass",
232                       [](bool SkipNonRecursive) {
233                         return PostOrderFunctionAttrsPass(SkipNonRecursive);
234                       },
235                       parsePostOrderFunctionAttrsPassOptions,
236                       "skip-non-recursive")
237#undef CGSCC_PASS_WITH_PARAMS
238
239#ifndef FUNCTION_ANALYSIS
240#define FUNCTION_ANALYSIS(NAME, CREATE_PASS)
241#endif
242FUNCTION_ANALYSIS("aa", AAManager())
243FUNCTION_ANALYSIS("assumptions", AssumptionAnalysis())
244FUNCTION_ANALYSIS("block-freq", BlockFrequencyAnalysis())
245FUNCTION_ANALYSIS("branch-prob", BranchProbabilityAnalysis())
246FUNCTION_ANALYSIS("cycles", CycleAnalysis())
247FUNCTION_ANALYSIS("domtree", DominatorTreeAnalysis())
248FUNCTION_ANALYSIS("postdomtree", PostDominatorTreeAnalysis())
249FUNCTION_ANALYSIS("demanded-bits", DemandedBitsAnalysis())
250FUNCTION_ANALYSIS("domfrontier", DominanceFrontierAnalysis())
251FUNCTION_ANALYSIS("func-properties", FunctionPropertiesAnalysis())
252FUNCTION_ANALYSIS("loops", LoopAnalysis())
253FUNCTION_ANALYSIS("access-info", LoopAccessAnalysis())
254FUNCTION_ANALYSIS("lazy-value-info", LazyValueAnalysis())
255FUNCTION_ANALYSIS("da", DependenceAnalysis())
256FUNCTION_ANALYSIS("inliner-size-estimator", InlineSizeEstimatorAnalysis())
257FUNCTION_ANALYSIS("memdep", MemoryDependenceAnalysis())
258FUNCTION_ANALYSIS("memoryssa", MemorySSAAnalysis())
259FUNCTION_ANALYSIS("phi-values", PhiValuesAnalysis())
260FUNCTION_ANALYSIS("regions", RegionInfoAnalysis())
261FUNCTION_ANALYSIS("no-op-function", NoOpFunctionAnalysis())
262FUNCTION_ANALYSIS("opt-remark-emit", OptimizationRemarkEmitterAnalysis())
263FUNCTION_ANALYSIS("scalar-evolution", ScalarEvolutionAnalysis())
264FUNCTION_ANALYSIS("should-not-run-function-passes", ShouldNotRunFunctionPassesAnalysis())
265FUNCTION_ANALYSIS("should-run-extra-vector-passes", ShouldRunExtraVectorPasses())
266FUNCTION_ANALYSIS("stack-safety-local", StackSafetyAnalysis())
267FUNCTION_ANALYSIS("targetlibinfo", TargetLibraryAnalysis())
268FUNCTION_ANALYSIS("targetir",
269                  TM ? TM->getTargetIRAnalysis() : TargetIRAnalysis())
270FUNCTION_ANALYSIS("verify", VerifierAnalysis())
271FUNCTION_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis(PIC))
272FUNCTION_ANALYSIS("uniformity", UniformityInfoAnalysis())
273
274#ifndef FUNCTION_ALIAS_ANALYSIS
275#define FUNCTION_ALIAS_ANALYSIS(NAME, CREATE_PASS)                             \
276  FUNCTION_ANALYSIS(NAME, CREATE_PASS)
277#endif
278FUNCTION_ALIAS_ANALYSIS("basic-aa", BasicAA())
279FUNCTION_ALIAS_ANALYSIS("objc-arc-aa", objcarc::ObjCARCAA())
280FUNCTION_ALIAS_ANALYSIS("scev-aa", SCEVAA())
281FUNCTION_ALIAS_ANALYSIS("scoped-noalias-aa", ScopedNoAliasAA())
282FUNCTION_ALIAS_ANALYSIS("tbaa", TypeBasedAA())
283#undef FUNCTION_ALIAS_ANALYSIS
284#undef FUNCTION_ANALYSIS
285
286#ifndef FUNCTION_PASS
287#define FUNCTION_PASS(NAME, CREATE_PASS)
288#endif
289FUNCTION_PASS("aa-eval", AAEvaluator())
290FUNCTION_PASS("adce", ADCEPass())
291FUNCTION_PASS("add-discriminators", AddDiscriminatorsPass())
292FUNCTION_PASS("aggressive-instcombine", AggressiveInstCombinePass())
293FUNCTION_PASS("assume-builder", AssumeBuilderPass())
294FUNCTION_PASS("assume-simplify", AssumeSimplifyPass())
295FUNCTION_PASS("alignment-from-assumptions", AlignmentFromAssumptionsPass())
296FUNCTION_PASS("annotation-remarks", AnnotationRemarksPass())
297FUNCTION_PASS("bdce", BDCEPass())
298FUNCTION_PASS("bounds-checking", BoundsCheckingPass())
299FUNCTION_PASS("break-crit-edges", BreakCriticalEdgesPass())
300FUNCTION_PASS("callsite-splitting", CallSiteSplittingPass())
301FUNCTION_PASS("consthoist", ConstantHoistingPass())
302FUNCTION_PASS("count-visits", CountVisitsPass())
303FUNCTION_PASS("constraint-elimination", ConstraintEliminationPass())
304FUNCTION_PASS("chr", ControlHeightReductionPass())
305FUNCTION_PASS("coro-elide", CoroElidePass())
306FUNCTION_PASS("correlated-propagation", CorrelatedValuePropagationPass())
307FUNCTION_PASS("dce", DCEPass())
308FUNCTION_PASS("dfa-jump-threading", DFAJumpThreadingPass())
309FUNCTION_PASS("div-rem-pairs", DivRemPairsPass())
310FUNCTION_PASS("dse", DSEPass())
311FUNCTION_PASS("dot-cfg", CFGPrinterPass())
312FUNCTION_PASS("dot-cfg-only", CFGOnlyPrinterPass())
313FUNCTION_PASS("dot-dom", DomPrinter())
314FUNCTION_PASS("dot-dom-only", DomOnlyPrinter())
315FUNCTION_PASS("dot-post-dom", PostDomPrinter())
316FUNCTION_PASS("dot-post-dom-only", PostDomOnlyPrinter())
317FUNCTION_PASS("view-dom", DomViewer())
318FUNCTION_PASS("view-dom-only", DomOnlyViewer())
319FUNCTION_PASS("view-post-dom", PostDomViewer())
320FUNCTION_PASS("view-post-dom-only", PostDomOnlyViewer())
321FUNCTION_PASS("fix-irreducible", FixIrreduciblePass())
322FUNCTION_PASS("flattencfg", FlattenCFGPass())
323FUNCTION_PASS("make-guards-explicit", MakeGuardsExplicitPass())
324FUNCTION_PASS("gvn-hoist", GVNHoistPass())
325FUNCTION_PASS("gvn-sink", GVNSinkPass())
326FUNCTION_PASS("helloworld", HelloWorldPass())
327FUNCTION_PASS("infer-address-spaces", InferAddressSpacesPass())
328FUNCTION_PASS("instcombine", InstCombinePass())
329FUNCTION_PASS("instcount", InstCountPass())
330FUNCTION_PASS("instsimplify", InstSimplifyPass())
331FUNCTION_PASS("invalidate<all>", InvalidateAllAnalysesPass())
332FUNCTION_PASS("irce", IRCEPass())
333FUNCTION_PASS("float2int", Float2IntPass())
334FUNCTION_PASS("no-op-function", NoOpFunctionPass())
335FUNCTION_PASS("libcalls-shrinkwrap", LibCallsShrinkWrapPass())
336FUNCTION_PASS("lint", LintPass())
337FUNCTION_PASS("inject-tli-mappings", InjectTLIMappings())
338FUNCTION_PASS("instnamer", InstructionNamerPass())
339FUNCTION_PASS("loweratomic", LowerAtomicPass())
340FUNCTION_PASS("lower-expect", LowerExpectIntrinsicPass())
341FUNCTION_PASS("lower-guard-intrinsic", LowerGuardIntrinsicPass())
342FUNCTION_PASS("lower-constant-intrinsics", LowerConstantIntrinsicsPass())
343FUNCTION_PASS("lower-widenable-condition", LowerWidenableConditionPass())
344FUNCTION_PASS("guard-widening", GuardWideningPass())
345FUNCTION_PASS("load-store-vectorizer", LoadStoreVectorizerPass())
346FUNCTION_PASS("loop-simplify", LoopSimplifyPass())
347FUNCTION_PASS("loop-sink", LoopSinkPass())
348FUNCTION_PASS("lowerinvoke", LowerInvokePass())
349FUNCTION_PASS("lowerswitch", LowerSwitchPass())
350FUNCTION_PASS("mem2reg", PromotePass())
351FUNCTION_PASS("memcpyopt", MemCpyOptPass())
352FUNCTION_PASS("mergeicmps", MergeICmpsPass())
353FUNCTION_PASS("mergereturn", UnifyFunctionExitNodesPass())
354FUNCTION_PASS("move-auto-init", MoveAutoInitPass())
355FUNCTION_PASS("nary-reassociate", NaryReassociatePass())
356FUNCTION_PASS("newgvn", NewGVNPass())
357FUNCTION_PASS("jump-threading", JumpThreadingPass())
358FUNCTION_PASS("partially-inline-libcalls", PartiallyInlineLibCallsPass())
359FUNCTION_PASS("kcfi", KCFIPass())
360FUNCTION_PASS("lcssa", LCSSAPass())
361FUNCTION_PASS("loop-data-prefetch", LoopDataPrefetchPass())
362FUNCTION_PASS("loop-load-elim", LoopLoadEliminationPass())
363FUNCTION_PASS("loop-fusion", LoopFusePass())
364FUNCTION_PASS("loop-distribute", LoopDistributePass())
365FUNCTION_PASS("loop-versioning", LoopVersioningPass())
366FUNCTION_PASS("objc-arc", ObjCARCOptPass())
367FUNCTION_PASS("objc-arc-contract", ObjCARCContractPass())
368FUNCTION_PASS("objc-arc-expand", ObjCARCExpandPass())
369FUNCTION_PASS("pa-eval", PAEvalPass())
370FUNCTION_PASS("pgo-memop-opt", PGOMemOPSizeOpt())
371FUNCTION_PASS("place-safepoints", PlaceSafepointsPass())
372FUNCTION_PASS("print", PrintFunctionPass(dbgs()))
373FUNCTION_PASS("print<assumptions>", AssumptionPrinterPass(dbgs()))
374FUNCTION_PASS("print<block-freq>", BlockFrequencyPrinterPass(dbgs()))
375FUNCTION_PASS("print<branch-prob>", BranchProbabilityPrinterPass(dbgs()))
376FUNCTION_PASS("print<cost-model>", CostModelPrinterPass(dbgs()))
377FUNCTION_PASS("print<cycles>", CycleInfoPrinterPass(dbgs()))
378FUNCTION_PASS("print<da>", DependenceAnalysisPrinterPass(dbgs()))
379FUNCTION_PASS("print<domtree>", DominatorTreePrinterPass(dbgs()))
380FUNCTION_PASS("print<postdomtree>", PostDominatorTreePrinterPass(dbgs()))
381FUNCTION_PASS("print<delinearization>", DelinearizationPrinterPass(dbgs()))
382FUNCTION_PASS("print<demanded-bits>", DemandedBitsPrinterPass(dbgs()))
383FUNCTION_PASS("print<domfrontier>", DominanceFrontierPrinterPass(dbgs()))
384FUNCTION_PASS("print<func-properties>", FunctionPropertiesPrinterPass(dbgs()))
385FUNCTION_PASS("print<inline-cost>", InlineCostAnnotationPrinterPass(dbgs()))
386FUNCTION_PASS("print<inliner-size-estimator>",
387  InlineSizeEstimatorAnalysisPrinterPass(dbgs()))
388FUNCTION_PASS("print<loops>", LoopPrinterPass(dbgs()))
389FUNCTION_PASS("print<memoryssa-walker>", MemorySSAWalkerPrinterPass(dbgs()))
390FUNCTION_PASS("print<phi-values>", PhiValuesPrinterPass(dbgs()))
391FUNCTION_PASS("print<regions>", RegionInfoPrinterPass(dbgs()))
392FUNCTION_PASS("print<scalar-evolution>", ScalarEvolutionPrinterPass(dbgs()))
393FUNCTION_PASS("print<stack-safety-local>", StackSafetyPrinterPass(dbgs()))
394FUNCTION_PASS("print<access-info>", LoopAccessInfoPrinterPass(dbgs()))
395// TODO: rename to print<foo> after NPM switch
396FUNCTION_PASS("print-alias-sets", AliasSetsPrinterPass(dbgs()))
397FUNCTION_PASS("print-cfg-sccs", CFGSCCPrinterPass(dbgs()))
398FUNCTION_PASS("print-predicateinfo", PredicateInfoPrinterPass(dbgs()))
399FUNCTION_PASS("print-mustexecute", MustExecutePrinterPass(dbgs()))
400FUNCTION_PASS("print-memderefs", MemDerefPrinterPass(dbgs()))
401FUNCTION_PASS("print<uniformity>", UniformityInfoPrinterPass(dbgs()))
402FUNCTION_PASS("reassociate", ReassociatePass())
403FUNCTION_PASS("redundant-dbg-inst-elim", RedundantDbgInstEliminationPass())
404FUNCTION_PASS("reg2mem", RegToMemPass())
405FUNCTION_PASS("scalarize-masked-mem-intrin", ScalarizeMaskedMemIntrinPass())
406FUNCTION_PASS("scalarizer", ScalarizerPass())
407FUNCTION_PASS("separate-const-offset-from-gep", SeparateConstOffsetFromGEPPass())
408FUNCTION_PASS("sccp", SCCPPass())
409FUNCTION_PASS("sink", SinkingPass())
410FUNCTION_PASS("slp-vectorizer", SLPVectorizerPass())
411FUNCTION_PASS("slsr", StraightLineStrengthReducePass())
412FUNCTION_PASS("speculative-execution", SpeculativeExecutionPass())
413FUNCTION_PASS("strip-gc-relocates", StripGCRelocates())
414FUNCTION_PASS("structurizecfg", StructurizeCFGPass())
415FUNCTION_PASS("tailcallelim", TailCallElimPass())
416FUNCTION_PASS("typepromotion", TypePromotionPass(TM))
417FUNCTION_PASS("unify-loop-exits", UnifyLoopExitsPass())
418FUNCTION_PASS("vector-combine", VectorCombinePass())
419FUNCTION_PASS("verify", VerifierPass())
420FUNCTION_PASS("verify<domtree>", DominatorTreeVerifierPass())
421FUNCTION_PASS("verify<loops>", LoopVerifierPass())
422FUNCTION_PASS("verify<memoryssa>", MemorySSAVerifierPass())
423FUNCTION_PASS("verify<regions>", RegionInfoVerifierPass())
424FUNCTION_PASS("verify<safepoint-ir>", SafepointIRVerifierPass())
425FUNCTION_PASS("verify<scalar-evolution>", ScalarEvolutionVerifierPass())
426FUNCTION_PASS("view-cfg", CFGViewerPass())
427FUNCTION_PASS("view-cfg-only", CFGOnlyViewerPass())
428FUNCTION_PASS("tlshoist", TLSVariableHoistPass())
429FUNCTION_PASS("transform-warning", WarnMissedTransformationsPass())
430FUNCTION_PASS("tsan", ThreadSanitizerPass())
431FUNCTION_PASS("memprof", MemProfilerPass())
432FUNCTION_PASS("declare-to-assign", llvm::AssignmentTrackingPass())
433#undef FUNCTION_PASS
434
435#ifndef FUNCTION_PASS_WITH_PARAMS
436#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS)
437#endif
438FUNCTION_PASS_WITH_PARAMS("early-cse",
439                          "EarlyCSEPass",
440                           [](bool UseMemorySSA) {
441                             return EarlyCSEPass(UseMemorySSA);
442                           },
443                          parseEarlyCSEPassOptions,
444                          "memssa")
445FUNCTION_PASS_WITH_PARAMS("ee-instrument",
446                          "EntryExitInstrumenterPass",
447                           [](bool PostInlining) {
448                             return EntryExitInstrumenterPass(PostInlining);
449                           },
450                          parseEntryExitInstrumenterPassOptions,
451                          "post-inline")
452FUNCTION_PASS_WITH_PARAMS("hardware-loops",
453                          "HardwareLoopsPass",
454                          [](HardwareLoopOptions Opts) {
455                              return HardwareLoopsPass(Opts);
456                          },
457                          parseHardwareLoopOptions,
458                          "force-hardware-loops;"
459                          "force-hardware-loop-phi;"
460                          "force-nested-hardware-loop;"
461                          "force-hardware-loop-guard;"
462                          "hardware-loop-decrement=N;"
463                          "hardware-loop-counter-bitwidth=N")
464FUNCTION_PASS_WITH_PARAMS("lower-matrix-intrinsics",
465                          "LowerMatrixIntrinsicsPass",
466                           [](bool Minimal) {
467                             return LowerMatrixIntrinsicsPass(Minimal);
468                           },
469                          parseLowerMatrixIntrinsicsPassOptions,
470                          "minimal")
471FUNCTION_PASS_WITH_PARAMS("loop-unroll",
472                          "LoopUnrollPass",
473                           [](LoopUnrollOptions Opts) {
474                             return LoopUnrollPass(Opts);
475                           },
476                          parseLoopUnrollOptions,
477                          "O0;O1;O2;O3;full-unroll-max=N;"
478                          "no-partial;partial;"
479                          "no-peeling;peeling;"
480                          "no-profile-peeling;profile-peeling;"
481                          "no-runtime;runtime;"
482                          "no-upperbound;upperbound")
483FUNCTION_PASS_WITH_PARAMS("simplifycfg",
484                          "SimplifyCFGPass",
485                           [](SimplifyCFGOptions Opts) {
486                             return SimplifyCFGPass(Opts);
487                           },
488                          parseSimplifyCFGOptions,
489                          "no-forward-switch-cond;forward-switch-cond;"
490                          "no-switch-range-to-icmp;switch-range-to-icmp;"
491                          "no-switch-to-lookup;switch-to-lookup;"
492                          "no-keep-loops;keep-loops;"
493                          "no-hoist-common-insts;hoist-common-insts;"
494                          "no-sink-common-insts;sink-common-insts;"
495                          "bonus-inst-threshold=N"
496                          )
497FUNCTION_PASS_WITH_PARAMS("loop-vectorize",
498                          "LoopVectorizePass",
499                           [](LoopVectorizeOptions Opts) {
500                             return LoopVectorizePass(Opts);
501                           },
502                          parseLoopVectorizeOptions,
503                          "no-interleave-forced-only;interleave-forced-only;"
504                          "no-vectorize-forced-only;vectorize-forced-only")
505FUNCTION_PASS_WITH_PARAMS("instcombine",
506                          "InstCombinePass",
507                           [](InstCombineOptions Opts) {
508                             return InstCombinePass(Opts);
509                           },
510                          parseInstCombineOptions,
511                          "no-use-loop-info;use-loop-info;"
512                          "max-iterations=N"
513                          )
514FUNCTION_PASS_WITH_PARAMS("mldst-motion",
515                          "MergedLoadStoreMotionPass",
516                           [](MergedLoadStoreMotionOptions Opts) {
517                             return MergedLoadStoreMotionPass(Opts);
518                           },
519                          parseMergedLoadStoreMotionOptions,
520                          "no-split-footer-bb;split-footer-bb")
521FUNCTION_PASS_WITH_PARAMS("gvn",
522                          "GVNPass",
523                           [](GVNOptions Opts) {
524                             return GVNPass(Opts);
525                           },
526                          parseGVNOptions,
527                          "no-pre;pre;"
528                          "no-load-pre;load-pre;"
529                          "no-split-backedge-load-pre;split-backedge-load-pre;"
530                          "no-memdep;memdep")
531FUNCTION_PASS_WITH_PARAMS("sroa",
532                          "SROAPass",
533                          [](SROAOptions PreserveCFG) {
534                            return SROAPass(PreserveCFG);
535                          },
536                          parseSROAOptions,
537                          "preserve-cfg;modify-cfg")
538FUNCTION_PASS_WITH_PARAMS("print<stack-lifetime>",
539                          "StackLifetimePrinterPass",
540                           [](StackLifetime::LivenessType Type) {
541                             return StackLifetimePrinterPass(dbgs(), Type);
542                           },
543                          parseStackLifetimeOptions,
544                          "may;must")
545FUNCTION_PASS_WITH_PARAMS("print<da>",
546                          "DependenceAnalysisPrinterPass",
547                           [](bool NormalizeResults) {
548                             return DependenceAnalysisPrinterPass(dbgs(), NormalizeResults);
549                           },
550                          parseDependenceAnalysisPrinterOptions,
551                          "normalized-results")
552FUNCTION_PASS_WITH_PARAMS("separate-const-offset-from-gep",
553                          "SeparateConstOffsetFromGEPPass",
554                           [](bool LowerGEP) {
555                             return SeparateConstOffsetFromGEPPass(LowerGEP);
556                           },
557                          parseSeparateConstOffsetFromGEPPassOptions,
558                          "lower-gep")
559FUNCTION_PASS_WITH_PARAMS("function-simplification",
560                          "",
561                           [this](OptimizationLevel OL) {
562                             return buildFunctionSimplificationPipeline(OL, ThinOrFullLTOPhase::None);
563                           },
564                          parseFunctionSimplificationPipelineOptions,
565                          "O1;O2;O3;Os;Oz")
566FUNCTION_PASS_WITH_PARAMS("print<memoryssa>",
567                          "MemorySSAPrinterPass",
568                           [](bool NoEnsureOptimizedUses) {
569                             return MemorySSAPrinterPass(dbgs(), !NoEnsureOptimizedUses);
570                           },
571                          parseMemorySSAPrinterPassOptions,
572                          "no-ensure-optimized-uses")
573#undef FUNCTION_PASS_WITH_PARAMS
574
575#ifndef LOOPNEST_PASS
576#define LOOPNEST_PASS(NAME, CREATE_PASS)
577#endif
578LOOPNEST_PASS("loop-flatten", LoopFlattenPass())
579LOOPNEST_PASS("loop-interchange", LoopInterchangePass())
580LOOPNEST_PASS("loop-unroll-and-jam", LoopUnrollAndJamPass())
581LOOPNEST_PASS("no-op-loopnest", NoOpLoopNestPass())
582#undef LOOPNEST_PASS
583
584#ifndef LOOP_ANALYSIS
585#define LOOP_ANALYSIS(NAME, CREATE_PASS)
586#endif
587LOOP_ANALYSIS("no-op-loop", NoOpLoopAnalysis())
588LOOP_ANALYSIS("ddg", DDGAnalysis())
589LOOP_ANALYSIS("iv-users", IVUsersAnalysis())
590LOOP_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis(PIC))
591#undef LOOP_ANALYSIS
592
593#ifndef LOOP_PASS
594#define LOOP_PASS(NAME, CREATE_PASS)
595#endif
596LOOP_PASS("canon-freeze", CanonicalizeFreezeInLoopsPass())
597LOOP_PASS("dot-ddg", DDGDotPrinterPass())
598LOOP_PASS("invalidate<all>", InvalidateAllAnalysesPass())
599LOOP_PASS("loop-idiom", LoopIdiomRecognizePass())
600LOOP_PASS("loop-instsimplify", LoopInstSimplifyPass())
601LOOP_PASS("no-op-loop", NoOpLoopPass())
602LOOP_PASS("print", PrintLoopPass(dbgs()))
603LOOP_PASS("loop-deletion", LoopDeletionPass())
604LOOP_PASS("loop-simplifycfg", LoopSimplifyCFGPass())
605LOOP_PASS("loop-reduce", LoopStrengthReducePass())
606LOOP_PASS("indvars", IndVarSimplifyPass())
607LOOP_PASS("loop-unroll-full", LoopFullUnrollPass())
608LOOP_PASS("print<ddg>", DDGAnalysisPrinterPass(dbgs()))
609LOOP_PASS("print<iv-users>", IVUsersPrinterPass(dbgs()))
610LOOP_PASS("print<loopnest>", LoopNestPrinterPass(dbgs()))
611LOOP_PASS("print<loop-cache-cost>", LoopCachePrinterPass(dbgs()))
612LOOP_PASS("loop-predication", LoopPredicationPass())
613LOOP_PASS("guard-widening", GuardWideningPass())
614LOOP_PASS("loop-bound-split", LoopBoundSplitPass())
615LOOP_PASS("loop-reroll", LoopRerollPass())
616LOOP_PASS("loop-versioning-licm", LoopVersioningLICMPass())
617#undef LOOP_PASS
618
619#ifndef LOOP_PASS_WITH_PARAMS
620#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS)
621#endif
622LOOP_PASS_WITH_PARAMS("simple-loop-unswitch",
623                      "SimpleLoopUnswitchPass",
624                      [](std::pair<bool, bool> Params) {
625                        return SimpleLoopUnswitchPass(Params.first, Params.second);
626                      },
627                      parseLoopUnswitchOptions,
628                      "nontrivial;no-nontrivial;trivial;no-trivial")
629
630LOOP_PASS_WITH_PARAMS("licm", "LICMPass",
631                      [](LICMOptions Params) {
632                        return LICMPass(Params);
633                      },
634                      parseLICMOptions,
635                      "allowspeculation");
636
637LOOP_PASS_WITH_PARAMS("lnicm", "LNICMPass",
638                      [](LICMOptions Params) {
639                        return LNICMPass(Params);
640                      },
641                      parseLICMOptions,
642                      "allowspeculation");
643
644LOOP_PASS_WITH_PARAMS("loop-rotate",
645                      "LoopRotatePass",
646                      [](std::pair<bool, bool> Params) {
647                        return LoopRotatePass(Params.first, Params.second);
648                      },
649                      parseLoopRotateOptions,
650                      "no-header-duplication;header-duplication;no-prepare-for-lto;prepare-for-lto")
651#undef LOOP_PASS_WITH_PARAMS
652