<div dir="ltr">Hello all,<div><br></div><div>I have two Tablegen questions in the context of an unconventional architecture.  The pertinent details: the architecture has multiple register files that are selected via a bit in the instruction.  One of the register files is a traditional one.  The other is unconventional in that all source and dest registers are both read from and written to by the instructions.  So</div><div><br></div><div>add special0, special1, special2</div><div><br></div><div>would require both the ins and outs dags in the instruction info to have all three registers, if I understand the scheduler correctly.</div><div><br></div><div>My questions:</div><div>1) Is my assumption that both ins and outs dags must have all three special registers correct?</div><div>2) Is there a way to template ins and outs and mix that with multiclass, or do I need to elaborate all options?  I can't find a similar example where ins and outs are conditionally populated for an instruction.  </div><div><br></div><div>Right now I'm using 4.0.1.  I used to have the if(eq()) embedded in the templates, but that doesn't generate.  I'm currently trying to create a class containing the ins and outs dags, using if(eq()) extensively, so that the multiclass template for the instructions is a single line.  Code follows (probably not correct due to name mangling).</div><div><br></div><div><div>class IO_MultSrc<bits<2> op0Type, RegisterClass Src0RC> {</div><div>  dag insDefault = !if(!eq(op0Type, 0b01),<br></div><div>                       (ins SpecialReg:$dst, Src0RC:$a),</div><div>                       (ins Src0RC:$a));</div><div>...</div><div> }</div></div><div><br></div><div><div>multiclass MultSrc1Spec<bits<5> subOpcode, bits<2> op0t, string opcodeStr, RegisterClass RegType> {</div><div>    def _allspecial:</div><div>      MultSrcOneDestInst<subOpcode, op0t, 0b00,</div><div>                         IO_MultSrc<op0t, SpecialReg>.outsDefault,</div><div>                         IO_MultSrc<op0t, SpecialReg>.insDefault>;</div><div>    ...</div><div>}</div></div><div><br></div><div>multiclass TwoSrcOneDestSpec<bits<5> subOpcode, string opcodeStr> {<br></div><div><div>  defm _dds: MultSrc1Spec<subOpcode, 0b10, opcodeStr, SpecialReg>;</div><div>  ...</div><div>  defm _rr: MultSrc1Spec<subOpcode, 0b11, opcodeStr, GPReg>;</div><div>}</div></div><div><br></div><div>defm ADD   : TwoSrcOneDestSpec<0b10000, "add">;<br></div><div><br></div><div>I currently get the error "Undefined reference:'ADDanonymous_545'" when I try to generate.</div><div><br></div><div>Any advice would be greatly appreciated, even if that advice is "don't try to conditionally set ins and outs."</div><div><br></div><div>Shane</div><div><br></div></div>