nir/print: Print annotations as comments

Also prints them in the same line as the instruction.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39184>
This commit is contained in:
Konstantin Seurer 2024-08-07 12:07:41 +02:00 committed by Marge Bot
parent 17615b412b
commit 2ed16ed1a6

View file

@ -110,7 +110,7 @@ print_annotation(print_state *state, void *obj)
const char *note = entry->data;
_mesa_hash_table_remove(state->annotations, entry);
fprintf(fp, "%s\n\n", note);
fprintf(fp, " %s", note);
}
/* For 1 element, the size is intentionally omitted. */
@ -1002,8 +1002,9 @@ print_var_decl(nir_variable *var, print_state *state)
if (var->pointer_initializer)
fprintf(fp, " = &%s", get_var_name(var->pointer_initializer, state));
fprintf(fp, "\n");
print_annotation(state, var);
fprintf(fp, "\n");
}
static void
@ -2356,8 +2357,8 @@ print_block(nir_block *block, print_state *state, unsigned tabs)
nir_foreach_instr(instr, block) {
print_instr(instr, state, tabs);
fprintf(fp, "\n");
print_annotation(state, instr);
fprintf(fp, "\n");
}
print_indentation(tabs, fp);