TableGen standard arithmetic ops
Use tablegen to generate definitions of the standard binary arithmetic operations. These operations share a lot of boilerplate that is better off generated by a tool. Using tablegen for standard binary arithmetic operations requires the following modifications. 1. Add a bit field `hasConstantFolder` to the base Op tablegen class; generate the `constantFold` method signature if the bit is set. Differentiate between single-result and zero/multi-result functions that use different signatures. The implementation of the method remains in C++, similarly to canonicalization patterns, since it may be large and non-trivial. 2. Define the `AnyType` record of class `Type` since `BinaryOp` currently provided in op_base.td is supposed to operate on tensors and other tablegen users may rely on this behavior. Note that this drops the inline documentation on the operation classes that was copy-pasted around anyway. Since we don't generate g3doc from tablegen yet, keep LangRef.md as it is. Eventually, the user documentation can move to the tablegen definition file as well. PiperOrigin-RevId: 227820815
Loading
Please sign in to comment