MLIR 22.0.0git
mlir::RewritePatternSet Class Reference

#include "mlir/IR/PatternMatch.h"

Public Member Functions

 RewritePatternSet (MLIRContext *context)
 RewritePatternSet (MLIRContext *context, std::unique_ptr< RewritePattern > pattern)
 Construct a RewritePatternSet populated with the given pattern.
 RewritePatternSet (PDLPatternModule &&pattern)
MLIRContextgetContext () const
NativePatternListT & getNativePatterns ()
 Return the native patterns held in this list.
PDLPatternModule & getPDLPatterns ()
 Return the PDL patterns held in this list.
void clear ()
 Clear out all of the held patterns in this list.
template<typename... Ts, typename ConstructorArg, typename... ConstructorArgs, typename = std::enable_if_t<sizeof...(Ts) != 0>>
RewritePatternSetadd (ConstructorArg &&arg, ConstructorArgs &&...args)
 Add an instance of each of the pattern types 'Ts' to the pattern list with the given arguments.
template<typename... Ts, typename ConstructorArg, typename... ConstructorArgs, typename = std::enable_if_t<sizeof...(Ts) != 0>>
RewritePatternSetaddWithLabel (ArrayRef< StringRef > debugLabels, ConstructorArg &&arg, ConstructorArgs &&...args)
 An overload of the above add method that allows for attaching a set of debug labels to the attached patterns.
template<typename... Ts>
RewritePatternSetadd ()
 Add an instance of each of the pattern types 'Ts'.
RewritePatternSetadd (std::unique_ptr< RewritePattern > pattern)
 Add the given native pattern to the pattern list.
RewritePatternSetadd (PDLPatternModule &&pattern)
 Add the given PDL pattern to the pattern list.
template<typename OpType>
RewritePatternSetadd (LogicalResult(*implFn)(OpType, PatternRewriter &rewriter), PatternBenefit benefit=1, ArrayRef< StringRef > generatedNames={})
template<typename... Ts, typename ConstructorArg, typename... ConstructorArgs, typename = std::enable_if_t<sizeof...(Ts) != 0>>
RewritePatternSetinsert (ConstructorArg &&arg, ConstructorArgs &&...args)
 Add an instance of each of the pattern types 'Ts' to the pattern list with the given arguments.
template<typename... Ts>
RewritePatternSetinsert ()
 Add an instance of each of the pattern types 'Ts'.
RewritePatternSetinsert (std::unique_ptr< RewritePattern > pattern)
 Add the given native pattern to the pattern list.
RewritePatternSetinsert (PDLPatternModule &&pattern)
 Add the given PDL pattern to the pattern list.
template<typename OpType>
RewritePatternSetinsert (LogicalResult(*implFn)(OpType, PatternRewriter &rewriter))

Detailed Description

Definition at line 816 of file PatternMatch.h.

Constructor & Destructor Documentation

◆ RewritePatternSet() [1/3]

mlir::RewritePatternSet::RewritePatternSet ( MLIRContext * context)
inline

Definition at line 820 of file PatternMatch.h.

Referenced by add(), add(), add(), add(), addWithLabel(), insert(), insert(), insert(), and insert().

◆ RewritePatternSet() [2/3]

mlir::RewritePatternSet::RewritePatternSet ( MLIRContext * context,
std::unique_ptr< RewritePattern > pattern )
inline

Construct a RewritePatternSet populated with the given pattern.

Definition at line 823 of file PatternMatch.h.

◆ RewritePatternSet() [3/3]

mlir::RewritePatternSet::RewritePatternSet ( PDLPatternModule && pattern)
inline

Definition at line 828 of file PatternMatch.h.

References getContext().

Member Function Documentation

◆ add() [1/5]

template<typename... Ts>
RewritePatternSet & mlir::RewritePatternSet::add ( )
inline

Add an instance of each of the pattern types 'Ts'.

Return a reference to this for chaining insertions.

Definition at line 882 of file PatternMatch.h.

References RewritePatternSet().

Referenced by insert().

◆ add() [2/5]

template<typename... Ts, typename ConstructorArg, typename... ConstructorArgs, typename = std::enable_if_t<sizeof...(Ts) != 0>>
RewritePatternSet & mlir::RewritePatternSet::add ( ConstructorArg && arg,
ConstructorArgs &&... args )
inline

Add an instance of each of the pattern types 'Ts' to the pattern list with the given arguments.

Return a reference to this for chaining insertions. Note: ConstructorArg is necessary here to separate the two variadic lists.

Definition at line 855 of file PatternMatch.h.

References RewritePatternSet().

Referenced by mlir::spirv::populateSPIRVGLCanonicalizationPatterns().

◆ add() [3/5]

template<typename OpType>
RewritePatternSet & mlir::RewritePatternSet::add ( LogicalResult(* implFn )(OpType, PatternRewriter &rewriter),
PatternBenefit benefit = 1,
ArrayRef< StringRef > generatedNames = {} )
inline

Definition at line 904 of file PatternMatch.h.

◆ add() [4/5]

RewritePatternSet & mlir::RewritePatternSet::add ( PDLPatternModule && pattern)
inline

Add the given PDL pattern to the pattern list.

Return a reference to this for chaining insertions.

Definition at line 896 of file PatternMatch.h.

References RewritePatternSet().

◆ add() [5/5]

RewritePatternSet & mlir::RewritePatternSet::add ( std::unique_ptr< RewritePattern > pattern)
inline

Add the given native pattern to the pattern list.

Return a reference to this for chaining insertions.

Definition at line 889 of file PatternMatch.h.

References RewritePatternSet().

◆ addWithLabel()

template<typename... Ts, typename ConstructorArg, typename... ConstructorArgs, typename = std::enable_if_t<sizeof...(Ts) != 0>>
RewritePatternSet & mlir::RewritePatternSet::addWithLabel ( ArrayRef< StringRef > debugLabels,
ConstructorArg && arg,
ConstructorArgs &&... args )
inline

An overload of the above add method that allows for attaching a set of debug labels to the attached patterns.

This is useful for labeling groups of patterns that may be shared between multiple different passes/users.

Definition at line 870 of file PatternMatch.h.

References RewritePatternSet().

◆ clear()

void mlir::RewritePatternSet::clear ( )
inline

Clear out all of the held patterns in this list.

Definition at line 840 of file PatternMatch.h.

◆ getContext()

MLIRContext * mlir::RewritePatternSet::getContext ( ) const
inline

◆ getNativePatterns()

NativePatternListT & mlir::RewritePatternSet::getNativePatterns ( )
inline

Return the native patterns held in this list.

Definition at line 834 of file PatternMatch.h.

◆ getPDLPatterns()

PDLPatternModule & mlir::RewritePatternSet::getPDLPatterns ( )
inline

Return the PDL patterns held in this list.

Definition at line 837 of file PatternMatch.h.

◆ insert() [1/5]

template<typename... Ts>
RewritePatternSet & mlir::RewritePatternSet::insert ( )
inline

Add an instance of each of the pattern types 'Ts'.

Return a reference to this for chaining insertions.

Definition at line 948 of file PatternMatch.h.

References RewritePatternSet().

◆ insert() [2/5]

template<typename... Ts, typename ConstructorArg, typename... ConstructorArgs, typename = std::enable_if_t<sizeof...(Ts) != 0>>
RewritePatternSet & mlir::RewritePatternSet::insert ( ConstructorArg && arg,
ConstructorArgs &&... args )
inline

Add an instance of each of the pattern types 'Ts' to the pattern list with the given arguments.

Return a reference to this for chaining insertions. Note: ConstructorArg is necessary here to separate the two variadic lists.

Definition at line 938 of file PatternMatch.h.

References RewritePatternSet().

◆ insert() [3/5]

template<typename OpType>
RewritePatternSet & mlir::RewritePatternSet::insert ( LogicalResult(* implFn )(OpType, PatternRewriter &rewriter))
inline

Definition at line 970 of file PatternMatch.h.

References add(), and getContext().

◆ insert() [4/5]

RewritePatternSet & mlir::RewritePatternSet::insert ( PDLPatternModule && pattern)
inline

Add the given PDL pattern to the pattern list.

Return a reference to this for chaining insertions.

Definition at line 962 of file PatternMatch.h.

References RewritePatternSet().

◆ insert() [5/5]

RewritePatternSet & mlir::RewritePatternSet::insert ( std::unique_ptr< RewritePattern > pattern)
inline

Add the given native pattern to the pattern list.

Return a reference to this for chaining insertions.

Definition at line 955 of file PatternMatch.h.

References RewritePatternSet().


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