MLIR  20.0.0git
Public Member Functions | Protected Member Functions | Friends | List of all members
mlir::transform::TransformState::Extension Class Reference

Base class for TransformState extensions that allow TransformState to contain user-specified information in the state object. More...

#include "mlir/Dialect/Transform/Interfaces/TransformInterfaces.h"

+ Inheritance diagram for mlir::transform::TransformState::Extension:

Public Member Functions

virtual ~Extension ()
 Base virtual destructor. More...
 

Protected Member Functions

 Extension (TransformState &state)
 Constructs an extension of the given TransformState object. More...
 
const TransformStategetTransformState () const
 Provides read-only access to the parent TransformState object. More...
 
LogicalResult replacePayloadOp (Operation *op, Operation *replacement)
 Replaces the given payload op with another op. More...
 
LogicalResult replacePayloadValue (Value value, Value replacement)
 Replaces the given payload value with another value. More...
 

Friends

class TransformState
 

Detailed Description

Base class for TransformState extensions that allow TransformState to contain user-specified information in the state object.

Clients are expected to derive this class, add the desired fields, and make the derived class compatible with the MLIR TypeID mechanism:

class MyExtension final : public TransformState::Extension {
public:
MyExtension(TranfsormState &state, int myData)
: Extension(state) {...}
private:
int mySupplementaryData;
};

Instances of this and derived classes are not expected to be created by the user, instead they are directly constructed within a TransformState. A TransformState can only contain one extension with the given TypeID. Extensions can be obtained from a TransformState instance, and can be removed when they are no longer required.

transformState.addExtension<MyExtension>(/*myData=*&zwj;/42);
MyExtension *ext = transformState.getExtension<MyExtension>();
ext->doSomething();

Definition at line 410 of file TransformInterfaces.h.

Constructor & Destructor Documentation

◆ ~Extension()

transform::TransformState::Extension::~Extension ( )
virtualdefault

Base virtual destructor.

◆ Extension()

mlir::transform::TransformState::Extension::Extension ( TransformState state)
inlineprotected

Constructs an extension of the given TransformState object.

Definition at line 422 of file TransformInterfaces.h.

Member Function Documentation

◆ getTransformState()

const TransformState& mlir::transform::TransformState::Extension::getTransformState ( ) const
inlineprotected

Provides read-only access to the parent TransformState object.

Definition at line 425 of file TransformInterfaces.h.

◆ replacePayloadOp()

LogicalResult transform::TransformState::Extension::replacePayloadOp ( Operation op,
Operation replacement 
)
protected

Replaces the given payload op with another op.

If the replacement op is null, removes the association of the payload op with its handle. Returns failure if the op is not associated with any handle.

Note: This function does not update value handles. None of the original op's results are allowed to be mapped to any value handle.

Definition at line 1044 of file TransformInterfaces.cpp.

◆ replacePayloadValue()

LogicalResult transform::TransformState::Extension::replacePayloadValue ( Value  value,
Value  replacement 
)
protected

Replaces the given payload value with another value.

If the replacement value is null, removes the association of the payload value with its handle. Returns failure if the value is not associated with any handle.

Definition at line 1052 of file TransformInterfaces.cpp.

Friends And Related Function Documentation

◆ TransformState

friend class TransformState
friend

Definition at line 412 of file TransformInterfaces.h.


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