MLIR: mlir::Pattern Class Reference (original) (raw)
This class contains all of the data related to a pattern, but does not contain any methods or logic for the actual matching. More...
#include "[mlir/IR/PatternMatch.h](PatternMatch%5F8h%5Fsource.html)"
Classes | |
---|---|
struct | MatchAnyOpTypeTag |
This class acts as a special tag that makes the desire to match "any" operation type explicit. More... | |
struct | MatchInterfaceOpTypeTag |
This class acts as a special tag that makes the desire to match any operation that implements a given interface explicit. More... | |
struct | MatchTraitOpTypeTag |
This class acts as a special tag that makes the desire to match any operation that implements a given trait explicit. More... | |
Public Member Functions | |
---|---|
ArrayRef< OperationName > | getGeneratedOps () const |
Return a list of operations that may be generated when rewriting an operation instance with this pattern. More... | |
std::optional< OperationName > | getRootKind () const |
Return the root node that this pattern matches. More... | |
std::optional< TypeID > | getRootInterfaceID () const |
Return the interface ID used to match the root operation of this pattern. More... | |
std::optional< TypeID > | getRootTraitID () 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... | |
MLIRContext * | getContext () 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) |
Protected Member Functions | |
---|---|
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... | |
This class contains all of the data related to a pattern, but does not contain any methods or logic for the actual matching.
This class is solely used to interface with the metadata of a pattern, such as the benefit or root operation.
Definition at line 73 of file PatternMatch.h.
◆ Pattern() [1/4]
Construct a pattern with a certain benefit that matches the operation with the given root name.
Definition at line 40 of file PatternMatch.cpp.
◆ Pattern() [2/4]
Construct a pattern that may match any operation type.
generatedNames
contains the names of operations that may be generated during a successful rewrite. [MatchAnyOpTypeTag](structmlir%5F1%5F1Pattern%5F1%5F1MatchAnyOpTypeTag.html "This class acts as a special tag that makes the desire to match "any" operation type explicit.")
is just a tag to ensure that the "match any" behavior is what the user actually desired, MatchAnyOpTypeTag()
should always be supplied here.
Definition at line 49 of file PatternMatch.cpp.
◆ Pattern() [3/4]
Construct a pattern that may match any operation that implements the interface defined by the provided interfaceID
.
generatedNames
contains the names of operations that may be generated during a successful rewrite. [MatchInterfaceOpTypeTag](structmlir%5F1%5F1Pattern%5F1%5F1MatchInterfaceOpTypeTag.html "This class acts as a special tag that makes the desire to match any operation that implements a given...")
is just a tag to ensure that the "match interface" behavior is what the user actually desired, MatchInterfaceOpTypeTag()
should always be supplied here.
Definition at line 57 of file PatternMatch.cpp.
◆ Pattern() [4/4]
Construct a pattern that may match any operation that implements the trait defined by the provided traitID
.
generatedNames
contains the names of operations that may be generated during a successful rewrite. [MatchTraitOpTypeTag](structmlir%5F1%5F1Pattern%5F1%5F1MatchTraitOpTypeTag.html "This class acts as a special tag that makes the desire to match any operation that implements a given...")
is just a tag to ensure that the "match trait" behavior is what the user actually desired, MatchTraitOpTypeTag()
should always be supplied here.
Definition at line 67 of file PatternMatch.cpp.
◆ addDebugLabels() [1/2]
void mlir::Pattern::addDebugLabels ( ArrayRef< StringRef > labels) | inline |
---|
Add the provided debug labels to this pattern.
Definition at line 150 of file PatternMatch.h.
◆ addDebugLabels() [2/2]
void mlir::Pattern::addDebugLabels ( StringRef label) | inline |
---|
◆ getBenefit()
int Pattern::getBenefit ( ) const | inline |
---|
◆ getContext()
MLIRContext* mlir::Pattern::getContext ( ) const | inline |
---|
◆ getDebugLabels()
ArrayRef mlir::Pattern::getDebugLabels ( ) const | inline |
---|
Return the set of debug labels attached to this pattern.
Definition at line 147 of file PatternMatch.h.
◆ getDebugName()
StringRef mlir::Pattern::getDebugName ( ) const | inline |
---|
◆ getGeneratedOps()
Return a list of operations that may be generated when rewriting an operation instance with this pattern.
Definition at line 90 of file PatternMatch.h.
◆ getRootInterfaceID()
std::optional<TypeID> mlir::Pattern::getRootInterfaceID ( ) const | inline |
---|
Return the interface ID used to match the root operation of this pattern.
If the pattern does not use an interface ID for deciding the root match, this returns std::nullopt.
Definition at line 103 of file PatternMatch.h.
References mlir::TypeID::getFromOpaquePointer().
◆ getRootKind()
std::optional<OperationName> mlir::Pattern::getRootKind ( ) const | inline |
---|
◆ getRootTraitID()
std::optional<TypeID> mlir::Pattern::getRootTraitID ( ) const | inline |
---|
◆ hasBoundedRewriteRecursion()
bool mlir::Pattern::hasBoundedRewriteRecursion ( ) const | inline |
---|
Returns true if this pattern is known to result in recursive application, i.e.
this pattern may generate IR that also matches this pattern, but is known to bound the recursion. This signals to a rewrite driver that it is safe to apply this pattern recursively to generated IR.
Definition at line 129 of file PatternMatch.h.
◆ setDebugName()
void mlir::Pattern::setDebugName ( StringRef name) | inline |
---|
Set the human readable debug name used for this pattern.
This name will only be used for debugging purposes.
Definition at line 144 of file PatternMatch.h.
◆ setHasBoundedRewriteRecursion()
void mlir::Pattern::setHasBoundedRewriteRecursion ( bool hasBoundedRecursionArg = true) | inlineprotected |
---|
Set the flag detailing if this pattern has bounded rewrite recursion or not.
Definition at line 202 of file PatternMatch.h.
The documentation for this class was generated from the following files:
- include/mlir/IR/PatternMatch.h
- lib/IR/PatternMatch.cpp
- lib/TableGen/Pattern.cpp