MLIR 22.0.0git
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.
virtual void notifyOperationModified (Operation *op)
 Notify the listener that the specified operation was modified in-place.
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.
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.
virtual void notifyOperationErased (Operation *op)
 Notify the listener that the specified operation is about to be erased.
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.
virtual void notifyPatternEnd (const Pattern &pattern, LogicalResult status)
 Notify the listener that a pattern application finished with the specified status.
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.
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.
virtual void notifyBlockInserted (Block *block, Region *previous, Region::iterator previousIt)
 Notify the listener that the specified block was inserted.
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 370 of file PatternMatch.h.

Constructor & Destructor Documentation

◆ Listener()

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 376 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, mlir::transform::ErrorCheckingTrackingListener, and mlir::transform::TrackingListener.

Definition at line 422 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, mlir::RewriterBase::ForwardingListener, and mlir::RewriterBase::PatternLoggingListener.

Definition at line 403 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, and mlir::RewriterBase::PatternLoggingListener.

Definition at line 379 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, and mlir::RewriterBase::PatternLoggingListener.

Definition at line 387 of file PatternMatch.h.

References notifyOperationReplaced(), and replacement().

Referenced by notifyOperationReplaced().

◆ 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, and mlir::RewriterBase::PatternLoggingListener.

Definition at line 396 of file PatternMatch.h.

References replacement().

◆ 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, and mlir::RewriterBase::PatternLoggingListener.

Definition at line 407 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 414 of file PatternMatch.h.


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