My Project
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
mlir::detail::ConversionPatternRewriterImpl Struct Reference
Collaboration diagram for mlir::detail::ConversionPatternRewriterImpl:
Collaboration graph
[legend]

Classes

struct  BlockAction
 
struct  BlockPosition
 
struct  OpReplacement
 This class represents one requested operation replacement via 'replaceOp'. More...
 

Public Types

enum  BlockActionKind { BlockActionKind::Create, BlockActionKind::Move, BlockActionKind::Split, BlockActionKind::TypeConversion }
 

Public Member Functions

 ConversionPatternRewriterImpl (PatternRewriter &rewriter, TypeConverter *converter)
 
RewriterState getCurrentState ()
 Return the current state of the rewriter. More...
 
void resetState (RewriterState state)
 Reset the state of the rewriter to a previously saved point. More...
 
void undoBlockActions (unsigned numActionsToKeep=0)
 
void discardRewrites ()
 
void applyRewrites ()
 
LogicalResult convertBlockSignature (Block *block)
 Convert the signature of the given block. More...
 
BlockapplySignatureConversion (Region *region, TypeConverter::SignatureConversion &conversion)
 Apply a signature conversion on the given region. More...
 
void replaceOp (Operation *op, ValueRange newValues, ValueRange valuesToRemoveIfDead)
 PatternRewriter hook for replacing the results of an operation. More...
 
void notifySplitBlock (Block *block, Block *continuation)
 Notifies that a block was split. More...
 
void notifyRegionIsBeingInlinedBefore (Region &region, Region &parent, Region::iterator before)
 Notifies that the blocks of a region are about to be moved. More...
 
void notifyRegionWasClonedBefore (iterator_range< Region::iterator > &blocks, Location origRegionLoc)
 Notifies that the blocks of a region were cloned into another. More...
 
void remapValues (Operation::operand_range operands, SmallVectorImpl< Value > &remapped)
 Remap the given operands to those with potentially different types. More...
 
bool isOpIgnored (Operation *op) const
 
void markNestedOpsIgnored (Operation *op)
 

Public Attributes

ConversionValueMapping mapping
 
ArgConverter argConverter
 Utility used to convert block arguments. More...
 
std::vector< Operation * > createdOps
 Ordered vector of all of the newly created operations during conversion. More...
 
SmallVector< OpReplacement, 4 > replacements
 Ordered vector of any requested operation replacements. More...
 
SmallVector< BlockAction, 4 > blockActions
 Ordered list of block operations (creations, splits, motions). More...
 
llvm::SetVector< Operation * > ignoredOps
 
SmallVector< OperationTransactionState, 4 > rootUpdates
 A transaction state for each of operations that were updated in-place. More...
 
SmallPtrSet< Operation *, 1 > pendingRootUpdates
 

Member Enumeration Documentation

◆ BlockActionKind

The kind of the block action performed during the rewrite. Actions can be undone if the conversion fails.

Enumerator
Create 
Move 
Split 
TypeConversion 

Constructor & Destructor Documentation

◆ ConversionPatternRewriterImpl()

mlir::detail::ConversionPatternRewriterImpl::ConversionPatternRewriterImpl ( PatternRewriter rewriter,
TypeConverter converter 
)
inline

Member Function Documentation

◆ applyRewrites()

void ConversionPatternRewriterImpl::applyRewrites ( )

Apply all requested operation rewrites. This method is invoked when the conversion process succeeds.

◆ applySignatureConversion()

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

Apply a signature conversion on the given region.

◆ convertBlockSignature()

LogicalResult ConversionPatternRewriterImpl::convertBlockSignature ( Block block)

Convert the signature of the given block.

◆ discardRewrites()

void ConversionPatternRewriterImpl::discardRewrites ( )

Cleanup and destroy any generated rewrite operations. This method is invoked when the conversion process fails.

◆ getCurrentState()

RewriterState ConversionPatternRewriterImpl::getCurrentState ( )

Return the current state of the rewriter.

◆ isOpIgnored()

bool ConversionPatternRewriterImpl::isOpIgnored ( Operation op) const

Returns true if the given operation is ignored, and does not need to be converted.

◆ markNestedOpsIgnored()

void ConversionPatternRewriterImpl::markNestedOpsIgnored ( Operation op)

Recursively marks the nested operations under 'op' as ignored. This removes them from being considered for legalization.

◆ notifyRegionIsBeingInlinedBefore()

void ConversionPatternRewriterImpl::notifyRegionIsBeingInlinedBefore ( Region region,
Region parent,
Region::iterator  before 
)

Notifies that the blocks of a region are about to be moved.

◆ notifyRegionWasClonedBefore()

void ConversionPatternRewriterImpl::notifyRegionWasClonedBefore ( iterator_range< Region::iterator > &  blocks,
Location  origRegionLoc 
)

Notifies that the blocks of a region were cloned into another.

◆ notifySplitBlock()

void ConversionPatternRewriterImpl::notifySplitBlock ( Block block,
Block continuation 
)

Notifies that a block was split.

◆ remapValues()

void ConversionPatternRewriterImpl::remapValues ( Operation::operand_range  operands,
SmallVectorImpl< Value > &  remapped 
)

Remap the given operands to those with potentially different types.

◆ replaceOp()

void ConversionPatternRewriterImpl::replaceOp ( Operation op,
ValueRange  newValues,
ValueRange  valuesToRemoveIfDead 
)

PatternRewriter hook for replacing the results of an operation.

Mark this operation as recursively ignored so that we don't need to convert any nested operations.

◆ resetState()

void ConversionPatternRewriterImpl::resetState ( RewriterState  state)

Reset the state of the rewriter to a previously saved point.

◆ undoBlockActions()

void ConversionPatternRewriterImpl::undoBlockActions ( unsigned  numActionsToKeep = 0)

Undo the block actions (motions, splits) one by one in reverse order until "numActionsToKeep" actions remains.

Member Data Documentation

◆ argConverter

ArgConverter mlir::detail::ConversionPatternRewriterImpl::argConverter

Utility used to convert block arguments.

◆ blockActions

SmallVector<BlockAction, 4> mlir::detail::ConversionPatternRewriterImpl::blockActions

Ordered list of block operations (creations, splits, motions).

◆ createdOps

std::vector<Operation *> mlir::detail::ConversionPatternRewriterImpl::createdOps

Ordered vector of all of the newly created operations during conversion.

◆ ignoredOps

llvm::SetVector<Operation *> mlir::detail::ConversionPatternRewriterImpl::ignoredOps

A set of operations that have been erased/replaced/etc that should no longer be considered for legalization. This is not meant to be an exhaustive list of all operations, but the minimal set that can be used to detect if a given operation should be ignored. For example, we may add the operations that define non-empty regions to the set, but not any of the others. This simplifies the amount of memory needed as we can query if the parent operation was ignored.

◆ mapping

ConversionValueMapping mlir::detail::ConversionPatternRewriterImpl::mapping

◆ pendingRootUpdates

SmallPtrSet<Operation *, 1> mlir::detail::ConversionPatternRewriterImpl::pendingRootUpdates

A set of operations that have pending updates. This tracking isn't strictly necessary, and is thus only active during debug builds for extra verification.

◆ replacements

SmallVector<OpReplacement, 4> mlir::detail::ConversionPatternRewriterImpl::replacements

Ordered vector of any requested operation replacements.

◆ rootUpdates

SmallVector<OperationTransactionState, 4> mlir::detail::ConversionPatternRewriterImpl::rootUpdates

A transaction state for each of operations that were updated in-place.


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