MLIR  18.0.0git
Classes | Public Member Functions | List of all members
mlir::detail::PDLByteCode Class Reference

The bytecode class is also the interpreter. More...

#include "Rewrite/ByteCode.h"

Classes

struct  MatchResult
 Each successful match returns a MatchResult, which contains information necessary to execute the rewriter and indicates the originating pattern. More...
 

Public Member Functions

 PDLByteCode (ModuleOp module, SmallVector< std::unique_ptr< PDLPatternConfigSet >> configs, const DenseMap< Operation *, PDLPatternConfigSet * > &configMap, llvm::StringMap< PDLConstraintFunction > constraintFns, llvm::StringMap< PDLRewriteFunction > rewriteFns)
 Create a ByteCode instance from the given module containing operations in the PDL interpreter dialect. More...
 
ArrayRef< PDLByteCodePatterngetPatterns () const
 Return the patterns held by the bytecode. More...
 
void initializeMutableState (PDLByteCodeMutableState &state) const
 Initialize the given state such that it can be used to execute the current bytecode. More...
 
void match (Operation *op, PatternRewriter &rewriter, SmallVectorImpl< MatchResult > &matches, PDLByteCodeMutableState &state) const
 Run the pattern matcher on the given root operation, collecting the matched patterns in matches. More...
 
LogicalResult rewrite (PatternRewriter &rewriter, const MatchResult &match, PDLByteCodeMutableState &state) const
 Run the rewriter of the given pattern that was previously matched in match. More...
 

Detailed Description

The bytecode class is also the interpreter.

Contains the bytecode itself, the static info, addresses of the rewriter functions, the interpreter memory buffer, and the execution context.

Definition at line 128 of file ByteCode.h.

Constructor & Destructor Documentation

◆ PDLByteCode()

PDLByteCode::PDLByteCode ( ModuleOp  module,
SmallVector< std::unique_ptr< PDLPatternConfigSet >>  configs,
const DenseMap< Operation *, PDLPatternConfigSet * > &  configMap,
llvm::StringMap< PDLConstraintFunction constraintFns,
llvm::StringMap< PDLRewriteFunction rewriteFns 
)

Create a ByteCode instance from the given module containing operations in the PDL interpreter dialect.

Definition at line 1043 of file ByteCode.cpp.

References generator.

Member Function Documentation

◆ getPatterns()

ArrayRef<PDLByteCodePattern> mlir::detail::PDLByteCode::getPatterns ( ) const
inline

Return the patterns held by the bytecode.

Definition at line 165 of file ByteCode.h.

◆ initializeMutableState()

void PDLByteCode::initializeMutableState ( PDLByteCodeMutableState state) const

Initialize the given state such that it can be used to execute the current bytecode.

Definition at line 1064 of file ByteCode.cpp.

◆ match()

void PDLByteCode::match ( Operation op,
PatternRewriter rewriter,
SmallVectorImpl< MatchResult > &  matches,
PDLByteCodeMutableState state 
) const

Run the pattern matcher on the given root operation, collecting the matched patterns in matches.

Definition at line 2273 of file ByteCode.cpp.

◆ rewrite()

LogicalResult PDLByteCode::rewrite ( PatternRewriter rewriter,
const MatchResult match,
PDLByteCodeMutableState state 
) const

Run the rewriter of the given pattern that was previously matched in match.

Returns if a failure was encountered during the rewrite.

Definition at line 2297 of file ByteCode.cpp.


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