[PATCH] D147102: [M68k] Add `TRAP`, `TRAPV`, `BKPT`, `ILLEGAL` instructions

Min-Yih Hsu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 1 19:31:27 PDT 2023


myhsu added a comment.

Thank you for this patch!
First, could you add MC tests? If you're not familiar, I believe `test/MC/M68k/Bits/Classes/MxBTST_RR.s` and `test/MC/Disassembler/M68k/bits.txt` are good examples.

> 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.


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