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