Hi,<div><br></div><div>I've come across a problem while working on an LLVM backend for a new target architecture.</div><div><br></div><div>This architecture has two single-ported register files. Each instruction can only read one operand from each register file, but can write to either.  I tried implementing it naïvely in TableGen with two definitions per instruction, so I had:</div>
<div><br></div><div>def AllRegs : RegisterClass< ... (add interleave (XRegs, YRegs))>;</div><div><br></div><div>and in the InstrInfo.td:</div><div><br></div><div>def Instr_xy: Instruction(outs AllRegs:$dst), (ins XRegs:$src1, YRegs:$src2), "...", [(set AllRegs:$dst, (OpNode XRegs:$src1, YRegs:$src2))]</div>
<div><br></div><div>def Instr_yx: Instruction(outs AllRegs:$dst), (ins YRegs:$src1, XRegs:$src2), "...", [(set AllRegs:$dst, (OpNode YRegs:$src1, XRegs:$src2))]</div><div><br></div><div>for each instruction. However, upon failing the first match, it insisted on swapping the registers between the two classes and sticking with that instruction.</div>
<div><br></div><div>I also tried using ComplexPatterns, but to no avail. I'm sure this is entirely possible, but I can't see how it's done.</div><div><br></div><div>Thanks,</div><div>Fraser</div>