My Project
Public Member Functions | List of all members
mlir::ConversionPatternRewriter Class Referencefinal

#include <DialectConversion.h>

Inheritance diagram for mlir::ConversionPatternRewriter:
Inheritance graph
[legend]
Collaboration diagram for mlir::ConversionPatternRewriter:
Collaboration graph
[legend]

Public Member Functions

 ConversionPatternRewriter (MLIRContext *ctx, TypeConverter *converter)
 
 ~ConversionPatternRewriter () override
 
BlockapplySignatureConversion (Region *region, TypeConverter::SignatureConversion &conversion)
 Apply a signature conversion to the entry block of the given region. More...
 
void replaceUsesOfBlockArgument (BlockArgument from, Value to)
 Replace all the uses of the block argument from with value to. More...
 
Value getRemappedValue (Value key)
 
void replaceOp (Operation *op, ValueRange newValues, ValueRange valuesToRemoveIfDead) override
 PatternRewriter hook for replacing the results of an operation. More...
 
void eraseOp (Operation *op) override
 
BlocksplitBlock (Block *block, Block::iterator before) override
 PatternRewriter hook for splitting a block into two parts. More...
 
void mergeBlocks (Block *source, Block *dest, ValueRange argValues) override
 PatternRewriter hook for merging a block into another. More...
 
void inlineRegionBefore (Region &region, Region &parent, Region::iterator before) override
 PatternRewriter hook for moving blocks out of a region. More...
 
void cloneRegionBefore (Region &region, Region &parent, Region::iterator before, BlockAndValueMapping &mapping) override
 PatternRewriter hook for cloning blocks of one region into another. More...
 
Operationinsert (Operation *op) override
 PatternRewriter hook for inserting a new operation. More...
 
void startRootUpdate (Operation *op) override
 PatternRewriter hook for updating the root operation in-place. More...
 
void finalizeRootUpdate (Operation *op) override
 PatternRewriter hook for updating the root operation in-place. More...
 
void cancelRootUpdate (Operation *op) override
 PatternRewriter hook for updating the root operation in-place. More...
 
detail::ConversionPatternRewriterImplgetImpl ()
 Return a reference to the internal implementation. More...
 
- Public Member Functions inherited from mlir::PatternRewriter
template<typename OpTy , typename... Args>
OpTy create (Location location, Args... args)
 
template<typename OpTy , typename... Args>
OpTy createChecked (Location location, Args... args)
 
void inlineRegionBefore (Region &region, Block *before)
 
void cloneRegionBefore (Region &region, Region &parent, Region::iterator before)
 
void cloneRegionBefore (Region &region, Block *before)
 
void replaceOp (Operation *op, ValueRange newValues)
 
template<typename OpTy , typename... Args>
void replaceOpWithNewOp (Operation *op, Args &&... args)
 
template<typename OpTy , typename... Args>
void replaceOpWithNewOp (ValueRange valuesToRemoveIfDead, Operation *op, Args &&... args)
 
template<typename CallableT >
void updateRootInPlace (Operation *root, CallableT &&callable)
 
- Public Member Functions inherited from mlir::OpBuilder
 OpBuilder (MLIRContext *ctx)
 Create a builder with the given context. More...
 
 OpBuilder (Region *region)
 Create a builder and set the insertion point to the start of the region. More...
 
 OpBuilder (Region &region)
 
virtual ~OpBuilder ()
 
 OpBuilder (Operation *op)
 
 OpBuilder (Block *block)
 
 OpBuilder (Block *block, Block::iterator insertPoint)
 
void clearInsertionPoint ()
 
InsertPoint saveInsertionPoint () const
 Return a saved insertion point. More...
 
void restoreInsertionPoint (InsertPoint ip)
 Restore the insert point to a previously saved point. More...
 
void setInsertionPoint (Block *block, Block::iterator insertPoint)
 Set the insertion point to the specified location. More...
 
void setInsertionPoint (Operation *op)
 
void setInsertionPointAfter (Operation *op)
 
void setInsertionPointToStart (Block *block)
 Sets the insertion point to the start of the specified block. More...
 
void setInsertionPointToEnd (Block *block)
 Sets the insertion point to the end of the specified block. More...
 
BlockgetInsertionBlock () const
 
Block::iterator getInsertionPoint () const
 Returns the current insertion point of the builder. More...
 
BlockcreateBlock (Region *parent, Region::iterator insertPt={})
 
BlockcreateBlock (Block *insertBefore)
 
BlockgetBlock () const
 Returns the current block of the builder. More...
 
OperationcreateOperation (const OperationState &state)
 Creates an operation given the fields represented as an OperationState. More...
 
template<typename OpTy , typename... Args>
OpTy create (Location location, Args &&... args)
 Create an operation of specific op type at the current insertion point. More...
 
template<typename OpTy , typename... Args>
void createOrFold (SmallVectorImpl< Value > &results, Location location, Args &&... args)
 
template<typename OpTy , typename... Args>
std::enable_if< OpTy::template hasTrait< OpTrait::OneResult >), Value >::type createOrFold (Location location, Args &&... args)
 Overload to create or fold a single result operation. More...
 
template<typename OpTy , typename... Args>
std::enable_if< OpTy::template hasTrait< OpTrait::ZeroResult >), OpTy >::type createOrFold (Location location, Args &&... args)
 Overload to create or fold a zero result operation. More...
 
LogicalResult tryFold (Operation *op, SmallVectorImpl< Value > &results)
 
Operationclone (Operation &op, BlockAndValueMapping &mapper)
 
Operationclone (Operation &op)
 
OperationcloneWithoutRegions (Operation &op, BlockAndValueMapping &mapper)
 
OperationcloneWithoutRegions (Operation &op)
 
template<typename OpT >
OpT cloneWithoutRegions (OpT op)
 
- Public Member Functions inherited from mlir::Builder
 Builder (MLIRContext *context)
 
 Builder (ModuleOp module)
 
MLIRContextgetContext () const
 
Identifier getIdentifier (StringRef str)
 
Location getUnknownLoc ()
 
Location getFileLineColLoc (Identifier filename, unsigned line, unsigned column)
 
Location getFusedLoc (ArrayRef< Location > locs, Attribute metadata=Attribute())
 
FloatType getBF16Type ()
 
FloatType getF16Type ()
 
FloatType getF32Type ()
 
FloatType getF64Type ()
 
IndexType getIndexType ()
 
IntegerType getI1Type ()
 
IntegerType getIntegerType (unsigned width)
 
FunctionType getFunctionType (ArrayRef< Type > inputs, ArrayRef< Type > results)
 
TupleType getTupleType (ArrayRef< Type > elementTypes)
 
NoneType getNoneType ()
 
template<typename Ty , typename... Args>
Ty getType (Args... args)
 Get or construct an instance of the type 'ty' with provided arguments. More...
 
NamedAttribute getNamedAttr (StringRef name, Attribute val)
 
UnitAttr getUnitAttr ()
 
BoolAttr getBoolAttr (bool value)
 
DictionaryAttr getDictionaryAttr (ArrayRef< NamedAttribute > value)
 
IntegerAttr getIntegerAttr (Type type, int64_t value)
 
IntegerAttr getIntegerAttr (Type type, const APInt &value)
 
FloatAttr getFloatAttr (Type type, double value)
 
FloatAttr getFloatAttr (Type type, const APFloat &value)
 
StringAttr getStringAttr (StringRef bytes)
 
ArrayAttr getArrayAttr (ArrayRef< Attribute > value)
 
FlatSymbolRefAttr getSymbolRefAttr (Operation *value)
 
FlatSymbolRefAttr getSymbolRefAttr (StringRef value)
 
SymbolRefAttr getSymbolRefAttr (StringRef value, ArrayRef< FlatSymbolRefAttr > nestedReferences)
 
Attribute getZeroAttr (Type type)
 
FloatAttr getF16FloatAttr (float value)
 
FloatAttr getF32FloatAttr (float value)
 
FloatAttr getF64FloatAttr (double value)
 
IntegerAttr getI8IntegerAttr (int8_t value)
 
IntegerAttr getI16IntegerAttr (int16_t value)
 
IntegerAttr getI32IntegerAttr (int32_t value)
 
IntegerAttr getI64IntegerAttr (int64_t value)
 
DenseIntElementsAttr getI32VectorAttr (ArrayRef< int32_t > values)
 
ArrayAttr getAffineMapArrayAttr (ArrayRef< AffineMap > values)
 
ArrayAttr getI32ArrayAttr (ArrayRef< int32_t > values)
 
ArrayAttr getI64ArrayAttr (ArrayRef< int64_t > values)
 
ArrayAttr getIndexArrayAttr (ArrayRef< int64_t > values)
 
ArrayAttr getF32ArrayAttr (ArrayRef< float > values)
 
ArrayAttr getF64ArrayAttr (ArrayRef< double > values)
 
ArrayAttr getStrArrayAttr (ArrayRef< StringRef > values)
 
AffineExpr getAffineDimExpr (unsigned position)
 
AffineExpr getAffineSymbolExpr (unsigned position)
 
AffineExpr getAffineConstantExpr (int64_t constant)
 
AffineMap getEmptyAffineMap ()
 Returns a zero result affine map with no dimensions or symbols: () -> (). More...
 
AffineMap getConstantAffineMap (int64_t val)
 
AffineMap getDimIdentityMap ()
 
AffineMap getMultiDimIdentityMap (unsigned rank)
 
AffineMap getSymbolIdentityMap ()
 
AffineMap getSingleDimShiftAffineMap (int64_t shift)
 
AffineMap getShiftedAffineMap (AffineMap map, int64_t shift)
 

Additional Inherited Members

- Protected Member Functions inherited from mlir::PatternRewriter
 PatternRewriter (MLIRContext *ctx)
 
virtual ~PatternRewriter ()
 
virtual void notifyRootReplaced (Operation *op)
 
virtual void notifyOperationRemoved (Operation *op)
 
- Protected Attributes inherited from mlir::Builder
MLIRContextcontext
 

Detailed Description

This class implements a pattern rewriter for use with ConversionPatterns. It extends the base PatternRewriter and provides special conversion specific hooks.

Constructor & Destructor Documentation

◆ ConversionPatternRewriter()

ConversionPatternRewriter::ConversionPatternRewriter ( MLIRContext ctx,
TypeConverter converter 
)

◆ ~ConversionPatternRewriter()

ConversionPatternRewriter::~ConversionPatternRewriter ( )
override

Member Function Documentation

◆ applySignatureConversion()

Block * ConversionPatternRewriter::applySignatureConversion ( Region region,
TypeConverter::SignatureConversion conversion 
)

Apply a signature conversion to the entry block of the given region.

Apply a signature conversion to the entry block of the given region. This replaces the entry block with a new block containing the updated signature. The new entry block to the region is returned for convenience.

◆ cancelRootUpdate()

void ConversionPatternRewriter::cancelRootUpdate ( Operation op)
overridevirtual

PatternRewriter hook for updating the root operation in-place.

Reimplemented from mlir::PatternRewriter.

◆ cloneRegionBefore()

void ConversionPatternRewriter::cloneRegionBefore ( Region region,
Region parent,
Region::iterator  before,
BlockAndValueMapping mapping 
)
overridevirtual

PatternRewriter hook for cloning blocks of one region into another.

PatternRewriter hook for cloning blocks of one region into another. The given region to clone must not have been modified as part of conversion yet, i.e. it must be within an operation that is either in the process of conversion, or has not yet been converted.

Reimplemented from mlir::PatternRewriter.

◆ eraseOp()

void ConversionPatternRewriter::eraseOp ( Operation op)
overridevirtual

PatternRewriter hook for erasing a dead operation. The uses of this operation must be made dead by the end of the conversion process, otherwise an assert will be issued.

Reimplemented from mlir::PatternRewriter.

◆ finalizeRootUpdate()

void ConversionPatternRewriter::finalizeRootUpdate ( Operation op)
overridevirtual

PatternRewriter hook for updating the root operation in-place.

Reimplemented from mlir::PatternRewriter.

◆ getImpl()

detail::ConversionPatternRewriterImpl & ConversionPatternRewriter::getImpl ( )

Return a reference to the internal implementation.

◆ getRemappedValue()

Value ConversionPatternRewriter::getRemappedValue ( Value  key)

Return the converted value that replaces 'key'. Return 'key' if there is no such a converted value.

◆ inlineRegionBefore()

void ConversionPatternRewriter::inlineRegionBefore ( Region region,
Region parent,
Region::iterator  before 
)
overridevirtual

PatternRewriter hook for moving blocks out of a region.

Reimplemented from mlir::PatternRewriter.

◆ insert()

Operation * ConversionPatternRewriter::insert ( Operation op)
overridevirtual

PatternRewriter hook for inserting a new operation.

PatternRewriter hook for creating a new operation.

Implements mlir::PatternRewriter.

◆ mergeBlocks()

void ConversionPatternRewriter::mergeBlocks ( Block source,
Block dest,
ValueRange  argValues 
)
overridevirtual

PatternRewriter hook for merging a block into another.

Reimplemented from mlir::PatternRewriter.

◆ replaceOp()

void ConversionPatternRewriter::replaceOp ( Operation op,
ValueRange  newValues,
ValueRange  valuesToRemoveIfDead 
)
overridevirtual

PatternRewriter hook for replacing the results of an operation.

Reimplemented from mlir::PatternRewriter.

◆ replaceUsesOfBlockArgument()

void ConversionPatternRewriter::replaceUsesOfBlockArgument ( BlockArgument  from,
Value  to 
)

Replace all the uses of the block argument from with value to.

◆ splitBlock()

Block * ConversionPatternRewriter::splitBlock ( Block block,
Block::iterator  before 
)
overridevirtual

PatternRewriter hook for splitting a block into two parts.

Reimplemented from mlir::PatternRewriter.

◆ startRootUpdate()

void ConversionPatternRewriter::startRootUpdate ( Operation op)
overridevirtual

PatternRewriter hook for updating the root operation in-place.

PatternRewriter hook for updating the root operation in-place. Note: These methods only track updates to the top-level operation itself, and not nested regions. Updates to regions will still require notification through other more specific hooks above.

Reimplemented from mlir::PatternRewriter.


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