RFC: aco: Add a disassembler
Based on !29695 .
Replaces the LLVM path with a lot of spaghetti code. I tried to match the LLVM output as closely as possible but there still are some differences. (Some due to LLVM bugs)
Design
I didn't use isaspec because the gcn instruction set is very inconsistent when it comes to instruction lengths and operand meanings, ... The disassembler consists of three parts:
- disasm_program and disasm_instr, which iterate over the instructions, detect the encoding and dispatch the various instruction handlers.
- instruction handlers, split based on gfx_level, if a new generation changed a lot, and encoding.
- general utilities, which handle common tests like extracting fields, printing operands, ...
I hope this keeps code duplication at a minimum while avoiding long gfx_level if - else if chains.