Depends on D3671
Details
Diff Detail
Event Timeline
lib/Target/Mips/Mips32r6InstrFormats.td | ||
---|---|---|
63 | I have just a question. Is there any particular reason why is inheritance used here? Couldn't we have single format class for AUI, DAHI, DATI and DAUI, and just to pass opcode as parameter, like we did for all other similar instructions so far? I'm just wondering why not to have a single style for doing a same things. class AUI_FM<bits<6> opcode> : MipsR6Inst { bits<5> rs; bits<5> rt; bits<16> imm; bits<32> Inst; let Inst{31-26} = opcode; let Inst{25-21} = rs; let Inst{20-16} = rt; let Inst{15-0} = imm; } |
lib/Target/Mips/Mips32r6InstrFormats.td | ||
---|---|---|
63 | DAHI and DATI are actually in the REGIMM_FM format. For AUI and DAUI: My thinking was that the format is derived from the top 6 bits of the opcode (with a few exceptions such as the SPECIAL formats). AUI and DAUI differ in these format bits and should therefore be different formats. Inheritance is merely used to exploit the similarity between these two formats. At the moment the compact branch formats are inconsistent with this line of thinking. I'll probably separate them into BLEZL/BGTZL/etc. formats at some point after we have a minimal compiler working. The main advantage of this is that you can glance at the format name and easily see how it maps to the spec since it uses the same names. It's also easier to spot mistakes in words rather than binary values. The OPCODE*_* constants are the result of the same line of thinking. |
lib/Target/Mips/Mips32r6InstrFormats.td | ||
---|---|---|
63 | I've just committed the patch (so I can commit the later work) but I'm still open to changing this if that's what we decide to do. |
I have just a question. Is there any particular reason why is inheritance used here? Couldn't we have single format class for AUI, DAHI, DATI and DAUI, and just to pass opcode as parameter, like we did for all other similar instructions so far? I'm just wondering why not to have a single style for doing a same things.
Maybe the class name should be different, but I was thinking to have something like this: