RISC-V: Minor improvements for dis-assembler.
authorNelson Chu <nelson@rivosinc.com>
Thu, 4 May 2023 07:22:13 +0000 (15:22 +0800)
committerNelson Chu <nelson@rivosinc.com>
Fri, 19 May 2023 08:24:05 +0000 (16:24 +0800)
commit26e91972538544a237897baa5c806a008d36a88c
tree4baad01123ed0b2277dc27461678e03f75a46d9d
parent1e66f4c55f83ba4d27330312aefdd4fbdf56cb43
RISC-V: Minor improvements for dis-assembler.

* Extract all private_data initializations into riscv_init_disasm_info, which
called from print_insn_riscv rather than riscv_disassemble_insn.

* The disassemble_free_target seems like the right place to release all target
private_data, also including the internal data structures, like riscv_subsets.
Therefore, add a new function, disassemble_free_riscv, to release them for safe.

opcodes/
* disassemble.c (disassemble_free_target): Called disassemble_free_riscv
for riscv to release private_data and internal data structures.
* disassemble.h: Added extern disassemble_free_riscv.
* riscv-dis.c (riscv_init_disasm_info): New function, used to init
riscv_private_data.
(riscv_disassemble_insn): Moved riscv_private_data initializations
into riscv_init_disasm_info.
(print_insn_riscv): Called riscv_init_disasm_info to init
riscv_private_data once time.
(disassemble_free_riscv): New function, used to free the internal data
structures, like riscv_subsets.
opcodes/disassemble.c
opcodes/disassemble.h
opcodes/riscv-dis.c