MLIR  18.0.0git
Public Member Functions | List of all members
mlir::RewriterBase::ForwardingListener Struct Reference

A listener that forwards all notifications to another listener. More...

#include "mlir/IR/PatternMatch.h"

+ Inheritance diagram for mlir::RewriterBase::ForwardingListener:

Public Member Functions

 ForwardingListener (OpBuilder::Listener *listener)
 
void notifyOperationInserted (Operation *op) override
 Notification handler for when an operation is inserted into the builder. More...
 
void notifyBlockCreated (Block *block) override
 Notification handler for when a block is created using the builder. More...
 
void notifyOperationModified (Operation *op) override
 Notify the listener that the specified operation was modified in-place. More...
 
void notifyOperationReplaced (Operation *op, Operation *newOp) override
 Notify the listener that the specified operation is about to be replaced with another operation. More...
 
void notifyOperationReplaced (Operation *op, ValueRange replacement) override
 Notify the listener that the specified operation is about to be replaced with the a range of values, potentially produced by other operations. More...
 
void notifyOperationRemoved (Operation *op) override
 Notify the listener that the specified operation is about to be erased. More...
 
LogicalResult notifyMatchFailure (Location loc, function_ref< void(Diagnostic &)> reasonCallback) override
 Notify the listener that the pattern failed to match the given operation, and provide a callback to populate a diagnostic with the reason why the failure occurred. More...
 
- Public Member Functions inherited from mlir::RewriterBase::Listener
 Listener ()
 
- Public Member Functions inherited from mlir::OpBuilder::Listener
 Listener ()
 
virtual ~Listener ()=default
 
- Public Member Functions inherited from mlir::OpBuilder::ListenerBase
Kind getKind () const
 

Additional Inherited Members

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

Detailed Description

A listener that forwards all notifications to another listener.

This struct can be used as a base to create listener chains, so that multiple listeners can be notified of IR changes.

Definition at line 446 of file PatternMatch.h.

Constructor & Destructor Documentation

◆ ForwardingListener()

mlir::RewriterBase::ForwardingListener::ForwardingListener ( OpBuilder::Listener listener)
inline

Definition at line 447 of file PatternMatch.h.

Member Function Documentation

◆ notifyBlockCreated()

void mlir::RewriterBase::ForwardingListener::notifyBlockCreated ( Block block)
inlineoverridevirtual

Notification handler for when a block is created using the builder.

block is the block that was created.

Reimplemented from mlir::OpBuilder::Listener.

Definition at line 452 of file PatternMatch.h.

References mlir::OpBuilder::Listener::notifyBlockCreated().

◆ notifyMatchFailure()

LogicalResult mlir::RewriterBase::ForwardingListener::notifyMatchFailure ( Location  loc,
function_ref< void(Diagnostic &)>  reasonCallback 
)
inlineoverridevirtual

Notify the listener that the pattern failed to match the given operation, 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 from mlir::RewriterBase::Listener.

Definition at line 472 of file PatternMatch.h.

References mlir::failure().

◆ notifyOperationInserted()

void mlir::RewriterBase::ForwardingListener::notifyOperationInserted ( Operation op)
inlineoverridevirtual

Notification handler for when an operation is inserted into the builder.

op is the operation that was inserted.

Reimplemented from mlir::OpBuilder::Listener.

Definition at line 449 of file PatternMatch.h.

◆ notifyOperationModified()

void mlir::RewriterBase::ForwardingListener::notifyOperationModified ( Operation op)
inlineoverridevirtual

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

Reimplemented from mlir::RewriterBase::Listener.

Definition at line 455 of file PatternMatch.h.

◆ notifyOperationRemoved()

void mlir::RewriterBase::ForwardingListener::notifyOperationRemoved ( Operation op)
inlineoverridevirtual

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

At this point, the operation has zero uses.

Reimplemented from mlir::RewriterBase::Listener.

Definition at line 468 of file PatternMatch.h.

◆ notifyOperationReplaced() [1/2]

void mlir::RewriterBase::ForwardingListener::notifyOperationReplaced ( Operation op,
Operation replacement 
)
inlineoverridevirtual

Notify the listener that the specified operation is about to be replaced with 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 from mlir::RewriterBase::Listener.

Definition at line 459 of file PatternMatch.h.

◆ notifyOperationReplaced() [2/2]

void mlir::RewriterBase::ForwardingListener::notifyOperationReplaced ( Operation op,
ValueRange  replacement 
)
inlineoverridevirtual

Notify the listener that the specified operation is 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 from mlir::RewriterBase::Listener.

Definition at line 463 of file PatternMatch.h.


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