When defining operations in ODS it is convenient group like ops together by deriving from a common “abstract” op:
class X_Op<string mnemonic, list<OpTrait> traits = []> :
Op<SomeDialect, mnemonic, traits>;
class X_ALike_Op<string mnemonic, list<OpTrait> traits = []> :
X_Op<mnemonic, traits>;
def X_A1_Op: X_ALike_Op<"a1">;
def X_A2_Op: X_ALike_Op<"a2">;
def X_A3_Op: X_ALike_Op<"a3">;
I was thinking this construct models a generalization/specialization, but the X_ALike_Op is not present anywhere in the generated code.
I can sort of emulate this by giving such an abstract op a similarly named trait. That works but is not as nice as having the full hierarchy present like in MDE/DSL frameworks such as for instance EMF.
Is there maybe a better way to have the X_ALike_Op available in patterns or constraints?