MLIR  21.0.0git
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
mlir::RewritePattern Class Referenceabstract

RewritePattern is the common base class for all DAG to DAG replacements. More...

#include "mlir/IR/PatternMatch.h"

+ Inheritance diagram for mlir::RewritePattern:

Public Member Functions

virtual ~RewritePattern ()=default
 
virtual LogicalResult matchAndRewrite (Operation *op, PatternRewriter &rewriter) const =0
 Attempt to match against code rooted at the specified operation, which is the same operation code as getRootKind(). More...
 
- Public Member Functions inherited from mlir::Pattern
ArrayRef< OperationNamegetGeneratedOps () const
 Return a list of operations that may be generated when rewriting an operation instance with this pattern. More...
 
std::optional< OperationNamegetRootKind () const
 Return the root node that this pattern matches. More...
 
std::optional< TypeIDgetRootInterfaceID () const
 Return the interface ID used to match the root operation of this pattern. More...
 
std::optional< TypeIDgetRootTraitID () const
 Return the trait ID used to match the root operation of this pattern. More...
 
PatternBenefit getBenefit () const
 Return the benefit (the inverse of "cost") of matching this pattern. More...
 
bool hasBoundedRewriteRecursion () const
 Returns true if this pattern is known to result in recursive application, i.e. More...
 
MLIRContextgetContext () const
 Return the MLIRContext used to create this pattern. More...
 
StringRef getDebugName () const
 Return a readable name for this pattern. More...
 
void setDebugName (StringRef name)
 Set the human readable debug name used for this pattern. More...
 
ArrayRef< StringRef > getDebugLabels () const
 Return the set of debug labels attached to this pattern. More...
 
void addDebugLabels (ArrayRef< StringRef > labels)
 Add the provided debug labels to this pattern. More...
 
void addDebugLabels (StringRef label)
 

Static Public Member Functions

template<typename T , typename... Args>
static std::unique_ptr< T > create (Args &&...args)
 This method provides a convenient interface for creating and initializing derived rewrite patterns of the given type T. More...
 

Protected Member Functions

 Pattern (StringRef rootName, PatternBenefit benefit, MLIRContext *context, ArrayRef< StringRef > generatedNames={})
 Inherit the base constructors from Pattern. More...
 
 Pattern (MatchAnyOpTypeTag tag, PatternBenefit benefit, MLIRContext *context, ArrayRef< StringRef > generatedNames={})
 Inherit the base constructors from Pattern. More...
 
 Pattern (MatchInterfaceOpTypeTag tag, TypeID interfaceID, PatternBenefit benefit, MLIRContext *context, ArrayRef< StringRef > generatedNames={})
 Inherit the base constructors from Pattern. More...
 
 Pattern (MatchTraitOpTypeTag tag, TypeID traitID, PatternBenefit benefit, MLIRContext *context, ArrayRef< StringRef > generatedNames={})
 Inherit the base constructors from Pattern. More...
 
- Protected Member Functions inherited from mlir::Pattern
 Pattern (StringRef rootName, PatternBenefit benefit, MLIRContext *context, ArrayRef< StringRef > generatedNames={})
 Construct a pattern with a certain benefit that matches the operation with the given root name. More...
 
 Pattern (MatchAnyOpTypeTag tag, PatternBenefit benefit, MLIRContext *context, ArrayRef< StringRef > generatedNames={})
 Construct a pattern that may match any operation type. More...
 
 Pattern (MatchInterfaceOpTypeTag tag, TypeID interfaceID, PatternBenefit benefit, MLIRContext *context, ArrayRef< StringRef > generatedNames={})
 Construct a pattern that may match any operation that implements the interface defined by the provided interfaceID. More...
 
 Pattern (MatchTraitOpTypeTag tag, TypeID traitID, PatternBenefit benefit, MLIRContext *context, ArrayRef< StringRef > generatedNames={})
 Construct a pattern that may match any operation that implements the trait defined by the provided traitID. More...
 
void setHasBoundedRewriteRecursion (bool hasBoundedRecursionArg=true)
 Set the flag detailing if this pattern has bounded rewrite recursion or not. More...
 

Detailed Description

RewritePattern is the common base class for all DAG to DAG replacements.

Definition at line 238 of file PatternMatch.h.

Constructor & Destructor Documentation

◆ ~RewritePattern()

virtual mlir::RewritePattern::~RewritePattern ( )
virtualdefault

Member Function Documentation

◆ create()

template<typename T , typename... Args>
static std::unique_ptr<T> mlir::RewritePattern::create ( Args &&...  args)
inlinestatic

This method provides a convenient interface for creating and initializing derived rewrite patterns of the given type T.

Definition at line 254 of file PatternMatch.h.

◆ matchAndRewrite()

virtual LogicalResult mlir::RewritePattern::matchAndRewrite ( Operation op,
PatternRewriter rewriter 
) const
pure virtual

◆ Pattern() [1/4]

Pattern::Pattern
protected

Inherit the base constructors from Pattern.

Definition at line 180 of file PatternMatch.cpp.

◆ Pattern() [2/4]

Pattern::Pattern
protected

Inherit the base constructors from Pattern.

Definition at line 188 of file PatternMatch.cpp.

◆ Pattern() [3/4]

Pattern::Pattern
protected

Inherit the base constructors from Pattern.

Definition at line 197 of file PatternMatch.cpp.

◆ Pattern() [4/4]

Pattern::Pattern
protected

Inherit the base constructors from Pattern.

Definition at line 173 of file PatternMatch.cpp.


The documentation for this class was generated from the following files: