jay: consolidate file prefixes

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41215>
This commit is contained in:
Alyssa Rosenzweig 2026-04-21 13:26:19 -04:00 committed by Marge Bot
parent 15365f8ea2
commit 0bd4f1b874
3 changed files with 9 additions and 5 deletions

View file

@ -53,12 +53,18 @@ jay_print_type(FILE *fp, enum jay_type t)
jay_type_size_bits(t));
}
const char *
jay_file_prefix(enum jay_file file)
{
return ENUM_TO_STR(file, jay_file_str);
}
static void
jay_print_def(FILE *fp, const jay_inst *I, int src)
{
jay_def def = src == -2 ? I->cond_flag : src == -1 ? I->dst : I->src[src];
unsigned len = jay_num_values(def);
const char *file = ENUM_TO_STR(def.file, jay_file_str);
const char *file = jay_file_prefix(def.file);
bool has_lu = jay_is_ssa(def) && !jay_is_null(def) && src >= 0;
unsigned lu_bit = has_lu ? jay_source_last_use_bit(I->src, src) : 0;

View file

@ -41,7 +41,7 @@ void jay_register_allocate(jay_shader *s);
void jay_assign_flags(jay_shader *s);
void jay_repair_ssa(jay_function *func);
const char *jay_file_to_string(enum jay_file file);
const char *jay_file_prefix(enum jay_file file);
void jay_print_type(FILE *f, enum jay_type t);
void jay_print_inst(FILE *f, jay_inst *I);
void jay_print_block(FILE *f, jay_block *block);

View file

@ -49,10 +49,8 @@ print_regfile(struct regfile *rf, FILE *fp)
jay_foreach_ssa_file(file) {
for (unsigned i = 0; i < rf->n[file]; ++i) {
uint32_t v = *reg(rf, file, i);
const char *prefixes = "ruf"; /* XXX: share with jay_print */
if (v) {
fprintf(fp, " %c%u = %u\n", prefixes[file], i, v);
fprintf(fp, " %s%u = %u\n", jay_file_prefix(file), i, v);
}
}
}