[PATCH] D79159: [MLIR] Add complex numbers to standard dialect
Alex Zinenko via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 30 05:38:57 PDT 2020
ftynse added inline comments.
================
Comment at: mlir/include/mlir/Dialect/StandardOps/IR/Ops.td:1016
+ let assemblyFormat = [{
+ $real `,` $imag attr-dict `:` type($real) `,` type($imag) `->` type($cplx)
+ }];
----------------
frgossen wrote:
> ftynse wrote:
> > Do we want to support "mixed" types, e.g. f32, f64 -> complex<f64>? If not, I would just keep the `type($cplx)` here.
> I would love to have only `type($cplx)` here.
> The reason for the current format is that `tablegen` complained when I dropped the other types.
> I can fix this with a hand-written parser and printer but before I do that I want to ask if this is also possible with the `assemblyFormat` thingy.
> What is the elegant way to do this?
Indeed, auto-generated printer and parser needs a way to resolve _all_ types and cannot do so in this case. Sometimes, it can rely on the traits like `SameOperandAndResultTypes`, but not here. Ideally, we would have some way of specifying "type deduction rules"... Until that exists, you will need printer and parser functions. To make life easier, you can just take those generated by mlir-tblgen today and amend them a bit to deduce the types.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79159/new/
https://reviews.llvm.org/D79159
More information about the llvm-commits
mailing list