Commit 9fdf0f8
committed
RISC-V: Cache instruction support
Calling riscv_subset_supports repeatedly harms the performance in a
measurable way (about 3-13% in total on the most cases).
As a simple solution, this commit now caches instruction class support
(whether specific instruction class is supported) as a signed char array.
It is expected to have 5-7% performance improvements when disassembling
linked RISC-V ELF programs using objdump but this is particularly effective
with programs with many CSR instructions (up to ~42% on the author's PC).
include/ChangeLog:
* opcode/riscv.h (enum riscv_insn_class): Add NUM_INSN_CLASSES.
opcodes/ChangeLog:
* riscv-dis.c (riscv_insn_support_cache) New.
(init_riscv_dis_state_for_arch): Clear the instruction support
cache. (riscv_disassemble_insn): Cache the instruction support.1 parent 5a8f3de commit 9fdf0f8
2 files changed
Lines changed: 16 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
422 | 422 | | |
423 | 423 | | |
424 | 424 | | |
| 425 | + | |
| 426 | + | |
425 | 427 | | |
426 | 428 | | |
427 | 429 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
110 | 113 | | |
111 | 114 | | |
112 | 115 | | |
| |||
200 | 203 | | |
201 | 204 | | |
202 | 205 | | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
203 | 209 | | |
204 | 210 | | |
205 | 211 | | |
| |||
955 | 961 | | |
956 | 962 | | |
957 | 963 | | |
958 | | - | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
959 | 972 | | |
960 | 973 | | |
961 | 974 | | |
| |||
0 commit comments