aarch64: Simplify print_find_next_alias_opcode
Simplifies AArch64 alias opcode resolution by using a bucket sort.
This patch simplifies the aarch64_find_next_alias_opcode function in opcodes/aarch64-dis-2.c by employing a bucket sort for alias opcodes. It creates a sorted list of aliases, prioritizing those earlier in the opcode table. This eliminates the need for the alias_info structure and replaces a separate bubble sort for each aliased opcode with a single efficient sort. The disassembler behavior remains unchanged, but the code is cleaner.
In Details
Refactors aarch64_find_next_alias_opcode in opcodes/aarch64-dis-2.c. It replaces the previous mechanism of building an alias_info structure and then using individual bubble sorts with a single bucket sort to order alias opcodes. This simplifies the generation of the switch statement cases by sorting aliases based on their priority in the main opcode table. The output sequence of alias resolutions may change, but the functional outcome is identical.
- alias opcode
- An instruction that is represented by multiple different opcodes or encoding patterns, but performs the same operation. The disassembler must correctly identify which alias corresponds to the given instruction encoding.
- bucket sort
- A sorting algorithm that distributes elements into a number of buckets or bins, and then sorts each bucket individually. It's efficient when the input data is uniformly distributed.