[Mlir-commits] [mlir] [mlir-c] Add mlirDialectMaterializeConstant (PR #206553)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Fri Sep 25 19:58:01 PDT 2026
================
@@ -304,6 +304,18 @@ void mlirIRRewriterDestroy(MlirRewriterBase rewriter) {
delete static_cast<IRRewriter *>(unwrap(rewriter));
}
+//===----------------------------------------------------------------------===//
+/// Dialect constant materialization API
+//===----------------------------------------------------------------------===//
+
+MlirOperation mlirDialectMaterializeConstant(MlirDialect dialect,
+ MlirRewriterBase rewriter,
+ MlirAttribute value, MlirType type,
+ MlirLocation loc) {
+ return wrap(unwrap(dialect)->materializeConstant(
+ *unwrap(rewriter), unwrap(value), unwrap(type), unwrap(loc)));
+}
----------------
PragmaTwice wrote:
yah I think the key fact here is that we don't have `OpBuilder` in C APIs. The C++ API is
```
materializeConstant (OpBuilder &builder, Attribute value, Type type, Location loc)
```
Here we use `Rewriter` but `Rewriter` is a subclass of `OpBuilder` IIRC so it may not cover all scenario.
https://github.com/llvm/llvm-project/pull/206553
More information about the Mlir-commits
mailing list