diff options
author | Nelson Chu <nelson@rivosinc.com> | 2023-09-07 10:52:25 +0800 |
---|---|---|
committer | Nelson Chu <nelson@rivosinc.com> | 2023-09-07 11:45:01 +0800 |
commit | 6de11ff67a925a496319d25dee0bea58427aacf6 (patch) | |
tree | f3b8e8134fde110c2ab5ae00898706c53bab7c05 /opcodes/riscv-dis.c | |
parent | 5e9091dab8858b25210a91d22fbbbfdee9c969ad (diff) | |
download | gdb-6de11ff67a925a496319d25dee0bea58427aacf6.zip gdb-6de11ff67a925a496319d25dee0bea58427aacf6.tar.gz gdb-6de11ff67a925a496319d25dee0bea58427aacf6.tar.bz2 |
RISC-V: Clarify the naming rules of vendor operands.
The vendor operands should be named starting with `X', and preferably the
second letter (or multiple following letters) is enough to differentiate
them from other vendors.
Therefore, added letter `t' after `X' for t-head operands, to differentiate
from future different vendor's operands.
bfd/
* elfxx-riscv.c (riscv_supported_vendor_x_ext): Removed the vendor
document link since it should already be recorded in the
gas/doc/c-riscv.texi.
gas/
* config/tc-riscv.c (validate_riscv_insn): Added `t' after `X' for
t-head operands. Minor updates for indents and comments.
(riscv_ip): Likewise.
* doc/c-riscv.texi: Minor updates.
opcodes/
* riscv-dis.c (print_insn_args): Added `t' after `X' for t-head
operands. Minor updates for indents and comments.
* riscv-opc.c (riscv_opcode): Likewise.
Diffstat (limited to 'opcodes/riscv-dis.c')
-rw-r--r-- | opcodes/riscv-dis.c | 167 |
1 files changed, 86 insertions, 81 deletions
diff --git a/opcodes/riscv-dis.c b/opcodes/riscv-dis.c index 90f0fea..c0fd062 100644 --- a/opcodes/riscv-dis.c +++ b/opcodes/riscv-dis.c @@ -584,97 +584,102 @@ print_insn_args (const char *oparg, insn_t l, bfd_vma pc, disassemble_info *info print (info->stream, dis_style_immediate, "%d", rs1); break; - case 'W': /* Various operands. */ - { - switch (*++oparg) + case 'W': /* Various operands for standard z extensions. */ + switch (*++oparg) + { + case 'i': + switch (*++oparg) + { + case 'f': + print (info->stream, dis_style_address_offset, "%d", + (int) EXTRACT_STYPE_IMM (l)); + break; + default: + goto undefined_modifier; + } + break; + case 'f': + switch (*++oparg) + { + case 'v': + if (riscv_fli_symval[rs1]) + print (info->stream, dis_style_text, "%s", + riscv_fli_symval[rs1]); + else + print (info->stream, dis_style_immediate, "%a", + riscv_fli_numval[rs1]); + break; + default: + goto undefined_modifier; + } + break; + case 'c': /* Zcb extension 16 bits length instruction fields. */ + switch (*++oparg) + { + case 'b': + print (info->stream, dis_style_immediate, "%d", + (int)EXTRACT_ZCB_BYTE_UIMM (l)); + break; + case 'h': + print (info->stream, dis_style_immediate, "%d", + (int)EXTRACT_ZCB_HALFWORD_UIMM (l)); + break; + default: + goto undefined_modifier; + } + break; + default: + goto undefined_modifier; + } + break; + + case 'X': /* Vendor-specific operands. */ + switch (*++oparg) + { + case 't': /* Vendor-specific (T-head) operands. */ { - case 'i': + size_t n; + size_t s; + bool sign; switch (*++oparg) { - case 'f': - print (info->stream, dis_style_address_offset, "%d", - (int) EXTRACT_STYPE_IMM (l)); + case 'l': /* Integer immediate, literal. */ + oparg++; + while (*oparg && *oparg != ',') + { + print (info->stream, dis_style_immediate, "%c", *oparg); + oparg++; + } + oparg--; break; - default: - goto undefined_modifier; - } - break; - case 'f': - switch (*++oparg) - { - case 'v': - if (riscv_fli_symval[rs1]) - print (info->stream, dis_style_text, "%s", - riscv_fli_symval[rs1]); + case 's': /* Integer immediate, 'XsN@S' ... N-bit signed immediate at bit S. */ + sign = true; + goto print_imm; + case 'u': /* Integer immediate, 'XuN@S' ... N-bit unsigned immediate at bit S. */ + sign = false; + goto print_imm; + print_imm: + n = strtol (oparg + 1, (char **)&oparg, 10); + if (*oparg != '@') + goto undefined_modifier; + s = strtol (oparg + 1, (char **)&oparg, 10); + oparg--; + + if (!sign) + print (info->stream, dis_style_immediate, "%lu", + (unsigned long)EXTRACT_U_IMM (n, s, l)); else - print (info->stream, dis_style_immediate, "%a", - riscv_fli_numval[rs1]); + print (info->stream, dis_style_immediate, "%li", + (signed long)EXTRACT_S_IMM (n, s, l)); break; default: goto undefined_modifier; } - break; - case 'c': /* Zcb extension 16 bits length instruction fields. */ - switch (*++oparg) - { - case 'b': - print (info->stream, dis_style_immediate, "%d", - (int)EXTRACT_ZCB_BYTE_UIMM (l)); - break; - case 'h': - print (info->stream, dis_style_immediate, "%d", - (int)EXTRACT_ZCB_HALFWORD_UIMM (l)); - break; - default: break; - } - break; - default: - goto undefined_modifier; - } - } - break; - - case 'X': /* Integer immediate. */ - { - size_t n; - size_t s; - bool sign; - - switch (*++oparg) - { - case 'l': /* Literal. */ - oparg++; - while (*oparg && *oparg != ',') - { - print (info->stream, dis_style_immediate, "%c", *oparg); - oparg++; - } - oparg--; - break; - case 's': /* 'XsN@S' ... N-bit signed immediate at bit S. */ - sign = true; - goto print_imm; - case 'u': /* 'XuN@S' ... N-bit unsigned immediate at bit S. */ - sign = false; - goto print_imm; - print_imm: - n = strtol (oparg + 1, (char **)&oparg, 10); - if (*oparg != '@') - goto undefined_modifier; - s = strtol (oparg + 1, (char **)&oparg, 10); - oparg--; - - if (!sign) - print (info->stream, dis_style_immediate, "%lu", - (unsigned long)EXTRACT_U_IMM (n, s, l)); - else - print (info->stream, dis_style_immediate, "%li", - (signed long)EXTRACT_S_IMM (n, s, l)); - break; - default: - goto undefined_modifier; } - } + break; + default: + goto undefined_modifier; + } break; default: |