MLIR  20.0.0git
Public Member Functions | List of all members
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. More...
 
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. More...
 

Additional Inherited Members

- Public Types inherited from mlir::detail::DialectInterfaceBase< ConcreteType, BaseT >
using Base = DialectInterfaceBase< ConcreteType, BaseT >
 
- Static Public Member Functions inherited from mlir::detail::DialectInterfaceBase< ConcreteType, BaseT >
static TypeID getInterfaceID ()
 Get a unique id for the derived interface type. More...
 
- Protected Member Functions inherited from mlir::detail::DialectInterfaceBase< ConcreteType, BaseT >
 DialectInterfaceBase (Dialect *dialect)
 

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.

◆ 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: