aboutsummaryrefslogtreecommitdiff
path: root/opcodes/riscv-dis.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2023-08-15 08:34:56 +0200
committerJan Beulich <jbeulich@suse.com>2023-08-15 08:34:56 +0200
commit02a63525ef02bac47fa750e89db0996bc96697d3 (patch)
tree2d704013bbc897da397f9e90246e188e4e10e91b /opcodes/riscv-dis.c
parenta2182c73d245530c5c5587bc47a6142e9738de84 (diff)
downloadgdb-02a63525ef02bac47fa750e89db0996bc96697d3.zip
gdb-02a63525ef02bac47fa750e89db0996bc96697d3.tar.gz
gdb-02a63525ef02bac47fa750e89db0996bc96697d3.tar.bz2
RISC-V: remove indirection from register tables
The longest register name is 4 characters (plus a nul one), so using a 4- or 8-byte pointer to get at it is neither space nor time efficient. Embed the names right into the array. For PIE this also reduces the number of base relocations in the final image. To avoid old gcc, when generating 32-bit code, bogusly warning about bounds being exceeded in the code processing Cs/Cw, Ct/Cx, and CD, an adjustment to EXTRACT_BITS() is needed: This macro shouldn't supply a 64-bit value, and it also doesn't need to - all operand fields to date are far more narrow than 32 bits. This in turn allows dropping a number of casts elsewhere.
Diffstat (limited to 'opcodes/riscv-dis.c')
-rw-r--r--opcodes/riscv-dis.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/opcodes/riscv-dis.c b/opcodes/riscv-dis.c
index 138eed8..90f0fea 100644
--- a/opcodes/riscv-dis.c
+++ b/opcodes/riscv-dis.c
@@ -69,8 +69,8 @@ static enum riscv_seg_mstate last_map_state = MAP_NONE;
static asection *last_map_section = NULL;
/* Register names as used by the disassembler. */
-static const char * const *riscv_gpr_names;
-static const char * const *riscv_fpr_names;
+static const char (*riscv_gpr_names)[NRC];
+static const char (*riscv_fpr_names)[NRC];
/* If set, disassemble as most general instruction. */
static bool no_aliases = false;
@@ -502,7 +502,7 @@ print_insn_args (const char *oparg, insn_t l, bfd_vma pc, disassemble_info *info
case 'y':
print (info->stream, dis_style_immediate, "0x%x",
- (unsigned)EXTRACT_OPERAND (BS, l));
+ EXTRACT_OPERAND (BS, l));
break;
case 'z':
@@ -511,12 +511,12 @@ print_insn_args (const char *oparg, insn_t l, bfd_vma pc, disassemble_info *info
case '>':
print (info->stream, dis_style_immediate, "0x%x",
- (unsigned)EXTRACT_OPERAND (SHAMT, l));
+ EXTRACT_OPERAND (SHAMT, l));
break;
case '<':
print (info->stream, dis_style_immediate, "0x%x",
- (unsigned)EXTRACT_OPERAND (SHAMTW, l));
+ EXTRACT_OPERAND (SHAMTW, l));
break;
case 'S':
@@ -577,7 +577,7 @@ print_insn_args (const char *oparg, insn_t l, bfd_vma pc, disassemble_info *info
case 'Y':
print (info->stream, dis_style_immediate, "0x%x",
- (unsigned) EXTRACT_OPERAND (RNUM, l));
+ EXTRACT_OPERAND (RNUM, l));
break;
case 'Z':