[PATCH] [RISCV] Initial support .insn directive for the assembler.
authorCraig Topper <craig.topper@sifive.com>
Sun, 12 Sep 2021 20:45:52 +0000 (13:45 -0700)
committerSylvestre Ledru <sylvestre@debian.org>
Fri, 22 Jul 2022 13:10:20 +0000 (14:10 +0100)
commitf8f079d5af679803782b5a82dd8dac34f0719e22
tree6e976c9be1af485395f31e1ad0bfc7b8ccd0ec14
parentb8453fbd79d95f9a830dc9f683dffea3d1283c05
[PATCH] [RISCV] Initial support .insn directive for the assembler.

This allows for a custom encoding to be emitted. It can also be
used with inline assembly to allow the custom instruction to be
register allocated like other instructions.

I initially started from SystemZ's implementation, but some of
the formats allow operands to be specified in multiple ways so I
had to add support for matching different operand class lists for
the same format. That implementation is a simplified version of
what is emitted by tablegen for regular instructions.

I've left out the compressed formats. And I haven't supported the
named opcodes like LUI or OP_IMM_32. Those can be added in future
patches.

Documentation can be found here https://sourceware.org/binutils/docs-2.37/as/RISC_002dV_002dFormats.html

Reviewed By: jrtc27, MaskRay

Differential Revision: https://reviews.llvm.org/D108602

Gbp-Pq: Topic risc
Gbp-Pq: Name riscv-insn-support.patch
llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp
llvm/lib/Target/RISCV/RISCVInstrFormats.td
llvm/lib/Target/RISCV/RISCVInstrInfo.td
llvm/lib/Target/RISCV/RISCVRegisterInfo.td
llvm/test/MC/RISCV/insn-invalid.s [new file with mode: 0644]
llvm/test/MC/RISCV/insn.s [new file with mode: 0644]