<div dir="ltr"><div><div><div>Hi all,<br><br></div>I am trying to implement an instruction with no operand for example "clr" in TableGen.<br><br>-----------------------------------------<br></div>e.g.<br><br><b>InstrInfo.td:</b><br><br>class TestInst<string opc, string asmstr, dag oops, dag iops, <br>                list<dag> pattern> : Instruction { ... }<br><br>def int_no_operand : Intrinsic<[]>;<br>class ALU<string opc> : TestInst<opc, "", (outs), (ins), [(int_no_operand)]>;<br><br><b>InstrFormat.td</b><br>multiclass Clr {<br> def _ : ALU<"clr"><br>   {let InstOp  = 0b11;}<br>}<br><br>-----------------------------------------<br><br></div>after compiling the code, I receive the following error:<br><br><br><i>llvm-tblgen: /llvm/utils/TableGen/CodeGenInstruction.h:186: std::pair<unsigned int, unsigned int> llvm::CGIOperandList::getSubOperandNumber(unsigned int) const: Assertion `i < OperandList.size() && "Invalid flat operand #"' failed.<br></i><div><br><br></div><div>How can I define an instruction with no operand?<br></div><div>In ARM there is a similar instruction like "CLREX" but I don't understand why in the assertion in CodeGenInstruction.h number of sub operand num should be more than 0? getSubOperandNumber counts the operator (i.e. the instruction mnemonic itself) as well? I mean, we will have minimum 1 in any situation or it's just the number of operators?!<br><br></div><div>Cheers,<br></div><div>ES<br></div></div>