My Project
|
#include <OpDefinition.h>
Public Member Functions | |
LogicalResult | fold (ArrayRef< Attribute > operands, SmallVectorImpl< OpFoldResult > &results) |
Static Public Member Functions | |
static LogicalResult | foldHook (Operation *op, ArrayRef< Attribute > operands, SmallVectorImpl< OpFoldResult > &results) |
This template defines the foldHook as used by AbstractOperation.
The default implementation uses a general fold method that can be defined on custom ops which can return multiple results.
|
inline |
This hook implements a generalized folder for this operation. Operations can implement this to provide simplifications rules that are applied by the Builder::createOrFold API and the canonicalization pass.
This is an intentionally limited interface - implementations of this hook can only perform the following changes to the operation:
This allows expression of some simple in-place canonicalizations (e.g. "x+0 -> x", "min(x,y,x,z) -> min(x,y,z)", "x+y-x -> y", etc), as well as generalized constant folding.
If not overridden, this fallback implementation always fails to fold.
|
inlinestatic |
This is an implementation detail of the constant folder hook for AbstractOperation.