LLVM 20.0.0git
PassBuilder.h
Go to the documentation of this file.
1//===- Parsing, selection, and construction of pass pipelines --*- 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/// \file
9///
10/// Interfaces for registering analysis passes, producing common pass manager
11/// configurations, and parsing of pass pipelines.
12///
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_PASSES_PASSBUILDER_H
16#define LLVM_PASSES_PASSBUILDER_H
17
21#include "llvm/IR/PassManager.h"
23#include "llvm/Support/Error.h"
29#include <optional>
30#include <vector>
31
32namespace llvm {
33class StringRef;
34class AAManager;
35class TargetMachine;
36class ModuleSummaryIndex;
37template <typename T> class IntrusiveRefCntPtr;
38namespace vfs {
39class FileSystem;
40} // namespace vfs
41
42/// Tunable parameters for passes in the default pipelines.
44public:
45 /// Constructor sets pipeline tuning defaults based on cl::opts. Each option
46 /// can be set in the PassBuilder when using a LLVM as a library.
48
49 /// Tuning option to set loop interleaving on/off, set based on opt level.
51
52 /// Tuning option to enable/disable loop vectorization, set based on opt
53 /// level.
55
56 /// Tuning option to enable/disable slp loop vectorization, set based on opt
57 /// level.
59
60 /// Tuning option to enable/disable loop unrolling. Its default value is true.
62
63 /// Tuning option to forget all SCEV loops in LoopUnroll. Its default value
64 /// is that of the flag: `-forget-scev-loop-unroll`.
66
67 /// Tuning option to cap the number of calls to retrive clobbering accesses in
68 /// MemorySSA, in LICM.
70
71 /// Tuning option to disable promotion to scalars in LICM with MemorySSA, if
72 /// the number of access is too large.
74
75 /// Tuning option to enable/disable call graph profile. Its default value is
76 /// that of the flag: `-enable-npm-call-graph-profile`.
78
79 // Add LTO pipeline tuning option to enable the unified LTO pipeline.
81
82 /// Tuning option to enable/disable function merging. Its default value is
83 /// false.
85
86 /// Tuning option to override the default inliner threshold.
88
89 // Experimental option to eagerly invalidate more analyses. This has the
90 // potential to decrease max memory usage in exchange for more compile time.
91 // This may affect codegen due to either passes using analyses only when
92 // cached, or invalidating and recalculating an analysis that was
93 // stale/imprecise but still valid. Currently this invalidates all function
94 // analyses after various module->function or cgscc->function adaptors in the
95 // default pipelines.
97};
98
99/// This class provides access to building LLVM's passes.
100///
101/// Its members provide the baseline state available to passes during their
102/// construction. The \c PassRegistry.def file specifies how to construct all
103/// of the built-in passes, and those may reference these members during
104/// construction.
106 TargetMachine *TM;
108 std::optional<PGOOptions> PGOOpt;
110
111public:
112 /// A struct to capture parsed pass pipeline names.
113 ///
114 /// A pipeline is defined as a series of names, each of which may in itself
115 /// recursively contain a nested pipeline. A name is either the name of a pass
116 /// (e.g. "instcombine") or the name of a pipeline type (e.g. "cgscc"). If the
117 /// name is the name of a pass, the InnerPipeline is empty, since passes
118 /// cannot contain inner pipelines. See parsePassPipeline() for a more
119 /// detailed description of the textual pipeline format.
122 std::vector<PipelineElement> InnerPipeline;
123 };
124
125 explicit PassBuilder(TargetMachine *TM = nullptr,
127 std::optional<PGOOptions> PGOOpt = std::nullopt,
128 PassInstrumentationCallbacks *PIC = nullptr);
129
130 /// Cross register the analysis managers through their proxies.
131 ///
132 /// This is an interface that can be used to cross register each
133 /// AnalysisManager with all the others analysis managers.
138 MachineFunctionAnalysisManager *MFAM = nullptr);
139
140 /// Registers all available module analysis passes.
141 ///
142 /// This is an interface that can be used to populate a \c
143 /// ModuleAnalysisManager with all registered module analyses. Callers can
144 /// still manually register any additional analyses. Callers can also
145 /// pre-register analyses and this will not override those.
147
148 /// Registers all available CGSCC analysis passes.
149 ///
150 /// This is an interface that can be used to populate a \c CGSCCAnalysisManager
151 /// with all registered CGSCC analyses. Callers can still manually register any
152 /// additional analyses. Callers can also pre-register analyses and this will
153 /// not override those.
155
156 /// Registers all available function analysis passes.
157 ///
158 /// This is an interface that can be used to populate a \c
159 /// FunctionAnalysisManager with all registered function analyses. Callers can
160 /// still manually register any additional analyses. Callers can also
161 /// pre-register analyses and this will not override those.
163
164 /// Registers all available loop analysis passes.
165 ///
166 /// This is an interface that can be used to populate a \c LoopAnalysisManager
167 /// with all registered loop analyses. Callers can still manually register any
168 /// additional analyses.
170
171 /// Registers all available machine function analysis passes.
172 ///
173 /// This is an interface that can be used to populate a \c
174 /// MachineFunctionAnalysisManager with all registered function analyses.
175 /// Callers can still manually register any additional analyses. Callers can
176 /// also pre-register analyses and this will not override those.
178
179 /// Construct the core LLVM function canonicalization and simplification
180 /// pipeline.
181 ///
182 /// This is a long pipeline and uses most of the per-function optimization
183 /// passes in LLVM to canonicalize and simplify the IR. It is suitable to run
184 /// repeatedly over the IR and is not expected to destroy important
185 /// information about the semantics of the IR.
186 ///
187 /// Note that \p Level cannot be `O0` here. The pipelines produced are
188 /// only intended for use when attempting to optimize code. If frontends
189 /// require some transformations for semantic reasons, they should explicitly
190 /// build them.
191 ///
192 /// \p Phase indicates the current ThinLTO phase.
196
197 /// Construct the core LLVM module canonicalization and simplification
198 /// pipeline.
199 ///
200 /// This pipeline focuses on canonicalizing and simplifying the entire module
201 /// of IR. Much like the function simplification pipeline above, it is
202 /// suitable to run repeatedly over the IR and is not expected to destroy
203 /// important information. It does, however, perform inlining and other
204 /// heuristic based simplifications that are not strictly reversible.
205 ///
206 /// Note that \p Level cannot be `O0` here. The pipelines produced are
207 /// only intended for use when attempting to optimize code. If frontends
208 /// require some transformations for semantic reasons, they should explicitly
209 /// build them.
210 ///
211 /// \p Phase indicates the current ThinLTO phase.
214
215 /// Construct the module pipeline that performs inlining as well as
216 /// the inlining-driven cleanups.
219
220 /// Construct the module pipeline that performs inlining with
221 /// module inliner pass.
224
225 /// Construct the core LLVM module optimization pipeline.
226 ///
227 /// This pipeline focuses on optimizing the execution speed of the IR. It
228 /// uses cost modeling and thresholds to balance code growth against runtime
229 /// improvements. It includes vectorization and other information destroying
230 /// transformations. It also cannot generally be run repeatedly on a module
231 /// without potentially seriously regressing either runtime performance of
232 /// the code or serious code size growth.
233 ///
234 /// Note that \p Level cannot be `O0` here. The pipelines produced are
235 /// only intended for use when attempting to optimize code. If frontends
236 /// require some transformations for semantic reasons, they should explicitly
237 /// build them.
240 ThinOrFullLTOPhase LTOPhase);
241
242 /// Build a per-module default optimization pipeline.
243 ///
244 /// This provides a good default optimization pipeline for per-module
245 /// optimization and code generation without any link-time optimization. It
246 /// typically correspond to frontend "-O[123]" options for optimization
247 /// levels \c O1, \c O2 and \c O3 resp.
249 OptimizationLevel Level,
251
252 /// Build a fat object default optimization pipeline.
253 ///
254 /// This builds a pipeline that runs the LTO/ThinLTO pre-link pipeline, and
255 /// emits a section containing the pre-link bitcode along side the object code
256 /// generated in non-LTO compilation.
258 bool ThinLTO, bool EmitSummary);
259
260 /// Build a pre-link, ThinLTO-targeting default optimization pipeline to
261 /// a pass manager.
262 ///
263 /// This adds the pre-link optimizations tuned to prepare a module for
264 /// a ThinLTO run. It works to minimize the IR which needs to be analyzed
265 /// without making irreversible decisions which could be made better during
266 /// the LTO run.
268
269 /// Build a ThinLTO default optimization pipeline to a pass manager.
270 ///
271 /// This provides a good default optimization pipeline for link-time
272 /// optimization and code generation. It is particularly tuned to fit well
273 /// when IR coming into the LTO phase was first run through \c
274 /// buildThinLTOPreLinkDefaultPipeline, and the two coordinate closely.
277 const ModuleSummaryIndex *ImportSummary);
278
279 /// Build a pre-link, LTO-targeting default optimization pipeline to a pass
280 /// manager.
281 ///
282 /// This adds the pre-link optimizations tuned to work well with a later LTO
283 /// run. It works to minimize the IR which needs to be analyzed without
284 /// making irreversible decisions which could be made better during the LTO
285 /// run.
287
288 /// Build an LTO default optimization pipeline to a pass manager.
289 ///
290 /// This provides a good default optimization pipeline for link-time
291 /// optimization and code generation. It is particularly tuned to fit well
292 /// when IR coming into the LTO phase was first run through \c
293 /// buildLTOPreLinkDefaultPipeline, and the two coordinate closely.
295 ModuleSummaryIndex *ExportSummary);
296
297 /// Build an O0 pipeline with the minimal semantically required passes.
298 ///
299 /// This should only be used for non-LTO and LTO pre-link pipelines.
303
304 /// Build the default `AAManager` with the default alias analysis pipeline
305 /// registered.
306 ///
307 /// This also adds target-specific alias analyses registered via
308 /// TargetMachine::registerDefaultAliasAnalyses().
310
311 /// Parse a textual pass pipeline description into a \c
312 /// ModulePassManager.
313 ///
314 /// The format of the textual pass pipeline description looks something like:
315 ///
316 /// module(function(instcombine,sroa),dce,cgscc(inliner,function(...)),...)
317 ///
318 /// Pass managers have ()s describing the nest structure of passes. All passes
319 /// are comma separated. As a special shortcut, if the very first pass is not
320 /// a module pass (as a module pass manager is), this will automatically form
321 /// the shortest stack of pass managers that allow inserting that first pass.
322 /// So, assuming function passes 'fpassN', CGSCC passes 'cgpassN', and loop
323 /// passes 'lpassN', all of these are valid:
324 ///
325 /// fpass1,fpass2,fpass3
326 /// cgpass1,cgpass2,cgpass3
327 /// lpass1,lpass2,lpass3
328 ///
329 /// And they are equivalent to the following (resp.):
330 ///
331 /// module(function(fpass1,fpass2,fpass3))
332 /// module(cgscc(cgpass1,cgpass2,cgpass3))
333 /// module(function(loop(lpass1,lpass2,lpass3)))
334 ///
335 /// This shortcut is especially useful for debugging and testing small pass
336 /// combinations.
337 ///
338 /// The sequence of passes aren't necessarily the exact same kind of pass.
339 /// You can mix different levels implicitly if adaptor passes are defined to
340 /// make them work. For example,
341 ///
342 /// mpass1,fpass1,fpass2,mpass2,lpass1
343 ///
344 /// This pipeline uses only one pass manager: the top-level module manager.
345 /// fpass1,fpass2 and lpass1 are added into the top-level module manager
346 /// using only adaptor passes. No nested function/loop pass managers are
347 /// added. The purpose is to allow easy pass testing when the user
348 /// specifically want the pass to run under a adaptor directly. This is
349 /// preferred when a pipeline is largely of one type, but one or just a few
350 /// passes are of different types(See PassBuilder.cpp for examples).
352
353 /// {{@ Parse a textual pass pipeline description into a specific PassManager
354 ///
355 /// Automatic deduction of an appropriate pass manager stack is not supported.
356 /// For example, to insert a loop pass 'lpass' into a FunctionPassManager,
357 /// this is the valid pipeline text:
358 ///
359 /// function(lpass)
363 /// @}}
364
365 /// Parse a textual MIR pipeline into the provided \c MachineFunctionPass
366 /// manager.
367 /// The format of the textual machine pipeline is a comma separated list of
368 /// machine pass names:
369 ///
370 /// machine-funciton-pass,machine-module-pass,...
371 ///
372 /// There is no need to specify the pass nesting, and this function
373 /// currently cannot handle the pass nesting.
375 StringRef PipelineText);
376
377 /// Parse a textual alias analysis pipeline into the provided AA manager.
378 ///
379 /// The format of the textual AA pipeline is a comma separated list of AA
380 /// pass names:
381 ///
382 /// basic-aa,globals-aa,...
383 ///
384 /// The AA manager is set up such that the provided alias analyses are tried
385 /// in the order specified. See the \c AAManaager documentation for details
386 /// about the logic used. This routine just provides the textual mapping
387 /// between AA names and the analyses to register with the manager.
388 ///
389 /// Returns false if the text cannot be parsed cleanly. The specific state of
390 /// the \p AA manager is unspecified if such an error is encountered and this
391 /// returns false.
392 Error parseAAPipeline(AAManager &AA, StringRef PipelineText);
393
394 /// Parse RegAllocFilterName to get RegAllocFilterFunc.
395 std::optional<RegAllocFilterFunc>
396 parseRegAllocFilter(StringRef RegAllocFilterName);
397
398 /// Print pass names.
400
401 /// Register a callback for a default optimizer pipeline extension
402 /// point
403 ///
404 /// This extension point allows adding passes that perform peephole
405 /// optimizations similar to the instruction combiner. These passes will be
406 /// inserted after each instance of the instruction combiner pass.
408 const std::function<void(FunctionPassManager &, OptimizationLevel)> &C) {
409 PeepholeEPCallbacks.push_back(C);
410 }
411
412 /// Register a callback for a default optimizer pipeline extension
413 /// point
414 ///
415 /// This extension point allows adding late loop canonicalization and
416 /// simplification passes. This is the last point in the loop optimization
417 /// pipeline before loop deletion. Each pass added
418 /// here must be an instance of LoopPass.
419 /// This is the place to add passes that can remove loops, such as target-
420 /// specific loop idiom recognition.
422 const std::function<void(LoopPassManager &, OptimizationLevel)> &C) {
423 LateLoopOptimizationsEPCallbacks.push_back(C);
424 }
425
426 /// Register a callback for a default optimizer pipeline extension
427 /// point
428 ///
429 /// This extension point allows adding loop passes to the end of the loop
430 /// optimizer.
432 const std::function<void(LoopPassManager &, OptimizationLevel)> &C) {
433 LoopOptimizerEndEPCallbacks.push_back(C);
434 }
435
436 /// Register a callback for a default optimizer pipeline extension
437 /// point
438 ///
439 /// This extension point allows adding optimization passes after most of the
440 /// main optimizations, but before the last cleanup-ish optimizations.
442 const std::function<void(FunctionPassManager &, OptimizationLevel)> &C) {
443 ScalarOptimizerLateEPCallbacks.push_back(C);
444 }
445
446 /// Register a callback for a default optimizer pipeline extension
447 /// point
448 ///
449 /// This extension point allows adding CallGraphSCC passes at the end of the
450 /// main CallGraphSCC passes and before any function simplification passes run
451 /// by CGPassManager.
453 const std::function<void(CGSCCPassManager &, OptimizationLevel)> &C) {
454 CGSCCOptimizerLateEPCallbacks.push_back(C);
455 }
456
457 /// Register a callback for a default optimizer pipeline extension
458 /// point
459 ///
460 /// This extension point allows adding optimization passes before the
461 /// vectorizer and other highly target specific optimization passes are
462 /// executed.
464 const std::function<void(FunctionPassManager &, OptimizationLevel)> &C) {
465 VectorizerStartEPCallbacks.push_back(C);
466 }
467
468 /// Register a callback for a default optimizer pipeline extension point.
469 ///
470 /// This extension point allows adding optimization once at the start of the
471 /// pipeline. This does not apply to 'backend' compiles (LTO and ThinLTO
472 /// link-time pipelines).
474 const std::function<void(ModulePassManager &, OptimizationLevel)> &C) {
475 PipelineStartEPCallbacks.push_back(C);
476 }
477
478 /// Register a callback for a default optimizer pipeline extension point.
479 ///
480 /// This extension point allows adding optimization right after passes that do
481 /// basic simplification of the input IR.
483 const std::function<void(ModulePassManager &, OptimizationLevel,
485 PipelineEarlySimplificationEPCallbacks.push_back(C);
486 }
487
488 /// Register a callback for a default optimizer pipeline extension point
489 ///
490 /// This extension point allows adding optimizations before the function
491 /// optimization pipeline.
493 const std::function<void(ModulePassManager &, OptimizationLevel,
495 OptimizerEarlyEPCallbacks.push_back(C);
496 }
497
498 /// Register a callback for a default optimizer pipeline extension point
499 ///
500 /// This extension point allows adding optimizations at the very end of the
501 /// function optimization pipeline.
503 const std::function<void(ModulePassManager &, OptimizationLevel,
505 OptimizerLastEPCallbacks.push_back(C);
506 }
507
508 /// Register a callback for a default optimizer pipeline extension point
509 ///
510 /// This extension point allows adding optimizations at the start of the full
511 /// LTO pipeline.
513 const std::function<void(ModulePassManager &, OptimizationLevel)> &C) {
514 FullLinkTimeOptimizationEarlyEPCallbacks.push_back(C);
515 }
516
517 /// Register a callback for a default optimizer pipeline extension point
518 ///
519 /// This extension point allows adding optimizations at the end of the full
520 /// LTO pipeline.
522 const std::function<void(ModulePassManager &, OptimizationLevel)> &C) {
523 FullLinkTimeOptimizationLastEPCallbacks.push_back(C);
524 }
525
526 /// Register a callback for parsing an AliasAnalysis Name to populate
527 /// the given AAManager \p AA
529 const std::function<bool(StringRef Name, AAManager &AA)> &C) {
530 AAParsingCallbacks.push_back(C);
531 }
532
533 /// {{@ Register callbacks for analysis registration with this PassBuilder
534 /// instance.
535 /// Callees register their analyses with the given AnalysisManager objects.
537 const std::function<void(CGSCCAnalysisManager &)> &C) {
538 CGSCCAnalysisRegistrationCallbacks.push_back(C);
539 }
541 const std::function<void(FunctionAnalysisManager &)> &C) {
542 FunctionAnalysisRegistrationCallbacks.push_back(C);
543 }
545 const std::function<void(LoopAnalysisManager &)> &C) {
546 LoopAnalysisRegistrationCallbacks.push_back(C);
547 }
549 const std::function<void(ModuleAnalysisManager &)> &C) {
550 ModuleAnalysisRegistrationCallbacks.push_back(C);
551 }
553 const std::function<void(MachineFunctionAnalysisManager &)> &C) {
554 MachineFunctionAnalysisRegistrationCallbacks.push_back(C);
555 }
556 /// @}}
557
558 /// {{@ Register pipeline parsing callbacks with this pass builder instance.
559 /// Using these callbacks, callers can parse both a single pass name, as well
560 /// as entire sub-pipelines, and populate the PassManager instance
561 /// accordingly.
563 const std::function<bool(StringRef Name, CGSCCPassManager &,
565 CGSCCPipelineParsingCallbacks.push_back(C);
566 }
568 const std::function<bool(StringRef Name, FunctionPassManager &,
570 FunctionPipelineParsingCallbacks.push_back(C);
571 }
573 const std::function<bool(StringRef Name, LoopPassManager &,
575 LoopPipelineParsingCallbacks.push_back(C);
576 }
578 const std::function<bool(StringRef Name, ModulePassManager &,
580 ModulePipelineParsingCallbacks.push_back(C);
581 }
583 const std::function<bool(StringRef Name, MachineFunctionPassManager &,
585 MachineFunctionPipelineParsingCallbacks.push_back(C);
586 }
587 /// @}}
588
589 /// Register callbacks to parse target specific filter field if regalloc pass
590 /// needs it. E.g. AMDGPU requires regalloc passes can handle sgpr and vgpr
591 /// separately.
593 const std::function<RegAllocFilterFunc(StringRef)> &C) {
594 RegClassFilterParsingCallbacks.push_back(C);
595 }
596
597 /// Register a callback for a top-level pipeline entry.
598 ///
599 /// If the PassManager type is not given at the top level of the pipeline
600 /// text, this Callback should be used to determine the appropriate stack of
601 /// PassManagers and populate the passed ModulePassManager.
603 const std::function<bool(ModulePassManager &, ArrayRef<PipelineElement>)>
604 &C);
605
606 /// Add PGOInstrumenation passes for O0 only.
607 void addPGOInstrPassesForO0(ModulePassManager &MPM, bool RunProfileGen,
608 bool IsCS, bool AtomicCounterUpdate,
609 std::string ProfileFile,
610 std::string ProfileRemappingFile,
612
613 /// Returns PIC. External libraries can use this to register pass
614 /// instrumentation callbacks.
616 return PIC;
617 }
618
619 // Invoke the callbacks registered for the various extension points.
620 // Custom pipelines should use these to invoke the callbacks registered
621 // by TargetMachines and other clients.
623 OptimizationLevel Level);
625 OptimizationLevel Level);
627 OptimizationLevel Level);
629 OptimizationLevel Level);
631 OptimizationLevel Level);
633 OptimizationLevel Level);
635 OptimizationLevel Level,
638 OptimizationLevel Level,
641 OptimizationLevel Level);
643 OptimizationLevel Level);
645 OptimizationLevel Level);
647 OptimizationLevel Level,
649
651 if (!Name.consume_front(PassName))
652 return false;
653 // normal pass name w/o parameters == default parameters
654 if (Name.empty())
655 return true;
656 return Name.starts_with("<") && Name.ends_with(">");
657 }
658
659 /// This performs customized parsing of pass name with parameters.
660 ///
661 /// We do not need parametrization of passes in textual pipeline very often,
662 /// yet on a rare occasion ability to specify parameters right there can be
663 /// useful.
664 ///
665 /// \p Name - parameterized specification of a pass from a textual pipeline
666 /// is a string in a form of :
667 /// PassName '<' parameter-list '>'
668 ///
669 /// Parameter list is being parsed by the parser callable argument, \p Parser,
670 /// It takes a string-ref of parameters and returns either StringError or a
671 /// parameter list in a form of a custom parameters type, all wrapped into
672 /// Expected<> template class.
673 ///
674 template <typename ParametersParseCallableT>
675 static auto parsePassParameters(ParametersParseCallableT &&Parser,
677 -> decltype(Parser(StringRef{})) {
678 using ParametersT = typename decltype(Parser(StringRef{}))::value_type;
679
680 StringRef Params = Name;
681 if (!Params.consume_front(PassName)) {
683 "unable to strip pass name from parametrized pass specification");
684 }
685 if (!Params.empty() &&
686 (!Params.consume_front("<") || !Params.consume_back(">"))) {
687 llvm_unreachable("invalid format for parametrized pass name");
688 }
689
690 Expected<ParametersT> Result = Parser(Params);
691 assert((Result || Result.template errorIsA<StringError>()) &&
692 "Pass parameter parser can only return StringErrors.");
693 return Result;
694 }
695
696 /// Handle passes only accept one bool-valued parameter.
697 ///
698 /// \return false when Params is empty.
699 static Expected<bool> parseSinglePassOption(StringRef Params,
700 StringRef OptionName,
701 StringRef PassName);
702
703private:
704 // O1 pass pipeline
706 buildO1FunctionSimplificationPipeline(OptimizationLevel Level,
708
709 void addRequiredLTOPreLinkPasses(ModulePassManager &MPM);
710
711 void addVectorPasses(OptimizationLevel Level, FunctionPassManager &FPM,
712 bool IsFullLTO);
713
714 static std::optional<std::vector<PipelineElement>>
715 parsePipelineText(StringRef Text);
716
717 Error parseModulePass(ModulePassManager &MPM, const PipelineElement &E);
718 Error parseCGSCCPass(CGSCCPassManager &CGPM, const PipelineElement &E);
719 Error parseFunctionPass(FunctionPassManager &FPM, const PipelineElement &E);
720 Error parseLoopPass(LoopPassManager &LPM, const PipelineElement &E);
721 Error parseMachinePass(MachineFunctionPassManager &MFPM,
722 const PipelineElement &E);
723 bool parseAAPassName(AAManager &AA, StringRef Name);
724
725 Error parseMachinePassPipeline(MachineFunctionPassManager &MFPM,
726 ArrayRef<PipelineElement> Pipeline);
727 Error parseLoopPassPipeline(LoopPassManager &LPM,
728 ArrayRef<PipelineElement> Pipeline);
729 Error parseFunctionPassPipeline(FunctionPassManager &FPM,
730 ArrayRef<PipelineElement> Pipeline);
731 Error parseCGSCCPassPipeline(CGSCCPassManager &CGPM,
732 ArrayRef<PipelineElement> Pipeline);
733 Error parseModulePassPipeline(ModulePassManager &MPM,
734 ArrayRef<PipelineElement> Pipeline);
735
736 // Adds passes to do pre-inlining and related cleanup passes before
737 // profile instrumentation/matching (to enable better context sensitivity),
738 // and for memprof to enable better matching with missing debug frames.
739 void addPreInlinerPasses(ModulePassManager &MPM, OptimizationLevel Level,
740 ThinOrFullLTOPhase LTOPhase);
741
742 void addPGOInstrPasses(ModulePassManager &MPM, OptimizationLevel Level,
743 bool RunProfileGen, bool IsCS,
744 bool AtomicCounterUpdate, std::string ProfileFile,
745 std::string ProfileRemappingFile,
746 IntrusiveRefCntPtr<vfs::FileSystem> FS);
747 void addPostPGOLoopRotation(ModulePassManager &MPM, OptimizationLevel Level);
748
749 // Extension Point callbacks
750 SmallVector<std::function<void(FunctionPassManager &, OptimizationLevel)>, 2>
751 PeepholeEPCallbacks;
752 SmallVector<std::function<void(LoopPassManager &, OptimizationLevel)>, 2>
753 LateLoopOptimizationsEPCallbacks;
754 SmallVector<std::function<void(LoopPassManager &, OptimizationLevel)>, 2>
755 LoopOptimizerEndEPCallbacks;
756 SmallVector<std::function<void(FunctionPassManager &, OptimizationLevel)>, 2>
757 ScalarOptimizerLateEPCallbacks;
758 SmallVector<std::function<void(CGSCCPassManager &, OptimizationLevel)>, 2>
759 CGSCCOptimizerLateEPCallbacks;
760 SmallVector<std::function<void(FunctionPassManager &, OptimizationLevel)>, 2>
761 VectorizerStartEPCallbacks;
762 // Module callbacks
763 SmallVector<std::function<void(ModulePassManager &, OptimizationLevel,
765 2>
766 OptimizerEarlyEPCallbacks;
767 SmallVector<std::function<void(ModulePassManager &, OptimizationLevel,
769 2>
770 OptimizerLastEPCallbacks;
771 SmallVector<std::function<void(ModulePassManager &, OptimizationLevel)>, 2>
772 FullLinkTimeOptimizationEarlyEPCallbacks;
773 SmallVector<std::function<void(ModulePassManager &, OptimizationLevel)>, 2>
774 FullLinkTimeOptimizationLastEPCallbacks;
775 SmallVector<std::function<void(ModulePassManager &, OptimizationLevel)>, 2>
776 PipelineStartEPCallbacks;
777 SmallVector<std::function<void(ModulePassManager &, OptimizationLevel,
779 2>
780 PipelineEarlySimplificationEPCallbacks;
781
782 SmallVector<std::function<void(ModuleAnalysisManager &)>, 2>
783 ModuleAnalysisRegistrationCallbacks;
784 SmallVector<std::function<bool(StringRef, ModulePassManager &,
785 ArrayRef<PipelineElement>)>,
786 2>
787 ModulePipelineParsingCallbacks;
789 std::function<bool(ModulePassManager &, ArrayRef<PipelineElement>)>, 2>
790 TopLevelPipelineParsingCallbacks;
791 // CGSCC callbacks
792 SmallVector<std::function<void(CGSCCAnalysisManager &)>, 2>
793 CGSCCAnalysisRegistrationCallbacks;
794 SmallVector<std::function<bool(StringRef, CGSCCPassManager &,
795 ArrayRef<PipelineElement>)>,
796 2>
797 CGSCCPipelineParsingCallbacks;
798 // Function callbacks
799 SmallVector<std::function<void(FunctionAnalysisManager &)>, 2>
800 FunctionAnalysisRegistrationCallbacks;
801 SmallVector<std::function<bool(StringRef, FunctionPassManager &,
802 ArrayRef<PipelineElement>)>,
803 2>
804 FunctionPipelineParsingCallbacks;
805 // Loop callbacks
806 SmallVector<std::function<void(LoopAnalysisManager &)>, 2>
807 LoopAnalysisRegistrationCallbacks;
808 SmallVector<std::function<bool(StringRef, LoopPassManager &,
809 ArrayRef<PipelineElement>)>,
810 2>
811 LoopPipelineParsingCallbacks;
812 // AA callbacks
813 SmallVector<std::function<bool(StringRef Name, AAManager &AA)>, 2>
814 AAParsingCallbacks;
815 // Machine pass callbackcs
816 SmallVector<std::function<void(MachineFunctionAnalysisManager &)>, 2>
817 MachineFunctionAnalysisRegistrationCallbacks;
818 SmallVector<std::function<bool(StringRef, MachineFunctionPassManager &,
819 ArrayRef<PipelineElement>)>,
820 2>
821 MachineFunctionPipelineParsingCallbacks;
822 // Callbacks to parse `filter` parameter in register allocation passes
823 SmallVector<std::function<RegAllocFilterFunc(StringRef)>, 2>
824 RegClassFilterParsingCallbacks;
825};
826
827/// This utility template takes care of adding require<> and invalidate<>
828/// passes for an analysis to a given \c PassManager. It is intended to be used
829/// during parsing of a pass pipeline when parsing a single PipelineName.
830/// When registering a new function analysis FancyAnalysis with the pass
831/// pipeline name "fancy-analysis", a matching ParsePipelineCallback could look
832/// like this:
833///
834/// static bool parseFunctionPipeline(StringRef Name, FunctionPassManager &FPM,
835/// ArrayRef<PipelineElement> P) {
836/// if (parseAnalysisUtilityPasses<FancyAnalysis>("fancy-analysis", Name,
837/// FPM))
838/// return true;
839/// return false;
840/// }
841template <typename AnalysisT, typename IRUnitT, typename AnalysisManagerT,
842 typename... ExtraArgTs>
844 StringRef AnalysisName, StringRef PipelineName,
846 if (!PipelineName.ends_with(">"))
847 return false;
848 // See if this is an invalidate<> pass name
849 if (PipelineName.starts_with("invalidate<")) {
850 PipelineName = PipelineName.substr(11, PipelineName.size() - 12);
851 if (PipelineName != AnalysisName)
852 return false;
854 return true;
855 }
856
857 // See if this is a require<> pass name
858 if (PipelineName.starts_with("require<")) {
859 PipelineName = PipelineName.substr(8, PipelineName.size() - 9);
860 if (PipelineName != AnalysisName)
861 return false;
862 PM.addPass(RequireAnalysisPass<AnalysisT, IRUnitT, AnalysisManagerT,
863 ExtraArgTs...>());
864 return true;
865 }
866
867 return false;
868}
869
870// These are special since they are only for testing purposes.
871
872/// No-op module pass which does nothing.
873struct NoOpModulePass : PassInfoMixin<NoOpModulePass> {
875 return PreservedAnalyses::all();
876 }
877};
878
879/// No-op module analysis.
880class NoOpModuleAnalysis : public AnalysisInfoMixin<NoOpModuleAnalysis> {
882 static AnalysisKey Key;
883
884public:
885 struct Result {};
887};
888
889/// No-op CGSCC pass which does nothing.
890struct NoOpCGSCCPass : PassInfoMixin<NoOpCGSCCPass> {
893 return PreservedAnalyses::all();
894 }
895};
896
897/// No-op CGSCC analysis.
898class NoOpCGSCCAnalysis : public AnalysisInfoMixin<NoOpCGSCCAnalysis> {
900 static AnalysisKey Key;
901
902public:
903 struct Result {};
905 return Result();
906 }
907};
908
909/// No-op function pass which does nothing.
910struct NoOpFunctionPass : PassInfoMixin<NoOpFunctionPass> {
912 return PreservedAnalyses::all();
913 }
914};
915
916/// No-op function analysis.
917class NoOpFunctionAnalysis : public AnalysisInfoMixin<NoOpFunctionAnalysis> {
919 static AnalysisKey Key;
920
921public:
922 struct Result {};
924};
925
926/// No-op loop nest pass which does nothing.
927struct NoOpLoopNestPass : PassInfoMixin<NoOpLoopNestPass> {
930 return PreservedAnalyses::all();
931 }
932};
933
934/// No-op loop pass which does nothing.
935struct NoOpLoopPass : PassInfoMixin<NoOpLoopPass> {
938 return PreservedAnalyses::all();
939 }
940};
941
942/// No-op machine function pass which does nothing.
943struct NoOpMachineFunctionPass : public PassInfoMixin<NoOpMachineFunctionPass> {
945 return PreservedAnalyses::all();
946 }
947};
948
949/// No-op loop analysis.
950class NoOpLoopAnalysis : public AnalysisInfoMixin<NoOpLoopAnalysis> {
952 static AnalysisKey Key;
953
954public:
955 struct Result {};
957 return Result();
958 }
959};
960
961/// Common option used by multiple tools to print pipeline passes
962extern cl::opt<bool> PrintPipelinePasses;
963
964}
965
966#endif
aarch64 falkor hwpf fix Falkor HW Prefetch Fix Late Phase
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This header provides classes for managing passes over SCCs of the call graph.
std::string Name
This header defines various interfaces for pass management in LLVM.
This header provides classes for managing a pipeline of passes over loops in LLVM IR.
#define F(x, y, z)
Definition: MD5.cpp:55
#define G(x, y, z)
Definition: MD5.cpp:56
This header enumerates the LLVM-provided high-level optimization levels.
Define option tunables for PGO.
CGSCCAnalysisManager CGAM
LoopAnalysisManager LAM
FunctionAnalysisManager FAM
ModuleAnalysisManager MAM
PassInstrumentationCallbacks PIC
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
raw_pwrite_stream & OS
static const char PassName[]
A manager for alias analyses.
A container for analyses that lazily runs them and caches their results.
Definition: PassManager.h:253
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
Lightweight error class with error context and mandatory checking.
Definition: Error.h:160
A smart pointer to a reference-counted object that inherits from RefCountedBase or ThreadSafeRefCount...
This class provides an interface for updating the loop pass manager based on mutations to the loop ne...
An SCC of the call graph.
A lazily constructed view of the call graph of a module.
This class represents a loop nest and can be used to query its properties.
Represents a single loop in the control flow graph.
Definition: LoopInfo.h:39
Module pass, wrapping the inliner pass.
Definition: Inliner.h:62
Class to hold module path string table and global value map, and encapsulate methods for operating on...
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
No-op CGSCC analysis.
Definition: PassBuilder.h:898
Result run(LazyCallGraph::SCC &, CGSCCAnalysisManager &, LazyCallGraph &G)
Definition: PassBuilder.h:904
No-op function analysis.
Definition: PassBuilder.h:917
Result run(Function &, FunctionAnalysisManager &)
Definition: PassBuilder.h:923
No-op loop analysis.
Definition: PassBuilder.h:950
Result run(Loop &, LoopAnalysisManager &, LoopStandardAnalysisResults &)
Definition: PassBuilder.h:956
No-op module analysis.
Definition: PassBuilder.h:880
Result run(Module &, ModuleAnalysisManager &)
Definition: PassBuilder.h:886
This class provides access to building LLVM's passes.
Definition: PassBuilder.h:105
void invokeFullLinkTimeOptimizationLastEPCallbacks(ModulePassManager &MPM, OptimizationLevel Level)
ModuleInlinerWrapperPass buildInlinerPipeline(OptimizationLevel Level, ThinOrFullLTOPhase Phase)
Construct the module pipeline that performs inlining as well as the inlining-driven cleanups.
void registerAnalysisRegistrationCallback(const std::function< void(MachineFunctionAnalysisManager &)> &C)
Definition: PassBuilder.h:552
void printPassNames(raw_ostream &OS)
Print pass names.
static bool checkParametrizedPassName(StringRef Name, StringRef PassName)
Definition: PassBuilder.h:650
void invokeOptimizerEarlyEPCallbacks(ModulePassManager &MPM, OptimizationLevel Level, ThinOrFullLTOPhase Phase)
void invokeVectorizerStartEPCallbacks(FunctionPassManager &FPM, OptimizationLevel Level)
void registerPipelineParsingCallback(const std::function< bool(StringRef Name, ModulePassManager &, ArrayRef< PipelineElement >)> &C)
Definition: PassBuilder.h:577
AAManager buildDefaultAAPipeline()
Build the default AAManager with the default alias analysis pipeline registered.
Error parseAAPipeline(AAManager &AA, StringRef PipelineText)
Parse a textual alias analysis pipeline into the provided AA manager.
void invokeCGSCCOptimizerLateEPCallbacks(CGSCCPassManager &CGPM, OptimizationLevel Level)
void registerPipelineEarlySimplificationEPCallback(const std::function< void(ModulePassManager &, OptimizationLevel, ThinOrFullLTOPhase)> &C)
Register a callback for a default optimizer pipeline extension point.
Definition: PassBuilder.h:482
ModulePassManager buildThinLTOPreLinkDefaultPipeline(OptimizationLevel Level)
Build a pre-link, ThinLTO-targeting default optimization pipeline to a pass manager.
void registerAnalysisRegistrationCallback(const std::function< void(ModuleAnalysisManager &)> &C)
Definition: PassBuilder.h:548
void registerPipelineStartEPCallback(const std::function< void(ModulePassManager &, OptimizationLevel)> &C)
Register a callback for a default optimizer pipeline extension point.
Definition: PassBuilder.h:473
void invokeScalarOptimizerLateEPCallbacks(FunctionPassManager &FPM, OptimizationLevel Level)
void registerPipelineParsingCallback(const std::function< bool(StringRef Name, LoopPassManager &, ArrayRef< PipelineElement >)> &C)
Definition: PassBuilder.h:572
void registerLoopAnalyses(LoopAnalysisManager &LAM)
Registers all available loop analysis passes.
std::optional< RegAllocFilterFunc > parseRegAllocFilter(StringRef RegAllocFilterName)
Parse RegAllocFilterName to get RegAllocFilterFunc.
PassInstrumentationCallbacks * getPassInstrumentationCallbacks() const
Returns PIC.
Definition: PassBuilder.h:615
void registerLateLoopOptimizationsEPCallback(const std::function< void(LoopPassManager &, OptimizationLevel)> &C)
Register a callback for a default optimizer pipeline extension point.
Definition: PassBuilder.h:421
void crossRegisterProxies(LoopAnalysisManager &LAM, FunctionAnalysisManager &FAM, CGSCCAnalysisManager &CGAM, ModuleAnalysisManager &MAM, MachineFunctionAnalysisManager *MFAM=nullptr)
Cross register the analysis managers through their proxies.
void registerLoopOptimizerEndEPCallback(const std::function< void(LoopPassManager &, OptimizationLevel)> &C)
Register a callback for a default optimizer pipeline extension point.
Definition: PassBuilder.h:431
void registerOptimizerLastEPCallback(const std::function< void(ModulePassManager &, OptimizationLevel, ThinOrFullLTOPhase)> &C)
Register a callback for a default optimizer pipeline extension point.
Definition: PassBuilder.h:502
void registerParseAACallback(const std::function< bool(StringRef Name, AAManager &AA)> &C)
Register a callback for parsing an AliasAnalysis Name to populate the given AAManager AA.
Definition: PassBuilder.h:528
void registerVectorizerStartEPCallback(const std::function< void(FunctionPassManager &, OptimizationLevel)> &C)
Register a callback for a default optimizer pipeline extension point.
Definition: PassBuilder.h:463
void registerAnalysisRegistrationCallback(const std::function< void(LoopAnalysisManager &)> &C)
Definition: PassBuilder.h:544
ModulePassManager buildPerModuleDefaultPipeline(OptimizationLevel Level, ThinOrFullLTOPhase Phase=ThinOrFullLTOPhase::None)
Build a per-module default optimization pipeline.
void registerPeepholeEPCallback(const std::function< void(FunctionPassManager &, OptimizationLevel)> &C)
Register a callback for a default optimizer pipeline extension point.
Definition: PassBuilder.h:407
void registerAnalysisRegistrationCallback(const std::function< void(FunctionAnalysisManager &)> &C)
Definition: PassBuilder.h:540
void registerScalarOptimizerLateEPCallback(const std::function< void(FunctionPassManager &, OptimizationLevel)> &C)
Register a callback for a default optimizer pipeline extension point.
Definition: PassBuilder.h:441
void registerAnalysisRegistrationCallback(const std::function< void(CGSCCAnalysisManager &)> &C)
{{@ Register callbacks for analysis registration with this PassBuilder instance.
Definition: PassBuilder.h:536
void invokePipelineStartEPCallbacks(ModulePassManager &MPM, OptimizationLevel Level)
ModulePassManager buildO0DefaultPipeline(OptimizationLevel Level, ThinOrFullLTOPhase Phase=ThinOrFullLTOPhase::None)
Build an O0 pipeline with the minimal semantically required passes.
FunctionPassManager buildFunctionSimplificationPipeline(OptimizationLevel Level, ThinOrFullLTOPhase Phase)
Construct the core LLVM function canonicalization and simplification pipeline.
void registerCGSCCOptimizerLateEPCallback(const std::function< void(CGSCCPassManager &, OptimizationLevel)> &C)
Register a callback for a default optimizer pipeline extension point.
Definition: PassBuilder.h:452
void invokePeepholeEPCallbacks(FunctionPassManager &FPM, OptimizationLevel Level)
void invokePipelineEarlySimplificationEPCallbacks(ModulePassManager &MPM, OptimizationLevel Level, ThinOrFullLTOPhase Phase)
Error parsePassPipeline(ModulePassManager &MPM, StringRef PipelineText)
Parse a textual pass pipeline description into a ModulePassManager.
void invokeLoopOptimizerEndEPCallbacks(LoopPassManager &LPM, OptimizationLevel Level)
void registerRegClassFilterParsingCallback(const std::function< RegAllocFilterFunc(StringRef)> &C)
Register callbacks to parse target specific filter field if regalloc pass needs it.
Definition: PassBuilder.h:592
ModulePassManager buildLTODefaultPipeline(OptimizationLevel Level, ModuleSummaryIndex *ExportSummary)
Build an LTO default optimization pipeline to a pass manager.
ModulePassManager buildModuleInlinerPipeline(OptimizationLevel Level, ThinOrFullLTOPhase Phase)
Construct the module pipeline that performs inlining with module inliner pass.
ModulePassManager buildThinLTODefaultPipeline(OptimizationLevel Level, const ModuleSummaryIndex *ImportSummary)
Build a ThinLTO default optimization pipeline to a pass manager.
void registerPipelineParsingCallback(const std::function< bool(StringRef Name, CGSCCPassManager &, ArrayRef< PipelineElement >)> &C)
{{@ Register pipeline parsing callbacks with this pass builder instance.
Definition: PassBuilder.h:562
void registerFullLinkTimeOptimizationEarlyEPCallback(const std::function< void(ModulePassManager &, OptimizationLevel)> &C)
Register a callback for a default optimizer pipeline extension point.
Definition: PassBuilder.h:512
void invokeLateLoopOptimizationsEPCallbacks(LoopPassManager &LPM, OptimizationLevel Level)
void registerPipelineParsingCallback(const std::function< bool(StringRef Name, FunctionPassManager &, ArrayRef< PipelineElement >)> &C)
Definition: PassBuilder.h:567
void registerModuleAnalyses(ModuleAnalysisManager &MAM)
Registers all available module analysis passes.
void registerFullLinkTimeOptimizationLastEPCallback(const std::function< void(ModulePassManager &, OptimizationLevel)> &C)
Register a callback for a default optimizer pipeline extension point.
Definition: PassBuilder.h:521
void registerCGSCCAnalyses(CGSCCAnalysisManager &CGAM)
Registers all available CGSCC analysis passes.
void invokeFullLinkTimeOptimizationEarlyEPCallbacks(ModulePassManager &MPM, OptimizationLevel Level)
ModulePassManager buildFatLTODefaultPipeline(OptimizationLevel Level, bool ThinLTO, bool EmitSummary)
Build a fat object default optimization pipeline.
static auto parsePassParameters(ParametersParseCallableT &&Parser, StringRef Name, StringRef PassName) -> decltype(Parser(StringRef{}))
This performs customized parsing of pass name with parameters.
Definition: PassBuilder.h:675
ModulePassManager buildModuleSimplificationPipeline(OptimizationLevel Level, ThinOrFullLTOPhase Phase)
Construct the core LLVM module canonicalization and simplification pipeline.
void registerPipelineParsingCallback(const std::function< bool(StringRef Name, MachineFunctionPassManager &, ArrayRef< PipelineElement >)> &C)
Definition: PassBuilder.h:582
static Expected< bool > parseSinglePassOption(StringRef Params, StringRef OptionName, StringRef PassName)
Handle passes only accept one bool-valued parameter.
void registerOptimizerEarlyEPCallback(const std::function< void(ModulePassManager &, OptimizationLevel, ThinOrFullLTOPhase Phase)> &C)
Register a callback for a default optimizer pipeline extension point.
Definition: PassBuilder.h:492
void registerMachineFunctionAnalyses(MachineFunctionAnalysisManager &MFAM)
Registers all available machine function analysis passes.
ModulePassManager buildModuleOptimizationPipeline(OptimizationLevel Level, ThinOrFullLTOPhase LTOPhase)
Construct the core LLVM module optimization pipeline.
void registerParseTopLevelPipelineCallback(const std::function< bool(ModulePassManager &, ArrayRef< PipelineElement >)> &C)
Register a callback for a top-level pipeline entry.
void addPGOInstrPassesForO0(ModulePassManager &MPM, bool RunProfileGen, bool IsCS, bool AtomicCounterUpdate, std::string ProfileFile, std::string ProfileRemappingFile, IntrusiveRefCntPtr< vfs::FileSystem > FS)
Add PGOInstrumenation passes for O0 only.
void invokeOptimizerLastEPCallbacks(ModulePassManager &MPM, OptimizationLevel Level, ThinOrFullLTOPhase Phase)
ModulePassManager buildLTOPreLinkDefaultPipeline(OptimizationLevel Level)
Build a pre-link, LTO-targeting default optimization pipeline to a pass manager.
void registerFunctionAnalyses(FunctionAnalysisManager &FAM)
Registers all available function analysis passes.
LLVM_ATTRIBUTE_MINSIZE std::enable_if_t<!std::is_same_v< PassT, PassManager > > addPass(PassT &&Pass)
Definition: PassManager.h:195
Tunable parameters for passes in the default pipelines.
Definition: PassBuilder.h:43
unsigned LicmMssaNoAccForPromotionCap
Tuning option to disable promotion to scalars in LICM with MemorySSA, if the number of access is too ...
Definition: PassBuilder.h:73
bool SLPVectorization
Tuning option to enable/disable slp loop vectorization, set based on opt level.
Definition: PassBuilder.h:58
int InlinerThreshold
Tuning option to override the default inliner threshold.
Definition: PassBuilder.h:87
bool CallGraphProfile
Tuning option to enable/disable call graph profile.
Definition: PassBuilder.h:77
bool MergeFunctions
Tuning option to enable/disable function merging.
Definition: PassBuilder.h:84
bool ForgetAllSCEVInLoopUnroll
Tuning option to forget all SCEV loops in LoopUnroll.
Definition: PassBuilder.h:65
unsigned LicmMssaOptCap
Tuning option to cap the number of calls to retrive clobbering accesses in MemorySSA,...
Definition: PassBuilder.h:69
bool LoopInterleaving
Tuning option to set loop interleaving on/off, set based on opt level.
Definition: PassBuilder.h:50
PipelineTuningOptions()
Constructor sets pipeline tuning defaults based on cl::opts.
bool LoopUnrolling
Tuning option to enable/disable loop unrolling. Its default value is true.
Definition: PassBuilder.h:61
bool LoopVectorization
Tuning option to enable/disable loop vectorization, set based on opt level.
Definition: PassBuilder.h:54
A set of analyses that are preserved following a run of a transformation pass.
Definition: Analysis.h:111
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Definition: Analysis.h:117
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:51
constexpr StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
Definition: StringRef.h:571
bool starts_with(StringRef Prefix) const
Check if this string starts with the given Prefix.
Definition: StringRef.h:265
constexpr size_t size() const
size - Get the string size.
Definition: StringRef.h:150
bool ends_with(StringRef Suffix) const
Check if this string ends with the given Suffix.
Definition: StringRef.h:277
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:77
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ C
The default llvm calling convention, compatible with C.
Definition: CallingConv.h:34
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
PassManager< Module > ModulePassManager
Convenience typedef for a pass manager over modules.
Definition: PassManager.h:237
std::function< bool(const TargetRegisterInfo &TRI, const MachineRegisterInfo &MRI, const Register Reg)> RegAllocFilterFunc
Filter function for register classes during regalloc.
PassManager< Function > FunctionPassManager
Convenience typedef for a pass manager over functions.
Definition: PassManager.h:246
bool parseAnalysisUtilityPasses(StringRef AnalysisName, StringRef PipelineName, PassManager< IRUnitT, AnalysisManagerT, ExtraArgTs... > &PM)
This utility template takes care of adding require<> and invalidate<> passes for an analysis to a giv...
Definition: PassBuilder.h:843
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
PassManager< MachineFunction > MachineFunctionPassManager
Convenience typedef for a pass manager over functions.
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
Definition: PassManager.h:546
AnalysisManager< Loop, LoopStandardAnalysisResults & > LoopAnalysisManager
The loop analysis manager.
ThinOrFullLTOPhase
This enumerates the LLVM full LTO or ThinLTO optimization phases.
Definition: Pass.h:76
@ None
No LTO/ThinLTO behavior needed.
PassManager< Loop, LoopAnalysisManager, LoopStandardAnalysisResults &, LPMUpdater & > LoopPassManager
The Loop pass manager.
PassManager< LazyCallGraph::SCC, CGSCCAnalysisManager, LazyCallGraph &, CGSCCUpdateResult & > CGSCCPassManager
The CGSCC pass manager.
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
Definition: SmallVector.h:1122
cl::opt< bool > PrintPipelinePasses
Common option used by multiple tools to print pipeline passes.
AnalysisManager< LazyCallGraph::SCC, LazyCallGraph & > CGSCCAnalysisManager
The CGSCC analysis manager.
AnalysisManager< Module > ModuleAnalysisManager
Convenience typedef for the Module analysis manager.
Definition: MIRParser.h:38
A CRTP mix-in that provides informational APIs needed for analysis passes.
Definition: PassManager.h:92
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition: Analysis.h:28
Support structure for SCC passes to communicate updates the call graph back to the CGSCC pass manager...
A no-op pass template which simply forces a specific analysis result to be invalidated.
Definition: PassManager.h:905
The adaptor from a function pass to a loop pass computes these analyses and makes them available to t...
No-op CGSCC pass which does nothing.
Definition: PassBuilder.h:890
PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager &, LazyCallGraph &, CGSCCUpdateResult &UR)
Definition: PassBuilder.h:891
No-op function pass which does nothing.
Definition: PassBuilder.h:910
PreservedAnalyses run(Function &F, FunctionAnalysisManager &)
Definition: PassBuilder.h:911
No-op loop nest pass which does nothing.
Definition: PassBuilder.h:927
PreservedAnalyses run(LoopNest &L, LoopAnalysisManager &, LoopStandardAnalysisResults &, LPMUpdater &)
Definition: PassBuilder.h:928
No-op loop pass which does nothing.
Definition: PassBuilder.h:935
PreservedAnalyses run(Loop &L, LoopAnalysisManager &, LoopStandardAnalysisResults &, LPMUpdater &)
Definition: PassBuilder.h:936
No-op machine function pass which does nothing.
Definition: PassBuilder.h:943
PreservedAnalyses run(MachineFunction &, MachineFunctionAnalysisManager &)
Definition: PassBuilder.h:944
No-op module pass which does nothing.
Definition: PassBuilder.h:873
PreservedAnalyses run(Module &M, ModuleAnalysisManager &)
Definition: PassBuilder.h:874
A struct to capture parsed pass pipeline names.
Definition: PassBuilder.h:120
std::vector< PipelineElement > InnerPipeline
Definition: PassBuilder.h:122
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:69
This class manages callbacks registration, as well as provides a way for PassInstrumentation to pass ...
A utility pass template to force an analysis result to be available.
Definition: PassManager.h:878