My Project
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
mlir::Pattern Class Referenceabstract

#include <PatternMatch.h>

Inheritance diagram for mlir::Pattern:
Inheritance graph
[legend]

Public Member Functions

PatternBenefit getBenefit () const
 
OperationName getRootKind () const
 
virtual PatternMatchResult match (Operation *op) const =0
 
virtual ~Pattern ()
 
PatternMatchResult matchSuccess (std::unique_ptr< PatternState > state={}) const
 This method indicates that a match was found and has the specified cost. More...
 

Static Public Member Functions

static PatternMatchResult matchFailure ()
 This method indicates that no match was found. More...
 

Protected Member Functions

 Pattern (StringRef rootName, PatternBenefit benefit, MLIRContext *context)
 

Detailed Description

Instances of Pattern can be matched against SSA IR. These matches get used in ways dependent on their subclasses and the driver doing the matching. For example, RewritePatterns implement a rewrite from one matched pattern to a replacement DAG tile.

Constructor & Destructor Documentation

◆ ~Pattern()

virtual mlir::Pattern::~Pattern ( )
inlinevirtual

◆ Pattern()

Pattern::Pattern ( StringRef  rootName,
PatternBenefit  benefit,
MLIRContext context 
)
protected

Patterns must specify the root operation name they match against, and can also specify the benefit of the pattern matching.

Member Function Documentation

◆ getBenefit()

PatternBenefit mlir::Pattern::getBenefit ( ) const
inline

Return the benefit (the inverse of "cost") of matching this pattern. The benefit of a Pattern is always static - rewrites that may have dynamic benefit can be instantiated multiple times (different Pattern instances) for each benefit that they may return, and be guarded by different match condition predicates.

◆ getRootKind()

OperationName mlir::Pattern::getRootKind ( ) const
inline

Return the root node that this pattern matches. Patterns that can match multiple root types are instantiated once per root.

◆ match()

virtual PatternMatchResult mlir::Pattern::match ( Operation op) const
pure virtual

◆ matchFailure()

static PatternMatchResult mlir::Pattern::matchFailure ( )
inlinestatic

This method indicates that no match was found.

◆ matchSuccess()

PatternMatchResult mlir::Pattern::matchSuccess ( std::unique_ptr< PatternState state = {}) const
inline

This method indicates that a match was found and has the specified cost.


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