MLIR  18.0.0git
Classes | Namespaces | Typedefs | Functions | Variables
PatternMatch.h File Reference
#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinOps.h"
#include "llvm/ADT/FunctionExtras.h"
#include "llvm/Support/TypeName.h"
#include <optional>

Go to the source code of this file.

Classes

class  mlir::PatternBenefit
 This class represents the benefit of a pattern match in a unitless scheme that ranges from 0 (very little benefit) to 65K. More...
 
class  mlir::Pattern
 This class contains all of the data related to a pattern, but does not contain any methods or logic for the actual matching. More...
 
struct  mlir::Pattern::MatchAnyOpTypeTag
 This class acts as a special tag that makes the desire to match "any" operation type explicit. More...
 
struct  mlir::Pattern::MatchInterfaceOpTypeTag
 This class acts as a special tag that makes the desire to match any operation that implements a given interface explicit. More...
 
struct  mlir::Pattern::MatchTraitOpTypeTag
 This class acts as a special tag that makes the desire to match any operation that implements a given trait explicit. More...
 
class  mlir::RewritePattern
 RewritePattern is the common base class for all DAG to DAG replacements. More...
 
struct  mlir::detail::OpOrInterfaceRewritePatternBase< SourceOp >
 OpOrInterfaceRewritePatternBase is a wrapper around RewritePattern that allows for matching and rewriting against an instance of a derived operation class or Interface. More...
 
struct  mlir::OpRewritePattern< SourceOp >
 OpRewritePattern is a wrapper around RewritePattern that allows for matching and rewriting against an instance of a derived operation class as opposed to a raw Operation. More...
 
struct  mlir::OpInterfaceRewritePattern< SourceOp >
 OpInterfaceRewritePattern is a wrapper around RewritePattern that allows for matching and rewriting against an instance of an operation interface instead of a raw Operation. More...
 
class  mlir::OpTraitRewritePattern< TraitType >
 OpTraitRewritePattern is a wrapper around RewritePattern that allows for matching and rewriting against instances of an operation that possess a given trait. More...
 
class  mlir::RewriterBase
 This class coordinates the application of a rewrite on a set of IR, providing a way for clients to track mutations and create new operations. More...
 
struct  mlir::RewriterBase::Listener
 
struct  mlir::RewriterBase::ForwardingListener
 A listener that forwards all notifications to another listener. More...
 
class  mlir::IRRewriter
 This class coordinates rewriting a piece of IR outside of a pattern rewrite, providing a way to keep track of the mutations made to the IR. More...
 
class  mlir::PatternRewriter
 A special type of RewriterBase that coordinates the application of a rewrite pattern on the current IR being matched, providing a way to keep track of any mutations made. More...
 
class  mlir::PDLValue
 Storage type of byte-code interpreter values. More...
 
class  mlir::PDLResultList
 The class represents a list of PDL results, returned by a native rewrite method. More...
 
class  mlir::PDLPatternConfig
 An individual configuration for a pattern, which can be accessed by native functions via the PDLPatternConfigSet. More...
 
class  mlir::PDLPatternConfigBase< T >
 This class provides a base class for users implementing a type of pattern configuration. More...
 
class  mlir::PDLPatternConfigSet
 This class contains a set of configurations for a specific pattern. More...
 
struct  mlir::detail::pdl_function_builder::ProcessPDLValueBasedOn< T, BaseT >
 This struct provides a simplified model for processing types that are based on another type, e.g. More...
 
struct  mlir::detail::pdl_function_builder::ProcessBuiltinPDLValue< T >
 This struct provides a simplified model for processing types that have "builtin" PDLValue support: More...
 
struct  mlir::detail::pdl_function_builder::ProcessDerivedPDLValue< T, BaseT >
 This struct provides a simplified model for processing types that inherit from builtin PDLValue types. More...
 
struct  mlir::detail::pdl_function_builder::ProcessPDLValue< Attribute >
 
struct  mlir::detail::pdl_function_builder::ProcessPDLValue< T, std::enable_if_t< std::is_base_of< Attribute, T >::value > >
 
struct  mlir::detail::pdl_function_builder::ProcessPDLValue< StringRef >
 Handling for various Attribute value types. More...
 
struct  mlir::detail::pdl_function_builder::ProcessPDLValue< std::string >
 
struct  mlir::detail::pdl_function_builder::ProcessPDLValue< Operation * >
 
struct  mlir::detail::pdl_function_builder::ProcessPDLValue< T, std::enable_if_t< std::is_base_of< OpState, T >::value > >
 
struct  mlir::detail::pdl_function_builder::ProcessPDLValue< Type >
 
struct  mlir::detail::pdl_function_builder::ProcessPDLValue< T, std::enable_if_t< std::is_base_of< Type, T >::value > >
 
struct  mlir::detail::pdl_function_builder::ProcessPDLValue< TypeRange >
 
struct  mlir::detail::pdl_function_builder::ProcessPDLValue< ValueTypeRange< OperandRange > >
 
struct  mlir::detail::pdl_function_builder::ProcessPDLValue< ValueTypeRange< ResultRange > >
 
struct  mlir::detail::pdl_function_builder::ProcessPDLValue< SmallVector< Type, N > >
 
struct  mlir::detail::pdl_function_builder::ProcessPDLValue< Value >
 
struct  mlir::detail::pdl_function_builder::ProcessPDLValue< ValueRange >
 
struct  mlir::detail::pdl_function_builder::ProcessPDLValue< OperandRange >
 
struct  mlir::detail::pdl_function_builder::ProcessPDLValue< ResultRange >
 
struct  mlir::detail::pdl_function_builder::ProcessPDLValue< SmallVector< Value, N > >
 
class  mlir::PDLPatternModule
 This class contains all of the necessary data for a set of PDL patterns, or pattern rewrites specified in the form of the PDL dialect. More...
 
class  mlir::RewritePatternSet
 

Namespaces

 mlir
 This header declares functions that assist transformations in the MemRef dialect.
 
 mlir::detail
 Detect if any of the given parameter types has a sub-element handler.
 
 mlir::detail::pdl_function_builder
 

Typedefs

using mlir::PDLConstraintFunction = std::function< LogicalResult(PatternRewriter &, ArrayRef< PDLValue >)>
 A generic PDL pattern constraint function. More...
 
using mlir::PDLRewriteFunction = std::function< LogicalResult(PatternRewriter &, PDLResultList &, ArrayRef< PDLValue >)>
 A native PDL rewrite function. More...
 

Functions

raw_ostream & mlir::operator<< (raw_ostream &os, PDLValue value)
 
raw_ostream & mlir::operator<< (raw_ostream &os, PDLValue::Kind kind)
 
template<typename PDLFnT , std::size_t... I>
LogicalResult mlir::detail::pdl_function_builder::verifyAsArgs (PatternRewriter &rewriter, ArrayRef< PDLValue > values, std::index_sequence< I... >)
 Validate the given PDLValues match the constraints defined by the argument types of the given function. More...
 
template<typename PDLFnT , std::size_t... I>
void mlir::detail::pdl_function_builder::assertArgs (PatternRewriter &rewriter, ArrayRef< PDLValue > values, std::index_sequence< I... >)
 Assert that the given PDLValues match the constraints defined by the arguments of the given function. More...
 
template<typename T >
static LogicalResult mlir::detail::pdl_function_builder::processResults (PatternRewriter &rewriter, PDLResultList &results, T &&value)
 Store a single result within the result list. More...
 
template<typename T1 , typename T2 >
static LogicalResult mlir::detail::pdl_function_builder::processResults (PatternRewriter &rewriter, PDLResultList &results, std::pair< T1, T2 > &&pair)
 Store a std::pair<> as individual results within the result list. More...
 
template<typename... Ts>
static LogicalResult mlir::detail::pdl_function_builder::processResults (PatternRewriter &rewriter, PDLResultList &results, std::tuple< Ts... > &&tuple)
 Store a std::tuple<> as individual results within the result list. More...
 
LogicalResult mlir::detail::pdl_function_builder::processResults (PatternRewriter &rewriter, PDLResultList &results, LogicalResult &&result)
 Handle LogicalResult propagation. More...
 
template<typename T >
static LogicalResult mlir::detail::pdl_function_builder::processResults (PatternRewriter &rewriter, PDLResultList &results, FailureOr< T > &&result)
 
template<typename PDLFnT , std::size_t... I, typename FnTraitsT = llvm::function_traits<PDLFnT>>
FnTraitsT::result_t mlir::detail::pdl_function_builder::processArgsAndInvokeConstraint (PDLFnT &fn, PatternRewriter &rewriter, ArrayRef< PDLValue > values, std::index_sequence< I... >)
 Process the arguments of a native constraint and invoke it. More...
 
template<typename ConstraintFnT >
std::enable_if_t< std::is_convertible< ConstraintFnT, PDLConstraintFunction >::value, PDLConstraintFunction > mlir::detail::pdl_function_builder::buildConstraintFn (ConstraintFnT &&constraintFn)
 Build a constraint function from the given function ConstraintFnT. More...
 
template<typename ConstraintFnT >
std::enable_if_t< !std::is_convertible< ConstraintFnT, PDLConstraintFunction >::value, PDLConstraintFunction > mlir::detail::pdl_function_builder::buildConstraintFn (ConstraintFnT &&constraintFn)
 Otherwise, we generate a wrapper that will unpack the PDLValues in the form we desire. More...
 
template<typename PDLFnT , std::size_t... I, typename FnTraitsT = llvm::function_traits<PDLFnT>>
std::enable_if_t< std::is_same< typename FnTraitsT::result_t, void >::value, LogicalResult > mlir::detail::pdl_function_builder::processArgsAndInvokeRewrite (PDLFnT &fn, PatternRewriter &rewriter, PDLResultList &, ArrayRef< PDLValue > values, std::index_sequence< I... >)
 Process the arguments of a native rewrite and invoke it. More...
 
template<typename PDLFnT , std::size_t... I, typename FnTraitsT = llvm::function_traits<PDLFnT>>
std::enable_if_t<!std::is_same< typename FnTraitsT::result_t, void >::value, LogicalResult > mlir::detail::pdl_function_builder::processArgsAndInvokeRewrite (PDLFnT &fn, PatternRewriter &rewriter, PDLResultList &results, ArrayRef< PDLValue > values, std::index_sequence< I... >)
 This overload handles the case of return values, which need to be packaged into the result list. More...
 
template<typename RewriteFnT >
std::enable_if_t< std::is_convertible< RewriteFnT, PDLRewriteFunction >::value, PDLRewriteFunction > mlir::detail::pdl_function_builder::buildRewriteFn (RewriteFnT &&rewriteFn)
 Build a rewrite function from the given function RewriteFnT. More...
 
template<typename RewriteFnT >
std::enable_if_t<!std::is_convertible< RewriteFnT, PDLRewriteFunction >::value, PDLRewriteFunction > mlir::detail::pdl_function_builder::buildRewriteFn (RewriteFnT &&rewriteFn)
 Otherwise, we generate a wrapper that will unpack the PDLValues in the form we desire. More...
 

Variables

template<class... T>
constexpr bool mlir::detail::pdl_function_builder::always_false = false
 A utility variable that always resolves to false. More...