intel/brw: Move regalloc and scheduling functions out of fs_visitor

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30169>
This commit is contained in:
Caio Oliveira
2024-07-12 16:55:33 -07:00
committed by Marge Bot
parent 5cb1f46fd1
commit b98930c770
12 changed files with 91 additions and 89 deletions
@@ -1606,40 +1606,40 @@ instruction_scheduler::run(instruction_scheduler_mode mode)
}
instruction_scheduler *
fs_visitor::prepare_scheduler(void *mem_ctx)
brw_prepare_scheduler(fs_visitor &s, void *mem_ctx)
{
const int grf_count = alloc.count;
const int grf_count = s.alloc.count;
instruction_scheduler *empty = rzalloc(mem_ctx, instruction_scheduler);
return new (empty) instruction_scheduler(mem_ctx, this, grf_count, first_non_payload_grf,
cfg->num_blocks, /* post_reg_alloc */ false);
return new (empty) instruction_scheduler(mem_ctx, &s, grf_count, s.first_non_payload_grf,
s.cfg->num_blocks, /* post_reg_alloc */ false);
}
void
fs_visitor::schedule_instructions_pre_ra(instruction_scheduler *sched,
instruction_scheduler_mode mode)
brw_schedule_instructions_pre_ra(fs_visitor &s, instruction_scheduler *sched,
instruction_scheduler_mode mode)
{
if (mode == SCHEDULE_NONE)
return;
sched->run(mode);
invalidate_analysis(DEPENDENCY_INSTRUCTIONS);
s.invalidate_analysis(DEPENDENCY_INSTRUCTIONS);
}
void
fs_visitor::schedule_instructions_post_ra()
brw_schedule_instructions_post_ra(fs_visitor &s)
{
const bool post_reg_alloc = true;
const int grf_count = reg_unit(devinfo) * grf_used;
const int grf_count = reg_unit(s.devinfo) * s.grf_used;
void *mem_ctx = ralloc_context(NULL);
instruction_scheduler sched(mem_ctx, this, grf_count, first_non_payload_grf,
cfg->num_blocks, post_reg_alloc);
instruction_scheduler sched(mem_ctx, &s, grf_count, s.first_non_payload_grf,
s.cfg->num_blocks, post_reg_alloc);
sched.run(SCHEDULE_POST);
ralloc_free(mem_ctx);
invalidate_analysis(DEPENDENCY_INSTRUCTIONS);
s.invalidate_analysis(DEPENDENCY_INSTRUCTIONS);
}