From 0e819465b3eaae70295a7f7fae620c0660b9992f Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Tue, 3 Oct 2023 11:55:03 +0200 Subject: [PATCH] aco: print final ir instead if printing asm is unsupported MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Not a perfect replacement, but it's better than nothing. Reviewed-by: Rhys Perry Reviewed-by: Timur Kristóf Part-of: --- src/amd/compiler/aco_interface.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/amd/compiler/aco_interface.cpp b/src/amd/compiler/aco_interface.cpp index 08274ea2bc3..4eefd188edd 100644 --- a/src/amd/compiler/aco_interface.cpp +++ b/src/amd/compiler/aco_interface.cpp @@ -84,25 +84,25 @@ get_disasm_string(aco::Program* program, std::vector& code, unsigned e { std::string disasm; - if (check_print_asm_support(program)) { - char* data = NULL; - size_t disasm_size = 0; - struct u_memstream mem; - if (u_memstream_open(&mem, &data, &disasm_size)) { - FILE* const memf = u_memstream_get(&mem); + char* data = NULL; + size_t disasm_size = 0; + struct u_memstream mem; + if (u_memstream_open(&mem, &data, &disasm_size)) { + FILE* const memf = u_memstream_get(&mem); + if (check_print_asm_support(program)) { aco::print_asm(program, code, exec_size / 4u, memf); - fputc(0, memf); - u_memstream_close(&mem); + } else { + fprintf(memf, "Shader disassembly is not supported in the current configuration" +#ifndef LLVM_AVAILABLE + " (LLVM not available)" +#endif + ", falling back to print_program.\n\n"); + aco::aco_print_program(program, memf); } - + fputc(0, memf); + u_memstream_close(&mem); disasm = std::string(data, data + disasm_size); free(data); - } else { - disasm = "Shader disassembly is not supported in the current configuration" -#ifndef LLVM_AVAILABLE - " (LLVM not available)" -#endif - ".\n"; } return disasm;