MLIR  19.0.0git
Public Member Functions | Static Public Member Functions | List of all members
mlir::RewriterBase::Listener Struct Reference

#include "mlir/IR/PatternMatch.h"

+ Inheritance diagram for mlir::RewriterBase::Listener:

Public Member Functions

 Listener ()
 
virtual void notifyBlockErased (Block *block)
 Notify the listener that the specified block is about to be erased. More...
 
virtual void notifyOperationModified (Operation *op)
 Notify the listener that the specified operation was modified in-place. More...
 
virtual void notifyOperationReplaced (Operation *op, Operation *replacement)
 Notify the listener that all uses of the specified operation's results are about to be replaced with the results of another operation. More...
 
virtual void notifyOperationReplaced (Operation *op, ValueRange replacement)
 Notify the listener that all uses of the specified operation's results are about to be replaced with the a range of values, potentially produced by other operations. More...
 
virtual void notifyOperationErased (Operation *op)
 Notify the listener that the specified operation is about to be erased. More...
 
virtual void notifyPatternBegin (const Pattern &pattern, Operation *op)
 Notify the listener that the specified pattern is about to be applied at the specified root operation. More...
 
virtual void notifyPatternEnd (const Pattern &pattern, LogicalResult status)
 Notify the listener that a pattern application finished with the specified status. More...
 
virtual void notifyMatchFailure (Location loc, function_ref< void(Diagnostic &)> reasonCallback)
 Notify the listener that the pattern failed to match, and provide a callback to populate a diagnostic with the reason why the failure occurred. More...
 
- Public Member Functions inherited from mlir::OpBuilder::Listener
 Listener ()
 
virtual ~Listener ()=default
 
virtual void notifyOperationInserted (Operation *op, InsertPoint previous)
 Notify the listener that the specified operation was inserted. More...
 
virtual void notifyBlockInserted (Block *block, Region *previous, Region::iterator previousIt)
 Notify the listener that the specified block was inserted. More...
 
- Public Member Functions inherited from mlir::OpBuilder::ListenerBase
Kind getKind () const
 

Static Public Member Functions

static bool classof (const OpBuilder::Listener *base)
 

Additional Inherited Members

- Public Types inherited from mlir::OpBuilder::ListenerBase
enum class  Kind { OpBuilderListener = 0 , RewriterBaseListener = 1 }
 The kind of listener. More...
 
- Protected Member Functions inherited from mlir::OpBuilder::Listener
 Listener (Kind kind)
 
- Protected Member Functions inherited from mlir::OpBuilder::ListenerBase
 ListenerBase (Kind kind)
 

Detailed Description

Definition at line 402 of file PatternMatch.h.

Constructor & Destructor Documentation

◆ Listener()

mlir::RewriterBase::Listener::Listener ( )
inline

Definition at line 403 of file PatternMatch.h.

Member Function Documentation

◆ classof()

bool RewriterBase::Listener::classof ( const OpBuilder::Listener base)
static

◆ notifyBlockErased()

virtual void mlir::RewriterBase::Listener::notifyBlockErased ( Block block)
inlinevirtual

Notify the listener that the specified block is about to be erased.

At this point, the block has zero uses.

Reimplemented in mlir::detail::ConversionPatternRewriterImpl::SingleEraseRewriter, and mlir::RewriterBase::ForwardingListener.

Definition at line 408 of file PatternMatch.h.

◆ notifyMatchFailure()

virtual void mlir::RewriterBase::Listener::notifyMatchFailure ( Location  loc,
function_ref< void(Diagnostic &)>  reasonCallback 
)
inlinevirtual

Notify the listener that the pattern failed to match, and provide a callback to populate a diagnostic with the reason why the failure occurred.

This method allows for derived listeners to optionally hook into the reason why a rewrite failed, and display it to users.

Reimplemented in mlir::detail::ConversionPatternRewriterImpl, mlir::RewriterBase::ForwardingListener, and mlir::transform::TrackingListener.

Definition at line 454 of file PatternMatch.h.

◆ notifyOperationErased()

virtual void mlir::RewriterBase::Listener::notifyOperationErased ( Operation op)
inlinevirtual

Notify the listener that the specified operation is about to be erased.

At this point, the operation has zero uses.

Note: This notification is not triggered when unlinking an operation.

Reimplemented in mlir::detail::ConversionPatternRewriterImpl::SingleEraseRewriter, and mlir::RewriterBase::ForwardingListener.

Definition at line 435 of file PatternMatch.h.

◆ notifyOperationModified()

virtual void mlir::RewriterBase::Listener::notifyOperationModified ( Operation op)
inlinevirtual

Notify the listener that the specified operation was modified in-place.

Reimplemented in mlir::RewriterBase::ForwardingListener.

Definition at line 411 of file PatternMatch.h.

◆ notifyOperationReplaced() [1/2]

virtual void mlir::RewriterBase::Listener::notifyOperationReplaced ( Operation op,
Operation replacement 
)
inlinevirtual

Notify the listener that all uses of the specified operation's results are about to be replaced with the results of another operation.

This is called before the uses of the old operation have been changed.

By default, this function calls the "operation replaced with values" notification.

Reimplemented in mlir::RewriterBase::ForwardingListener.

Definition at line 419 of file PatternMatch.h.

◆ notifyOperationReplaced() [2/2]

virtual void mlir::RewriterBase::Listener::notifyOperationReplaced ( Operation op,
ValueRange  replacement 
)
inlinevirtual

Notify the listener that all uses of the specified operation's results are about to be replaced with the a range of values, potentially produced by other operations.

This is called before the uses of the operation have been changed.

Reimplemented in mlir::RewriterBase::ForwardingListener.

Definition at line 428 of file PatternMatch.h.

◆ notifyPatternBegin()

virtual void mlir::RewriterBase::Listener::notifyPatternBegin ( const Pattern pattern,
Operation op 
)
inlinevirtual

Notify the listener that the specified pattern is about to be applied at the specified root operation.

Reimplemented in mlir::RewriterBase::ForwardingListener.

Definition at line 439 of file PatternMatch.h.

◆ notifyPatternEnd()

virtual void mlir::RewriterBase::Listener::notifyPatternEnd ( const Pattern pattern,
LogicalResult  status 
)
inlinevirtual

Notify the listener that a pattern application finished with the specified status.

"success" indicates that the pattern was applied successfully. "failure" indicates that the pattern could not be applied. The pattern may have communicated the reason for the failure with notifyMatchFailure.

Reimplemented in mlir::RewriterBase::ForwardingListener.

Definition at line 446 of file PatternMatch.h.


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