The attached patch adds a construct that enables extending the base class' lists rather than completely overwriting them.<br>The patch hasn't gone through extensive testing yet (other than running make check).<br><br>
The lists can be extended either with a "+=" operator in a let statement or placing a '"+" in front of a superclass:<br><br>- Example 1:<br> <br>def D0 : C1 {<br> let Predicates += [P2]; // Append P2 to C1's Predicates<br>
}<br><br>- Example 2:<br><br>def D0 : C1, +AddP1;<br><br><br>Using a real example, MOVi16 (in ARMInstrInfo.td) which is defined as<br><br>def MOVi16 : AI1<0b1000, (outs GPR:$Rd), (ins imm0_65535_expr:$imm),<br> DPFrm, IIC_iMOVi,<br>
"movw", "\t$Rd, $imm",<br> [(set GPR:$Rd, imm0_65535:$imm)]>,<br> Requires<[IsARM, HasV6T2]>, UnaryDP {<br><br><br>can be rewritten to this:<br>
<br>class PredHasV6T2 {<br> list<Predicate> Predicates = [HasV6T2];<br>}<br><br>def MOVi16 : AI1<0b1000, (outs GPR:$Rd), (ins imm0_65535_expr:$imm),<br>
DPFrm, IIC_iMOVi,<br>
"movw", "\t$Rd, $imm",<br>
[(set GPR:$Rd, imm0_65535:$imm)]>,<br>
+PredHasV6T2, UnaryDP {<br>
<br>
Since AI1 already has "IsARM" in its predicate list, MOVi16 just has to extend the list with [HasV6T2].<br><br><br>Also, I changed the last statement of ListRecTy::convertValue (in lib/TableGen/Record.cpp) to pass the element type of the list rather than the list type.<br>
I would appreciate if someone could take a look at this code and tell me whether this is correct.<br><br>