[PATCH] D154916: [LoongArch][NFC] Consistently derive instruction mnemonics from TableGen record names

WÁNG Xuěruì via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 10 21:21:05 PDT 2023


xen0n created this revision.
xen0n added reviewers: SixWeining, wangleiat, MaskRay, xry111.
Herald added a subscriber: hiraditya.
Herald added a project: All.
xen0n requested review of this revision.
Herald added subscribers: llvm-commits, wangpc.
Herald added a project: LLVM.

The recent D154183 <https://reviews.llvm.org/D154183> and D154195 <https://reviews.llvm.org/D154195> have introduced a simpler way to specify
instruction mnemonics: by leveraging TableGen's `NAME` and string
processing features, the mnemonics can be automatically derived from the
respective TableGen record names. LoongArch instructions don't have
"strange" characters in their names, so this approach can be applied to
all the other instructions.

A `deriveInsnMnemonic` helper class, modeled after the LSX/LASX mnemonic
derivation logic, has been added, and all non-pseudo instruction formats
are converted to use it, losing their `opstr/opcstr` arguments in the
process.

There are minor differences that are worth mentioning though:

- The atomic instructions with implicit data barriers have an underscore (`_`) in their mnemonics, that will get converted to a period (`.`) if not specially handled. Double-underscore (`__`) in record names are converted to a single underscore in the resulting mnemonic; the definitions are tweaked accordingly.
- Various duplicated FP instructions need special handling, mainly because of the need to handle both FPR32 and FPR64 classes for a single hardware instruction. The substrings `_xS`, `_xD` and `_64` are additionally dropped before deriving FP instructions' mnemonics.

All of these are pure refactoring, no functional change.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D154916

Files:
  llvm/lib/Target/LoongArch/LoongArchFloat32InstrInfo.td
  llvm/lib/Target/LoongArch/LoongArchFloat64InstrInfo.td
  llvm/lib/Target/LoongArch/LoongArchFloatInstrFormats.td
  llvm/lib/Target/LoongArch/LoongArchInstrFormats.td
  llvm/lib/Target/LoongArch/LoongArchInstrInfo.td
  llvm/lib/Target/LoongArch/LoongArchLASXInstrFormats.td
  llvm/lib/Target/LoongArch/LoongArchLASXInstrInfo.td
  llvm/lib/Target/LoongArch/LoongArchLSXInstrFormats.td
  llvm/lib/Target/LoongArch/LoongArchLSXInstrInfo.td

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154916.538907.patch
Type: text/x-patch
Size: 130341 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230711/ecefd7ae/attachment.bin>


More information about the llvm-commits mailing list