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"
31#include <optional>
32#include <vector>
33
34namespace llvm {
35class StringRef;
36class AAManager;
37class TargetMachine;
39
40/// Tunable parameters for passes in the default pipelines.
42public:
43 /// Constructor sets pipeline tuning defaults based on cl::opts. Each option
44 /// can be set in the PassBuilder when using a LLVM as a library.
46
47 /// Tuning option to set loop interleaving on/off, set based on opt level.
49
50 /// Tuning option to enable/disable loop vectorization, set based on opt
51 /// level.
53
54 /// Tuning option to enable/disable slp loop vectorization, set based on opt
55 /// level.
57
58 /// Tuning option to enable/disable loop unrolling. Its default value is true.
60
61 /// Tuning option to enable/disable loop interchange. Its default value is
62 /// false.
64
65 /// Tuning option to enable/disable loop fusion. Its default value is false.
67
68 /// Tuning option to forget all SCEV loops in LoopUnroll. Its default value
69 /// is that of the flag: `-forget-scev-loop-unroll`.
71
72 /// Tuning option to cap the number of calls to retrive clobbering accesses in
73 /// MemorySSA, in LICM.
75
76 /// Tuning option to disable promotion to scalars in LICM with MemorySSA, if
77 /// the number of access is too large.
79
80 /// Tuning option to enable/disable call graph profile. Its default value is
81 /// that of the flag: `-enable-npm-call-graph-profile`.
83
84 // Add LTO pipeline tuning option to enable the unified LTO pipeline.
86
87 /// Tuning option to enable/disable function merging. Its default value is
88 /// false.
90
91 /// Tuning option to override the default inliner threshold.
93
94 // Experimental option to eagerly invalidate more analyses. This has the
95 // potential to decrease max memory usage in exchange for more compile time.
96 // This may affect codegen due to either passes using analyses only when
97 // cached, or invalidating and recalculating an analysis that was
98 // stale/imprecise but still valid. Currently this invalidates all function
99 // analyses after various module->function or cgscc->function adaptors in the
100 // default pipelines.
102};
103
104/// This class provides access to building LLVM's passes.
105///
106/// Its members provide the baseline state available to passes during their
107/// construction. The \c PassRegistry.def file specifies how to construct all
108/// of the built-in passes, and those may reference these members during
109/// construction.
111 TargetMachine *TM;
113 std::optional<PGOOptions> PGOOpt;
116
117public:
118 /// A struct to capture parsed pass pipeline names.
119 ///
120 /// A pipeline is defined as a series of names, each of which may in itself
121 /// recursively contain a nested pipeline. A name is either the name of a pass
122 /// (e.g. "instcombine") or the name of a pipeline type (e.g. "cgscc"). If the
123 /// name is the name of a pass, the InnerPipeline is empty, since passes
124 /// cannot contain inner pipelines. See parsePassPipeline() for a more
125 /// detailed description of the textual pipeline format.
128 std::vector<PipelineElement> InnerPipeline;
129 };
130
131 LLVM_ABI explicit PassBuilder(
132 TargetMachine *TM = nullptr,
134 std::optional<PGOOptions> PGOOpt = std::nullopt,
135 PassInstrumentationCallbacks *PIC = nullptr,
137
138 /// Cross register the analysis managers through their proxies.
139 ///
140 /// This is an interface that can be used to cross register each
141 /// AnalysisManager with all the others analysis managers.
142 LLVM_ABI void
145 MachineFunctionAnalysisManager *MFAM = nullptr);
146
147 /// Registers all available module analysis passes.
148 ///
149 /// This is an interface that can be used to populate a \c
150 /// ModuleAnalysisManager with all registered module analyses. Callers can
151 /// still manually register any additional analyses. Callers can also
152 /// pre-register analyses and this will not override those.
154
155 /// Registers all available CGSCC analysis passes.
156 ///
157 /// This is an interface that can be used to populate a \c CGSCCAnalysisManager
158 /// with all registered CGSCC analyses. Callers can still manually register any
159 /// additional analyses. Callers can also pre-register analyses and this will
160 /// not override those.
162
163 /// Registers all available function analysis passes.
164 ///
165 /// This is an interface that can be used to populate a \c
166 /// FunctionAnalysisManager with all registered function analyses. Callers can
167 /// still manually register any additional analyses. Callers can also
168 /// pre-register analyses and this will not override those.
170
171 /// Registers all available loop analysis passes.
172 ///
173 /// This is an interface that can be used to populate a \c LoopAnalysisManager
174 /// with all registered loop analyses. Callers can still manually register any
175 /// additional analyses.
177
178 /// Registers all available machine function analysis passes.
179 ///
180 /// This is an interface that can be used to populate a \c
181 /// MachineFunctionAnalysisManager with all registered function analyses.
182 /// Callers can still manually register any additional analyses. Callers can
183 /// also pre-register analyses and this will not override those.
184 LLVM_ABI void
186
187 /// Construct the core LLVM function canonicalization and simplification
188 /// pipeline.
189 ///
190 /// This is a long pipeline and uses most of the per-function optimization
191 /// passes in LLVM to canonicalize and simplify the IR. It is suitable to run
192 /// repeatedly over the IR and is not expected to destroy important
193 /// information about the semantics of the IR.
194 ///
195 /// Note that \p Level cannot be `O0` here. The pipelines produced are
196 /// only intended for use when attempting to optimize code. If frontends
197 /// require some transformations for semantic reasons, they should explicitly
198 /// build them.
199 ///
200 /// \p Phase indicates the current ThinLTO phase.
203
204 /// Construct the core LLVM module canonicalization and simplification
205 /// pipeline.
206 ///
207 /// This pipeline focuses on canonicalizing and simplifying the entire module
208 /// of IR. Much like the function simplification pipeline above, it is
209 /// suitable to run repeatedly over the IR and is not expected to destroy
210 /// important information. It does, however, perform inlining and other
211 /// heuristic based simplifications that are not strictly reversible.
212 ///
213 /// Note that \p Level cannot be `O0` here. The pipelines produced are
214 /// only intended for use when attempting to optimize code. If frontends
215 /// require some transformations for semantic reasons, they should explicitly
216 /// build them.
217 ///
218 /// \p Phase indicates the current ThinLTO phase.
221
222 /// Construct the module pipeline that performs inlining as well as
223 /// the inlining-driven cleanups.
226
227 /// Construct the module pipeline that performs inlining with
228 /// module inliner pass.
231
232 /// Construct the core LLVM module optimization pipeline.
233 ///
234 /// This pipeline focuses on optimizing the execution speed of the IR. It
235 /// uses cost modeling and thresholds to balance code growth against runtime
236 /// improvements. It includes vectorization and other information destroying
237 /// transformations. It also cannot generally be run repeatedly on a module
238 /// without potentially seriously regressing either runtime performance of
239 /// the code or serious code size growth.
240 ///
241 /// Note that \p Level cannot be `O0` here. The pipelines produced are
242 /// only intended for use when attempting to optimize code. If frontends
243 /// require some transformations for semantic reasons, they should explicitly
244 /// build them.
246 OptimizationLevel Level, ThinOrFullLTOPhase LTOPhase);
247
248 /// Build a per-module default optimization pipeline.
249 ///
250 /// This provides a good default optimization pipeline for per-module
251 /// optimization and code generation without any link-time optimization. It
252 /// typically correspond to frontend "-O[123]" options for optimization
253 /// levels \c O1, \c O2 and \c O3 resp.
255 OptimizationLevel Level,
257
258 /// Build a fat object default optimization pipeline.
259 ///
260 /// This builds a pipeline that runs the LTO/ThinLTO pre-link pipeline, and
261 /// emits a section containing the pre-link bitcode along side the object code
262 /// generated in non-LTO compilation.
264 bool ThinLTO,
265 bool EmitSummary);
266
267 /// Build a pre-link, ThinLTO-targeting default optimization pipeline to
268 /// a pass manager.
269 ///
270 /// This adds the pre-link optimizations tuned to prepare a module for
271 /// a ThinLTO run. It works to minimize the IR which needs to be analyzed
272 /// without making irreversible decisions which could be made better during
273 /// the LTO run.
276
277 /// Build a ThinLTO default optimization pipeline to a pass manager.
278 ///
279 /// This provides a good default optimization pipeline for link-time
280 /// optimization and code generation. It is particularly tuned to fit well
281 /// when IR coming into the LTO phase was first run through \c
282 /// buildThinLTOPreLinkDefaultPipeline, and the two coordinate closely.
284 OptimizationLevel Level, const ModuleSummaryIndex *ImportSummary);
285
286 /// Build a pre-link, LTO-targeting default optimization pipeline to a pass
287 /// manager.
288 ///
289 /// This adds the pre-link optimizations tuned to work well with a later LTO
290 /// run. It works to minimize the IR which needs to be analyzed without
291 /// making irreversible decisions which could be made better during the LTO
292 /// run.
295
296 /// Build an LTO default optimization pipeline to a pass manager.
297 ///
298 /// This provides a good default optimization pipeline for link-time
299 /// optimization and code generation. It is particularly tuned to fit well
300 /// when IR coming into the LTO phase was first run through \c
301 /// buildLTOPreLinkDefaultPipeline, and the two coordinate closely.
303 OptimizationLevel Level, ModuleSummaryIndex *ExportSummary);
304
305 /// Build an O0 pipeline with the minimal semantically required passes.
306 ///
307 /// This should only be used for non-LTO and LTO pre-link pipelines.
311
312 /// Build the default `AAManager` with the default alias analysis pipeline
313 /// registered.
314 ///
315 /// This also adds target-specific alias analyses registered via
316 /// TargetMachine::registerDefaultAliasAnalyses().
318
319 /// Parse a textual pass pipeline description into a \c
320 /// ModulePassManager.
321 ///
322 /// The format of the textual pass pipeline description looks something like:
323 ///
324 /// module(function(instcombine,sroa),dce,cgscc(inliner,function(...)),...)
325 ///
326 /// Pass managers have ()s describing the nest structure of passes. All passes
327 /// are comma separated. As a special shortcut, if the very first pass is not
328 /// a module pass (as a module pass manager is), this will automatically form
329 /// the shortest stack of pass managers that allow inserting that first pass.
330 /// So, assuming function passes 'fpassN', CGSCC passes 'cgpassN', and loop
331 /// passes 'lpassN', all of these are valid:
332 ///
333 /// fpass1,fpass2,fpass3
334 /// cgpass1,cgpass2,cgpass3
335 /// lpass1,lpass2,lpass3
336 ///
337 /// And they are equivalent to the following (resp.):
338 ///
339 /// module(function(fpass1,fpass2,fpass3))
340 /// module(cgscc(cgpass1,cgpass2,cgpass3))
341 /// module(function(loop(lpass1,lpass2,lpass3)))
342 ///
343 /// This shortcut is especially useful for debugging and testing small pass
344 /// combinations.
345 ///
346 /// The sequence of passes aren't necessarily the exact same kind of pass.
347 /// You can mix different levels implicitly if adaptor passes are defined to
348 /// make them work. For example,
349 ///
350 /// mpass1,fpass1,fpass2,mpass2,lpass1
351 ///
352 /// This pipeline uses only one pass manager: the top-level module manager.
353 /// fpass1,fpass2 and lpass1 are added into the top-level module manager
354 /// using only adaptor passes. No nested function/loop pass managers are
355 /// added. The purpose is to allow easy pass testing when the user
356 /// specifically want the pass to run under a adaptor directly. This is
357 /// preferred when a pipeline is largely of one type, but one or just a few
358 /// passes are of different types(See PassBuilder.cpp for examples).
360 StringRef PipelineText);
361
362 /// {{@ Parse a textual pass pipeline description into a specific PassManager
363 ///
364 /// Automatic deduction of an appropriate pass manager stack is not supported.
365 /// For example, to insert a loop pass 'lpass' into a FunctionPassManager,
366 /// this is the valid pipeline text:
367 ///
368 /// function(lpass)
370 StringRef PipelineText);
372 StringRef PipelineText);
374 StringRef PipelineText);
375 /// @}}
376
377 /// Parse a textual MIR pipeline into the provided \c MachineFunctionPass
378 /// manager.
379 /// The format of the textual machine pipeline is a comma separated list of
380 /// machine pass names:
381 ///
382 /// machine-funciton-pass,machine-module-pass,...
383 ///
384 /// There is no need to specify the pass nesting, and this function
385 /// currently cannot handle the pass nesting.
387 StringRef PipelineText);
388
389 /// Parse a textual alias analysis pipeline into the provided AA manager.
390 ///
391 /// The format of the textual AA pipeline is a comma separated list of AA
392 /// pass names:
393 ///
394 /// basic-aa,globals-aa,...
395 ///
396 /// The AA manager is set up such that the provided alias analyses are tried
397 /// in the order specified. See the \c AAManaager documentation for details
398 /// about the logic used. This routine just provides the textual mapping
399 /// between AA names and the analyses to register with the manager.
400 ///
401 /// Returns false if the text cannot be parsed cleanly. The specific state of
402 /// the \p AA manager is unspecified if such an error is encountered and this
403 /// returns false.
405
406 /// Parse RegAllocFilterName to get RegAllocFilterFunc.
407 LLVM_ABI std::optional<RegAllocFilterFunc>
408 parseRegAllocFilter(StringRef RegAllocFilterName);
409
410 /// Print pass names.
412
413 /// Register a callback for a default optimizer pipeline extension
414 /// point
415 ///
416 /// This extension point allows adding passes that perform peephole
417 /// optimizations similar to the instruction combiner. These passes will be
418 /// inserted after each instance of the instruction combiner pass.
420 const std::function<void(FunctionPassManager &, OptimizationLevel)> &C) {
421 PeepholeEPCallbacks.push_back(C);
422 }
423
424 /// Register a callback for a default optimizer pipeline extension
425 /// point
426 ///
427 /// This extension point allows adding late loop canonicalization and
428 /// simplification passes. This is the last point in the loop optimization
429 /// pipeline before loop deletion. Each pass added
430 /// here must be an instance of LoopPass.
431 /// This is the place to add passes that can remove loops, such as target-
432 /// specific loop idiom recognition.
434 const std::function<void(LoopPassManager &, OptimizationLevel)> &C) {
435 LateLoopOptimizationsEPCallbacks.push_back(C);
436 }
437
438 /// Register a callback for a default optimizer pipeline extension
439 /// point
440 ///
441 /// This extension point allows adding loop passes to the end of the loop
442 /// optimizer.
444 const std::function<void(LoopPassManager &, OptimizationLevel)> &C) {
445 LoopOptimizerEndEPCallbacks.push_back(C);
446 }
447
448 /// Register a callback for a default optimizer pipeline extension
449 /// point
450 ///
451 /// This extension point allows adding optimization passes after most of the
452 /// main optimizations, but before the last cleanup-ish optimizations.
454 const std::function<void(FunctionPassManager &, OptimizationLevel)> &C) {
455 ScalarOptimizerLateEPCallbacks.push_back(C);
456 }
457
458 /// Register a callback for a default optimizer pipeline extension
459 /// point
460 ///
461 /// This extension point allows adding CallGraphSCC passes at the end of the
462 /// main CallGraphSCC passes and before any function simplification passes run
463 /// by CGPassManager.
465 const std::function<void(CGSCCPassManager &, OptimizationLevel)> &C) {
466 CGSCCOptimizerLateEPCallbacks.push_back(C);
467 }
468
469 /// Register a callback for a default optimizer pipeline extension
470 /// point
471 ///
472 /// This extension point allows adding optimization passes before the
473 /// vectorizer and other highly target specific optimization passes are
474 /// executed.
476 const std::function<void(FunctionPassManager &, OptimizationLevel)> &C) {
477 VectorizerStartEPCallbacks.push_back(C);
478 }
479
480 /// Register a callback for a default optimizer pipeline extension
481 /// point
482 ///
483 /// This extension point allows adding optimization passes after the
484 /// vectorizer and other highly target specific optimization passes are
485 /// executed.
487 const std::function<void(FunctionPassManager &, OptimizationLevel)> &C) {
488 VectorizerEndEPCallbacks.push_back(C);
489 }
490
491 /// Register a callback for a default optimizer pipeline extension point.
492 ///
493 /// This extension point allows adding optimization once at the start of the
494 /// pipeline. This does not apply to 'backend' compiles (LTO and ThinLTO
495 /// link-time pipelines).
497 const std::function<void(ModulePassManager &, OptimizationLevel)> &C) {
498 PipelineStartEPCallbacks.push_back(C);
499 }
500
501 /// Register a callback for a default optimizer pipeline extension point.
502 ///
503 /// This extension point allows adding optimization right after passes that do
504 /// basic simplification of the input IR.
506 const std::function<void(ModulePassManager &, OptimizationLevel,
508 PipelineEarlySimplificationEPCallbacks.push_back(C);
509 }
510
511 /// Register a callback for a default optimizer pipeline extension point
512 ///
513 /// This extension point allows adding optimizations before the function
514 /// optimization pipeline.
516 const std::function<void(ModulePassManager &, OptimizationLevel,
518 OptimizerEarlyEPCallbacks.push_back(C);
519 }
520
521 /// Register a callback for a default optimizer pipeline extension point
522 ///
523 /// This extension point allows adding optimizations at the very end of the
524 /// function optimization pipeline.
526 const std::function<void(ModulePassManager &, OptimizationLevel,
528 OptimizerLastEPCallbacks.push_back(C);
529 }
530
531 /// Register a callback for a default optimizer pipeline extension point
532 ///
533 /// This extension point allows adding optimizations at the start of the full
534 /// LTO pipeline.
536 const std::function<void(ModulePassManager &, OptimizationLevel)> &C) {
537 FullLinkTimeOptimizationEarlyEPCallbacks.push_back(C);
538 }
539
540 /// Register a callback for a default optimizer pipeline extension point
541 ///
542 /// This extension point allows adding optimizations at the end of the full
543 /// LTO pipeline.
545 const std::function<void(ModulePassManager &, OptimizationLevel)> &C) {
546 FullLinkTimeOptimizationLastEPCallbacks.push_back(C);
547 }
548
549 /// Register a callback for parsing an AliasAnalysis Name to populate
550 /// the given AAManager \p AA
552 const std::function<bool(StringRef Name, AAManager &AA)> &C) {
553 AAParsingCallbacks.push_back(C);
554 }
555
556 /// {{@ Register callbacks for analysis registration with this PassBuilder
557 /// instance.
558 /// Callees register their analyses with the given AnalysisManager objects.
560 const std::function<void(CGSCCAnalysisManager &)> &C) {
561 CGSCCAnalysisRegistrationCallbacks.push_back(C);
562 }
564 const std::function<void(FunctionAnalysisManager &)> &C) {
565 FunctionAnalysisRegistrationCallbacks.push_back(C);
566 }
568 const std::function<void(LoopAnalysisManager &)> &C) {
569 LoopAnalysisRegistrationCallbacks.push_back(C);
570 }
572 const std::function<void(ModuleAnalysisManager &)> &C) {
573 ModuleAnalysisRegistrationCallbacks.push_back(C);
574 }
576 const std::function<void(MachineFunctionAnalysisManager &)> &C) {
577 MachineFunctionAnalysisRegistrationCallbacks.push_back(C);
578 }
579 /// @}}
580
581 /// {{@ Register pipeline parsing callbacks with this pass builder instance.
582 /// Using these callbacks, callers can parse both a single pass name, as well
583 /// as entire sub-pipelines, and populate the PassManager instance
584 /// accordingly.
586 const std::function<bool(StringRef Name, CGSCCPassManager &,
588 CGSCCPipelineParsingCallbacks.push_back(C);
589 }
591 const std::function<bool(StringRef Name, FunctionPassManager &,
593 FunctionPipelineParsingCallbacks.push_back(C);
594 }
596 const std::function<bool(StringRef Name, LoopPassManager &,
598 LoopPipelineParsingCallbacks.push_back(C);
599 }
601 const std::function<bool(StringRef Name, ModulePassManager &,
603 ModulePipelineParsingCallbacks.push_back(C);
604 }
606 const std::function<bool(StringRef Name, MachineFunctionPassManager &,
608 MachineFunctionPipelineParsingCallbacks.push_back(C);
609 }
610 /// @}}
611
612 /// Register callbacks to parse target specific filter field if regalloc pass
613 /// needs it. E.g. AMDGPU requires regalloc passes can handle sgpr and vgpr
614 /// separately.
616 const std::function<RegAllocFilterFunc(StringRef)> &C) {
617 RegClassFilterParsingCallbacks.push_back(C);
618 }
619
620 /// Register a callback for a top-level pipeline entry.
621 ///
622 /// If the PassManager type is not given at the top level of the pipeline
623 /// text, this Callback should be used to determine the appropriate stack of
624 /// PassManagers and populate the passed ModulePassManager.
626 const std::function<bool(ModulePassManager &, ArrayRef<PipelineElement>)>
627 &C);
628
629 /// Add PGOInstrumenation passes for O0 only.
631 bool RunProfileGen, bool IsCS,
632 bool AtomicCounterUpdate,
633 std::string ProfileFile,
634 std::string ProfileRemappingFile);
635
636 /// Returns PIC. External libraries can use this to register pass
637 /// instrumentation callbacks.
641
642 /// Returns the virtual file system.
646
647 // Invoke the callbacks registered for the various extension points.
648 // Custom pipelines should use these to invoke the callbacks registered
649 // by TargetMachines and other clients.
651 OptimizationLevel Level);
653 OptimizationLevel Level);
655 OptimizationLevel Level);
657 OptimizationLevel Level);
659 OptimizationLevel Level);
661 OptimizationLevel Level);
663 OptimizationLevel Level);
665 OptimizationLevel Level,
668 OptimizationLevel Level,
670 LLVM_ABI void
672 OptimizationLevel Level);
673 LLVM_ABI void
675 OptimizationLevel Level);
677 OptimizationLevel Level);
678 LLVM_ABI void
680 OptimizationLevel Level,
682
684 if (!Name.consume_front(PassName))
685 return false;
686 // normal pass name w/o parameters == default parameters
687 if (Name.empty())
688 return true;
689 return Name.starts_with("<") && Name.ends_with(">");
690 }
691
692 /// This performs customized parsing of pass name with parameters.
693 ///
694 /// We do not need parametrization of passes in textual pipeline very often,
695 /// yet on a rare occasion ability to specify parameters right there can be
696 /// useful.
697 ///
698 /// \p Name - parameterized specification of a pass from a textual pipeline
699 /// is a string in a form of :
700 /// PassName '<' parameter-list '>'
701 ///
702 /// Parameter list is being parsed by the parser callable argument, \p Parser,
703 /// It takes a string-ref of parameters and returns either StringError or a
704 /// parameter list in a form of a custom parameters type, all wrapped into
705 /// Expected<> template class.
706 ///
707 template <typename ParametersParseCallableT>
708 static auto parsePassParameters(ParametersParseCallableT &&Parser,
710 -> decltype(Parser(StringRef{})) {
711 using ParametersT = typename decltype(Parser(StringRef{}))::value_type;
712
713 StringRef Params = Name;
714 if (!Params.consume_front(PassName)) {
716 "unable to strip pass name from parametrized pass specification");
717 }
718 if (!Params.empty() &&
719 (!Params.consume_front("<") || !Params.consume_back(">"))) {
720 llvm_unreachable("invalid format for parametrized pass name");
721 }
722
723 Expected<ParametersT> Result = Parser(Params);
724 assert((Result || Result.template errorIsA<StringError>()) &&
725 "Pass parameter parser can only return StringErrors.");
726 return Result;
727 }
728
729 /// Handle passes only accept one bool-valued parameter.
730 ///
731 /// \return false when Params is empty.
732 LLVM_ABI static Expected<bool> parseSinglePassOption(StringRef Params,
733 StringRef OptionName,
734 StringRef PassName);
735
736private:
737 // O1 pass pipeline
739 buildO1FunctionSimplificationPipeline(OptimizationLevel Level,
741
742 void addRequiredLTOPreLinkPasses(ModulePassManager &MPM);
743
744 void addVectorPasses(OptimizationLevel Level, FunctionPassManager &FPM,
745 bool IsFullLTO);
746
747 static std::optional<std::vector<PipelineElement>>
748 parsePipelineText(StringRef Text);
749
750 Error parseModulePass(ModulePassManager &MPM, const PipelineElement &E);
751 Error parseCGSCCPass(CGSCCPassManager &CGPM, const PipelineElement &E);
752 Error parseFunctionPass(FunctionPassManager &FPM, const PipelineElement &E);
753 Error parseLoopPass(LoopPassManager &LPM, const PipelineElement &E);
754 Error parseMachinePass(MachineFunctionPassManager &MFPM,
755 const PipelineElement &E);
756 bool parseAAPassName(AAManager &AA, StringRef Name);
757
758 Error parseMachinePassPipeline(MachineFunctionPassManager &MFPM,
760 Error parseLoopPassPipeline(LoopPassManager &LPM,
762 Error parseFunctionPassPipeline(FunctionPassManager &FPM,
764 Error parseCGSCCPassPipeline(CGSCCPassManager &CGPM,
766 Error parseModulePassPipeline(ModulePassManager &MPM,
768
769 // Adds passes to do pre-inlining and related cleanup passes before
770 // profile instrumentation/matching (to enable better context sensitivity),
771 // and for memprof to enable better matching with missing debug frames.
772 void addPreInlinerPasses(ModulePassManager &MPM, OptimizationLevel Level,
773 ThinOrFullLTOPhase LTOPhase);
774
775 void addPGOInstrPasses(ModulePassManager &MPM, OptimizationLevel Level,
776 bool RunProfileGen, bool IsCS,
777 bool AtomicCounterUpdate, std::string ProfileFile,
778 std::string ProfileRemappingFile);
779 void addPostPGOLoopRotation(ModulePassManager &MPM, OptimizationLevel Level);
780
781 bool isInstrumentedPGOUse() const;
782
783 // Extension Point callbacks
784 SmallVector<std::function<void(FunctionPassManager &, OptimizationLevel)>, 2>
785 PeepholeEPCallbacks;
786 SmallVector<std::function<void(LoopPassManager &, OptimizationLevel)>, 2>
787 LateLoopOptimizationsEPCallbacks;
788 SmallVector<std::function<void(LoopPassManager &, OptimizationLevel)>, 2>
789 LoopOptimizerEndEPCallbacks;
790 SmallVector<std::function<void(FunctionPassManager &, OptimizationLevel)>, 2>
791 ScalarOptimizerLateEPCallbacks;
792 SmallVector<std::function<void(CGSCCPassManager &, OptimizationLevel)>, 2>
793 CGSCCOptimizerLateEPCallbacks;
794 SmallVector<std::function<void(FunctionPassManager &, OptimizationLevel)>, 2>
795 VectorizerStartEPCallbacks;
796 SmallVector<std::function<void(FunctionPassManager &, OptimizationLevel)>, 2>
797 VectorizerEndEPCallbacks;
798 // Module callbacks
799 SmallVector<std::function<void(ModulePassManager &, OptimizationLevel,
801 2>
802 OptimizerEarlyEPCallbacks;
803 SmallVector<std::function<void(ModulePassManager &, OptimizationLevel,
805 2>
806 OptimizerLastEPCallbacks;
807 SmallVector<std::function<void(ModulePassManager &, OptimizationLevel)>, 2>
808 FullLinkTimeOptimizationEarlyEPCallbacks;
809 SmallVector<std::function<void(ModulePassManager &, OptimizationLevel)>, 2>
810 FullLinkTimeOptimizationLastEPCallbacks;
811 SmallVector<std::function<void(ModulePassManager &, OptimizationLevel)>, 2>
812 PipelineStartEPCallbacks;
813 SmallVector<std::function<void(ModulePassManager &, OptimizationLevel,
815 2>
816 PipelineEarlySimplificationEPCallbacks;
817
818 SmallVector<std::function<void(ModuleAnalysisManager &)>, 2>
819 ModuleAnalysisRegistrationCallbacks;
820 SmallVector<std::function<bool(StringRef, ModulePassManager &,
822 2>
823 ModulePipelineParsingCallbacks;
825 std::function<bool(ModulePassManager &, ArrayRef<PipelineElement>)>, 2>
826 TopLevelPipelineParsingCallbacks;
827 // CGSCC callbacks
828 SmallVector<std::function<void(CGSCCAnalysisManager &)>, 2>
829 CGSCCAnalysisRegistrationCallbacks;
830 SmallVector<std::function<bool(StringRef, CGSCCPassManager &,
832 2>
833 CGSCCPipelineParsingCallbacks;
834 // Function callbacks
835 SmallVector<std::function<void(FunctionAnalysisManager &)>, 2>
836 FunctionAnalysisRegistrationCallbacks;
837 SmallVector<std::function<bool(StringRef, FunctionPassManager &,
839 2>
840 FunctionPipelineParsingCallbacks;
841 // Loop callbacks
842 SmallVector<std::function<void(LoopAnalysisManager &)>, 2>
843 LoopAnalysisRegistrationCallbacks;
844 SmallVector<std::function<bool(StringRef, LoopPassManager &,
846 2>
847 LoopPipelineParsingCallbacks;
848 // AA callbacks
849 SmallVector<std::function<bool(StringRef Name, AAManager &AA)>, 2>
850 AAParsingCallbacks;
851 // Machine pass callbackcs
852 SmallVector<std::function<void(MachineFunctionAnalysisManager &)>, 2>
853 MachineFunctionAnalysisRegistrationCallbacks;
854 SmallVector<std::function<bool(StringRef, MachineFunctionPassManager &,
856 2>
857 MachineFunctionPipelineParsingCallbacks;
858 // Callbacks to parse `filter` parameter in register allocation passes
859 SmallVector<std::function<RegAllocFilterFunc(StringRef)>, 2>
860 RegClassFilterParsingCallbacks;
861};
862
863/// This utility template takes care of adding require<> and invalidate<>
864/// passes for an analysis to a given \c PassManager. It is intended to be used
865/// during parsing of a pass pipeline when parsing a single PipelineName.
866/// When registering a new function analysis FancyAnalysis with the pass
867/// pipeline name "fancy-analysis", a matching ParsePipelineCallback could look
868/// like this:
869///
870/// static bool parseFunctionPipeline(StringRef Name, FunctionPassManager &FPM,
871/// ArrayRef<PipelineElement> P) {
872/// if (parseAnalysisUtilityPasses<FancyAnalysis>("fancy-analysis", Name,
873/// FPM))
874/// return true;
875/// return false;
876/// }
877template <typename AnalysisT, typename IRUnitT, typename AnalysisManagerT,
878 typename... ExtraArgTs>
880 StringRef AnalysisName, StringRef PipelineName,
882 if (!PipelineName.ends_with(">"))
883 return false;
884 // See if this is an invalidate<> pass name
885 if (PipelineName.starts_with("invalidate<")) {
886 PipelineName = PipelineName.substr(11, PipelineName.size() - 12);
887 if (PipelineName != AnalysisName)
888 return false;
890 return true;
891 }
892
893 // See if this is a require<> pass name
894 if (PipelineName.starts_with("require<")) {
895 PipelineName = PipelineName.substr(8, PipelineName.size() - 9);
896 if (PipelineName != AnalysisName)
897 return false;
898 PM.addPass(RequireAnalysisPass<AnalysisT, IRUnitT, AnalysisManagerT,
899 ExtraArgTs...>());
900 return true;
901 }
902
903 return false;
904}
905
906// These are special since they are only for testing purposes.
907
908/// No-op module pass which does nothing.
914
915/// No-op module analysis.
916class NoOpModuleAnalysis : public AnalysisInfoMixin<NoOpModuleAnalysis> {
918 LLVM_ABI static AnalysisKey Key;
919
920public:
921 struct Result {};
923};
924
925/// No-op CGSCC pass which does nothing.
932
933/// No-op CGSCC analysis.
934class NoOpCGSCCAnalysis : public AnalysisInfoMixin<NoOpCGSCCAnalysis> {
936 LLVM_ABI static AnalysisKey Key;
937
938public:
939 struct Result {};
943};
944
945/// No-op function pass which does nothing.
951
952/// No-op function analysis.
953class NoOpFunctionAnalysis : public AnalysisInfoMixin<NoOpFunctionAnalysis> {
955 LLVM_ABI static AnalysisKey Key;
956
957public:
958 struct Result {};
960};
961
962/// No-op loop nest pass which does nothing.
969
970/// No-op loop pass which does nothing.
977
978/// No-op machine function pass which does nothing.
984
985/// No-op loop analysis.
986class NoOpLoopAnalysis : public AnalysisInfoMixin<NoOpLoopAnalysis> {
988 LLVM_ABI static AnalysisKey Key;
989
990public:
991 struct Result {};
995};
996
997/// Common option used by multiple tools to print pipeline passes
999}
1000
1001#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
Defines the virtual file system interface vfs::FileSystem.
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)
LLVM_ABI void addPGOInstrPassesForO0(ModulePassManager &MPM, bool RunProfileGen, bool IsCS, bool AtomicCounterUpdate, std::string ProfileFile, std::string ProfileRemappingFile)
Add PGOInstrumenation passes for O0 only.
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 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.
LLVM_ABI PassBuilder(TargetMachine *TM=nullptr, PipelineTuningOptions PTO=PipelineTuningOptions(), std::optional< PGOOptions > PGOOpt=std::nullopt, PassInstrumentationCallbacks *PIC=nullptr, IntrusiveRefCntPtr< vfs::FileSystem > FS=vfs::getRealFileSystem())
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)
IntrusiveRefCntPtr< vfs::FileSystem > getVirtualFileSystemPtr() const
Returns the virtual file system.
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 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:41
unsigned LicmMssaNoAccForPromotionCap
Tuning option to disable promotion to scalars in LICM with MemorySSA, if the number of access is too ...
Definition PassBuilder.h:78
bool SLPVectorization
Tuning option to enable/disable slp loop vectorization, set based on opt level.
Definition PassBuilder.h:56
int InlinerThreshold
Tuning option to override the default inliner threshold.
Definition PassBuilder.h:92
bool LoopFusion
Tuning option to enable/disable loop fusion. Its default value is false.
Definition PassBuilder.h:66
bool CallGraphProfile
Tuning option to enable/disable call graph profile.
Definition PassBuilder.h:82
bool MergeFunctions
Tuning option to enable/disable function merging.
Definition PassBuilder.h:89
bool ForgetAllSCEVInLoopUnroll
Tuning option to forget all SCEV loops in LoopUnroll.
Definition PassBuilder.h:70
unsigned LicmMssaOptCap
Tuning option to cap the number of calls to retrive clobbering accesses in MemorySSA,...
Definition PassBuilder.h:74
bool LoopInterleaving
Tuning option to set loop interleaving on/off, set based on opt level.
Definition PassBuilder.h:48
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:59
bool LoopInterchange
Tuning option to enable/disable loop interchange.
Definition PassBuilder.h:63
bool LoopVectorization
Tuning option to enable/disable loop vectorization, set based on opt level.
Definition PassBuilder.h:52
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:573
bool starts_with(StringRef Prefix) const
Check if this string starts with the given Prefix.
Definition StringRef.h:261
constexpr size_t size() const
size - Get the string size.
Definition StringRef.h:146
bool ends_with(StringRef Suffix) const
Check if this string ends with the given Suffix.
Definition StringRef.h:273
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
#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 >
LLVM_ABI IntrusiveRefCntPtr< FileSystem > getRealFileSystem()
Gets an vfs::FileSystem for the 'real' file system, as seen by the operating system.
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.