This patch adds R600/SI disassembly text to compiled object files, when a code dump is requested, to assist debugging in Mesa clients.
Here's an example of the output in a Mesa client with a corresponding patch and RADEON_DUMP_SHADERS set:
S_WQM_B64 EXEC, EXEC ; BEFE0A7E
S_MOV_B32 M0, SGPR6 ; BEFC0306
V_INTERP_MOV_F32 VGPR0, P0, 3, 0, [M0] ; C8020302
V_INTERP_MOV_F32 VGPR1, P0, 2, 0, [M0] ; C8060202
V_INTERP_MOV_F32 VGPR2, P0, 1, 0, [M0] ; C80A0102
V_INTERP_MOV_F32 VGPR3, P0, 0, 0, [M0] ; C80E0002
EXP 15, 0, 0, 1, 1, VGPR3, VGPR2, VGPR1, VGPR0 ; F800180F 00010203
S_ENDPGM ; BF810000
A less verbose disassembler is included in Mesa for pre-SI clients, so the patch does not embed disassembly for NI or earlier targets.
Disassembling during compilation is preferred, as it avoids the overhead of a second LLVM invocation. Further, the SILowerControlFlow pass modifies the input LLVM IR, which makes a second invocation for disassembly fail.
An example patch to Mesa to test functionality is available here: gist:6911363 · GitHub
llvm-r600-gcn-disassembly-in-elf.patch (6.19 KB)