MLIR  21.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 414 of file PatternMatch.h.

Constructor & Destructor Documentation

◆ Listener()

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

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

Referenced by mlir::RewriterBase::ForwardingListener::notifyBlockErased().

◆ 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 466 of file PatternMatch.h.

Referenced by mlir::RewriterBase::ForwardingListener::notifyMatchFailure().

◆ 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 447 of file PatternMatch.h.

Referenced by mlir::RewriterBase::ForwardingListener::notifyOperationErased().

◆ 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 423 of file PatternMatch.h.

Referenced by mlir::RewriterBase::ForwardingListener::notifyOperationModified().

◆ 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 431 of file PatternMatch.h.

References mlir::Operation::getResults().

Referenced by mlir::RewriterBase::ForwardingListener::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.

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

Referenced by mlir::RewriterBase::ForwardingListener::notifyPatternBegin().

◆ 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 458 of file PatternMatch.h.

Referenced by mlir::RewriterBase::ForwardingListener::notifyPatternEnd().


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