TableGen MCInstrDesc Instruction Size Zero

Dear all,

I am trying to write an AsmParser and a CodeEmitter for simple ADD instruction.
Here is what I have in the TestGenInstrInfo.td:

extern const MCInstrDesc TestInsts[] = {

{ 23, 3, 1, 0, 0, 0, 0x0ULL, nullptr, nullptr, OperandInfo13, 0, nullptr }, // Inst #23 = ADD8_rr

}

I parse the instruction successfully but I am not sure what I did wrong that the Size (as you can see in the line above is Zero for this instruction. (In EncodeInstruction, Desc.getSize() returns zero.)

Any help is appreciated…

Cheers,

ES

Hi Sky

I think you need a ‘let Size = ‘ line in your instruction definition.

If you have fixed size instructions, then you can put a single size in the base class for all your instructions, eg, like this from AArch64InstrFormats.td

// Real instructions (have encoding information)
class EncodedI<string cstr, list pattern> : AArch64Inst<NormalFrm, cstr> {
let Pattern = pattern;
let Size = 4;
}

Or if you have variable sized instructions then you might need to set the size on each class of instruction you define, or even each instruction.

Cheers,
Pete

Thanks a lot Pete :slight_smile: