[PATCH] D147102: [M68k] Add `TRAP`, `TRAPV`, `BKPT`, `ILLEGAL` instructions
Ian D. Scott via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 1 20:22:37 PDT 2023
ids1024 added a comment.
>> This does not validate that the 4 and 3 bit immediates taken by TRAP and BKPT are in range. But it seems the backend isn't validating the range of immediates in general.
>
> This can be done by adding a new immediate Operand with a different `AsmOperandClass`, instead of using MxImm <https://github.com/llvm/llvm-project/blob/241ad16eb012ed75d1ff2d8eed8db9464b5c7787/llvm/lib/Target/M68k/M68kInstrInfo.td#L374>. In this new `AsmOperandClass` you can use different `PredicateMethod` / `RenderMethod` / `ParserMethod` to validate the range.
Ah, so this would be best done with another `AsmOperandClass`? And not somehow using `MxImm` and `MxOp`. I'm still trying to understand how these sorts of things are handled in tablegen.
With the current version here, it accepts ` __asm__ ("bkpt #6666666666666666");` without error. So `Mxi8imm` doesn't seem to be correctly validating that the immediate fits in 8 bits.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147102/new/
https://reviews.llvm.org/D147102
More information about the llvm-commits
mailing list