MLIR  15.0.0git
Classes | Public Types | Public Member Functions | List of all members
mlir::FrozenRewritePatternSet Class Reference

This class represents a frozen set of patterns that can be processed by a pattern applicator. More...

#include "mlir/Rewrite/FrozenRewritePatternSet.h"

Public Types

using OpSpecificNativePatternListT = DenseMap< OperationName, std::vector< RewritePattern * > >
 A map of operation specific native patterns. More...
 

Public Member Functions

 FrozenRewritePatternSet ()
 
 FrozenRewritePatternSet (FrozenRewritePatternSet &&patterns)=default
 
 FrozenRewritePatternSet (const FrozenRewritePatternSet &patterns)=default
 
FrozenRewritePatternSetoperator= (const FrozenRewritePatternSet &patterns)=default
 
FrozenRewritePatternSetoperator= (FrozenRewritePatternSet &&patterns)=default
 
 ~FrozenRewritePatternSet ()
 
 FrozenRewritePatternSet (RewritePatternSet &&patterns, ArrayRef< std::string > disabledPatternLabels=llvm::None, ArrayRef< std::string > enabledPatternLabels=llvm::None)
 Freeze the patterns held in patterns, and take ownership. More...
 
const OpSpecificNativePatternListTgetOpSpecificNativePatterns () const
 Return the op specific native patterns held by this list. More...
 
iterator_range< llvm::pointee_iterator< NativePatternListT::const_iterator > > getMatchAnyOpNativePatterns () const
 Return the "match any" native patterns held by this list. More...
 
const detail::PDLByteCodegetPDLByteCode () const
 Return the compiled PDL bytecode held by this list. More...
 

Detailed Description

This class represents a frozen set of patterns that can be processed by a pattern applicator.

This class is designed to enable caching pattern lists such that they need not be continuously recomputed. Note that all copies of this class share the same compiled pattern list, allowing for a reduction in the number of duplicated patterns that need to be created.

Definition at line 24 of file FrozenRewritePatternSet.h.

Member Typedef Documentation

◆ OpSpecificNativePatternListT

A map of operation specific native patterns.

Definition at line 30 of file FrozenRewritePatternSet.h.

Constructor & Destructor Documentation

◆ FrozenRewritePatternSet() [1/4]

FrozenRewritePatternSet::FrozenRewritePatternSet ( )

Definition at line 53 of file FrozenRewritePatternSet.cpp.

◆ FrozenRewritePatternSet() [2/4]

mlir::FrozenRewritePatternSet::FrozenRewritePatternSet ( FrozenRewritePatternSet &&  patterns)
default

◆ FrozenRewritePatternSet() [3/4]

mlir::FrozenRewritePatternSet::FrozenRewritePatternSet ( const FrozenRewritePatternSet patterns)
default

◆ ~FrozenRewritePatternSet()

FrozenRewritePatternSet::~FrozenRewritePatternSet ( )
default

Referenced by FrozenRewritePatternSet().

◆ FrozenRewritePatternSet() [4/4]

FrozenRewritePatternSet::FrozenRewritePatternSet ( RewritePatternSet &&  patterns,
ArrayRef< std::string >  disabledPatternLabels = llvm::None,
ArrayRef< std::string >  enabledPatternLabels = llvm::None 
)

Freeze the patterns held in patterns, and take ownership.

disabledPatternLabels is a set of labels used to filter out input patterns with a debug label or debug name in this set. enabledPatternLabels is a set of labels used to filter out input patterns that do not have one of the labels in this set. Debug labels must be set explicitly on patterns or when adding them with RewritePatternSet::addWithLabel. Debug names may be empty, but patterns created with RewritePattern::create have their default debug name set to their type name.

Definition at line 56 of file FrozenRewritePatternSet.cpp.

References convertPDLToPDLInterp(), mlir::failed(), mlir::PDLPatternModule::getModule(), mlir::OperationName::hasInterface(), mlir::RegisteredOperationName::hasTrait(), mlir::PDLPatternModule::takeConstraintFunctions(), mlir::PDLPatternModule::takeRewriteFunctions(), and ~FrozenRewritePatternSet().

Member Function Documentation

◆ getMatchAnyOpNativePatterns()

iterator_range<llvm::pointee_iterator<NativePatternListT::const_iterator> > mlir::FrozenRewritePatternSet::getMatchAnyOpNativePatterns ( ) const
inline

Return the "match any" native patterns held by this list.

Definition at line 62 of file FrozenRewritePatternSet.h.

Referenced by mlir::PatternApplicator::applyCostModel(), and mlir::PatternApplicator::walkAllPatterns().

◆ getOpSpecificNativePatterns()

const OpSpecificNativePatternListT& mlir::FrozenRewritePatternSet::getOpSpecificNativePatterns ( ) const
inline

Return the op specific native patterns held by this list.

Definition at line 56 of file FrozenRewritePatternSet.h.

Referenced by mlir::PatternApplicator::applyCostModel(), and mlir::PatternApplicator::walkAllPatterns().

◆ getPDLByteCode()

const detail::PDLByteCode* mlir::FrozenRewritePatternSet::getPDLByteCode ( ) const
inline

Return the compiled PDL bytecode held by this list.

Returns null if there are no PDL patterns within the list.

Definition at line 69 of file FrozenRewritePatternSet.h.

Referenced by mlir::PatternApplicator::applyCostModel(), mlir::PatternApplicator::matchAndRewrite(), mlir::PatternApplicator::PatternApplicator(), and mlir::PatternApplicator::walkAllPatterns().

◆ operator=() [1/2]

FrozenRewritePatternSet& mlir::FrozenRewritePatternSet::operator= ( const FrozenRewritePatternSet patterns)
default

◆ operator=() [2/2]

FrozenRewritePatternSet& mlir::FrozenRewritePatternSet::operator= ( FrozenRewritePatternSet &&  patterns)
default

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