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