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