MIR instruction size

Hello,
Is there any common way to determine a size of MIR instruction? I’ve tried both: MachineInstr::getDesc().getSize() and TargetInstrInfo::getInstSizeInBytes(I), and unfortunately, both interfaces can’t determine instruction sizes for x86_64, though they could do it for arm architecture.

No,
X86 instructions are variable size. Depending on which registers are allocated or what sized immediate an instruction variant takes you may need additional rex/rex.w prefixes immediate bytes etc.
There is no API today that would answer that question, and even if there were it would be a dangerous API as later passes could change the size just by swapping some registers.

- Matthias