MLIR 22.0.0git
mlir::DialectFoldInterface Class Reference

Define a fold interface to allow for dialects to control specific aspects of the folding behavior for operations they define. More...

#include "mlir/Interfaces/FoldInterfaces.h"

Inheritance diagram for mlir::DialectFoldInterface:

Public Member Functions

 DialectFoldInterface (Dialect *dialect)
virtual LogicalResult fold (Operation *op, ArrayRef< Attribute > operands, SmallVectorImpl< OpFoldResult > &results) const
 Registered fallback fold for the dialect.
virtual bool shouldMaterializeInto (Region *region) const
 Registered hook to check if the given region, which is attached to an operation that is not isolated from above, should be used when materializing constants.
Public Member Functions inherited from mlir::DialectInterface
virtual ~DialectInterface ()
DialectgetDialect () const
 Return the dialect that this interface represents.
MLIRContextgetContext () const
 Return the context that holds the parent dialect of this interface.
TypeID getID () const
 Return the derived interface id.

Additional Inherited Members

Public Types inherited from mlir::detail::DialectInterfaceBase< ConcreteType, DialectInterface >
using Base
Public Types inherited from mlir::DialectInterface
template<typename ConcreteType>
using Base = detail::DialectInterfaceBase<ConcreteType, DialectInterface>
 The base class used for all derived interface types.
Static Public Member Functions inherited from mlir::detail::DialectInterfaceBase< ConcreteType, DialectInterface >
static TypeID getInterfaceID ()
 Get a unique id for the derived interface type.
Protected Member Functions inherited from mlir::detail::DialectInterfaceBase< ConcreteType, DialectInterface >
 DialectInterfaceBase (Dialect *dialect)
Protected Member Functions inherited from mlir::DialectInterface
 DialectInterface (Dialect *dialect, TypeID id)

Detailed Description

Define a fold interface to allow for dialects to control specific aspects of the folding behavior for operations they define.

Definition at line 22 of file FoldInterfaces.h.

Constructor & Destructor Documentation

◆ DialectFoldInterface()

mlir::DialectFoldInterface::DialectFoldInterface ( Dialect * dialect)
inline

Definition at line 25 of file FoldInterfaces.h.

Member Function Documentation

◆ fold()

virtual LogicalResult mlir::DialectFoldInterface::fold ( Operation * op,
ArrayRef< Attribute > operands,
SmallVectorImpl< OpFoldResult > & results ) const
inlinevirtual

Registered fallback fold for the dialect.

Like the fold hook of each operation, it attempts to fold the operation with the specified constant operand values - the elements in "operands" will correspond directly to the operands of the operation, but may be null if non-constant. If folding is successful, this fills in the results vector. If not, this returns failure and results is unspecified.

Definition at line 33 of file FoldInterfaces.h.

Referenced by mlir::Operation::fold().

◆ shouldMaterializeInto()

virtual bool mlir::DialectFoldInterface::shouldMaterializeInto ( Region * region) const
inlinevirtual

Registered hook to check if the given region, which is attached to an operation that is not isolated from above, should be used when materializing constants.

The folder will generally materialize constants into the top-level isolated region, this allows for materializing into a lower level ancestor region if it is more profitable/correct.

Definition at line 43 of file FoldInterfaces.h.


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