MLIR
19.0.0git
|
This class provides a hook that expands one Value into multiple Value's, with a TypeConverter-inspired callback registration mechanism. More...
#include "mlir/Dialect/Func/Transforms/DecomposeCallGraphTypes.h"
Public Member Functions | |
void | decomposeValue (OpBuilder &, Location, Type, Value, SmallVectorImpl< Value > &) |
This method tries to decompose a value of a certain type using provided decompose callback functions. More... | |
template<typename FnT , typename T = typename llvm::function_traits< std::decay_t<FnT>>::template arg_t<2>> | |
void | addDecomposeValueConversion (FnT &&callback) |
This method registers a callback function that will be called to decompose a value of a certain type into 0, 1, or multiple values. More... | |
This class provides a hook that expands one Value into multiple Value's, with a TypeConverter-inspired callback registration mechanism.
For folks that are familiar with the dialect conversion framework / TypeConverter, this is effectively the inverse of a source/argument materialization. A target materialization is not what we want here because it always produces a single Value, but in this case the whole point is to decompose a Value into multiple Value's.
The reason we need this inverse is easily understood by looking at what we need to do for decomposing types for a return op. When converting a return op, the dialect conversion framework will give the list of converted operands, and will ensure that each converted operand, even if it expanded into multiple types, is materialized as a single result. We then need to undo that materialization to a single result, which we do with the decomposeValue hooks registered on this object.
TODO: Eventually, the type conversion infra should have this hook built-in. See https://llvm.discourse.group/t/extending-type-conversion-infrastructure/779/2
Definition at line 46 of file DecomposeCallGraphTypes.h.
|
inline |
This method registers a callback function that will be called to decompose a value of a certain type into 0, 1, or multiple values.
Definition at line 58 of file DecomposeCallGraphTypes.h.
void ValueDecomposer::decomposeValue | ( | OpBuilder & | builder, |
Location | loc, | ||
Type | type, | ||
Value | value, | ||
SmallVectorImpl< Value > & | results | ||
) |
This method tries to decompose a value of a certain type using provided decompose callback functions.
If it is unable to do so, the original value is returned.
Definition at line 20 of file DecomposeCallGraphTypes.cpp.