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