[Mlir-commits] [mlir] [mlir][EmitC] Add custom assembly format to constant and variable ops (PR #87618)
Matthias Gehre
llvmlistbot at llvm.org
Mon Apr 15 01:41:09 PDT 2024
mgehre-amd wrote:
> I really appreciate any effort to improve the / add a custom assembly format. While
>
> ```mlir
> %c5 = emitc.variable(#emitc.opaque<"">) : !emitc.ptr<i32>
> %c6 = emitc.variable(#emitc.opaque<"NULL">) : !emitc.ptr<i32>
> ```
>
> looks (nearly) good to me, I would appreciate something similar for non-opaque attributes so we have
>
> ```mlir
> %c3 = emitc.variable -1 : si8
> %c4 = emitc.variable 255 : ui8
> ```
>
> instead of
>
> ```mlir
> %c3 = emitc.variable(-1 : si8) : si8
> %c4 = emitc.variable(255 : ui8) : ui8
> ```
>
> similar to `arith.constant`. As discussed offline, this isn't straight forward as opaque attributes have no type and `arith.constant` uses a `TypedAttrInterface`.
>
> I am being cautious here, because if we adjust the IR then it should be stable and we won't break it by further updates. So we should see if there really is no better way.
Would this be possible with a custom parse function like in https://github.com/llvm/llvm-project/blob/main/mlir/lib/Dialect/EmitC/IR/EmitC.cpp#L325?
https://github.com/llvm/llvm-project/pull/87618
More information about the Mlir-commits
mailing list