xref: /freebsd/contrib/llvm-project/llvm/lib/Passes/PassRegistry.def (revision c66ec88fed842fbaad62c30d510644ceb7bd2d71)
1//===- PassRegistry.def - Registry of passes --------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file is used as the registry of passes that are part of the core LLVM
10// libraries. This file describes both transformation passes and analyses
11// Analyses are registered while transformation passes have names registered
12// that can be used when providing a textual pass pipeline.
13//
14//===----------------------------------------------------------------------===//
15
16// NOTE: NO INCLUDE GUARD DESIRED!
17
18#ifndef MODULE_ANALYSIS
19#define MODULE_ANALYSIS(NAME, CREATE_PASS)
20#endif
21MODULE_ANALYSIS("callgraph", CallGraphAnalysis())
22MODULE_ANALYSIS("lcg", LazyCallGraphAnalysis())
23MODULE_ANALYSIS("module-summary", ModuleSummaryIndexAnalysis())
24MODULE_ANALYSIS("no-op-module", NoOpModuleAnalysis())
25MODULE_ANALYSIS("profile-summary", ProfileSummaryAnalysis())
26MODULE_ANALYSIS("stack-safety", StackSafetyGlobalAnalysis())
27MODULE_ANALYSIS("verify", VerifierAnalysis())
28MODULE_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis(PIC))
29MODULE_ANALYSIS("asan-globals-md", ASanGlobalsMetadataAnalysis())
30MODULE_ANALYSIS("inline-advisor", InlineAdvisorAnalysis())
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("called-value-propagation", CalledValuePropagationPass())
46MODULE_PASS("canonicalize-aliases", CanonicalizeAliasesPass())
47MODULE_PASS("cg-profile", CGProfilePass())
48MODULE_PASS("constmerge", ConstantMergePass())
49MODULE_PASS("cross-dso-cfi", CrossDSOCFIPass())
50MODULE_PASS("deadargelim", DeadArgumentEliminationPass())
51MODULE_PASS("elim-avail-extern", EliminateAvailableExternallyPass())
52MODULE_PASS("forceattrs", ForceFunctionAttrsPass())
53MODULE_PASS("function-import", FunctionImportPass())
54MODULE_PASS("globaldce", GlobalDCEPass())
55MODULE_PASS("globalopt", GlobalOptPass())
56MODULE_PASS("globalsplit", GlobalSplitPass())
57MODULE_PASS("hotcoldsplit", HotColdSplittingPass())
58MODULE_PASS("hwasan", HWAddressSanitizerPass(false, false))
59MODULE_PASS("khwasan", HWAddressSanitizerPass(true, true))
60MODULE_PASS("inferattrs", InferFunctionAttrsPass())
61MODULE_PASS("inliner-wrapper", ModuleInlinerWrapperPass())
62MODULE_PASS("insert-gcov-profiling", GCOVProfilerPass())
63MODULE_PASS("instrorderfile", InstrOrderFilePass())
64MODULE_PASS("instrprof", InstrProfiling())
65MODULE_PASS("internalize", InternalizePass())
66MODULE_PASS("invalidate<all>", InvalidateAllAnalysesPass())
67MODULE_PASS("ipsccp", IPSCCPPass())
68MODULE_PASS("lowertypetests", LowerTypeTestsPass(nullptr, nullptr))
69MODULE_PASS("mergefunc", MergeFunctionsPass())
70MODULE_PASS("name-anon-globals", NameAnonGlobalPass())
71MODULE_PASS("no-op-module", NoOpModulePass())
72MODULE_PASS("partial-inliner", PartialInlinerPass())
73MODULE_PASS("pgo-icall-prom", PGOIndirectCallPromotion())
74MODULE_PASS("pgo-instr-gen", PGOInstrumentationGen())
75MODULE_PASS("pgo-instr-use", PGOInstrumentationUse())
76MODULE_PASS("print-profile-summary", ProfileSummaryPrinterPass(dbgs()))
77MODULE_PASS("print-callgraph", CallGraphPrinterPass(dbgs()))
78MODULE_PASS("print", PrintModulePass(dbgs()))
79MODULE_PASS("print-lcg", LazyCallGraphPrinterPass(dbgs()))
80MODULE_PASS("print-lcg-dot", LazyCallGraphDOTPrinterPass(dbgs()))
81MODULE_PASS("print-stack-safety", StackSafetyGlobalPrinterPass(dbgs()))
82MODULE_PASS("rewrite-statepoints-for-gc", RewriteStatepointsForGC())
83MODULE_PASS("rewrite-symbols", RewriteSymbolPass())
84MODULE_PASS("rpo-functionattrs", ReversePostOrderFunctionAttrsPass())
85MODULE_PASS("sample-profile", SampleProfileLoaderPass())
86MODULE_PASS("scc-oz-module-inliner",
87  buildInlinerPipeline(OptimizationLevel::Oz, ThinLTOPhase::None, DebugLogging))
88MODULE_PASS("strip-dead-prototypes", StripDeadPrototypesPass())
89MODULE_PASS("synthetic-counts-propagation", SyntheticCountsPropagation())
90MODULE_PASS("wholeprogramdevirt", WholeProgramDevirtPass(nullptr, nullptr))
91MODULE_PASS("verify", VerifierPass())
92MODULE_PASS("asan-module", ModuleAddressSanitizerPass(/*CompileKernel=*/false, false, true, false))
93MODULE_PASS("msan-module", MemorySanitizerPass({}))
94MODULE_PASS("tsan-module", ThreadSanitizerPass())
95MODULE_PASS("kasan-module", ModuleAddressSanitizerPass(/*CompileKernel=*/true, false, true, false))
96MODULE_PASS("sancov-module", ModuleSanitizerCoveragePass())
97MODULE_PASS("poison-checking", PoisonCheckingPass())
98#undef MODULE_PASS
99
100#ifndef CGSCC_ANALYSIS
101#define CGSCC_ANALYSIS(NAME, CREATE_PASS)
102#endif
103CGSCC_ANALYSIS("no-op-cgscc", NoOpCGSCCAnalysis())
104CGSCC_ANALYSIS("fam-proxy", FunctionAnalysisManagerCGSCCProxy())
105CGSCC_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis(PIC))
106#undef CGSCC_ANALYSIS
107
108#ifndef CGSCC_PASS
109#define CGSCC_PASS(NAME, CREATE_PASS)
110#endif
111CGSCC_PASS("argpromotion", ArgumentPromotionPass())
112CGSCC_PASS("invalidate<all>", InvalidateAllAnalysesPass())
113CGSCC_PASS("function-attrs", PostOrderFunctionAttrsPass())
114CGSCC_PASS("attributor-cgscc", AttributorCGSCCPass())
115CGSCC_PASS("inline", InlinerPass())
116CGSCC_PASS("openmpopt", OpenMPOptPass())
117CGSCC_PASS("coro-split", CoroSplitPass())
118CGSCC_PASS("no-op-cgscc", NoOpCGSCCPass())
119#undef CGSCC_PASS
120
121#ifndef FUNCTION_ANALYSIS
122#define FUNCTION_ANALYSIS(NAME, CREATE_PASS)
123#endif
124FUNCTION_ANALYSIS("aa", AAManager())
125FUNCTION_ANALYSIS("assumptions", AssumptionAnalysis())
126FUNCTION_ANALYSIS("block-freq", BlockFrequencyAnalysis())
127FUNCTION_ANALYSIS("branch-prob", BranchProbabilityAnalysis())
128FUNCTION_ANALYSIS("domtree", DominatorTreeAnalysis())
129FUNCTION_ANALYSIS("postdomtree", PostDominatorTreeAnalysis())
130FUNCTION_ANALYSIS("demanded-bits", DemandedBitsAnalysis())
131FUNCTION_ANALYSIS("domfrontier", DominanceFrontierAnalysis())
132FUNCTION_ANALYSIS("loops", LoopAnalysis())
133FUNCTION_ANALYSIS("lazy-value-info", LazyValueAnalysis())
134FUNCTION_ANALYSIS("da", DependenceAnalysis())
135FUNCTION_ANALYSIS("inliner-features", InlineFeaturesAnalysis())
136FUNCTION_ANALYSIS("inliner-size-estimator", InlineSizeEstimatorAnalysis())
137FUNCTION_ANALYSIS("memdep", MemoryDependenceAnalysis())
138FUNCTION_ANALYSIS("memoryssa", MemorySSAAnalysis())
139FUNCTION_ANALYSIS("phi-values", PhiValuesAnalysis())
140FUNCTION_ANALYSIS("regions", RegionInfoAnalysis())
141FUNCTION_ANALYSIS("no-op-function", NoOpFunctionAnalysis())
142FUNCTION_ANALYSIS("opt-remark-emit", OptimizationRemarkEmitterAnalysis())
143FUNCTION_ANALYSIS("scalar-evolution", ScalarEvolutionAnalysis())
144FUNCTION_ANALYSIS("stack-safety-local", StackSafetyAnalysis())
145FUNCTION_ANALYSIS("targetlibinfo", TargetLibraryAnalysis())
146FUNCTION_ANALYSIS("targetir",
147                  TM ? TM->getTargetIRAnalysis() : TargetIRAnalysis())
148FUNCTION_ANALYSIS("verify", VerifierAnalysis())
149FUNCTION_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis(PIC))
150
151#ifndef FUNCTION_ALIAS_ANALYSIS
152#define FUNCTION_ALIAS_ANALYSIS(NAME, CREATE_PASS)                             \
153  FUNCTION_ANALYSIS(NAME, CREATE_PASS)
154#endif
155FUNCTION_ALIAS_ANALYSIS("basic-aa", BasicAA())
156FUNCTION_ALIAS_ANALYSIS("cfl-anders-aa", CFLAndersAA())
157FUNCTION_ALIAS_ANALYSIS("cfl-steens-aa", CFLSteensAA())
158FUNCTION_ALIAS_ANALYSIS("scev-aa", SCEVAA())
159FUNCTION_ALIAS_ANALYSIS("scoped-noalias-aa", ScopedNoAliasAA())
160FUNCTION_ALIAS_ANALYSIS("type-based-aa", TypeBasedAA())
161#undef FUNCTION_ALIAS_ANALYSIS
162#undef FUNCTION_ANALYSIS
163
164#ifndef FUNCTION_PASS
165#define FUNCTION_PASS(NAME, CREATE_PASS)
166#endif
167FUNCTION_PASS("aa-eval", AAEvaluator())
168FUNCTION_PASS("adce", ADCEPass())
169FUNCTION_PASS("add-discriminators", AddDiscriminatorsPass())
170FUNCTION_PASS("aggressive-instcombine", AggressiveInstCombinePass())
171FUNCTION_PASS("assume-builder", AssumeBuilderPass())
172FUNCTION_PASS("assume-simplify", AssumeSimplifyPass())
173FUNCTION_PASS("alignment-from-assumptions", AlignmentFromAssumptionsPass())
174FUNCTION_PASS("bdce", BDCEPass())
175FUNCTION_PASS("bounds-checking", BoundsCheckingPass())
176FUNCTION_PASS("break-crit-edges", BreakCriticalEdgesPass())
177FUNCTION_PASS("callsite-splitting", CallSiteSplittingPass())
178FUNCTION_PASS("consthoist", ConstantHoistingPass())
179FUNCTION_PASS("chr", ControlHeightReductionPass())
180FUNCTION_PASS("coro-early", CoroEarlyPass())
181FUNCTION_PASS("coro-elide", CoroElidePass())
182FUNCTION_PASS("coro-cleanup", CoroCleanupPass())
183FUNCTION_PASS("correlated-propagation", CorrelatedValuePropagationPass())
184FUNCTION_PASS("dce", DCEPass())
185FUNCTION_PASS("div-rem-pairs", DivRemPairsPass())
186FUNCTION_PASS("dse", DSEPass())
187FUNCTION_PASS("dot-cfg", CFGPrinterPass())
188FUNCTION_PASS("dot-cfg-only", CFGOnlyPrinterPass())
189FUNCTION_PASS("early-cse", EarlyCSEPass(/*UseMemorySSA=*/false))
190FUNCTION_PASS("early-cse-memssa", EarlyCSEPass(/*UseMemorySSA=*/true))
191FUNCTION_PASS("ee-instrument", EntryExitInstrumenterPass(/*PostInlining=*/false))
192FUNCTION_PASS("make-guards-explicit", MakeGuardsExplicitPass())
193FUNCTION_PASS("post-inline-ee-instrument", EntryExitInstrumenterPass(/*PostInlining=*/true))
194FUNCTION_PASS("gvn-hoist", GVNHoistPass())
195FUNCTION_PASS("instcombine", InstCombinePass())
196FUNCTION_PASS("instsimplify", InstSimplifyPass())
197FUNCTION_PASS("invalidate<all>", InvalidateAllAnalysesPass())
198FUNCTION_PASS("irce", IRCEPass())
199FUNCTION_PASS("float2int", Float2IntPass())
200FUNCTION_PASS("no-op-function", NoOpFunctionPass())
201FUNCTION_PASS("libcalls-shrinkwrap", LibCallsShrinkWrapPass())
202FUNCTION_PASS("inject-tli-mappings", InjectTLIMappings())
203FUNCTION_PASS("loweratomic", LowerAtomicPass())
204FUNCTION_PASS("lower-expect", LowerExpectIntrinsicPass())
205FUNCTION_PASS("lower-guard-intrinsic", LowerGuardIntrinsicPass())
206FUNCTION_PASS("lower-constant-intrinsics", LowerConstantIntrinsicsPass())
207FUNCTION_PASS("lower-matrix-intrinsics", LowerMatrixIntrinsicsPass())
208FUNCTION_PASS("lower-widenable-condition", LowerWidenableConditionPass())
209FUNCTION_PASS("guard-widening", GuardWideningPass())
210FUNCTION_PASS("load-store-vectorizer", LoadStoreVectorizerPass())
211FUNCTION_PASS("loop-simplify", LoopSimplifyPass())
212FUNCTION_PASS("loop-sink", LoopSinkPass())
213FUNCTION_PASS("loop-unroll-and-jam", LoopUnrollAndJamPass())
214FUNCTION_PASS("lowerinvoke", LowerInvokePass())
215FUNCTION_PASS("mem2reg", PromotePass())
216FUNCTION_PASS("memcpyopt", MemCpyOptPass())
217FUNCTION_PASS("mergeicmps", MergeICmpsPass())
218FUNCTION_PASS("nary-reassociate", NaryReassociatePass())
219FUNCTION_PASS("newgvn", NewGVNPass())
220FUNCTION_PASS("jump-threading", JumpThreadingPass())
221FUNCTION_PASS("partially-inline-libcalls", PartiallyInlineLibCallsPass())
222FUNCTION_PASS("lcssa", LCSSAPass())
223FUNCTION_PASS("loop-data-prefetch", LoopDataPrefetchPass())
224FUNCTION_PASS("loop-load-elim", LoopLoadEliminationPass())
225FUNCTION_PASS("loop-fusion", LoopFusePass())
226FUNCTION_PASS("loop-distribute", LoopDistributePass())
227FUNCTION_PASS("pgo-memop-opt", PGOMemOPSizeOpt())
228FUNCTION_PASS("print", PrintFunctionPass(dbgs()))
229FUNCTION_PASS("print<assumptions>", AssumptionPrinterPass(dbgs()))
230FUNCTION_PASS("print<block-freq>", BlockFrequencyPrinterPass(dbgs()))
231FUNCTION_PASS("print<branch-prob>", BranchProbabilityPrinterPass(dbgs()))
232FUNCTION_PASS("print<da>", DependenceAnalysisPrinterPass(dbgs()))
233FUNCTION_PASS("print<domtree>", DominatorTreePrinterPass(dbgs()))
234FUNCTION_PASS("print<postdomtree>", PostDominatorTreePrinterPass(dbgs()))
235FUNCTION_PASS("print<demanded-bits>", DemandedBitsPrinterPass(dbgs()))
236FUNCTION_PASS("print<domfrontier>", DominanceFrontierPrinterPass(dbgs()))
237FUNCTION_PASS("print<inline-cost>", InlineCostAnnotationPrinterPass(dbgs()))
238FUNCTION_PASS("print<loops>", LoopPrinterPass(dbgs()))
239FUNCTION_PASS("print<memoryssa>", MemorySSAPrinterPass(dbgs()))
240FUNCTION_PASS("print<phi-values>", PhiValuesPrinterPass(dbgs()))
241FUNCTION_PASS("print<regions>", RegionInfoPrinterPass(dbgs()))
242FUNCTION_PASS("print<scalar-evolution>", ScalarEvolutionPrinterPass(dbgs()))
243FUNCTION_PASS("print<stack-safety-local>", StackSafetyPrinterPass(dbgs()))
244FUNCTION_PASS("print-predicateinfo", PredicateInfoPrinterPass(dbgs()))
245FUNCTION_PASS("reassociate", ReassociatePass())
246FUNCTION_PASS("scalarizer", ScalarizerPass())
247FUNCTION_PASS("sccp", SCCPPass())
248FUNCTION_PASS("simplifycfg", SimplifyCFGPass())
249FUNCTION_PASS("sink", SinkingPass())
250FUNCTION_PASS("slp-vectorizer", SLPVectorizerPass())
251FUNCTION_PASS("speculative-execution", SpeculativeExecutionPass())
252FUNCTION_PASS("spec-phis", SpeculateAroundPHIsPass())
253FUNCTION_PASS("sroa", SROA())
254FUNCTION_PASS("tailcallelim", TailCallElimPass())
255FUNCTION_PASS("vector-combine", VectorCombinePass())
256FUNCTION_PASS("verify", VerifierPass())
257FUNCTION_PASS("verify<domtree>", DominatorTreeVerifierPass())
258FUNCTION_PASS("verify<loops>", LoopVerifierPass())
259FUNCTION_PASS("verify<memoryssa>", MemorySSAVerifierPass())
260FUNCTION_PASS("verify<regions>", RegionInfoVerifierPass())
261FUNCTION_PASS("verify<safepoint-ir>", SafepointIRVerifierPass())
262FUNCTION_PASS("verify<scalar-evolution>", ScalarEvolutionVerifierPass())
263FUNCTION_PASS("view-cfg", CFGViewerPass())
264FUNCTION_PASS("view-cfg-only", CFGOnlyViewerPass())
265FUNCTION_PASS("transform-warning", WarnMissedTransformationsPass())
266FUNCTION_PASS("asan", AddressSanitizerPass(false, false, false))
267FUNCTION_PASS("kasan", AddressSanitizerPass(true, false, false))
268FUNCTION_PASS("msan", MemorySanitizerPass({}))
269FUNCTION_PASS("kmsan", MemorySanitizerPass({0, false, /*Kernel=*/true}))
270FUNCTION_PASS("tsan", ThreadSanitizerPass())
271#undef FUNCTION_PASS
272
273#ifndef FUNCTION_PASS_WITH_PARAMS
274#define FUNCTION_PASS_WITH_PARAMS(NAME, CREATE_PASS, PARSER)
275#endif
276FUNCTION_PASS_WITH_PARAMS("loop-unroll",
277                           [](LoopUnrollOptions Opts) {
278                             return LoopUnrollPass(Opts);
279                           },
280                           parseLoopUnrollOptions)
281FUNCTION_PASS_WITH_PARAMS("msan",
282                           [](MemorySanitizerOptions Opts) {
283                             return MemorySanitizerPass(Opts);
284                           },
285                           parseMSanPassOptions)
286FUNCTION_PASS_WITH_PARAMS("simplify-cfg",
287                           [](SimplifyCFGOptions Opts) {
288                             return SimplifyCFGPass(Opts);
289                           },
290                           parseSimplifyCFGOptions)
291FUNCTION_PASS_WITH_PARAMS("loop-vectorize",
292                           [](LoopVectorizeOptions Opts) {
293                             return LoopVectorizePass(Opts);
294                           },
295                           parseLoopVectorizeOptions)
296FUNCTION_PASS_WITH_PARAMS("mldst-motion",
297                           [](MergedLoadStoreMotionOptions Opts) {
298                             return MergedLoadStoreMotionPass(Opts);
299                           },
300                           parseMergedLoadStoreMotionOptions)
301FUNCTION_PASS_WITH_PARAMS("gvn",
302                           [](GVNOptions Opts) {
303                             return GVN(Opts);
304                           },
305                           parseGVNOptions)
306FUNCTION_PASS_WITH_PARAMS("print<stack-lifetime>",
307                           [](StackLifetime::LivenessType Type) {
308                             return StackLifetimePrinterPass(dbgs(), Type);
309                           },
310                           parseStackLifetimeOptions)
311#undef FUNCTION_PASS_WITH_PARAMS
312
313#ifndef LOOP_ANALYSIS
314#define LOOP_ANALYSIS(NAME, CREATE_PASS)
315#endif
316LOOP_ANALYSIS("no-op-loop", NoOpLoopAnalysis())
317LOOP_ANALYSIS("access-info", LoopAccessAnalysis())
318LOOP_ANALYSIS("ddg", DDGAnalysis())
319LOOP_ANALYSIS("ivusers", IVUsersAnalysis())
320LOOP_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis(PIC))
321#undef LOOP_ANALYSIS
322
323#ifndef LOOP_PASS
324#define LOOP_PASS(NAME, CREATE_PASS)
325#endif
326LOOP_PASS("canon-freeze", CanonicalizeFreezeInLoopsPass())
327LOOP_PASS("invalidate<all>", InvalidateAllAnalysesPass())
328LOOP_PASS("licm", LICMPass())
329LOOP_PASS("loop-idiom", LoopIdiomRecognizePass())
330LOOP_PASS("loop-instsimplify", LoopInstSimplifyPass())
331LOOP_PASS("rotate", LoopRotatePass())
332LOOP_PASS("no-op-loop", NoOpLoopPass())
333LOOP_PASS("print", PrintLoopPass(dbgs()))
334LOOP_PASS("loop-deletion", LoopDeletionPass())
335LOOP_PASS("simplify-cfg", LoopSimplifyCFGPass())
336LOOP_PASS("loop-reduce", LoopStrengthReducePass())
337LOOP_PASS("indvars", IndVarSimplifyPass())
338LOOP_PASS("loop-unroll-full", LoopFullUnrollPass())
339LOOP_PASS("print-access-info", LoopAccessInfoPrinterPass(dbgs()))
340LOOP_PASS("print<ddg>", DDGAnalysisPrinterPass(dbgs()))
341LOOP_PASS("print<ivusers>", IVUsersPrinterPass(dbgs()))
342LOOP_PASS("print<loopnest>", LoopNestPrinterPass(dbgs()))
343LOOP_PASS("print<loop-cache-cost>", LoopCachePrinterPass(dbgs()))
344LOOP_PASS("loop-predication", LoopPredicationPass())
345LOOP_PASS("guard-widening", GuardWideningPass())
346LOOP_PASS("simple-loop-unswitch", SimpleLoopUnswitchPass())
347#undef LOOP_PASS
348
349#ifndef LOOP_PASS_WITH_PARAMS
350#define LOOP_PASS_WITH_PARAMS(NAME, CREATE_PASS, PARSER)
351#endif
352LOOP_PASS_WITH_PARAMS("unswitch",
353                           [](bool NonTrivial) {
354                             return SimpleLoopUnswitchPass(NonTrivial);
355                           },
356                           parseLoopUnswitchOptions)
357#undef LOOP_PASS_WITH_PARAMS
358