This revision adds a new StaticVerifierFunctionEmitter class that emits local static functions in the .cpp file for shared operation verification. This class deduplicates shared operation verification code by emitting static functions alongside the op definitions. These methods are local to the definition file, and are invoked within the operation verify methods. The first bit of shared verification is for the type constraints used when verifying operands and results. An example is shown below:
static LogicalResult localVerify(...) { ... } LogicalResult OpA::verify(...) { if (failed(localVerify(...))) return failure(); ... } LogicalResult OpB::verify(...) { if (failed(localVerify(...))) return failure(); ... }
This allowed for saving >400kb of code size from a downstream TensorFlow project (~15% of MLIR code size).
Is this only needed to be able to unique? Would exposing a compare function suffice to not need this? (To avoid exposing TableGen types from these types)