[Mlir-commits] [mlir] [mlir-c] Add TypeConverter source and target materialization (PR #208934)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Sat Jul 11 20:47:51 PDT 2026
================
----------------
PragmaTwice wrote:
I checked the signature in C++ and it seems for target materialization it's more complicated?
```c++
/// Generate a wrapper for the given target materialization callback.
/// The callback may take any subclass of `Type` and the wrapper will check
/// for the target type to be of the expected class before calling the
/// callback.
///
/// With callback of form:
/// - Value(OpBuilder &, T, ValueRange, Location, Type)
/// - SmallVector<Value>(OpBuilder &, TypeRange, ValueRange, Location, Type)
template <typename T, typename FnT>
std::enable_if_t<
std::is_invocable_v<FnT, OpBuilder &, T, ValueRange, Location, Type>,
TargetMaterializationCallbackFn>
wrapTargetMaterialization(FnT &&callback) const {
```
It can accept an additional `Type` and return a list of `Value`s (for 1:N conversion?). Note that for source materialization this callback models 1:N conversion already (i.e. `intptr_t nInputs, MlirValue *inputs`).
https://github.com/llvm/llvm-project/pull/208934
More information about the Mlir-commits
mailing list