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  bool DebugLogging;
141  TargetMachine *TM;
143  Optional<PGOOptions> PGOOpt;
145 
146 public:
147  /// A struct to capture parsed pass pipeline names.
148  ///
149  /// A pipeline is defined as a series of names, each of which may in itself
150  /// recursively contain a nested pipeline. A name is either the name of a pass
151  /// (e.g. "instcombine") or the name of a pipeline type (e.g. "cgscc"). If the
152  /// name is the name of a pass, the InnerPipeline is empty, since passes
153  /// cannot contain inner pipelines. See parsePassPipeline() for a more
154  /// detailed description of the textual pipeline format.
157  std::vector<PipelineElement> InnerPipeline;
158  };
159 
160  /// LLVM-provided high-level optimization levels.
161  ///
162  /// This enumerates the LLVM-provided high-level optimization levels. Each
163  /// level has a specific goal and rationale.
164  class OptimizationLevel final {
165  unsigned SpeedLevel = 2;
166  unsigned SizeLevel = 0;
167  OptimizationLevel(unsigned SpeedLevel, unsigned SizeLevel)
168  : SpeedLevel(SpeedLevel), SizeLevel(SizeLevel) {
169  // Check that only valid combinations are passed.
170  assert(SpeedLevel <= 3 &&
171  "Optimization level for speed should be 0, 1, 2, or 3");
172  assert(SizeLevel <= 2 &&
173  "Optimization level for size should be 0, 1, or 2");
174  assert((SizeLevel == 0 || SpeedLevel == 2) &&
175  "Optimize for size should be encoded with speedup level == 2");
176  }
177 
178  public:
179  OptimizationLevel() = default;
180  /// Disable as many optimizations as possible. This doesn't completely
181  /// disable the optimizer in all cases, for example always_inline functions
182  /// can be required to be inlined for correctness.
183  static const OptimizationLevel O0;
184 
185  /// Optimize quickly without destroying debuggability.
186  ///
187  /// This level is tuned to produce a result from the optimizer as quickly
188  /// as possible and to avoid destroying debuggability. This tends to result
189  /// in a very good development mode where the compiled code will be
190  /// immediately executed as part of testing. As a consequence, where
191  /// possible, we would like to produce efficient-to-execute code, but not
192  /// if it significantly slows down compilation or would prevent even basic
193  /// debugging of the resulting binary.
194  ///
195  /// As an example, complex loop transformations such as versioning,
196  /// vectorization, or fusion don't make sense here due to the degree to
197  /// which the executed code differs from the source code, and the compile
198  /// time cost.
199  static const OptimizationLevel O1;
200  /// Optimize for fast execution as much as possible without triggering
201  /// significant incremental compile time or code size growth.
202  ///
203  /// The key idea is that optimizations at this level should "pay for
204  /// themselves". So if an optimization increases compile time by 5% or
205  /// increases code size by 5% for a particular benchmark, that benchmark
206  /// should also be one which sees a 5% runtime improvement. If the compile
207  /// time or code size penalties happen on average across a diverse range of
208  /// LLVM users' benchmarks, then the improvements should as well.
209  ///
210  /// And no matter what, the compile time needs to not grow superlinearly
211  /// with the size of input to LLVM so that users can control the runtime of
212  /// the optimizer in this mode.
213  ///
214  /// This is expected to be a good default optimization level for the vast
215  /// majority of users.
216  static const OptimizationLevel O2;
217  /// Optimize for fast execution as much as possible.
218  ///
219  /// This mode is significantly more aggressive in trading off compile time
220  /// and code size to get execution time improvements. The core idea is that
221  /// this mode should include any optimization that helps execution time on
222  /// balance across a diverse collection of benchmarks, even if it increases
223  /// code size or compile time for some benchmarks without corresponding
224  /// improvements to execution time.
225  ///
226  /// Despite being willing to trade more compile time off to get improved
227  /// execution time, this mode still tries to avoid superlinear growth in
228  /// order to make even significantly slower compile times at least scale
229  /// reasonably. This does not preclude very substantial constant factor
230  /// costs though.
231  static const OptimizationLevel O3;
232  /// Similar to \c O2 but tries to optimize for small code size instead of
233  /// fast execution without triggering significant incremental execution
234  /// time slowdowns.
235  ///
236  /// The logic here is exactly the same as \c O2, but with code size and
237  /// execution time metrics swapped.
238  ///
239  /// A consequence of the different core goal is that this should in general
240  /// produce substantially smaller executables that still run in
241  /// a reasonable amount of time.
242  static const OptimizationLevel Os;
243  /// A very specialized mode that will optimize for code size at any and all
244  /// costs.
245  ///
246  /// This is useful primarily when there are absolute size limitations and
247  /// any effort taken to reduce the size is worth it regardless of the
248  /// execution time impact. You should expect this level to produce rather
249  /// slow, but very small, code.
250  static const OptimizationLevel Oz;
251 
252  bool isOptimizingForSpeed() const {
253  return SizeLevel == 0 && SpeedLevel > 0;
254  }
255 
256  bool isOptimizingForSize() const { return SizeLevel > 0; }
257 
258  bool operator==(const OptimizationLevel &Other) const {
259  return SizeLevel == Other.SizeLevel && SpeedLevel == Other.SpeedLevel;
260  }
261  bool operator!=(const OptimizationLevel &Other) const {
262  return SizeLevel != Other.SizeLevel || SpeedLevel != Other.SpeedLevel;
263  }
264 
265  unsigned getSpeedupLevel() const { return SpeedLevel; }
266 
267  unsigned getSizeLevel() const { return SizeLevel; }
268  };
269 
270  explicit PassBuilder(bool DebugLogging = false, TargetMachine *TM = nullptr,
272  Optional<PGOOptions> PGOOpt = None,
273  PassInstrumentationCallbacks *PIC = nullptr);
274 
275  /// Cross register the analysis managers through their proxies.
276  ///
277  /// This is an interface that can be used to cross register each
278  /// AnalysisManager with all the others analysis managers.
281  CGSCCAnalysisManager &CGAM,
282  ModuleAnalysisManager &MAM);
283 
284  /// Registers all available module analysis passes.
285  ///
286  /// This is an interface that can be used to populate a \c
287  /// ModuleAnalysisManager with all registered module analyses. Callers can
288  /// still manually register any additional analyses. Callers can also
289  /// pre-register analyses and this will not override those.
291 
292  /// Registers all available CGSCC analysis passes.
293  ///
294  /// This is an interface that can be used to populate a \c CGSCCAnalysisManager
295  /// with all registered CGSCC analyses. Callers can still manually register any
296  /// additional analyses. Callers can also pre-register analyses and this will
297  /// not override those.
299 
300  /// Registers all available function analysis passes.
301  ///
302  /// This is an interface that can be used to populate a \c
303  /// FunctionAnalysisManager with all registered function analyses. Callers can
304  /// still manually register any additional analyses. Callers can also
305  /// pre-register analyses and this will not override those.
307 
308  /// Registers all available loop analysis passes.
309  ///
310  /// This is an interface that can be used to populate a \c LoopAnalysisManager
311  /// with all registered loop analyses. Callers can still manually register any
312  /// additional analyses.
314 
315  /// Construct the core LLVM function canonicalization and simplification
316  /// pipeline.
317  ///
318  /// This is a long pipeline and uses most of the per-function optimization
319  /// passes in LLVM to canonicalize and simplify the IR. It is suitable to run
320  /// repeatedly over the IR and is not expected to destroy important
321  /// information about the semantics of the IR.
322  ///
323  /// Note that \p Level cannot be `O0` here. The pipelines produced are
324  /// only intended for use when attempting to optimize code. If frontends
325  /// require some transformations for semantic reasons, they should explicitly
326  /// build them.
327  ///
328  /// \p Phase indicates the current ThinLTO phase.
330  buildFunctionSimplificationPipeline(OptimizationLevel Level,
332 
333  /// Construct the core LLVM module canonicalization and simplification
334  /// pipeline.
335  ///
336  /// This pipeline focuses on canonicalizing and simplifying the entire module
337  /// of IR. Much like the function simplification pipeline above, it is
338  /// suitable to run repeatedly over the IR and is not expected to destroy
339  /// important information. It does, however, perform inlining and other
340  /// heuristic based simplifications that are not strictly reversible.
341  ///
342  /// Note that \p Level cannot be `O0` here. The pipelines produced are
343  /// only intended for use when attempting to optimize code. If frontends
344  /// require some transformations for semantic reasons, they should explicitly
345  /// build them.
346  ///
347  /// \p Phase indicates the current ThinLTO phase.
350 
351  /// Construct the module pipeline that performs inlining as well as
352  /// the inlining-driven cleanups.
355 
356  /// Construct the core LLVM module optimization pipeline.
357  ///
358  /// This pipeline focuses on optimizing the execution speed of the IR. It
359  /// uses cost modeling and thresholds to balance code growth against runtime
360  /// improvements. It includes vectorization and other information destroying
361  /// transformations. It also cannot generally be run repeatedly on a module
362  /// without potentially seriously regressing either runtime performance of
363  /// the code or serious code size growth.
364  ///
365  /// Note that \p Level cannot be `O0` here. The pipelines produced are
366  /// only intended for use when attempting to optimize code. If frontends
367  /// require some transformations for semantic reasons, they should explicitly
368  /// build them.
370  bool LTOPreLink = false);
371 
372  /// Build a per-module default optimization pipeline.
373  ///
374  /// This provides a good default optimization pipeline for per-module
375  /// optimization and code generation without any link-time optimization. It
376  /// typically correspond to frontend "-O[123]" options for optimization
377  /// levels \c O1, \c O2 and \c O3 resp.
378  ///
379  /// Note that \p Level cannot be `O0` here. The pipelines produced are
380  /// only intended for use when attempting to optimize code. If frontends
381  /// require some transformations for semantic reasons, they should explicitly
382  /// build them.
384  bool LTOPreLink = false);
385 
386  /// Build a pre-link, ThinLTO-targeting default optimization pipeline to
387  /// a pass manager.
388  ///
389  /// This adds the pre-link optimizations tuned to prepare a module for
390  /// a ThinLTO run. It works to minimize the IR which needs to be analyzed
391  /// without making irreversible decisions which could be made better during
392  /// the LTO run.
393  ///
394  /// Note that \p Level cannot be `O0` here. The pipelines produced are
395  /// only intended for use when attempting to optimize code. If frontends
396  /// require some transformations for semantic reasons, they should explicitly
397  /// build them.
399 
400  /// Build an ThinLTO default optimization pipeline to a pass manager.
401  ///
402  /// This provides a good default optimization pipeline for link-time
403  /// optimization and code generation. It is particularly tuned to fit well
404  /// when IR coming into the LTO phase was first run through \c
405  /// addPreLinkLTODefaultPipeline, and the two coordinate closely.
406  ///
407  /// Note that \p Level cannot be `O0` here. The pipelines produced are
408  /// only intended for use when attempting to optimize code. If frontends
409  /// require some transformations for semantic reasons, they should explicitly
410  /// build them.
412  buildThinLTODefaultPipeline(OptimizationLevel Level,
413  const ModuleSummaryIndex *ImportSummary);
414 
415  /// Build a pre-link, LTO-targeting default optimization pipeline to a pass
416  /// manager.
417  ///
418  /// This adds the pre-link optimizations tuned to work well with a later LTO
419  /// run. It works to minimize the IR which needs to be analyzed without
420  /// making irreversible decisions which could be made better during the LTO
421  /// run.
422  ///
423  /// Note that \p Level cannot be `O0` here. The pipelines produced are
424  /// only intended for use when attempting to optimize code. If frontends
425  /// require some transformations for semantic reasons, they should explicitly
426  /// build them.
428 
429  /// Build an LTO default optimization pipeline to a pass manager.
430  ///
431  /// This provides a good default optimization pipeline for link-time
432  /// optimization and code generation. It is particularly tuned to fit well
433  /// when IR coming into the LTO phase was first run through \c
434  /// addPreLinkLTODefaultPipeline, and the two coordinate closely.
435  ///
436  /// Note that \p Level cannot be `O0` here. The pipelines produced are
437  /// only intended for use when attempting to optimize code. If frontends
438  /// require some transformations for semantic reasons, they should explicitly
439  /// build them.
441  ModuleSummaryIndex *ExportSummary);
442 
443  /// Build an O0 pipeline with the minimal semantically required passes.
444  ///
445  /// This should only be used for non-LTO and LTO pre-link pipelines.
447  bool LTOPreLink = false);
448 
449  /// Build the default `AAManager` with the default alias analysis pipeline
450  /// registered.
451  ///
452  /// This also adds target-specific alias analyses registered via
453  /// TargetMachine::registerDefaultAliasAnalyses().
455 
456  /// Parse a textual pass pipeline description into a \c
457  /// ModulePassManager.
458  ///
459  /// The format of the textual pass pipeline description looks something like:
460  ///
461  /// module(function(instcombine,sroa),dce,cgscc(inliner,function(...)),...)
462  ///
463  /// Pass managers have ()s describing the nest structure of passes. All passes
464  /// are comma separated. As a special shortcut, if the very first pass is not
465  /// a module pass (as a module pass manager is), this will automatically form
466  /// the shortest stack of pass managers that allow inserting that first pass.
467  /// So, assuming function passes 'fpassN', CGSCC passes 'cgpassN', and loop
468  /// passes 'lpassN', all of these are valid:
469  ///
470  /// fpass1,fpass2,fpass3
471  /// cgpass1,cgpass2,cgpass3
472  /// lpass1,lpass2,lpass3
473  ///
474  /// And they are equivalent to the following (resp.):
475  ///
476  /// module(function(fpass1,fpass2,fpass3))
477  /// module(cgscc(cgpass1,cgpass2,cgpass3))
478  /// module(function(loop(lpass1,lpass2,lpass3)))
479  ///
480  /// This shortcut is especially useful for debugging and testing small pass
481  /// combinations.
482  ///
483  /// The sequence of passes aren't necessarily the exact same kind of pass.
484  /// You can mix different levels implicitly if adaptor passes are defined to
485  /// make them work. For example,
486  ///
487  /// mpass1,fpass1,fpass2,mpass2,lpass1
488  ///
489  /// This pipeline uses only one pass manager: the top-level module manager.
490  /// fpass1,fpass2 and lpass1 are added into the the top-level module manager
491  /// using only adaptor passes. No nested function/loop pass managers are
492  /// added. The purpose is to allow easy pass testing when the user
493  /// specifically want the pass to run under a adaptor directly. This is
494  /// preferred when a pipeline is largely of one type, but one or just a few
495  /// passes are of different types(See PassBuilder.cpp for examples).
497 
498  /// {{@ Parse a textual pass pipeline description into a specific PassManager
499  ///
500  /// Automatic deduction of an appropriate pass manager stack is not supported.
501  /// For example, to insert a loop pass 'lpass' into a FunctionPassManager,
502  /// this is the valid pipeline text:
503  ///
504  /// function(lpass)
505  Error parsePassPipeline(CGSCCPassManager &CGPM, StringRef PipelineText);
507  Error parsePassPipeline(LoopPassManager &LPM, StringRef PipelineText);
508  /// @}}
509 
510  /// Parse a textual alias analysis pipeline into the provided AA manager.
511  ///
512  /// The format of the textual AA pipeline is a comma separated list of AA
513  /// pass names:
514  ///
515  /// basic-aa,globals-aa,...
516  ///
517  /// The AA manager is set up such that the provided alias analyses are tried
518  /// in the order specified. See the \c AAManaager documentation for details
519  /// about the logic used. This routine just provides the textual mapping
520  /// between AA names and the analyses to register with the manager.
521  ///
522  /// Returns false if the text cannot be parsed cleanly. The specific state of
523  /// the \p AA manager is unspecified if such an error is encountered and this
524  /// returns false.
525  Error parseAAPipeline(AAManager &AA, StringRef PipelineText);
526 
527  /// Returns true if the pass name is the name of an alias analysis pass.
529 
530  /// Returns true if the pass name is the name of a (non-alias) analysis pass.
532 
533  /// Print pass names.
534  void printPassNames(raw_ostream &OS);
535 
536  /// Register a callback for a default optimizer pipeline extension
537  /// point
538  ///
539  /// This extension point allows adding passes that perform peephole
540  /// optimizations similar to the instruction combiner. These passes will be
541  /// inserted after each instance of the instruction combiner pass.
544  PeepholeEPCallbacks.push_back(C);
545  }
546 
547  /// Register a callback for a default optimizer pipeline extension
548  /// point
549  ///
550  /// This extension point allows adding late loop canonicalization and
551  /// simplification passes. This is the last point in the loop optimization
552  /// pipeline before loop deletion. Each pass added
553  /// here must be an instance of LoopPass.
554  /// This is the place to add passes that can remove loops, such as target-
555  /// specific loop idiom recognition.
558  LateLoopOptimizationsEPCallbacks.push_back(C);
559  }
560 
561  /// Register a callback for a default optimizer pipeline extension
562  /// point
563  ///
564  /// This extension point allows adding loop passes to the end of the loop
565  /// optimizer.
568  LoopOptimizerEndEPCallbacks.push_back(C);
569  }
570 
571  /// Register a callback for a default optimizer pipeline extension
572  /// point
573  ///
574  /// This extension point allows adding optimization passes after most of the
575  /// main optimizations, but before the last cleanup-ish optimizations.
578  ScalarOptimizerLateEPCallbacks.push_back(C);
579  }
580 
581  /// Register a callback for a default optimizer pipeline extension
582  /// point
583  ///
584  /// This extension point allows adding CallGraphSCC passes at the end of the
585  /// main CallGraphSCC passes and before any function simplification passes run
586  /// by CGPassManager.
589  CGSCCOptimizerLateEPCallbacks.push_back(C);
590  }
591 
592  /// Register a callback for a default optimizer pipeline extension
593  /// point
594  ///
595  /// This extension point allows adding optimization passes before the
596  /// vectorizer and other highly target specific optimization passes are
597  /// executed.
600  VectorizerStartEPCallbacks.push_back(C);
601  }
602 
603  /// Register a callback for a default optimizer pipeline extension point.
604  ///
605  /// This extension point allows adding optimization once at the start of the
606  /// pipeline. This does not apply to 'backend' compiles (LTO and ThinLTO
607  /// link-time pipelines).
610  PipelineStartEPCallbacks.push_back(C);
611  }
612 
613  /// Register a callback for a default optimizer pipeline extension point.
614  ///
615  /// This extension point allows adding optimization right after passes that do
616  /// basic simplification of the input IR.
619  PipelineEarlySimplificationEPCallbacks.push_back(C);
620  }
621 
622  /// Register a callback for a default optimizer pipeline extension point
623  ///
624  /// This extension point allows adding optimizations at the very end of the
625  /// function optimization pipeline.
628  OptimizerLastEPCallbacks.push_back(C);
629  }
630 
631  /// Register a callback for parsing an AliasAnalysis Name to populate
632  /// the given AAManager \p AA
634  const std::function<bool(StringRef Name, AAManager &AA)> &C) {
635  AAParsingCallbacks.push_back(C);
636  }
637 
638  /// {{@ Register callbacks for analysis registration with this PassBuilder
639  /// instance.
640  /// Callees register their analyses with the given AnalysisManager objects.
642  const std::function<void(CGSCCAnalysisManager &)> &C) {
643  CGSCCAnalysisRegistrationCallbacks.push_back(C);
644  }
646  const std::function<void(FunctionAnalysisManager &)> &C) {
647  FunctionAnalysisRegistrationCallbacks.push_back(C);
648  }
650  const std::function<void(LoopAnalysisManager &)> &C) {
651  LoopAnalysisRegistrationCallbacks.push_back(C);
652  }
654  const std::function<void(ModuleAnalysisManager &)> &C) {
655  ModuleAnalysisRegistrationCallbacks.push_back(C);
656  }
657  /// @}}
658 
659  /// {{@ Register pipeline parsing callbacks with this pass builder instance.
660  /// Using these callbacks, callers can parse both a single pass name, as well
661  /// as entire sub-pipelines, and populate the PassManager instance
662  /// accordingly.
666  CGSCCPipelineParsingCallbacks.push_back(C);
667  }
671  FunctionPipelineParsingCallbacks.push_back(C);
672  }
676  LoopPipelineParsingCallbacks.push_back(C);
677  }
681  ModulePipelineParsingCallbacks.push_back(C);
682  }
683  /// @}}
684 
685  /// Register a callback for a top-level pipeline entry.
686  ///
687  /// If the PassManager type is not given at the top level of the pipeline
688  /// text, this Callback should be used to determine the appropriate stack of
689  /// PassManagers and populate the passed ModulePassManager.
692  bool DebugLogging)> &C);
693 
694  /// Add PGOInstrumenation passes for O0 only.
695  void addPGOInstrPassesForO0(ModulePassManager &MPM, bool RunProfileGen,
696  bool IsCS, std::string ProfileFile,
697  std::string ProfileRemappingFile);
698 
699  /// Returns PIC. External libraries can use this to register pass
700  /// instrumentation callbacks.
702  return PIC;
703  }
704 
705 private:
706  // O1 pass pipeline
708  buildO1FunctionSimplificationPipeline(OptimizationLevel Level,
710 
711  void addRequiredLTOPreLinkPasses(ModulePassManager &MPM);
712 
713  void addVectorPasses(OptimizationLevel Level, FunctionPassManager &FPM,
714  bool IsLTO);
715 
717  parsePipelineText(StringRef Text);
718 
719  Error parseModulePass(ModulePassManager &MPM, const PipelineElement &E);
720  Error parseCGSCCPass(CGSCCPassManager &CGPM, const PipelineElement &E);
721  Error parseFunctionPass(FunctionPassManager &FPM, const PipelineElement &E);
722  Error parseLoopPass(LoopPassManager &LPM, const PipelineElement &E);
723  bool parseAAPassName(AAManager &AA, StringRef Name);
724 
725  Error parseLoopPassPipeline(LoopPassManager &LPM,
726  ArrayRef<PipelineElement> Pipeline);
727  Error parseFunctionPassPipeline(FunctionPassManager &FPM,
728  ArrayRef<PipelineElement> Pipeline);
729  Error parseCGSCCPassPipeline(CGSCCPassManager &CGPM,
730  ArrayRef<PipelineElement> Pipeline);
731  Error parseModulePassPipeline(ModulePassManager &MPM,
732  ArrayRef<PipelineElement> Pipeline);
733 
734  void addPGOInstrPasses(ModulePassManager &MPM, OptimizationLevel Level,
735  bool RunProfileGen, bool IsCS, std::string ProfileFile,
736  std::string ProfileRemappingFile);
737  void invokePeepholeEPCallbacks(FunctionPassManager &, OptimizationLevel);
738 
739  // Extension Point callbacks
740  SmallVector<std::function<void(FunctionPassManager &, OptimizationLevel)>, 2>
741  PeepholeEPCallbacks;
742  SmallVector<std::function<void(LoopPassManager &, OptimizationLevel)>, 2>
743  LateLoopOptimizationsEPCallbacks;
744  SmallVector<std::function<void(LoopPassManager &, OptimizationLevel)>, 2>
745  LoopOptimizerEndEPCallbacks;
746  SmallVector<std::function<void(FunctionPassManager &, OptimizationLevel)>, 2>
747  ScalarOptimizerLateEPCallbacks;
748  SmallVector<std::function<void(CGSCCPassManager &, OptimizationLevel)>, 2>
749  CGSCCOptimizerLateEPCallbacks;
750  SmallVector<std::function<void(FunctionPassManager &, OptimizationLevel)>, 2>
751  VectorizerStartEPCallbacks;
752  SmallVector<std::function<void(ModulePassManager &, OptimizationLevel)>, 2>
753  OptimizerLastEPCallbacks;
754  // Module callbacks
755  SmallVector<std::function<void(ModulePassManager &, OptimizationLevel)>, 2>
756  PipelineStartEPCallbacks;
757  SmallVector<std::function<void(ModulePassManager &, OptimizationLevel)>, 2>
758  PipelineEarlySimplificationEPCallbacks;
759 
761  ModuleAnalysisRegistrationCallbacks;
764  2>
765  ModulePipelineParsingCallbacks;
767  bool DebugLogging)>,
768  2>
769  TopLevelPipelineParsingCallbacks;
770  // CGSCC callbacks
772  CGSCCAnalysisRegistrationCallbacks;
775  2>
776  CGSCCPipelineParsingCallbacks;
777  // Function callbacks
779  FunctionAnalysisRegistrationCallbacks;
782  2>
783  FunctionPipelineParsingCallbacks;
784  // Loop callbacks
786  LoopAnalysisRegistrationCallbacks;
789  2>
790  LoopPipelineParsingCallbacks;
791  // AA callbacks
793  AAParsingCallbacks;
794 };
795 
796 /// This utility template takes care of adding require<> and invalidate<>
797 /// passes for an analysis to a given \c PassManager. It is intended to be used
798 /// during parsing of a pass pipeline when parsing a single PipelineName.
799 /// When registering a new function analysis FancyAnalysis with the pass
800 /// pipeline name "fancy-analysis", a matching ParsePipelineCallback could look
801 /// like this:
802 ///
803 /// static bool parseFunctionPipeline(StringRef Name, FunctionPassManager &FPM,
804 /// ArrayRef<PipelineElement> P) {
805 /// if (parseAnalysisUtilityPasses<FancyAnalysis>("fancy-analysis", Name,
806 /// FPM))
807 /// return true;
808 /// return false;
809 /// }
810 template <typename AnalysisT, typename IRUnitT, typename AnalysisManagerT,
811  typename... ExtraArgTs>
813  StringRef AnalysisName, StringRef PipelineName,
815  if (!PipelineName.endswith(">"))
816  return false;
817  // See if this is an invalidate<> pass name
818  if (PipelineName.startswith("invalidate<")) {
819  PipelineName = PipelineName.substr(11, PipelineName.size() - 12);
820  if (PipelineName != AnalysisName)
821  return false;
823  return true;
824  }
825 
826  // See if this is a require<> pass name
827  if (PipelineName.startswith("require<")) {
828  PipelineName = PipelineName.substr(8, PipelineName.size() - 9);
829  if (PipelineName != AnalysisName)
830  return false;
831  PM.addPass(RequireAnalysisPass<AnalysisT, IRUnitT, AnalysisManagerT,
832  ExtraArgTs...>());
833  return true;
834  }
835 
836  return false;
837 }
838 }
839 
840 #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:1221
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:199
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:608
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:701
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:1318
llvm::PassBuilder::OptimizationLevel::isOptimizingForSpeed
bool isOptimizingForSpeed() const
Definition: PassBuilder.h:252
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:641
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:626
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:576
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:250
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:216
llvm::PassBuilder::PassBuilder
PassBuilder(bool DebugLogging=false, TargetMachine *TM=nullptr, PipelineTuningOptions PTO=PipelineTuningOptions(), Optional< PGOOptions > PGOOpt=None, PassInstrumentationCallbacks *PIC=nullptr)
Definition: PassBuilder.cpp:450
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:261
llvm::PassBuilder::OptimizationLevel::O0
static const OptimizationLevel O0
Disable as many optimizations as possible.
Definition: PassBuilder.h:183
llvm::PassBuilder::parsePassPipeline
Error parsePassPipeline(ModulePassManager &MPM, StringRef PipelineText)
Parse a textual pass pipeline description into a ModulePassManager.
Definition: PassBuilder.cpp:3013
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:668
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:256
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:633
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:265
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:155
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:812
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:1532
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:3144
llvm::PassBuilder::isAAPassName
bool isAAPassName(StringRef PassName)
Returns true if the pass name is the name of an alias analysis pass.
Definition: PassBuilder.cpp:3133
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:617
llvm::PassBuilder::registerPipelineParsingCallback
void registerPipelineParsingCallback(const std::function< bool(StringRef Name, ModulePassManager &, ArrayRef< PipelineElement >)> &C)
Definition: PassBuilder.h:678
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:267
llvm::PassBuilder::buildLTOPreLinkDefaultPipeline
ModulePassManager buildLTOPreLinkDefaultPipeline(OptimizationLevel Level)
Build a pre-link, LTO-targeting default optimization pipeline to a pass manager.
Definition: PassBuilder.cpp:1649
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:598
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:1658
llvm::InvalidateAnalysisPass
A no-op pass template which simply forces a specific analysis result to be invalidated.
Definition: PassManager.h:1271
llvm::PassBuilder::buildThinLTODefaultPipeline
ModulePassManager buildThinLTODefaultPipeline(OptimizationLevel Level, const ModuleSummaryIndex *ImportSummary)
Build an ThinLTO default optimization pipeline to a pass manager.
Definition: PassBuilder.cpp:1593
llvm::PassBuilder::buildDefaultAAPipeline
AAManager buildDefaultAAPipeline()
Build the default AAManager with the default alias analysis pipeline registered.
Definition: PassBuilder.cpp:2008
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:258
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::PassBuilder::printPassNames
void printPassNames(raw_ostream &OS)
Print pass names.
Definition: PassBuilder.cpp:3171
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:566
llvm::PassBuilder::registerAnalysisRegistrationCallback
void registerAnalysisRegistrationCallback(const std::function< void(FunctionAnalysisManager &)> &C)
Definition: PassBuilder.h:645
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:663
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:242
LoopPassManager.h
llvm::PassBuilder::PipelineElement::Name
StringRef Name
Definition: PassBuilder.h:156
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:556
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::PassBuilder::registerParseTopLevelPipelineCallback
void registerParseTopLevelPipelineCallback(const std::function< bool(ModulePassManager &, ArrayRef< PipelineElement >, bool DebugLogging)> &C)
Register a callback for a top-level pipeline entry.
Definition: PassBuilder.cpp:3215
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:673
llvm::PassBuilder::parseAAPipeline
Error parseAAPipeline(AAManager &AA, StringRef PipelineText)
Parse a textual alias analysis pipeline into the provided AA manager.
Definition: PassBuilder.cpp:3113
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:164
llvm::PassBuilder::buildPerModuleDefaultPipeline
ModulePassManager buildPerModuleDefaultPipeline(OptimizationLevel Level, bool LTOPreLink=false)
Build a per-module default optimization pipeline.
Definition: PassBuilder.cpp:1491
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:231
PassManager.h
llvm::PassBuilder::registerAnalysisRegistrationCallback
void registerAnalysisRegistrationCallback(const std::function< void(LoopAnalysisManager &)> &C)
Definition: PassBuilder.h:649
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:1913
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:2988
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:587
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:542
llvm::RequireAnalysisPass
A utility pass template to force an analysis result to be available.
Definition: PassManager.h:1249
llvm::PassBuilder::buildModuleSimplificationPipeline
ModulePassManager buildModuleSimplificationPipeline(OptimizationLevel Level, ThinOrFullLTOPhase Phase)
Construct the core LLVM module canonicalization and simplification pipeline.
Definition: PassBuilder.cpp:1040
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:653
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::PassManager::addPass
std::enable_if_t<!std::is_same< PassT, PassManager >::value > addPass(PassT Pass)
Definition: PassManager.h:553
PassName
static const char PassName[]
Definition: X86LowerAMXIntrinsics.cpp:666
llvm::PassBuilder::PipelineElement::InnerPipeline
std::vector< PipelineElement > InnerPipeline
Definition: PassBuilder.h:157
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:1167