Files
clang-p2996/mlir/lib/TableGen/Class.cpp
Markus Böck f3b1361f35 [mlir] Generate constructor in generic adaptors allowing construction from an op instance
In essentially all occurrences of adaptor constructions in the codebase, an instance of the op is available and only a different value range is being used. Nevertheless, one had to perform the ritual of calling and pass `getAttrDictionary()`, `getProperties` and `getRegions` manually.

This patch changes that by teaching TableGen to generate a new constructor in the adaptor that is constructable using `GenericAdaptor(valueRange, op)`. The (discardable) attr dictionary, properties and the regions are then taken directly from the passed op, with only the value range being taken from the first parameter.

This simplifies a lot of code and also guarantees that all the various getters of the adaptor work in all scenarios.

Differential Revision: https://reviews.llvm.org/D157516
2023-08-10 12:38:54 +02:00

13 KiB