pan/bi: Share ALU type printing
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 27 Apr 2020 22:43:01 +0000 (18:43 -0400)
committerMarge Bot <eric+marge@anholt.net>
Wed, 29 Apr 2020 15:35:54 +0000 (15:35 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4793>

src/panfrost/bifrost/bi_print.c
src/panfrost/util/pan_ir.c
src/panfrost/util/pan_ir.h

index e9e737d662a06611d03677fee2479544e913c08c..f1e42db26d24273f0860fe7f489d5fc1a25dafa4 100644 (file)
@@ -215,35 +215,6 @@ bi_print_src(FILE *fp, bi_instruction *ins, unsigned s)
                 fprintf(fp, ")");
 }
 
-/* Prints a NIR ALU type in Bifrost-style ".f32" ".i8" etc */
-
-static void
-bi_print_alu_type(nir_alu_type t, FILE *fp)
-{
-        unsigned size = nir_alu_type_get_type_size(t);
-        nir_alu_type base = nir_alu_type_get_base_type(t);
-
-        switch (base) {
-        case nir_type_int:
-                fprintf(fp, ".i");
-                break;
-        case nir_type_uint:
-                fprintf(fp, ".u");
-                break;
-        case nir_type_bool:
-                fprintf(fp, ".b");
-                break;
-        case nir_type_float:
-                fprintf(fp, ".f");
-                break;
-        default:
-                fprintf(fp, ".unknown");
-                break;
-        }
-
-        fprintf(fp, "%u", size);
-}
-
 static void
 bi_print_swizzle(bi_instruction *ins, unsigned src, FILE *fp)
 {
@@ -388,7 +359,7 @@ bi_print_instruction(bi_instruction *ins, FILE *fp)
                 fprintf(fp, ".v%u", ins->vector_channels);
 
         if (ins->dest)
-                bi_print_alu_type(ins->dest_type, fp);
+                pan_print_alu_type(ins->dest_type, fp);
 
         if (bi_has_outmod(ins))
                 fprintf(fp, "%s", bi_output_mod_name(ins->outmod));
@@ -409,7 +380,7 @@ bi_print_instruction(bi_instruction *ins, FILE *fp)
                 bi_print_src(fp, ins, s);
 
                 if (ins->src[s] && !(ins->src[s] & (BIR_INDEX_CONSTANT | BIR_INDEX_ZERO))) {
-                        bi_print_alu_type(ins->src_types[s], fp);
+                        pan_print_alu_type(ins->src_types[s], fp);
                         bi_print_swizzle(ins, s, fp);
                 }
 
index fbe8f66bff410d67c3d80c6a75e6845af18ee30c..895c9b67f0377ea05332015f4e945cf2ea217c30 100644 (file)
@@ -92,3 +92,32 @@ pan_block_add_successor(pan_block *block, pan_block *successor)
 
         unreachable("Too many successors");
 }
+
+/* Prints a NIR ALU type in Bifrost-style ".f32" ".i8" etc */
+
+void
+pan_print_alu_type(nir_alu_type t, FILE *fp)
+{
+        unsigned size = nir_alu_type_get_type_size(t);
+        nir_alu_type base = nir_alu_type_get_base_type(t);
+
+        switch (base) {
+        case nir_type_int:
+                fprintf(fp, ".i");
+                break;
+        case nir_type_uint:
+                fprintf(fp, ".u");
+                break;
+        case nir_type_bool:
+                fprintf(fp, ".b");
+                break;
+        case nir_type_float:
+                fprintf(fp, ".f");
+                break;
+        default:
+                fprintf(fp, ".unknown");
+                break;
+        }
+
+        fprintf(fp, "%u", size);
+}
index 5b00edae5f2900a5612302c1f0e7ce5cc8eee754..6f1b60deacfbeadf98ebb9db9e5860d6b0298d77 100644 (file)
@@ -210,4 +210,7 @@ pan_dest_index(nir_dest *dst)
         }
 }
 
+/* IR printing helpers */
+void pan_print_alu_type(nir_alu_type t, FILE *fp);
+
 #endif