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