LLVM  13.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 
18 #include "llvm/ADT/Optional.h"
20 #include "llvm/IR/PassManager.h"
21 #include "llvm/Support/Error.h"
26 #include <vector>
27 
28 namespace llvm {
29 class StringRef;
30 class AAManager;
31 class TargetMachine;
32 class ModuleSummaryIndex;
33 
34 /// A struct capturing PGO tunables.
35 struct PGOOptions {
38  PGOOptions(std::string ProfileFile = "", std::string CSProfileGenFile = "",
39  std::string ProfileRemappingFile = "", PGOAction Action = NoAction,
41  bool DebugInfoForProfiling = false,
42  bool PseudoProbeForProfiling = false)
46  (Action == SampleUse &&
49  // Note, we do allow ProfileFile.empty() for Action=IRUse LTO can
50  // callback with IRUse action without ProfileFile.
51 
52  // If there is a CSAction, PGOAction cannot be IRInstr or SampleUse.
53  assert(this->CSAction == NoCSAction ||
54  (this->Action != IRInstr && this->Action != SampleUse));
55 
56  // For CSIRInstr, CSProfileGenFile also needs to be nonempty.
57  assert(this->CSAction != CSIRInstr || !this->CSProfileGenFile.empty());
58 
59  // If CSAction is CSIRUse, PGOAction needs to be IRUse as they share
60  // a profile.
61  assert(this->CSAction != CSIRUse || this->Action == IRUse);
62 
63  // If neither Action nor CSAction, DebugInfoForProfiling or
64  // PseudoProbeForProfiling needs to be true.
65  assert(this->Action != NoAction || this->CSAction != NoCSAction ||
67 
68  // Pseudo probe emission does not work with -fdebug-info-for-profiling since
69  // they both use the discriminator field of debug lines but for different
70  // purposes.
73  "Pseudo probes cannot be used with -debug-info-for-profiling", false);
74  }
75  }
76  std::string ProfileFile;
77  std::string CSProfileGenFile;
78  std::string ProfileRemappingFile;
83 };
84 
85 /// Tunable parameters for passes in the default pipelines.
87 public:
88  /// Constructor sets pipeline tuning defaults based on cl::opts. Each option
89  /// can be set in the PassBuilder when using a LLVM as a library.
91 
92  /// Tuning option to set loop interleaving on/off, set based on opt level.
94 
95  /// Tuning option to enable/disable loop vectorization, set based on opt
96  /// level.
98 
99  /// Tuning option to enable/disable slp loop vectorization, set based on opt
100  /// level.
102 
103  /// Tuning option to enable/disable loop unrolling. Its default value is true.
105 
106  /// Tuning option to forget all SCEV loops in LoopUnroll. Its default value
107  /// is that of the flag: `-forget-scev-loop-unroll`.
109 
110  /// Tuning option to enable/disable coroutine intrinsic lowering. Its default
111  /// value is false. Frontends such as Clang may enable this conditionally. For
112  /// example, Clang enables this option if the flags `-std=c++2a` or above, or
113  /// `-fcoroutines-ts`, have been specified.
115 
116  /// Tuning option to cap the number of calls to retrive clobbering accesses in
117  /// MemorySSA, in LICM.
118  unsigned LicmMssaOptCap;
119 
120  /// Tuning option to disable promotion to scalars in LICM with MemorySSA, if
121  /// the number of access is too large.
123 
124  /// Tuning option to enable/disable call graph profile. Its default value is
125  /// that of the flag: `-enable-npm-call-graph-profile`.
127 
128  /// Tuning option to enable/disable function merging. Its default value is
129  /// false.
131 };
132 
133 /// This class provides access to building LLVM's passes.
134 ///
135 /// Its members provide the baseline state available to passes during their
136 /// construction. The \c PassRegistry.def file specifies how to construct all
137 /// of the built-in passes, and those may reference these members during
138 /// construction.
139 class PassBuilder {
140  TargetMachine *TM;
142  Optional<PGOOptions> PGOOpt;
144 
145 public:
146  /// A struct to capture parsed pass pipeline names.
147  ///
148  /// A pipeline is defined as a series of names, each of which may in itself
149  /// recursively contain a nested pipeline. A name is either the name of a pass
150  /// (e.g. "instcombine") or the name of a pipeline type (e.g. "cgscc"). If the
151  /// name is the name of a pass, the InnerPipeline is empty, since passes
152  /// cannot contain inner pipelines. See parsePassPipeline() for a more
153  /// detailed description of the textual pipeline format.
156  std::vector<PipelineElement> InnerPipeline;
157  };
158 
159  /// LLVM-provided high-level optimization levels.
160  ///
161  /// This enumerates the LLVM-provided high-level optimization levels. Each
162  /// level has a specific goal and rationale.
163  class OptimizationLevel final {
164  unsigned SpeedLevel = 2;
165  unsigned SizeLevel = 0;
166  OptimizationLevel(unsigned SpeedLevel, unsigned SizeLevel)
167  : SpeedLevel(SpeedLevel), SizeLevel(SizeLevel) {
168  // Check that only valid combinations are passed.
169  assert(SpeedLevel <= 3 &&
170  "Optimization level for speed should be 0, 1, 2, or 3");
171  assert(SizeLevel <= 2 &&
172  "Optimization level for size should be 0, 1, or 2");
173  assert((SizeLevel == 0 || SpeedLevel == 2) &&
174  "Optimize for size should be encoded with speedup level == 2");
175  }
176 
177  public:
178  OptimizationLevel() = default;
179  /// Disable as many optimizations as possible. This doesn't completely
180  /// disable the optimizer in all cases, for example always_inline functions
181  /// can be required to be inlined for correctness.
182  static const OptimizationLevel O0;
183 
184  /// Optimize quickly without destroying debuggability.
185  ///
186  /// This level is tuned to produce a result from the optimizer as quickly
187  /// as possible and to avoid destroying debuggability. This tends to result
188  /// in a very good development mode where the compiled code will be
189  /// immediately executed as part of testing. As a consequence, where
190  /// possible, we would like to produce efficient-to-execute code, but not
191  /// if it significantly slows down compilation or would prevent even basic
192  /// debugging of the resulting binary.
193  ///
194  /// As an example, complex loop transformations such as versioning,
195  /// vectorization, or fusion don't make sense here due to the degree to
196  /// which the executed code differs from the source code, and the compile
197  /// time cost.
198  static const OptimizationLevel O1;
199  /// Optimize for fast execution as much as possible without triggering
200  /// significant incremental compile time or code size growth.
201  ///
202  /// The key idea is that optimizations at this level should "pay for
203  /// themselves". So if an optimization increases compile time by 5% or
204  /// increases code size by 5% for a particular benchmark, that benchmark
205  /// should also be one which sees a 5% runtime improvement. If the compile
206  /// time or code size penalties happen on average across a diverse range of
207  /// LLVM users' benchmarks, then the improvements should as well.
208  ///
209  /// And no matter what, the compile time needs to not grow superlinearly
210  /// with the size of input to LLVM so that users can control the runtime of
211  /// the optimizer in this mode.
212  ///
213  /// This is expected to be a good default optimization level for the vast
214  /// majority of users.
215  static const OptimizationLevel O2;
216  /// Optimize for fast execution as much as possible.
217  ///
218  /// This mode is significantly more aggressive in trading off compile time
219  /// and code size to get execution time improvements. The core idea is that
220  /// this mode should include any optimization that helps execution time on
221  /// balance across a diverse collection of benchmarks, even if it increases
222  /// code size or compile time for some benchmarks without corresponding
223  /// improvements to execution time.
224  ///
225  /// Despite being willing to trade more compile time off to get improved
226  /// execution time, this mode still tries to avoid superlinear growth in
227  /// order to make even significantly slower compile times at least scale
228  /// reasonably. This does not preclude very substantial constant factor
229  /// costs though.
230  static const OptimizationLevel O3;
231  /// Similar to \c O2 but tries to optimize for small code size instead of
232  /// fast execution without triggering significant incremental execution
233  /// time slowdowns.
234  ///
235  /// The logic here is exactly the same as \c O2, but with code size and
236  /// execution time metrics swapped.
237  ///
238  /// A consequence of the different core goal is that this should in general
239  /// produce substantially smaller executables that still run in
240  /// a reasonable amount of time.
241  static const OptimizationLevel Os;
242  /// A very specialized mode that will optimize for code size at any and all
243  /// costs.
244  ///
245  /// This is useful primarily when there are absolute size limitations and
246  /// any effort taken to reduce the size is worth it regardless of the
247  /// execution time impact. You should expect this level to produce rather
248  /// slow, but very small, code.
249  static const OptimizationLevel Oz;
250 
251  bool isOptimizingForSpeed() const {
252  return SizeLevel == 0 && SpeedLevel > 0;
253  }
254 
255  bool isOptimizingForSize() const { return SizeLevel > 0; }
256 
257  bool operator==(const OptimizationLevel &Other) const {
258  return SizeLevel == Other.SizeLevel && SpeedLevel == Other.SpeedLevel;
259  }
260  bool operator!=(const OptimizationLevel &Other) const {
261  return SizeLevel != Other.SizeLevel || SpeedLevel != Other.SpeedLevel;
262  }
263 
264  unsigned getSpeedupLevel() const { return SpeedLevel; }
265 
266  unsigned getSizeLevel() const { return SizeLevel; }
267  };
268 
269  explicit PassBuilder(TargetMachine *TM = nullptr,
271  Optional<PGOOptions> PGOOpt = None,
272  PassInstrumentationCallbacks *PIC = nullptr);
273 
274  /// Cross register the analysis managers through their proxies.
275  ///
276  /// This is an interface that can be used to cross register each
277  /// AnalysisManager with all the others analysis managers.
280  CGSCCAnalysisManager &CGAM,
281  ModuleAnalysisManager &MAM);
282 
283  /// Registers all available module analysis passes.
284  ///
285  /// This is an interface that can be used to populate a \c
286  /// ModuleAnalysisManager with all registered module analyses. Callers can
287  /// still manually register any additional analyses. Callers can also
288  /// pre-register analyses and this will not override those.
290 
291  /// Registers all available CGSCC analysis passes.
292  ///
293  /// This is an interface that can be used to populate a \c CGSCCAnalysisManager
294  /// with all registered CGSCC analyses. Callers can still manually register any
295  /// additional analyses. Callers can also pre-register analyses and this will
296  /// not override those.
298 
299  /// Registers all available function analysis passes.
300  ///
301  /// This is an interface that can be used to populate a \c
302  /// FunctionAnalysisManager with all registered function analyses. Callers can
303  /// still manually register any additional analyses. Callers can also
304  /// pre-register analyses and this will not override those.
306 
307  /// Registers all available loop analysis passes.
308  ///
309  /// This is an interface that can be used to populate a \c LoopAnalysisManager
310  /// with all registered loop analyses. Callers can still manually register any
311  /// additional analyses.
313 
314  /// Construct the core LLVM function canonicalization and simplification
315  /// pipeline.
316  ///
317  /// This is a long pipeline and uses most of the per-function optimization
318  /// passes in LLVM to canonicalize and simplify the IR. It is suitable to run
319  /// repeatedly over the IR and is not expected to destroy important
320  /// information about the semantics of the IR.
321  ///
322  /// Note that \p Level cannot be `O0` here. The pipelines produced are
323  /// only intended for use when attempting to optimize code. If frontends
324  /// require some transformations for semantic reasons, they should explicitly
325  /// build them.
326  ///
327  /// \p Phase indicates the current ThinLTO phase.
329  buildFunctionSimplificationPipeline(OptimizationLevel Level,
331 
332  /// Construct the core LLVM module canonicalization and simplification
333  /// pipeline.
334  ///
335  /// This pipeline focuses on canonicalizing and simplifying the entire module
336  /// of IR. Much like the function simplification pipeline above, it is
337  /// suitable to run repeatedly over the IR and is not expected to destroy
338  /// important information. It does, however, perform inlining and other
339  /// heuristic based simplifications that are not strictly reversible.
340  ///
341  /// Note that \p Level cannot be `O0` here. The pipelines produced are
342  /// only intended for use when attempting to optimize code. If frontends
343  /// require some transformations for semantic reasons, they should explicitly
344  /// build them.
345  ///
346  /// \p Phase indicates the current ThinLTO phase.
349 
350  /// Construct the module pipeline that performs inlining as well as
351  /// the inlining-driven cleanups.
354 
355  /// Construct the core LLVM module optimization pipeline.
356  ///
357  /// This pipeline focuses on optimizing the execution speed of the IR. It
358  /// uses cost modeling and thresholds to balance code growth against runtime
359  /// improvements. It includes vectorization and other information destroying
360  /// transformations. It also cannot generally be run repeatedly on a module
361  /// without potentially seriously regressing either runtime performance of
362  /// the code or serious code size growth.
363  ///
364  /// Note that \p Level cannot be `O0` here. The pipelines produced are
365  /// only intended for use when attempting to optimize code. If frontends
366  /// require some transformations for semantic reasons, they should explicitly
367  /// build them.
369  bool LTOPreLink = false);
370 
371  /// Build a per-module default optimization pipeline.
372  ///
373  /// This provides a good default optimization pipeline for per-module
374  /// optimization and code generation without any link-time optimization. It
375  /// typically correspond to frontend "-O[123]" options for optimization
376  /// levels \c O1, \c O2 and \c O3 resp.
377  ///
378  /// Note that \p Level cannot be `O0` here. The pipelines produced are
379  /// only intended for use when attempting to optimize code. If frontends
380  /// require some transformations for semantic reasons, they should explicitly
381  /// build them.
383  bool LTOPreLink = false);
384 
385  /// Build a pre-link, ThinLTO-targeting default optimization pipeline to
386  /// a pass manager.
387  ///
388  /// This adds the pre-link optimizations tuned to prepare a module for
389  /// a ThinLTO run. It works to minimize the IR which needs to be analyzed
390  /// without making irreversible decisions which could be made better during
391  /// the LTO run.
392  ///
393  /// Note that \p Level cannot be `O0` here. The pipelines produced are
394  /// only intended for use when attempting to optimize code. If frontends
395  /// require some transformations for semantic reasons, they should explicitly
396  /// build them.
398 
399  /// Build an ThinLTO default optimization pipeline to a pass manager.
400  ///
401  /// This provides a good default optimization pipeline for link-time
402  /// optimization and code generation. It is particularly tuned to fit well
403  /// when IR coming into the LTO phase was first run through \c
404  /// addPreLinkLTODefaultPipeline, and the two coordinate closely.
405  ///
406  /// Note that \p Level cannot be `O0` here. The pipelines produced are
407  /// only intended for use when attempting to optimize code. If frontends
408  /// require some transformations for semantic reasons, they should explicitly
409  /// build them.
411  buildThinLTODefaultPipeline(OptimizationLevel Level,
412  const ModuleSummaryIndex *ImportSummary);
413 
414  /// Build a pre-link, LTO-targeting default optimization pipeline to a pass
415  /// manager.
416  ///
417  /// This adds the pre-link optimizations tuned to work well with a later LTO
418  /// run. It works to minimize the IR which needs to be analyzed without
419  /// making irreversible decisions which could be made better during the LTO
420  /// run.
421  ///
422  /// Note that \p Level cannot be `O0` here. The pipelines produced are
423  /// only intended for use when attempting to optimize code. If frontends
424  /// require some transformations for semantic reasons, they should explicitly
425  /// build them.
427 
428  /// Build an LTO default optimization pipeline to a pass manager.
429  ///
430  /// This provides a good default optimization pipeline for link-time
431  /// optimization and code generation. It is particularly tuned to fit well
432  /// when IR coming into the LTO phase was first run through \c
433  /// addPreLinkLTODefaultPipeline, and the two coordinate closely.
434  ///
435  /// Note that \p Level cannot be `O0` here. The pipelines produced are
436  /// only intended for use when attempting to optimize code. If frontends
437  /// require some transformations for semantic reasons, they should explicitly
438  /// build them.
440  ModuleSummaryIndex *ExportSummary);
441 
442  /// Build an O0 pipeline with the minimal semantically required passes.
443  ///
444  /// This should only be used for non-LTO and LTO pre-link pipelines.
446  bool LTOPreLink = false);
447 
448  /// Build the default `AAManager` with the default alias analysis pipeline
449  /// registered.
450  ///
451  /// This also adds target-specific alias analyses registered via
452  /// TargetMachine::registerDefaultAliasAnalyses().
454 
455  /// Parse a textual pass pipeline description into a \c
456  /// ModulePassManager.
457  ///
458  /// The format of the textual pass pipeline description looks something like:
459  ///
460  /// module(function(instcombine,sroa),dce,cgscc(inliner,function(...)),...)
461  ///
462  /// Pass managers have ()s describing the nest structure of passes. All passes
463  /// are comma separated. As a special shortcut, if the very first pass is not
464  /// a module pass (as a module pass manager is), this will automatically form
465  /// the shortest stack of pass managers that allow inserting that first pass.
466  /// So, assuming function passes 'fpassN', CGSCC passes 'cgpassN', and loop
467  /// passes 'lpassN', all of these are valid:
468  ///
469  /// fpass1,fpass2,fpass3
470  /// cgpass1,cgpass2,cgpass3
471  /// lpass1,lpass2,lpass3
472  ///
473  /// And they are equivalent to the following (resp.):
474  ///
475  /// module(function(fpass1,fpass2,fpass3))
476  /// module(cgscc(cgpass1,cgpass2,cgpass3))
477  /// module(function(loop(lpass1,lpass2,lpass3)))
478  ///
479  /// This shortcut is especially useful for debugging and testing small pass
480  /// combinations.
481  ///
482  /// The sequence of passes aren't necessarily the exact same kind of pass.
483  /// You can mix different levels implicitly if adaptor passes are defined to
484  /// make them work. For example,
485  ///
486  /// mpass1,fpass1,fpass2,mpass2,lpass1
487  ///
488  /// This pipeline uses only one pass manager: the top-level module manager.
489  /// fpass1,fpass2 and lpass1 are added into the the top-level module manager
490  /// using only adaptor passes. No nested function/loop pass managers are
491  /// added. The purpose is to allow easy pass testing when the user
492  /// specifically want the pass to run under a adaptor directly. This is
493  /// preferred when a pipeline is largely of one type, but one or just a few
494  /// passes are of different types(See PassBuilder.cpp for examples).
496 
497  /// {{@ Parse a textual pass pipeline description into a specific PassManager
498  ///
499  /// Automatic deduction of an appropriate pass manager stack is not supported.
500  /// For example, to insert a loop pass 'lpass' into a FunctionPassManager,
501  /// this is the valid pipeline text:
502  ///
503  /// function(lpass)
504  Error parsePassPipeline(CGSCCPassManager &CGPM, StringRef PipelineText);
506  Error parsePassPipeline(LoopPassManager &LPM, StringRef PipelineText);
507  /// @}}
508 
509  /// Parse a textual alias analysis pipeline into the provided AA manager.
510  ///
511  /// The format of the textual AA pipeline is a comma separated list of AA
512  /// pass names:
513  ///
514  /// basic-aa,globals-aa,...
515  ///
516  /// The AA manager is set up such that the provided alias analyses are tried
517  /// in the order specified. See the \c AAManaager documentation for details
518  /// about the logic used. This routine just provides the textual mapping
519  /// between AA names and the analyses to register with the manager.
520  ///
521  /// Returns false if the text cannot be parsed cleanly. The specific state of
522  /// the \p AA manager is unspecified if such an error is encountered and this
523  /// returns false.
524  Error parseAAPipeline(AAManager &AA, StringRef PipelineText);
525 
526  /// Returns true if the pass name is the name of an alias analysis pass.
528 
529  /// Returns true if the pass name is the name of a (non-alias) analysis pass.
531 
532  /// Print pass names.
533  void printPassNames(raw_ostream &OS);
534 
535  /// Register a callback for a default optimizer pipeline extension
536  /// point
537  ///
538  /// This extension point allows adding passes that perform peephole
539  /// optimizations similar to the instruction combiner. These passes will be
540  /// inserted after each instance of the instruction combiner pass.
543  PeepholeEPCallbacks.push_back(C);
544  }
545 
546  /// Register a callback for a default optimizer pipeline extension
547  /// point
548  ///
549  /// This extension point allows adding late loop canonicalization and
550  /// simplification passes. This is the last point in the loop optimization
551  /// pipeline before loop deletion. Each pass added
552  /// here must be an instance of LoopPass.
553  /// This is the place to add passes that can remove loops, such as target-
554  /// specific loop idiom recognition.
557  LateLoopOptimizationsEPCallbacks.push_back(C);
558  }
559 
560  /// Register a callback for a default optimizer pipeline extension
561  /// point
562  ///
563  /// This extension point allows adding loop passes to the end of the loop
564  /// optimizer.
567  LoopOptimizerEndEPCallbacks.push_back(C);
568  }
569 
570  /// Register a callback for a default optimizer pipeline extension
571  /// point
572  ///
573  /// This extension point allows adding optimization passes after most of the
574  /// main optimizations, but before the last cleanup-ish optimizations.
577  ScalarOptimizerLateEPCallbacks.push_back(C);
578  }
579 
580  /// Register a callback for a default optimizer pipeline extension
581  /// point
582  ///
583  /// This extension point allows adding CallGraphSCC passes at the end of the
584  /// main CallGraphSCC passes and before any function simplification passes run
585  /// by CGPassManager.
588  CGSCCOptimizerLateEPCallbacks.push_back(C);
589  }
590 
591  /// Register a callback for a default optimizer pipeline extension
592  /// point
593  ///
594  /// This extension point allows adding optimization passes before the
595  /// vectorizer and other highly target specific optimization passes are
596  /// executed.
599  VectorizerStartEPCallbacks.push_back(C);
600  }
601 
602  /// Register a callback for a default optimizer pipeline extension point.
603  ///
604  /// This extension point allows adding optimization once at the start of the
605  /// pipeline. This does not apply to 'backend' compiles (LTO and ThinLTO
606  /// link-time pipelines).
609  PipelineStartEPCallbacks.push_back(C);
610  }
611 
612  /// Register a callback for a default optimizer pipeline extension point.
613  ///
614  /// This extension point allows adding optimization right after passes that do
615  /// basic simplification of the input IR.
618  PipelineEarlySimplificationEPCallbacks.push_back(C);
619  }
620 
621  /// Register a callback for a default optimizer pipeline extension point
622  ///
623  /// This extension point allows adding optimizations at the very end of the
624  /// function optimization pipeline.
627  OptimizerLastEPCallbacks.push_back(C);
628  }
629 
630  /// Register a callback for parsing an AliasAnalysis Name to populate
631  /// the given AAManager \p AA
633  const std::function<bool(StringRef Name, AAManager &AA)> &C) {
634  AAParsingCallbacks.push_back(C);
635  }
636 
637  /// {{@ Register callbacks for analysis registration with this PassBuilder
638  /// instance.
639  /// Callees register their analyses with the given AnalysisManager objects.
641  const std::function<void(CGSCCAnalysisManager &)> &C) {
642  CGSCCAnalysisRegistrationCallbacks.push_back(C);
643  }
645  const std::function<void(FunctionAnalysisManager &)> &C) {
646  FunctionAnalysisRegistrationCallbacks.push_back(C);
647  }
649  const std::function<void(LoopAnalysisManager &)> &C) {
650  LoopAnalysisRegistrationCallbacks.push_back(C);
651  }
653  const std::function<void(ModuleAnalysisManager &)> &C) {
654  ModuleAnalysisRegistrationCallbacks.push_back(C);
655  }
656  /// @}}
657 
658  /// {{@ Register pipeline parsing callbacks with this pass builder instance.
659  /// Using these callbacks, callers can parse both a single pass name, as well
660  /// as entire sub-pipelines, and populate the PassManager instance
661  /// accordingly.
665  CGSCCPipelineParsingCallbacks.push_back(C);
666  }
670  FunctionPipelineParsingCallbacks.push_back(C);
671  }
675  LoopPipelineParsingCallbacks.push_back(C);
676  }
680  ModulePipelineParsingCallbacks.push_back(C);
681  }
682  /// @}}
683 
684  /// Register a callback for a top-level pipeline entry.
685  ///
686  /// If the PassManager type is not given at the top level of the pipeline
687  /// text, this Callback should be used to determine the appropriate stack of
688  /// PassManagers and populate the passed ModulePassManager.
691  &C);
692 
693  /// Add PGOInstrumenation passes for O0 only.
694  void addPGOInstrPassesForO0(ModulePassManager &MPM, bool RunProfileGen,
695  bool IsCS, std::string ProfileFile,
696  std::string ProfileRemappingFile);
697 
698  /// Returns PIC. External libraries can use this to register pass
699  /// instrumentation callbacks.
701  return PIC;
702  }
703 
704 private:
705  // O1 pass pipeline
707  buildO1FunctionSimplificationPipeline(OptimizationLevel Level,
709 
710  void addRequiredLTOPreLinkPasses(ModulePassManager &MPM);
711 
712  void addVectorPasses(OptimizationLevel Level, FunctionPassManager &FPM,
713  bool IsLTO);
714 
716  parsePipelineText(StringRef Text);
717 
718  Error parseModulePass(ModulePassManager &MPM, const PipelineElement &E);
719  Error parseCGSCCPass(CGSCCPassManager &CGPM, const PipelineElement &E);
720  Error parseFunctionPass(FunctionPassManager &FPM, const PipelineElement &E);
721  Error parseLoopPass(LoopPassManager &LPM, const PipelineElement &E);
722  bool parseAAPassName(AAManager &AA, StringRef Name);
723 
724  Error parseLoopPassPipeline(LoopPassManager &LPM,
725  ArrayRef<PipelineElement> Pipeline);
726  Error parseFunctionPassPipeline(FunctionPassManager &FPM,
727  ArrayRef<PipelineElement> Pipeline);
728  Error parseCGSCCPassPipeline(CGSCCPassManager &CGPM,
729  ArrayRef<PipelineElement> Pipeline);
730  Error parseModulePassPipeline(ModulePassManager &MPM,
731  ArrayRef<PipelineElement> Pipeline);
732 
733  void addPGOInstrPasses(ModulePassManager &MPM, OptimizationLevel Level,
734  bool RunProfileGen, bool IsCS, std::string ProfileFile,
735  std::string ProfileRemappingFile);
736  void invokePeepholeEPCallbacks(FunctionPassManager &, OptimizationLevel);
737 
738  // Extension Point callbacks
739  SmallVector<std::function<void(FunctionPassManager &, OptimizationLevel)>, 2>
740  PeepholeEPCallbacks;
741  SmallVector<std::function<void(LoopPassManager &, OptimizationLevel)>, 2>
742  LateLoopOptimizationsEPCallbacks;
743  SmallVector<std::function<void(LoopPassManager &, OptimizationLevel)>, 2>
744  LoopOptimizerEndEPCallbacks;
745  SmallVector<std::function<void(FunctionPassManager &, OptimizationLevel)>, 2>
746  ScalarOptimizerLateEPCallbacks;
747  SmallVector<std::function<void(CGSCCPassManager &, OptimizationLevel)>, 2>
748  CGSCCOptimizerLateEPCallbacks;
749  SmallVector<std::function<void(FunctionPassManager &, OptimizationLevel)>, 2>
750  VectorizerStartEPCallbacks;
751  SmallVector<std::function<void(ModulePassManager &, OptimizationLevel)>, 2>
752  OptimizerLastEPCallbacks;
753  // Module callbacks
754  SmallVector<std::function<void(ModulePassManager &, OptimizationLevel)>, 2>
755  PipelineStartEPCallbacks;
756  SmallVector<std::function<void(ModulePassManager &, OptimizationLevel)>, 2>
757  PipelineEarlySimplificationEPCallbacks;
758 
760  ModuleAnalysisRegistrationCallbacks;
763  2>
764  ModulePipelineParsingCallbacks;
765  SmallVector<
767  TopLevelPipelineParsingCallbacks;
768  // CGSCC callbacks
770  CGSCCAnalysisRegistrationCallbacks;
773  2>
774  CGSCCPipelineParsingCallbacks;
775  // Function callbacks
777  FunctionAnalysisRegistrationCallbacks;
780  2>
781  FunctionPipelineParsingCallbacks;
782  // Loop callbacks
784  LoopAnalysisRegistrationCallbacks;
787  2>
788  LoopPipelineParsingCallbacks;
789  // AA callbacks
791  AAParsingCallbacks;
792 };
793 
794 /// This utility template takes care of adding require<> and invalidate<>
795 /// passes for an analysis to a given \c PassManager. It is intended to be used
796 /// during parsing of a pass pipeline when parsing a single PipelineName.
797 /// When registering a new function analysis FancyAnalysis with the pass
798 /// pipeline name "fancy-analysis", a matching ParsePipelineCallback could look
799 /// like this:
800 ///
801 /// static bool parseFunctionPipeline(StringRef Name, FunctionPassManager &FPM,
802 /// ArrayRef<PipelineElement> P) {
803 /// if (parseAnalysisUtilityPasses<FancyAnalysis>("fancy-analysis", Name,
804 /// FPM))
805 /// return true;
806 /// return false;
807 /// }
808 template <typename AnalysisT, typename IRUnitT, typename AnalysisManagerT,
809  typename... ExtraArgTs>
811  StringRef AnalysisName, StringRef PipelineName,
813  if (!PipelineName.endswith(">"))
814  return false;
815  // See if this is an invalidate<> pass name
816  if (PipelineName.startswith("invalidate<")) {
817  PipelineName = PipelineName.substr(11, PipelineName.size() - 12);
818  if (PipelineName != AnalysisName)
819  return false;
821  return true;
822  }
823 
824  // See if this is a require<> pass name
825  if (PipelineName.startswith("require<")) {
826  PipelineName = PipelineName.substr(8, PipelineName.size() - 9);
827  if (PipelineName != AnalysisName)
828  return false;
829  PM.addPass(RequireAnalysisPass<AnalysisT, IRUnitT, AnalysisManagerT,
830  ExtraArgTs...>());
831  return true;
832  }
833 
834  return false;
835 }
836 }
837 
838 #endif
llvm::PipelineTuningOptions::Coroutines
bool Coroutines
Tuning option to enable/disable coroutine intrinsic lowering.
Definition: PassBuilder.h:114
llvm::PassManager< Loop, LoopAnalysisManager, LoopStandardAnalysisResults &, LPMUpdater & >
Definition: LoopPassManager.h:70
Instrumentation.h
llvm::AAManager
A manager for alias analyses.
Definition: AliasAnalysis.h:1233
llvm::StringRef::startswith
LLVM_NODISCARD bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
Definition: StringRef.h:289
llvm::PassBuilder::OptimizationLevel::O1
static const OptimizationLevel O1
Optimize quickly without destroying debuggability.
Definition: PassBuilder.h:198
llvm
Definition: AllocatorList.h:23
Phase
aarch64 falkor hwpf fix Falkor HW Prefetch Fix Late Phase
Definition: AArch64FalkorHWPFFix.cpp:231
Optional.h
llvm::PassBuilder::OptimizationLevel::OptimizationLevel
OptimizationLevel()=default
llvm::PassBuilder::registerPipelineStartEPCallback
void registerPipelineStartEPCallback(const std::function< void(ModulePassManager &, OptimizationLevel)> &C)
Register a callback for a default optimizer pipeline extension point.
Definition: PassBuilder.h:607
Inliner.h
llvm::StringRef::endswith
LLVM_NODISCARD bool endswith(StringRef Suffix) const
Check if this string ends with the given Suffix.
Definition: StringRef.h:300
llvm::PassBuilder::getPassInstrumentationCallbacks
PassInstrumentationCallbacks * getPassInstrumentationCallbacks() const
Returns PIC.
Definition: PassBuilder.h:700
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1168
llvm::PassBuilder::buildModuleOptimizationPipeline
ModulePassManager buildModuleOptimizationPipeline(OptimizationLevel Level, bool LTOPreLink=false)
Construct the core LLVM module optimization pipeline.
Definition: PassBuilder.cpp:1326
llvm::PassBuilder::PassBuilder
PassBuilder(TargetMachine *TM=nullptr, PipelineTuningOptions PTO=PipelineTuningOptions(), Optional< PGOOptions > PGOOpt=None, PassInstrumentationCallbacks *PIC=nullptr)
Definition: PassBuilder.cpp:450
llvm::PassBuilder::OptimizationLevel::isOptimizingForSpeed
bool isOptimizingForSpeed() const
Definition: PassBuilder.h:251
llvm::PipelineTuningOptions
Tunable parameters for passes in the default pipelines.
Definition: PassBuilder.h:86
llvm::PGOOptions::CSProfileGenFile
std::string CSProfileGenFile
Definition: PassBuilder.h:77
Error.h
llvm::PGOOptions::CSPGOAction
CSPGOAction
Definition: PassBuilder.h:37
llvm::PipelineTuningOptions::ForgetAllSCEVInLoopUnroll
bool ForgetAllSCEVInLoopUnroll
Tuning option to forget all SCEV loops in LoopUnroll.
Definition: PassBuilder.h:108
llvm::Optional
Definition: APInt.h:33
llvm::PassBuilder::registerAnalysisRegistrationCallback
void registerAnalysisRegistrationCallback(const std::function< void(CGSCCAnalysisManager &)> &C)
{{@ Register callbacks for analysis registration with this PassBuilder instance.
Definition: PassBuilder.h:640
llvm::PassBuilder::registerOptimizerLastEPCallback
void registerOptimizerLastEPCallback(const std::function< void(ModulePassManager &, OptimizationLevel)> &C)
Register a callback for a default optimizer pipeline extension point.
Definition: PassBuilder.h:625
llvm::PassBuilder::registerScalarOptimizerLateEPCallback
void registerScalarOptimizerLateEPCallback(const std::function< void(FunctionPassManager &, OptimizationLevel)> &C)
Register a callback for a default optimizer pipeline extension point.
Definition: PassBuilder.h:575
llvm::PassBuilder::OptimizationLevel::Oz
static const OptimizationLevel Oz
A very specialized mode that will optimize for code size at any and all costs.
Definition: PassBuilder.h:249
llvm::PGOOptions::SampleUse
@ SampleUse
Definition: PassBuilder.h:36
llvm::PassBuilder::addPGOInstrPassesForO0
void addPGOInstrPassesForO0(ModulePassManager &MPM, bool RunProfileGen, bool IsCS, std::string ProfileFile, std::string ProfileRemappingFile)
Add PGOInstrumenation passes for O0 only.
Definition: PassBuilder.cpp:939
llvm::PassBuilder::OptimizationLevel::O2
static const OptimizationLevel O2
Optimize for fast execution as much as possible without triggering significant incremental compile ti...
Definition: PassBuilder.h:215
llvm::PipelineTuningOptions::LicmMssaNoAccForPromotionCap
unsigned LicmMssaNoAccForPromotionCap
Tuning option to disable promotion to scalars in LICM with MemorySSA, if the number of access is too ...
Definition: PassBuilder.h:122
llvm::PassBuilder::OptimizationLevel::operator!=
bool operator!=(const OptimizationLevel &Other) const
Definition: PassBuilder.h:260
llvm::PassBuilder::OptimizationLevel::O0
static const OptimizationLevel O0
Disable as many optimizations as possible.
Definition: PassBuilder.h:182
llvm::PassBuilder::parsePassPipeline
Error parsePassPipeline(ModulePassManager &MPM, StringRef PipelineText)
Parse a textual pass pipeline description into a ModulePassManager.
Definition: PassBuilder.cpp:3014
llvm::StringRef::substr
LLVM_NODISCARD StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
Definition: StringRef.h:612
llvm::PassBuilder::registerPipelineParsingCallback
void registerPipelineParsingCallback(const std::function< bool(StringRef Name, FunctionPassManager &, ArrayRef< PipelineElement >)> &C)
Definition: PassBuilder.h:667
llvm::ThinOrFullLTOPhase
ThinOrFullLTOPhase
This enumerates the LLVM full LTO or ThinLTO optimization phases.
Definition: Pass.h:73
llvm::ModuleInlinerWrapperPass
Module pass, wrapping the inliner pass.
Definition: Inliner.h:118
llvm::PGOOptions::PseudoProbeForProfiling
bool PseudoProbeForProfiling
Definition: PassBuilder.h:82
llvm::PassBuilder::OptimizationLevel::isOptimizingForSize
bool isOptimizingForSize() const
Definition: PassBuilder.h:255
llvm::PassBuilder::registerParseAACallback
void registerParseAACallback(const std::function< bool(StringRef Name, AAManager &AA)> &C)
Register a callback for parsing an AliasAnalysis Name to populate the given AAManager AA.
Definition: PassBuilder.h:632
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
llvm::PassBuilder
This class provides access to building LLVM's passes.
Definition: PassBuilder.h:139
llvm::PassBuilder::buildFunctionSimplificationPipeline
FunctionPassManager buildFunctionSimplificationPipeline(OptimizationLevel Level, ThinOrFullLTOPhase Phase)
Construct the core LLVM function canonicalization and simplification pipeline.
Definition: PassBuilder.cpp:670
llvm::PGOOptions::IRUse
@ IRUse
Definition: PassBuilder.h:36
llvm::PassBuilder::OptimizationLevel::getSpeedupLevel
unsigned getSpeedupLevel() const
Definition: PassBuilder.h:264
llvm::report_fatal_error
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
Definition: Error.cpp:140
llvm::PassBuilder::PipelineElement
A struct to capture parsed pass pipeline names.
Definition: PassBuilder.h:154
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:50
llvm::parseAnalysisUtilityPasses
bool parseAnalysisUtilityPasses(StringRef AnalysisName, StringRef PipelineName, PassManager< IRUnitT, AnalysisManagerT, ExtraArgTs... > &PM)
This utility template takes care of adding require<> and invalidate<> passes for an analysis to a giv...
Definition: PassBuilder.h:810
llvm::PGOOptions::CSIRInstr
@ CSIRInstr
Definition: PassBuilder.h:37
llvm::PassBuilder::buildInlinerPipeline
ModuleInlinerWrapperPass buildInlinerPipeline(OptimizationLevel Level, ThinOrFullLTOPhase Phase)
Construct the module pipeline that performs inlining as well as the inlining-driven cleanups.
Definition: PassBuilder.cpp:970
llvm::PGOOptions::CSAction
CSPGOAction CSAction
Definition: PassBuilder.h:80
llvm::PassBuilder::buildThinLTOPreLinkDefaultPipeline
ModulePassManager buildThinLTOPreLinkDefaultPipeline(OptimizationLevel Level)
Build a pre-link, ThinLTO-targeting default optimization pipeline to a pass manager.
Definition: PassBuilder.cpp:1531
llvm::None
const NoneType None
Definition: None.h:23
llvm::PassBuilder::isAnalysisPassName
bool isAnalysisPassName(StringRef PassName)
Returns true if the pass name is the name of a (non-alias) analysis pass.
Definition: PassBuilder.cpp:3145
llvm::PassBuilder::isAAPassName
bool isAAPassName(StringRef PassName)
Returns true if the pass name is the name of an alias analysis pass.
Definition: PassBuilder.cpp:3134
llvm::PGOOptions::NoCSAction
@ NoCSAction
Definition: PassBuilder.h:37
llvm::PassBuilder::registerPipelineEarlySimplificationEPCallback
void registerPipelineEarlySimplificationEPCallback(const std::function< void(ModulePassManager &, OptimizationLevel)> &C)
Register a callback for a default optimizer pipeline extension point.
Definition: PassBuilder.h:616
llvm::PassBuilder::registerPipelineParsingCallback
void registerPipelineParsingCallback(const std::function< bool(StringRef Name, ModulePassManager &, ArrayRef< PipelineElement >)> &C)
Definition: PassBuilder.h:677
llvm::PassBuilder::registerFunctionAnalyses
void registerFunctionAnalyses(FunctionAnalysisManager &FAM)
Registers all available function analysis passes.
Definition: PassBuilder.cpp:501
llvm::PassBuilder::OptimizationLevel::getSizeLevel
unsigned getSizeLevel() const
Definition: PassBuilder.h:266
llvm::PassBuilder::buildLTOPreLinkDefaultPipeline
ModulePassManager buildLTOPreLinkDefaultPipeline(OptimizationLevel Level)
Build a pre-link, LTO-targeting default optimization pipeline to a pass manager.
Definition: PassBuilder.cpp:1648
llvm::PassBuilder::registerModuleAnalyses
void registerModuleAnalyses(ModuleAnalysisManager &MAM)
Registers all available module analysis passes.
Definition: PassBuilder.cpp:483
llvm::PassBuilder::registerVectorizerStartEPCallback
void registerVectorizerStartEPCallback(const std::function< void(FunctionPassManager &, OptimizationLevel)> &C)
Register a callback for a default optimizer pipeline extension point.
Definition: PassBuilder.h:597
CGSCCPassManager.h
llvm::PGOOptions::ProfileFile
std::string ProfileFile
Definition: PassBuilder.h:76
llvm::PassBuilder::buildLTODefaultPipeline
ModulePassManager buildLTODefaultPipeline(OptimizationLevel Level, ModuleSummaryIndex *ExportSummary)
Build an LTO default optimization pipeline to a pass manager.
Definition: PassBuilder.cpp:1657
llvm::InvalidateAnalysisPass
A no-op pass template which simply forces a specific analysis result to be invalidated.
Definition: PassManager.h:1252
llvm::PassBuilder::buildThinLTODefaultPipeline
ModulePassManager buildThinLTODefaultPipeline(OptimizationLevel Level, const ModuleSummaryIndex *ImportSummary)
Build an ThinLTO default optimization pipeline to a pass manager.
Definition: PassBuilder.cpp:1592
llvm::PassBuilder::buildDefaultAAPipeline
AAManager buildDefaultAAPipeline()
Build the default AAManager with the default alias analysis pipeline registered.
Definition: PassBuilder.cpp:2012
llvm::PipelineTuningOptions::PipelineTuningOptions
PipelineTuningOptions()
Constructor sets pipeline tuning defaults based on cl::opts.
Definition: PassBuilder.cpp:285
llvm::PassBuilder::OptimizationLevel::operator==
bool operator==(const OptimizationLevel &Other) const
Definition: PassBuilder.h:257
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::PassBuilder::printPassNames
void printPassNames(raw_ostream &OS)
Print pass names.
Definition: PassBuilder.cpp:3172
llvm::TargetMachine
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:77
llvm::PipelineTuningOptions::SLPVectorization
bool SLPVectorization
Tuning option to enable/disable slp loop vectorization, set based on opt level.
Definition: PassBuilder.h:101
llvm::PGOOptions::DebugInfoForProfiling
bool DebugInfoForProfiling
Definition: PassBuilder.h:81
llvm::PassBuilder::registerLoopOptimizerEndEPCallback
void registerLoopOptimizerEndEPCallback(const std::function< void(LoopPassManager &, OptimizationLevel)> &C)
Register a callback for a default optimizer pipeline extension point.
Definition: PassBuilder.h:565
llvm::PassBuilder::registerAnalysisRegistrationCallback
void registerAnalysisRegistrationCallback(const std::function< void(FunctionAnalysisManager &)> &C)
Definition: PassBuilder.h:644
function
print Print MemDeps of function
Definition: MemDepPrinter.cpp:83
llvm::PassBuilder::registerPipelineParsingCallback
void registerPipelineParsingCallback(const std::function< bool(StringRef Name, CGSCCPassManager &, ArrayRef< PipelineElement >)> &C)
{{@ Register pipeline parsing callbacks with this pass builder instance.
Definition: PassBuilder.h:662
llvm::PassBuilder::OptimizationLevel::Os
static const OptimizationLevel Os
Similar to O2 but tries to optimize for small code size instead of fast execution without triggering ...
Definition: PassBuilder.h:241
LoopPassManager.h
llvm::PassBuilder::PipelineElement::Name
StringRef Name
Definition: PassBuilder.h:155
llvm::PGOOptions::NoAction
@ NoAction
Definition: PassBuilder.h:36
llvm::PassBuilder::registerLateLoopOptimizationsEPCallback
void registerLateLoopOptimizationsEPCallback(const std::function< void(LoopPassManager &, OptimizationLevel)> &C)
Register a callback for a default optimizer pipeline extension point.
Definition: PassBuilder.h:555
llvm::PipelineTuningOptions::CallGraphProfile
bool CallGraphProfile
Tuning option to enable/disable call graph profile.
Definition: PassBuilder.h:126
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
llvm::PGOOptions
A struct capturing PGO tunables.
Definition: PassBuilder.h:35
llvm::PipelineTuningOptions::LoopVectorization
bool LoopVectorization
Tuning option to enable/disable loop vectorization, set based on opt level.
Definition: PassBuilder.h:97
llvm::PICLevel::Level
Level
Definition: CodeGen.h:33
llvm::PGOOptions::Action
PGOAction Action
Definition: PassBuilder.h:79
llvm::PassBuilder::registerPipelineParsingCallback
void registerPipelineParsingCallback(const std::function< bool(StringRef Name, LoopPassManager &, ArrayRef< PipelineElement >)> &C)
Definition: PassBuilder.h:672
llvm::PassBuilder::parseAAPipeline
Error parseAAPipeline(AAManager &AA, StringRef PipelineText)
Parse a textual alias analysis pipeline into the provided AA manager.
Definition: PassBuilder.cpp:3114
llvm::PassManager< Function >
llvm::PassBuilder::registerLoopAnalyses
void registerLoopAnalyses(LoopAnalysisManager &LAM)
Registers all available loop analysis passes.
Definition: PassBuilder.cpp:510
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52
llvm::PassBuilder::OptimizationLevel
LLVM-provided high-level optimization levels.
Definition: PassBuilder.h:163
llvm::PassBuilder::buildPerModuleDefaultPipeline
ModulePassManager buildPerModuleDefaultPipeline(OptimizationLevel Level, bool LTOPreLink=false)
Build a per-module default optimization pipeline.
Definition: PassBuilder.cpp:1490
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157
llvm::PipelineTuningOptions::MergeFunctions
bool MergeFunctions
Tuning option to enable/disable function merging.
Definition: PassBuilder.h:130
llvm::PassBuilder::registerCGSCCAnalyses
void registerCGSCCAnalyses(CGSCCAnalysisManager &CGAM)
Registers all available CGSCC analysis passes.
Definition: PassBuilder.cpp:492
llvm::PassBuilder::OptimizationLevel::O3
static const OptimizationLevel O3
Optimize for fast execution as much as possible.
Definition: PassBuilder.h:230
PassManager.h
llvm::PassBuilder::registerAnalysisRegistrationCallback
void registerAnalysisRegistrationCallback(const std::function< void(LoopAnalysisManager &)> &C)
Definition: PassBuilder.h:648
llvm::PGOOptions::CSIRUse
@ CSIRUse
Definition: PassBuilder.h:37
llvm::PassBuilder::buildO0DefaultPipeline
ModulePassManager buildO0DefaultPipeline(OptimizationLevel Level, bool LTOPreLink=false)
Build an O0 pipeline with the minimal semantically required passes.
Definition: PassBuilder.cpp:1917
llvm::PGOOptions::PGOAction
PGOAction
Definition: PassBuilder.h:36
llvm::ModuleSummaryIndex
Class to hold module path string table and global value map, and encapsulate methods for operating on...
Definition: ModuleSummaryIndex.h:1026
llvm::PassInstrumentationCallbacks
This class manages callbacks registration, as well as provides a way for PassInstrumentation to pass ...
Definition: PassInstrumentation.h:65
llvm::PassBuilder::crossRegisterProxies
void crossRegisterProxies(LoopAnalysisManager &LAM, FunctionAnalysisManager &FAM, CGSCCAnalysisManager &CGAM, ModuleAnalysisManager &MAM)
Cross register the analysis managers through their proxies.
Definition: PassBuilder.cpp:2989
llvm::PGOOptions::ProfileRemappingFile
std::string ProfileRemappingFile
Definition: PassBuilder.h:78
llvm::PassBuilder::registerCGSCCOptimizerLateEPCallback
void registerCGSCCOptimizerLateEPCallback(const std::function< void(CGSCCPassManager &, OptimizationLevel)> &C)
Register a callback for a default optimizer pipeline extension point.
Definition: PassBuilder.h:586
llvm::PGOOptions::IRInstr
@ IRInstr
Definition: PassBuilder.h:36
llvm::AnalysisManager
A container for analyses that lazily runs them and caches their results.
Definition: InstructionSimplify.h:44
llvm::PassBuilder::registerPeepholeEPCallback
void registerPeepholeEPCallback(const std::function< void(FunctionPassManager &, OptimizationLevel)> &C)
Register a callback for a default optimizer pipeline extension point.
Definition: PassBuilder.h:541
llvm::RequireAnalysisPass
A utility pass template to force an analysis result to be available.
Definition: PassManager.h:1230
llvm::PassBuilder::buildModuleSimplificationPipeline
ModulePassManager buildModuleSimplificationPipeline(OptimizationLevel Level, ThinOrFullLTOPhase Phase)
Construct the core LLVM module canonicalization and simplification pipeline.
Definition: PassBuilder.cpp:1039
llvm::PipelineTuningOptions::LoopUnrolling
bool LoopUnrolling
Tuning option to enable/disable loop unrolling. Its default value is true.
Definition: PassBuilder.h:104
llvm::PassBuilder::registerAnalysisRegistrationCallback
void registerAnalysisRegistrationCallback(const std::function< void(ModuleAnalysisManager &)> &C)
Definition: PassBuilder.h:652
llvm::PipelineTuningOptions::LicmMssaOptCap
unsigned LicmMssaOptCap
Tuning option to cap the number of calls to retrive clobbering accesses in MemorySSA,...
Definition: PassBuilder.h:118
raw_ostream.h
llvm::PipelineTuningOptions::LoopInterleaving
bool LoopInterleaving
Tuning option to set loop interleaving on/off, set based on opt level.
Definition: PassBuilder.h:93
llvm::StringRef::size
LLVM_NODISCARD size_t size() const
size - Get the string size.
Definition: StringRef.h:160
llvm::PassBuilder::registerParseTopLevelPipelineCallback
void registerParseTopLevelPipelineCallback(const std::function< bool(ModulePassManager &, ArrayRef< PipelineElement >)> &C)
Register a callback for a top-level pipeline entry.
Definition: PassBuilder.cpp:3216
llvm::PassManager::addPass
std::enable_if_t<!std::is_same< PassT, PassManager >::value > addPass(PassT Pass)
Definition: PassManager.h:542
PassName
static const char PassName[]
Definition: X86LowerAMXIntrinsics.cpp:669
llvm::PassBuilder::PipelineElement::InnerPipeline
std::vector< PipelineElement > InnerPipeline
Definition: PassBuilder.h:156
llvm::PGOOptions::PGOOptions
PGOOptions(std::string ProfileFile="", std::string CSProfileGenFile="", std::string ProfileRemappingFile="", PGOAction Action=NoAction, CSPGOAction CSAction=NoCSAction, bool DebugInfoForProfiling=false, bool PseudoProbeForProfiling=false)
Definition: PassBuilder.h:38
Other
Optional< std::vector< StOtherPiece > > Other
Definition: ELFYAML.cpp:1168