MLIR
21.0.0git
|
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"
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 | |
![]() | |
using | Base = DialectInterfaceBase< ConcreteType, BaseT > |
![]() | |
static TypeID | getInterfaceID () |
Get a unique id for the derived interface type. More... | |
![]() | |
DialectInterfaceBase (Dialect *dialect) | |
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.
|
inline |
Definition at line 25 of file FoldInterfaces.h.
|
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.
|
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.