<div dir="ltr"><div>Guys, I stuck at this point. Could you please give me a hint how to solve this problem without touching the LLVM backbone?!<br></div>Why LLVM doesn't let me define an instruction consisting of an operator with no operand?<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 19, 2015 at 5:04 PM, Sky Flyer <span dir="ltr"><<a href="mailto:skylake007@googlemail.com" target="_blank">skylake007@googlemail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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>
</blockquote></div><br></div>