diff options
author | Alyssa Rosenzweig <[email protected]> | 2020-04-27 18:43:01 -0400 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-04-29 15:35:54 +0000 |
commit | b9f7f06a61ead80bf035213a270aca532e34c838 (patch) | |
tree | 26221161b2c316236264b754fee3c04a4042efdf /src | |
parent | 6c08e294c8bb838a4d0242683167b034be4f924b (diff) |
pan/bi: Share ALU type printing
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4793>
Diffstat (limited to 'src')
-rw-r--r-- | src/panfrost/bifrost/bi_print.c | 33 | ||||
-rw-r--r-- | src/panfrost/util/pan_ir.c | 29 | ||||
-rw-r--r-- | src/panfrost/util/pan_ir.h | 3 |
3 files changed, 34 insertions, 31 deletions
diff --git a/src/panfrost/bifrost/bi_print.c b/src/panfrost/bifrost/bi_print.c index e9e737d662a..f1e42db26d2 100644 --- a/src/panfrost/bifrost/bi_print.c +++ b/src/panfrost/bifrost/bi_print.c @@ -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); } diff --git a/src/panfrost/util/pan_ir.c b/src/panfrost/util/pan_ir.c index fbe8f66bff4..895c9b67f03 100644 --- a/src/panfrost/util/pan_ir.c +++ b/src/panfrost/util/pan_ir.c @@ -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); +} diff --git a/src/panfrost/util/pan_ir.h b/src/panfrost/util/pan_ir.h index 5b00edae5f2..6f1b60deacf 100644 --- a/src/panfrost/util/pan_ir.h +++ b/src/panfrost/util/pan_ir.h @@ -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 |