[LLVMdev] A simpler method to reject undefined encodings

Tim Northover t.p.northover at gmail.com
Wed May 1 04:06:15 PDT 2013


Hi Mihail,

> static DecodeStatus CheckNEONConstraint(const MCInst &Inst, unsigned Insn)
[...]
> ConstraintCheckMethod = "CheckNEONConstraint"

In general I like the idea of an instruction-validation method. I
think it could also potentially solve the SoftFail/UNPREDICTABLE
issues that are looming (and partially resolved for decoding at
present).

However, I think that to cope with the other issues the scope of the
method should (at least potentially) be wider than just disassembly.
For example we will eventually want to reject some load instructions
based on complex operand constraints (e.g. if it's write-back indexed
and Rt == Rn). Currently the only way to handle cross-operand
conditions in the AsmParser (I believe) is with a custom
ConvertMethod, which is even more heavyweight than the disassembler
situation.

I think making this checker work for assembly would be rather simple
if the method acts on an MCInst, but probably not possible if it also
gets to use the bit-pattern as suggested.

In addition, in my view working on the bit-pattern adds redundancy and
potential bugs where the decoder and checker interpret the bits
differently.

I've been wrong about MC layer design before though. Jim's been very
helpful at explaining the error of my ways in the past; I've added him
on CC.

Cheers.

Tim.



More information about the llvm-dev mailing list