mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-27 23:30:10 +01:00
panfrost/util: Move print_alu_type and PAN_IS_REG to midgard
Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com> Acked-by: Boris Brezillon <boris.brezillon@collabora.com> Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Acked-by: Eric R. Smith <eric.smith@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32650>
This commit is contained in:
parent
fdef86a4a2
commit
dce110a604
4 changed files with 32 additions and 37 deletions
|
|
@ -447,6 +447,9 @@ make_compiler_temp(compiler_context *ctx)
|
|||
return (ctx->func->impl->ssa_alloc + ctx->temp_alloc++) << 1;
|
||||
}
|
||||
|
||||
/* IR indexing */
|
||||
#define PAN_IS_REG (1)
|
||||
|
||||
static inline unsigned
|
||||
make_compiler_temp_reg(compiler_context *ctx)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -152,13 +152,40 @@ mir_print_embedded_constant(const midgard_instruction *ins, unsigned src_idx)
|
|||
printf(")");
|
||||
}
|
||||
|
||||
static void
|
||||
mir_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
|
||||
mir_print_src(const midgard_instruction *ins, unsigned c)
|
||||
{
|
||||
mir_print_index(ins->src[c]);
|
||||
|
||||
if (ins->src[c] != ~0 && ins->src_types[c] != nir_type_invalid) {
|
||||
pan_print_alu_type(ins->src_types[c], stdout);
|
||||
mir_print_alu_type(ins->src_types[c], stdout);
|
||||
mir_print_swizzle(ins->mask, ins->swizzle[c]);
|
||||
}
|
||||
}
|
||||
|
|
@ -260,7 +287,7 @@ mir_print_instruction(const midgard_instruction *ins)
|
|||
mir_print_index(ins->dest);
|
||||
|
||||
if (ins->dest != ~0) {
|
||||
pan_print_alu_type(ins->dest_type, stdout);
|
||||
mir_print_alu_type(ins->dest_type, stdout);
|
||||
mir_print_mask(ins->mask);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -94,35 +94,6 @@ 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);
|
||||
}
|
||||
|
||||
/* Could optimize with a better data structure if anyone cares, TODO: profile */
|
||||
|
||||
unsigned
|
||||
|
|
|
|||
|
|
@ -373,12 +373,6 @@ uint16_t pan_to_bytemask(unsigned bytes, unsigned mask);
|
|||
|
||||
void pan_block_add_successor(pan_block *block, pan_block *successor);
|
||||
|
||||
/* IR indexing */
|
||||
#define PAN_IS_REG (1)
|
||||
|
||||
/* IR printing helpers */
|
||||
void pan_print_alu_type(nir_alu_type t, FILE *fp);
|
||||
|
||||
/* NIR passes to do some backend-specific lowering */
|
||||
|
||||
#define PAN_WRITEOUT_C 1
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue