v3d: Changed v3d_compile:failed to an enum

Instead of just having a bool status for the failure, there is now an
enum so that the compilation can report a more detailed status.
Currently this is only used to report whether the failure was due to
failed register allocation. The “failed” bool doesn’t seem to actually
have been used anywhere so this doesn’t really change a lot.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5953>
diff --git a/src/broadcom/compiler/nir_to_vir.c b/src/broadcom/compiler/nir_to_vir.c
index 671f3db..8d805a9 100644
--- a/src/broadcom/compiler/nir_to_vir.c
+++ b/src/broadcom/compiler/nir_to_vir.c
@@ -3018,7 +3018,8 @@
                         fprintf(stderr, "Failed to register allocate at %d threads:\n",
                                 c->threads);
                         vir_dump(c);
-                        c->failed = true;
+                        c->compilation_result =
+                                V3D_COMPILATION_FAILED_REGISTER_ALLOCATION;
                         return;
                 }
 
diff --git a/src/broadcom/compiler/v3d_compiler.h b/src/broadcom/compiler/v3d_compiler.h
index 10df1af..624af49 100644
--- a/src/broadcom/compiler/v3d_compiler.h
+++ b/src/broadcom/compiler/v3d_compiler.h
@@ -489,6 +489,12 @@
         return (struct vir_cursor){ vir_cursor_addtail, &block->instructions };
 }
 
+enum v3d_compilation_result {
+        V3D_COMPILATION_SUCCEEDED,
+        V3D_COMPILATION_FAILED_REGISTER_ALLOCATION,
+        V3D_COMPILATION_FAILED,
+};
+
 /**
  * Compiler state saved across compiler invocations, for any expensive global
  * setup.
@@ -666,7 +672,7 @@
         bool emitted_tlb_load;
         bool lock_scoreboard_on_first_thrsw;
 
-        bool failed;
+        enum v3d_compilation_result compilation_result;
 
         bool tmu_dirty_rcl;
 };
diff --git a/src/broadcom/compiler/vir.c b/src/broadcom/compiler/vir.c
index fceaafb..a118d2d 100644
--- a/src/broadcom/compiler/vir.c
+++ b/src/broadcom/compiler/vir.c
@@ -512,6 +512,7 @@
         c->threads = 4;
         c->debug_output = debug_output;
         c->debug_output_data = debug_output_data;
+        c->compilation_result = V3D_COMPILATION_SUCCEEDED;
 
         s = nir_shader_clone(c, s);
         c->s = s;
diff --git a/src/broadcom/compiler/vir_to_qpu.c b/src/broadcom/compiler/vir_to_qpu.c
index e6461ff..2d72f2f 100644
--- a/src/broadcom/compiler/vir_to_qpu.c
+++ b/src/broadcom/compiler/vir_to_qpu.c
@@ -417,7 +417,7 @@
                         fprintf(stderr, "Failed to pack instruction:\n");
                         vir_dump_inst(c, inst);
                         fprintf(stderr, "\n");
-                        c->failed = true;
+                        c->compilation_result = V3D_COMPILATION_FAILED;
                         return;
                 }
         }