Module: Mesa
Branch: main
Commit: 0e819465b3eaae70295a7f7fae620c0660b9992f
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0e819465b3eaae70295a7f7fae620c0660b9992f

Author: Georg Lehmann <[email protected]>
Date:   Tue Oct  3 11:55:03 2023 +0200

aco: print final ir instead if printing asm is unsupported

Not a perfect replacement, but it's better than nothing.

Reviewed-by: Rhys Perry <[email protected]>
Reviewed-by: Timur Kristóf <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25522>

---

 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<uint32_t>& 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;

Reply via email to