<div dir="ltr"><div>Hello<br>I'm dealing with an implementation from scratch of a
backend. However, although I reached some first good results, now I'm
facing a quite strange issue that I'm not able to figure out.<br><br>In my Arch0RegisterInfo.td, I have:<br><br>def sub_even : SubRegIndex<32>;<br>def sub_odd : SubRegIndex<32, 32>;<br><br>class Arch0GPRReg<bits<16> Enc, string n> : Arch0Reg<Enc, n>;<br>class Arch064GPRReg<bits<16> Enc, string n, list<Register> subregs><br> : Arch0RegWithSubRegs<Enc, n, subregs> {<br> let SubRegIndices = [sub_even, sub_odd];<br> let CoveredBySubRegs = 1;<br>}<br><br>and then:<br><br>foreach i = 0-57 in {<br> def S#i : Arch0GPRReg<i, "s"#i>, DwarfRegNum<[i]>;<br>}<br>foreach i = 0-28 in {<br> def S#!shl(i, 1)#_S#!add(!shl(i, 1), 1) : Arch064GPRReg<!shl(i, 1), "s"#!shl(i, 1),<br> [!cast<Arch0GPRReg>("S"#!shl(<wbr>i, 1)),<br> !cast<Arch0GPRReg>("S"#!add(!<wbr>shl(i, 1), 1))]>;<br>}<br><br></div><div>The two loops will generate something like this:<br>def S0 : Arch0GPRReg<0, "s0">, DwarfRegNum<[0]>;<br>def S1 : Arch0GPRReg<1, "s1">, DwarfRegNum<[1]>;<br>def S2 : Arch0GPRReg<2, "s2">, DwarfRegNum<[2]>;<br>def S3 : Arch0GPRReg<3, "s3">, DwarfRegNum<[3]>;<br>...<br><br>def S0_S1 : Arch064GPRReg<0, "s0", [S0, S1]>;<br>def S2_S3 : Arch064GPRReg<2, "s2", [S2, S3]>;<br>...<br><br></div><div><br>I would like to have 32 bit general purpose registers that could be taken in pairs to have 64 bit registers.<br><br>However, when I compile in debug mode, I got the following error message:<br>Assertion `Matches.size() == 1 && "Had duplicate keys to match on"' failed.<br><br>This
depends on the fact that the method emitMatchRegisterName and in
particular the method EmitStringMatcherForChar found different registers
with the same names. <br><br></div>However, I have seen that this is quite common in many other backends (sparca, mips, etc..).<br><div><br>Can somebody help me to figure out what is wrong with my code?<br><br></div><div>Thank you,<br></div>Edo</div>