RISC-V: Print highest address (-1) on the disassembler
authorTsukasa OI <research_trasio@irq.a4lg.com>
Sat, 27 Aug 2022 00:11:01 +0000 (00:11 +0000)
committerNelson Chu <nelson@rivosinc.com>
Fri, 2 Sep 2022 06:03:28 +0000 (14:03 +0800)
commit8fe1be5fabd097a8b9110ab63729e08c0d686660
treeff5688584010bebd58ea37cfdc8900eafb40b85d
parent48525554d5222d98953202b9252ff65fdead58a4
RISC-V: Print highest address (-1) on the disassembler

This patch makes possible to print the highest address (-1) and the addresses
related to gp which value is -1.  This is particularly useful if the highest
address space is used for I/O registers and corresponding symbols are defined.
Besides, despite that it is very rare to have GP the highest address, it would
be nice because we enabled highest address printing on regular cases.

gas/ChangeLog:

* testsuite/gas/riscv/dis-addr-topaddr.s: New test for the top
address (-1) printing.
* testsuite/gas/riscv/dis-addr-topaddr-32.d: Likewise.
* testsuite/gas/riscv/dis-addr-topaddr-64.d: Likewise.
* testsuite/gas/riscv/dis-addr-topaddr-gp.s: New test for
GP-relative addressing when GP is the highest address (-1).
* testsuite/gas/riscv/dis-addr-topaddr-gp-32.d: Likewise.
* testsuite/gas/riscv/dis-addr-topaddr-gp-64.d: Likewise.

opcodes/ChangeLog:

* riscv-dis.c (struct riscv_private_data): Add `to_print_addr' to
enable printing the highest address.
(maybe_print_address): Utilize `to_print_addr'.
(riscv_disassemble_insn): Likewise.
gas/testsuite/gas/riscv/dis-addr-topaddr-32.d [new file with mode: 0644]
gas/testsuite/gas/riscv/dis-addr-topaddr-64.d [new file with mode: 0644]
gas/testsuite/gas/riscv/dis-addr-topaddr-gp-32.d [new file with mode: 0644]
gas/testsuite/gas/riscv/dis-addr-topaddr-gp-64.d [new file with mode: 0644]
gas/testsuite/gas/riscv/dis-addr-topaddr-gp.s [new file with mode: 0644]
gas/testsuite/gas/riscv/dis-addr-topaddr.s [new file with mode: 0644]
opcodes/riscv-dis.c