[PATCH] D115224: [RISCV] Support named opcodes in .insn directive.

Nelson Chu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 7 01:11:09 PST 2021


Nelson1225 created this revision.
Herald added subscribers: VincentWu, luke957, achieveartificialintelligence, vkmr, frasercrmck, evandro, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya.
Nelson1225 requested review of this revision.
Herald added subscribers: llvm-commits, MaskRay.
Herald added a project: LLVM.

This patch is one of the TODO of commit, 283879793dc787225992496587581ec77b6b0610 <https://reviews.llvm.org/rG283879793dc787225992496587581ec77b6b0610>

We build the GenericTable for these opcodes, and also extend class RISCVOpcode, to store the names of opcodes.  Then we call the parseInsnDirectiveOpcode to parse the opcode filed in .insn directive. 
 We only allow users to write the recognized opcode names, or just write the immediate values in the 7 bits range.

Besides, for the llvm/lib/Target/RISCV/RISCVInstrInfoZb.td, replace RISCVOpcode<xxx> with the defined OPC_OP_IMM and OPC_OP_IMM_32.

Documentation: https://sourceware.org/binutils/docs-2.37/as/RISC_002dV_002dFormats.html


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D115224

Files:
  llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
  llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.cpp
  llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
  llvm/lib/Target/RISCV/RISCVInstrFormats.td
  llvm/lib/Target/RISCV/RISCVInstrInfo.td
  llvm/lib/Target/RISCV/RISCVInstrInfoZb.td
  llvm/test/MC/RISCV/insn-invalid.s
  llvm/test/MC/RISCV/insn.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115224.392304.patch
Type: text/x-patch
Size: 22825 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211207/14c070ae/attachment.bin>


More information about the llvm-commits mailing list