Odd error with Return Instruction

Hi everyone,

I am working on a new backend and I am having an odd problem with the CodeGenEmitter (trying to create GenCodeEmitter.inc) when defining the “return” instruction of this architecture. I have followed other backends, however, that did not solve it.

The “Return” instruction is defined as follows.

def Ret : SDNode<“ArchISD::RET”, SDTNone,
[SDNPHasChain, SDNPOptInGlue, SDNPVariadic]>;

class ReturnInstr<string OpcStr, bits<8> OpVal, InstrItinClass Itin>
: InstArch<(outs), (ins),
[(Ret)], Itin>{
let isReturn = 1;

def RET : ReturnInstr<“return”, 0b00100110, IIAlu>;

And the error is the following.

Assertion failed: (i < OperandList.size() && “Invalid flat operand #”), function getSubOperandNumber, file llvm/utils/TableGen/CodeGenInstruction.h, line 186.

The odd thing is: this is similar to other architectures.

It looks like I cannot make an instruction to be SDTNone (no Ins), since it worked when I changed this instruction by adding an Input DAG in it (that is not what I want, though).

Any thoughts? Am I missing something?