MLIR  17.0.0git
Pass.h
Go to the documentation of this file.
1 //===- Pass.h - Base classes for compiler passes ----------------*- 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 
9 #ifndef MLIR_PASS_PASS_H
10 #define MLIR_PASS_PASS_H
11 
13 #include "mlir/Pass/PassRegistry.h"
15 #include "llvm/ADT/PointerIntPair.h"
16 #include "llvm/ADT/Statistic.h"
17 #include <optional>
18 
19 namespace mlir {
20 namespace detail {
21 class OpToOpPassAdaptor;
22 struct OpPassManagerImpl;
23 
24 /// The state for a single execution of a pass. This provides a unified
25 /// interface for accessing and initializing necessary state for pass execution.
32 
33  /// The current operation being transformed and a bool for if the pass
34  /// signaled a failure.
35  llvm::PointerIntPair<Operation *, 1, bool> irAndPassFailed;
36 
37  /// The analysis manager for the operation.
39 
40  /// The set of preserved analyses for the current execution.
42 
43  /// This is a callback in the PassManager that allows to schedule dynamic
44  /// pipelines that will be rooted at the provided operation.
46 };
47 } // namespace detail
48 
49 /// The abstract base pass class. This class contains information describing the
50 /// derived pass object, e.g its kind and abstract TypeID.
51 class Pass {
52 public:
53  virtual ~Pass() = default;
54 
55  /// Returns the unique identifier that corresponds to this pass.
56  TypeID getTypeID() const { return passID; }
57 
58  /// Returns the pass info for the specified pass class or null if unknown.
59  static const PassInfo *lookupPassInfo(StringRef passArg);
60 
61  /// Returns the pass info for this pass, or null if unknown.
62  const PassInfo *lookupPassInfo() const {
63  return lookupPassInfo(getArgument());
64  }
65 
66  /// Returns the derived pass name.
67  virtual StringRef getName() const = 0;
68 
69  /// Register dependent dialects for the current pass.
70  /// A pass is expected to register the dialects it will create entities for
71  /// (Operations, Types, Attributes), other than dialect that exists in the
72  /// input. For example, a pass that converts from Linalg to Affine would
73  /// register the Affine dialect but does not need to register Linalg.
74  virtual void getDependentDialects(DialectRegistry &registry) const {}
75 
76  /// Return the command line argument used when registering this pass. Return
77  /// an empty string if one does not exist.
78  virtual StringRef getArgument() const { return ""; }
79 
80  /// Return the command line description used when registering this pass.
81  /// Return an empty string if one does not exist.
82  virtual StringRef getDescription() const { return ""; }
83 
84  /// Returns the name of the operation that this pass operates on, or
85  /// std::nullopt if this is a generic OperationPass.
86  std::optional<StringRef> getOpName() const { return opName; }
87 
88  //===--------------------------------------------------------------------===//
89  // Options
90  //===--------------------------------------------------------------------===//
91 
92  /// This class represents a specific pass option, with a provided data type.
93  template <typename DataType,
94  typename OptionParser = detail::PassOptions::OptionParser<DataType>>
95  struct Option : public detail::PassOptions::Option<DataType, OptionParser> {
96  template <typename... Args>
97  Option(Pass &parent, StringRef arg, Args &&...args)
98  : detail::PassOptions::Option<DataType, OptionParser>(
99  parent.passOptions, arg, std::forward<Args>(args)...) {}
101  };
102  /// This class represents a specific pass option that contains a list of
103  /// values of the provided data type.
104  template <typename DataType,
105  typename OptionParser = detail::PassOptions::OptionParser<DataType>>
106  struct ListOption
107  : public detail::PassOptions::ListOption<DataType, OptionParser> {
108  template <typename... Args>
109  ListOption(Pass &parent, StringRef arg, Args &&...args)
110  : detail::PassOptions::ListOption<DataType, OptionParser>(
111  parent.passOptions, arg, std::forward<Args>(args)...) {}
113  };
114 
115  /// Attempt to initialize the options of this pass from the given string.
116  /// Derived classes may override this method to hook into the point at which
117  /// options are initialized, but should generally always invoke this base
118  /// class variant.
119  virtual LogicalResult initializeOptions(StringRef options);
120 
121  /// Prints out the pass in the textual representation of pipelines. If this is
122  /// an adaptor pass, print its pass managers.
123  void printAsTextualPipeline(raw_ostream &os);
124 
125  //===--------------------------------------------------------------------===//
126  // Statistics
127  //===--------------------------------------------------------------------===//
128 
129  /// This class represents a single pass statistic. This statistic functions
130  /// similarly to an unsigned integer value, and may be updated and incremented
131  /// accordingly. This class can be used to provide additional information
132  /// about the transformations and analyses performed by a pass.
133  class Statistic : public llvm::Statistic {
134  public:
135  /// The statistic is initialized by the pass owner, a name, and a
136  /// description.
137  Statistic(Pass *owner, const char *name, const char *description);
138 
139  /// Assign the statistic to the given value.
140  Statistic &operator=(unsigned value);
141  };
142 
143  /// Returns the main statistics for this pass instance.
144  ArrayRef<Statistic *> getStatistics() const { return statistics; }
146 
147  /// Returns the thread sibling of this pass.
148  ///
149  /// If this pass was cloned by the pass manager for the sake of
150  /// multi-threading, this function returns the original pass it was cloned
151  /// from. This is useful for diagnostic purposes to distinguish passes that
152  /// were replicated for threading purposes from passes instantiated by the
153  /// user. Used to collapse passes in timing statistics.
154  const Pass *getThreadingSibling() const { return threadingSibling; }
155 
156  /// Returns the thread sibling of this pass, or the pass itself it has no
157  /// sibling. See `getThreadingSibling()` for details.
159  return threadingSibling ? threadingSibling : this;
160  }
161 
162 protected:
163  explicit Pass(TypeID passID, std::optional<StringRef> opName = std::nullopt)
164  : passID(passID), opName(opName) {}
165  Pass(const Pass &other) : Pass(other.passID, other.opName) {}
166 
167  /// Returns the current pass state.
169  assert(passState && "pass state was never initialized");
170  return *passState;
171  }
172 
173  /// Return the MLIR context for the current operation being transformed.
175 
176  /// The polymorphic API that runs the pass over the currently held operation.
177  virtual void runOnOperation() = 0;
178 
179  /// Initialize any complex state necessary for running this pass. This hook
180  /// should not rely on any state accessible during the execution of a pass.
181  /// For example, `getContext`/`getOperation`/`getAnalysis`/etc. should not be
182  /// invoked within this hook.
183  /// Returns a LogicalResult to indicate failure, in which case the pass
184  /// pipeline won't execute.
185  virtual LogicalResult initialize(MLIRContext *context) { return success(); }
186 
187  /// Indicate if the current pass can be scheduled on the given operation type.
188  /// This is useful for generic operation passes to add restrictions on the
189  /// operations they operate on.
190  virtual bool canScheduleOn(RegisteredOperationName opName) const = 0;
191 
192  /// Schedule an arbitrary pass pipeline on the provided operation.
193  /// This can be invoke any time in a pass to dynamic schedule more passes.
194  /// The provided operation must be the current one or one nested below.
196  return passState->pipelineExecutor(pipeline, op);
197  }
198 
199  /// A clone method to create a copy of this pass.
200  std::unique_ptr<Pass> clone() const {
201  auto newInst = clonePass();
202  newInst->copyOptionValuesFrom(this);
203  return newInst;
204  }
205 
206  /// Return the current operation being transformed.
208  return getPassState().irAndPassFailed.getPointer();
209  }
210 
211  /// Signal that some invariant was broken when running. The IR is allowed to
212  /// be in an invalid state.
213  void signalPassFailure() { getPassState().irAndPassFailed.setInt(true); }
214 
215  /// Query an analysis for the current ir unit.
216  template <typename AnalysisT>
217  AnalysisT &getAnalysis() {
218  return getAnalysisManager().getAnalysis<AnalysisT>();
219  }
220 
221  /// Query an analysis for the current ir unit of a specific derived operation
222  /// type.
223  template <typename AnalysisT, typename OpT>
224  AnalysisT &getAnalysis() {
225  return getAnalysisManager().getAnalysis<AnalysisT, OpT>();
226  }
227 
228  /// Query a cached instance of an analysis for the current ir unit if one
229  /// exists.
230  template <typename AnalysisT>
231  std::optional<std::reference_wrapper<AnalysisT>> getCachedAnalysis() {
232  return getAnalysisManager().getCachedAnalysis<AnalysisT>();
233  }
234 
235  /// Mark all analyses as preserved.
238  }
239 
240  /// Mark the provided analyses as preserved.
241  template <typename... AnalysesT>
243  getPassState().preservedAnalyses.preserve<AnalysesT...>();
244  }
247  }
248 
249  /// Returns the analysis for the given parent operation if it exists.
250  template <typename AnalysisT>
251  std::optional<std::reference_wrapper<AnalysisT>>
253  return getAnalysisManager().getCachedParentAnalysis<AnalysisT>(parent);
254  }
255 
256  /// Returns the analysis for the parent operation if it exists.
257  template <typename AnalysisT>
258  std::optional<std::reference_wrapper<AnalysisT>> getCachedParentAnalysis() {
259  return getAnalysisManager().getCachedParentAnalysis<AnalysisT>(
261  }
262 
263  /// Returns the analysis for the given child operation if it exists.
264  template <typename AnalysisT>
265  std::optional<std::reference_wrapper<AnalysisT>>
267  return getAnalysisManager().getCachedChildAnalysis<AnalysisT>(child);
268  }
269 
270  /// Returns the analysis for the given child operation, or creates it if it
271  /// doesn't exist.
272  template <typename AnalysisT>
273  AnalysisT &getChildAnalysis(Operation *child) {
274  return getAnalysisManager().getChildAnalysis<AnalysisT>(child);
275  }
276 
277  /// Returns the analysis for the given child operation of specific derived
278  /// operation type, or creates it if it doesn't exist.
279  template <typename AnalysisT, typename OpTy>
280  AnalysisT &getChildAnalysis(OpTy child) {
281  return getAnalysisManager().getChildAnalysis<AnalysisT>(child);
282  }
283 
284  /// Returns the current analysis manager.
286  return getPassState().analysisManager;
287  }
288 
289  /// Create a copy of this pass, ignoring statistics and options.
290  virtual std::unique_ptr<Pass> clonePass() const = 0;
291 
292  /// Copy the option values from 'other', which is another instance of this
293  /// pass.
294  void copyOptionValuesFrom(const Pass *other);
295 
296 private:
297  /// Out of line virtual method to ensure vtables and metadata are emitted to a
298  /// single .o file.
299  virtual void anchor();
300 
301  /// Represents a unique identifier for the pass.
302  TypeID passID;
303 
304  /// The name of the operation that this pass operates on, or std::nullopt if
305  /// this is a generic OperationPass.
306  std::optional<StringRef> opName;
307 
308  /// The current execution state for the pass.
309  std::optional<detail::PassExecutionState> passState;
310 
311  /// The set of statistics held by this pass.
312  std::vector<Statistic *> statistics;
313 
314  /// The pass options registered to this pass instance.
315  detail::PassOptions passOptions;
316 
317  /// A pointer to the pass this pass was cloned from, if the clone was made by
318  /// the pass manager for the sake of multi-threading.
319  const Pass *threadingSibling = nullptr;
320 
321  /// Allow access to 'clone'.
322  friend class OpPassManager;
323 
324  /// Allow access to 'canScheduleOn'.
326 
327  /// Allow access to 'passState'.
329 
330  /// Allow access to 'passOptions'.
331  friend class PassInfo;
332 };
333 
334 //===----------------------------------------------------------------------===//
335 // Pass Model Definitions
336 //===----------------------------------------------------------------------===//
337 
338 /// Pass to transform an operation of a specific type.
339 ///
340 /// Operation passes must not:
341 /// - modify any other operations within the parent region, as other threads
342 /// may be manipulating them concurrently.
343 /// - modify any state within the parent operation, this includes adding
344 /// additional operations.
345 ///
346 /// Derived operation passes are expected to provide the following:
347 /// - A 'void runOnOperation()' method.
348 /// - A 'StringRef getName() const' method.
349 /// - A 'std::unique_ptr<Pass> clonePass() const' method.
350 template <typename OpT = void>
351 class OperationPass : public Pass {
352 protected:
353  OperationPass(TypeID passID) : Pass(passID, OpT::getOperationName()) {}
354  OperationPass(const OperationPass &) = default;
355 
356  /// Support isa/dyn_cast functionality.
357  static bool classof(const Pass *pass) {
358  return pass->getOpName() == OpT::getOperationName();
359  }
360 
361  /// Indicate if the current pass can be scheduled on the given operation type.
362  bool canScheduleOn(RegisteredOperationName opName) const final {
363  return opName.getStringRef() == getOpName();
364  }
365 
366  /// Return the current operation being transformed.
367  OpT getOperation() { return cast<OpT>(Pass::getOperation()); }
368 
369  /// Query an analysis for the current operation of the specific derived
370  /// operation type.
371  template <typename AnalysisT>
372  AnalysisT &getAnalysis() {
373  return Pass::getAnalysis<AnalysisT, OpT>();
374  }
375 };
376 
377 /// Pass to transform an operation.
378 ///
379 /// Operation passes must not:
380 /// - modify any other operations within the parent region, as other threads
381 /// may be manipulating them concurrently.
382 /// - modify any state within the parent operation, this includes adding
383 /// additional operations.
384 ///
385 /// Derived operation passes are expected to provide the following:
386 /// - A 'void runOnOperation()' method.
387 /// - A 'StringRef getName() const' method.
388 /// - A 'std::unique_ptr<Pass> clonePass() const' method.
389 template <>
390 class OperationPass<void> : public Pass {
391 protected:
392  OperationPass(TypeID passID) : Pass(passID) {}
393  OperationPass(const OperationPass &) = default;
394 
395  /// Indicate if the current pass can be scheduled on the given operation type.
396  /// By default, generic operation passes can be scheduled on any operation.
397  bool canScheduleOn(RegisteredOperationName opName) const override {
398  return true;
399  }
400 };
401 
402 /// Pass to transform an operation that implements the given interface.
403 ///
404 /// Interface passes must not:
405 /// - modify any other operations within the parent region, as other threads
406 /// may be manipulating them concurrently.
407 /// - modify any state within the parent operation, this includes adding
408 /// additional operations.
409 ///
410 /// Derived interface passes are expected to provide the following:
411 /// - A 'void runOnOperation()' method.
412 /// - A 'StringRef getName() const' method.
413 /// - A 'std::unique_ptr<Pass> clonePass() const' method.
414 template <typename InterfaceT>
415 class InterfacePass : public OperationPass<> {
416 protected:
418 
419  /// Indicate if the current pass can be scheduled on the given operation type.
420  /// For an InterfacePass, this checks if the operation implements the given
421  /// interface.
422  bool canScheduleOn(RegisteredOperationName opName) const final {
423  return opName.hasInterface<InterfaceT>();
424  }
425 
426  /// Return the current operation being transformed.
427  InterfaceT getOperation() { return cast<InterfaceT>(Pass::getOperation()); }
428 
429  /// Query an analysis for the current operation.
430  template <typename AnalysisT>
431  AnalysisT &getAnalysis() {
432  return Pass::getAnalysis<AnalysisT, InterfaceT>();
433  }
434 };
435 
436 /// This class provides a CRTP wrapper around a base pass class to define
437 /// several necessary utility methods. This should only be used for passes that
438 /// are not suitably represented using the declarative pass specification(i.e.
439 /// tablegen backend).
440 template <typename PassT, typename BaseT>
441 class PassWrapper : public BaseT {
442 public:
443  /// Support isa/dyn_cast functionality for the derived pass class.
444  static bool classof(const Pass *pass) {
445  return pass->getTypeID() == TypeID::get<PassT>();
446  }
447 
448 protected:
449  PassWrapper() : BaseT(TypeID::get<PassT>()) {}
450  PassWrapper(const PassWrapper &) = default;
451 
452  /// Returns the derived pass name.
453  StringRef getName() const override { return llvm::getTypeName<PassT>(); }
454 
455  /// A clone method to create a copy of this pass.
456  std::unique_ptr<Pass> clonePass() const override {
457  return std::make_unique<PassT>(*static_cast<const PassT *>(this));
458  }
459 };
460 
461 } // namespace mlir
462 
463 #endif // MLIR_PASS_PASS_H
static llvm::ManagedStatic< PassManagerOptions > options
This class represents an analysis manager for a particular operation instance.
std::optional< std::reference_wrapper< AnalysisT > > getCachedChildAnalysis(Operation *op) const
Query for a cached analysis of a child operation, or return null.
std::optional< std::reference_wrapper< AnalysisT > > getCachedAnalysis() const
Query for a cached entry of the given analysis on the current operation.
AnalysisT & getAnalysis()
Query for the given analysis for the current operation.
std::optional< std::reference_wrapper< AnalysisT > > getCachedParentAnalysis(Operation *parentOp) const
Query for a cached analysis on the given parent operation.
AnalysisT & getChildAnalysis(Operation *op)
Query for an analysis of a child operation, constructing it if necessary.
The DialectRegistry maps a dialect namespace to a constructor for the matching dialect.
Pass to transform an operation that implements the given interface.
Definition: Pass.h:415
AnalysisT & getAnalysis()
Query an analysis for the current operation.
Definition: Pass.h:431
bool canScheduleOn(RegisteredOperationName opName) const final
Indicate if the current pass can be scheduled on the given operation type.
Definition: Pass.h:422
InterfaceT getOperation()
Return the current operation being transformed.
Definition: Pass.h:427
MLIRContext is the top-level object for a collection of MLIR operations.
Definition: MLIRContext.h:60
This class represents a pass manager that runs passes on either a specific operation type,...
Definition: PassManager.h:52
OperationPass(TypeID passID)
Definition: Pass.h:392
OperationPass(const OperationPass &)=default
bool canScheduleOn(RegisteredOperationName opName) const override
Indicate if the current pass can be scheduled on the given operation type.
Definition: Pass.h:397
Pass to transform an operation of a specific type.
Definition: Pass.h:351
OperationPass(TypeID passID)
Definition: Pass.h:353
static bool classof(const Pass *pass)
Support isa/dyn_cast functionality.
Definition: Pass.h:357
AnalysisT & getAnalysis()
Query an analysis for the current operation of the specific derived operation type.
Definition: Pass.h:372
OperationPass(const OperationPass &)=default
OpT getOperation()
Return the current operation being transformed.
Definition: Pass.h:367
bool canScheduleOn(RegisteredOperationName opName) const final
Indicate if the current pass can be scheduled on the given operation type.
Definition: Pass.h:362
Operation is the basic unit of execution within MLIR.
Definition: Operation.h:75
MLIRContext * getContext()
Return the context this operation is associated with.
Definition: Operation.h:200
Operation * getParentOp()
Returns the closest surrounding operation that contains this operation or nullptr if this is a top-le...
Definition: Operation.h:218
A structure to represent the information for a derived pass class.
Definition: PassRegistry.h:111
This class provides a CRTP wrapper around a base pass class to define several necessary utility metho...
Definition: Pass.h:441
PassWrapper(const PassWrapper &)=default
std::unique_ptr< Pass > clonePass() const override
A clone method to create a copy of this pass.
Definition: Pass.h:456
StringRef getName() const override
Returns the derived pass name.
Definition: Pass.h:453
static bool classof(const Pass *pass)
Support isa/dyn_cast functionality for the derived pass class.
Definition: Pass.h:444
This class represents a single pass statistic.
Definition: Pass.h:133
Statistic(Pass *owner, const char *name, const char *description)
The statistic is initialized by the pass owner, a name, and a description.
Statistic & operator=(unsigned value)
Assign the statistic to the given value.
The abstract base pass class.
Definition: Pass.h:51
void copyOptionValuesFrom(const Pass *other)
Copy the option values from 'other', which is another instance of this pass.
Definition: Pass.cpp:58
void printAsTextualPipeline(raw_ostream &os)
Prints out the pass in the textual representation of pipelines.
Definition: Pass.cpp:64
AnalysisManager getAnalysisManager()
Returns the current analysis manager.
Definition: Pass.h:285
MutableArrayRef< Statistic * > getStatistics()
Definition: Pass.h:145
AnalysisT & getChildAnalysis(OpTy child)
Returns the analysis for the given child operation of specific derived operation type,...
Definition: Pass.h:280
virtual std::unique_ptr< Pass > clonePass() const =0
Create a copy of this pass, ignoring statistics and options.
void markAllAnalysesPreserved()
Mark all analyses as preserved.
Definition: Pass.h:236
virtual bool canScheduleOn(RegisteredOperationName opName) const =0
Indicate if the current pass can be scheduled on the given operation type.
TypeID getTypeID() const
Returns the unique identifier that corresponds to this pass.
Definition: Pass.h:56
std::optional< std::reference_wrapper< AnalysisT > > getCachedChildAnalysis(Operation *child)
Returns the analysis for the given child operation if it exists.
Definition: Pass.h:266
Pass(TypeID passID, std::optional< StringRef > opName=std::nullopt)
Definition: Pass.h:163
virtual StringRef getDescription() const
Return the command line description used when registering this pass.
Definition: Pass.h:82
std::optional< std::reference_wrapper< AnalysisT > > getCachedAnalysis()
Query a cached instance of an analysis for the current ir unit if one exists.
Definition: Pass.h:231
AnalysisT & getAnalysis()
Query an analysis for the current ir unit of a specific derived operation type.
Definition: Pass.h:224
std::optional< std::reference_wrapper< AnalysisT > > getCachedParentAnalysis()
Returns the analysis for the parent operation if it exists.
Definition: Pass.h:258
LogicalResult runPipeline(OpPassManager &pipeline, Operation *op)
Schedule an arbitrary pass pipeline on the provided operation.
Definition: Pass.h:195
virtual LogicalResult initializeOptions(StringRef options)
Attempt to initialize the options of this pass from the given string.
Definition: Pass.cpp:52
std::optional< StringRef > getOpName() const
Returns the name of the operation that this pass operates on, or std::nullopt if this is a generic Op...
Definition: Pass.h:86
virtual void runOnOperation()=0
The polymorphic API that runs the pass over the currently held operation.
ArrayRef< Statistic * > getStatistics() const
Returns the main statistics for this pass instance.
Definition: Pass.h:144
std::unique_ptr< Pass > clone() const
A clone method to create a copy of this pass.
Definition: Pass.h:200
virtual ~Pass()=default
detail::PassExecutionState & getPassState()
Returns the current pass state.
Definition: Pass.h:168
const Pass * getThreadingSiblingOrThis() const
Returns the thread sibling of this pass, or the pass itself it has no sibling.
Definition: Pass.h:158
const Pass * getThreadingSibling() const
Returns the thread sibling of this pass.
Definition: Pass.h:154
AnalysisT & getChildAnalysis(Operation *child)
Returns the analysis for the given child operation, or creates it if it doesn't exist.
Definition: Pass.h:273
virtual LogicalResult initialize(MLIRContext *context)
Initialize any complex state necessary for running this pass.
Definition: Pass.h:185
virtual void getDependentDialects(DialectRegistry &registry) const
Register dependent dialects for the current pass.
Definition: Pass.h:74
void markAnalysesPreserved(TypeID id)
Definition: Pass.h:245
virtual StringRef getName() const =0
Returns the derived pass name.
void markAnalysesPreserved()
Mark the provided analyses as preserved.
Definition: Pass.h:242
Pass(const Pass &other)
Definition: Pass.h:165
Operation * getOperation()
Return the current operation being transformed.
Definition: Pass.h:207
void signalPassFailure()
Signal that some invariant was broken when running.
Definition: Pass.h:213
std::optional< std::reference_wrapper< AnalysisT > > getCachedParentAnalysis(Operation *parent)
Returns the analysis for the given parent operation if it exists.
Definition: Pass.h:252
const PassInfo * lookupPassInfo() const
Returns the pass info for this pass, or null if unknown.
Definition: Pass.h:62
virtual StringRef getArgument() const
Return the command line argument used when registering this pass.
Definition: Pass.h:78
MLIRContext & getContext()
Return the MLIR context for the current operation being transformed.
Definition: Pass.h:174
AnalysisT & getAnalysis()
Query an analysis for the current ir unit.
Definition: Pass.h:217
This is a "type erased" representation of a registered operation.
This class provides an efficient unique identifier for a specific C++ type.
Definition: TypeID.h:104
An adaptor pass used to run operation passes over nested operations.
Definition: PassDetail.h:45
This class represents a specific pass option that contains a list of values of the provided data type...
Definition: PassOptions.h:207
This class represents a specific pass option, with a provided data type.
Definition: PassOptions.h:160
Base container class and manager for all pass options.
Definition: PassOptions.h:79
std::conditional_t< std::is_base_of< llvm::cl::generic_parser_base, llvm::cl::parser< DataType > >::value, GenericOptionParser< DataType >, llvm::cl::parser< DataType > > OptionParser
The specific parser to use depending on llvm::cl parser used.
Definition: PassOptions.h:154
A utility class to represent the analyses that are known to be preserved.
void preserveAll()
Mark all analyses as preserved.
void preserve()
Preserve the given analyses.
This header declares functions that assit transformations in the MemRef dialect.
LogicalResult success(bool isSuccess=true)
Utility function to generate a LogicalResult.
Definition: LogicalResult.h:56
This class represents an efficient way to signal success or failure.
Definition: LogicalResult.h:26
This class represents a specific pass option that contains a list of values of the provided data type...
Definition: Pass.h:107
ListOption(Pass &parent, StringRef arg, Args &&...args)
Definition: Pass.h:109
This class represents a specific pass option, with a provided data type.
Definition: Pass.h:95
Option(Pass &parent, StringRef arg, Args &&...args)
Definition: Pass.h:97
The state for a single execution of a pass.
Definition: Pass.h:26
detail::PreservedAnalyses preservedAnalyses
The set of preserved analyses for the current execution.
Definition: Pass.h:41
function_ref< LogicalResult(OpPassManager &, Operation *)> pipelineExecutor
This is a callback in the PassManager that allows to schedule dynamic pipelines that will be rooted a...
Definition: Pass.h:45
AnalysisManager analysisManager
The analysis manager for the operation.
Definition: Pass.h:38
llvm::PointerIntPair< Operation *, 1, bool > irAndPassFailed
The current operation being transformed and a bool for if the pass signaled a failure.
Definition: Pass.h:35
PassExecutionState(Operation *ir, AnalysisManager analysisManager, function_ref< LogicalResult(OpPassManager &, Operation *)> pipelineExecutor)
Definition: Pass.h:27