intel/brw: Print blocks in brw_print_instructions_to_file()

Useful when examining the control flow graph.  For some reason,
we printed this for the final assembly but not the IR.

Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30530>
This commit is contained in:
Kenneth Graunke 2024-07-08 16:49:50 -07:00 committed by Marge Bot
parent 2d73e42333
commit bb4f05005e

View file

@ -21,22 +21,40 @@ brw_print_instructions_to_file(const fs_visitor &s, FILE *file)
unsigned ip = 0, max_pressure = 0;
unsigned cf_count = 0;
foreach_block_and_inst(block, fs_inst, inst, s.cfg) {
if (inst->is_control_flow_end())
cf_count -= 1;
foreach_block(block, s.cfg) {
fprintf(file, "START B%d", block->num);
foreach_list_typed(bblock_link, link, link, &block->parents) {
fprintf(file, " <%cB%d",
link->kind == bblock_link_logical ? '-' : '~',
link->block->num);
}
fprintf(file, "\n");
if (rp) {
max_pressure = MAX2(max_pressure, rp->regs_live_at_ip[ip]);
fprintf(file, "{%3d} ", rp->regs_live_at_ip[ip]);
foreach_inst_in_block(fs_inst, inst, block) {
if (inst->is_control_flow_end())
cf_count -= 1;
if (rp) {
max_pressure = MAX2(max_pressure, rp->regs_live_at_ip[ip]);
fprintf(file, "{%3d} ", rp->regs_live_at_ip[ip]);
}
for (unsigned i = 0; i < cf_count; i++)
fprintf(file, " ");
brw_print_instruction(s, inst, file, &defs);
ip++;
if (inst->is_control_flow_begin())
cf_count += 1;
}
for (unsigned i = 0; i < cf_count; i++)
fprintf(file, " ");
brw_print_instruction(s, inst, file, &defs);
ip++;
if (inst->is_control_flow_begin())
cf_count += 1;
fprintf(file, "END B%d", block->num);
foreach_list_typed(bblock_link, link, link, &block->children) {
fprintf(file, " %c>B%d",
link->kind == bblock_link_logical ? '-' : '~',
link->block->num);
}
fprintf(file, "\n");
}
if (rp)
fprintf(file, "Maximum %3d registers live at once.\n", max_pressure);