tablegen multiple inheritance question

class one {
   int i = 0;

class two {
   int i = 1;

class multiple: one, two;

This causes the first i to be ignored and the second i to replace it.

This is a useful property if you want to specialize classes.

But I don't know if it was intended to work that way or not.

For example, if you have an instruction class with no patterns, you can merge it with one that defines the pattern and maybe other instruction components by building a derived class.

Anybody know if this is intended behavior in tablegen?

Seems to just be a byproduct of TGParser::AddSubClass() begin called
twice. This means that TGParser::AddValue() is being called once for
the "i" of each class, and the "last one wins".

Not sure if it is intended, but this behavior seems to more-or-less
"make sense".

--Sean Silva

Whether originally intended or not, existing targets use/exploit/abuse (depending on your perspective) this behavior quite a bit.