]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
RISC-V: Add macro-only operands to validate_riscv_insn
authorTsukasa OI <research_trasio@irq.a4lg.com>
Sun, 7 Aug 2022 05:57:00 +0000 (14:57 +0900)
committerTsukasa OI <research_trasio@irq.a4lg.com>
Thu, 22 Sep 2022 06:28:19 +0000 (06:28 +0000)
Although they are not (and should not be) reachable, following macro-only
operands are parsed in the `validate_riscv_insn' function and ignored.
That function also notes that they are macro-only.

-   "A"
-   "B"
-   "I"

Following this convention, this commit adds three remaining macro-only
operands to this function.  By doing this, we could instead choose to reject
those operands from appearing in regular instructions later.

-   "c"   (used by call, tail and jump macros)
-   "VM"  (used by vmsge.vx and vmsgeu.vx macros)
-   "VT"  (likewise)

gas/ChangeLog:

* config/tc-riscv.c (validate_riscv_insn): Add "c", "VM" and "VT"
macro-only operand types.

gas/config/tc-riscv.c

index 5411d68a4017393d2f6992bd05d276efd34acce7..0a14b2cecc89a78ac71cda313c03b148f308b52a 100644 (file)
@@ -1203,6 +1203,8 @@ validate_riscv_insn (const struct riscv_opcode *opc, int length)
            case 'j':
            case 'k': USE_BITS (OP_MASK_VIMM, OP_SH_VIMM); break;
            case 'm': USE_BITS (OP_MASK_VMASK, OP_SH_VMASK); break;
+           case 'M': break; /* Macro operand, must be a mask register.  */
+           case 'T': break; /* Macro operand, must be a vector register.  */
            default:
              goto unknown_validate_operand;
            }
@@ -1214,6 +1216,7 @@ validate_riscv_insn (const struct riscv_opcode *opc, int length)
        case '>': USE_BITS (OP_MASK_SHAMT, OP_SH_SHAMT); break;
        case 'A': break; /* Macro operand, must be symbol.  */
        case 'B': break; /* Macro operand, must be symbol or constant.  */
+       case 'c': break; /* Macro operand, must be symbol or constant.  */
        case 'I': break; /* Macro operand, must be constant.  */
        case 'D': /* RD, floating point.  */
        case 'd': USE_BITS (OP_MASK_RD, OP_SH_RD); break;