[mlir] Generate Op builders for Python bindings
Add an ODS-backed generator of default builders. This currently does not support operation with attribute arguments, for which the builder is just ignored. Attribute support will be introduced separately for builders and accessors. Default builders are always generated with the same number of result and operand groups as the ODS specification, i.e. one group per each operand or result. Optional elements accept None but cannot be omitted. Variadic groups accept iterable objects and cannot be replaced with a single object. For some operations, it is possible to infer the result type given the traits, but most traits rely on inline pieces of C++ that we cannot (yet) forward to Python bindings. Since the Ops where the inference is possible (having the `SameOperandAndResultTypes` trait or `TypeMatchesWith` without transform field) are a small minority, they also require the result type to make the builder syntax more consistent. Reviewed By: stellaraccident Differential Revision: https://reviews.llvm.org/D91190
Loading
Please sign in to comment