Mesa (master): aco/ra: split register_file initialization into separate function
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Mar 25 15:25:30 UTC 2021
Module: Mesa
Branch: master
Commit: 3ea2c05b32602410939ba7e7b9991f2fcd61aaa5
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3ea2c05b32602410939ba7e7b9991f2fcd61aaa5
Author: Daniel Schürmann <daniel at schuermann.dev>
Date: Mon Mar 15 15:27:03 2021 +0100
aco/ra: split register_file initialization into separate function
Reviewed-by: Rhys Perry <pendingchaos02 at gmail.com>
Reviewed-by: Tony Wasserka <tony.wasserka at gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9763>
---
src/amd/compiler/aco_register_allocation.cpp | 27 +++++++++++++++++----------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/src/amd/compiler/aco_register_allocation.cpp b/src/amd/compiler/aco_register_allocation.cpp
index 7325203146a..1ffbd93afc3 100644
--- a/src/amd/compiler/aco_register_allocation.cpp
+++ b/src/amd/compiler/aco_register_allocation.cpp
@@ -1938,6 +1938,22 @@ void try_remove_trivial_phi(ra_ctx& ctx, Temp temp)
return;
}
+RegisterFile init_reg_file(ra_ctx& ctx, IDSet& live_in, Block& block)
+{
+ assert(block.index != 0 || live_in.empty());
+ RegisterFile register_file;
+
+ for (unsigned t : live_in) {
+ Temp renamed = handle_live_in(ctx, Temp(t, ctx.program->temp_rc[t]), &block);
+ assignment& var = ctx.assignments[renamed.id()];
+ /* due to live-range splits, the live-in might be a phi, now */
+ if (var.assigned)
+ register_file.fill(Definition(renamed.id(), var.reg, var.rc));
+ }
+
+ return register_file;
+}
+
void get_affinities(ra_ctx& ctx, std::vector<IDSet>& live_out_per_block)
{
std::vector<std::vector<Temp>> phi_ressources;
@@ -2043,18 +2059,9 @@ void register_allocation(Program *program, std::vector<IDSet>& live_out_per_bloc
for (Block& block : program->blocks) {
IDSet& live = live_out_per_block[block.index];
/* initialize register file */
- assert(block.index != 0 || live.empty());
- RegisterFile register_file;
+ RegisterFile register_file = init_reg_file(ctx, live, block);
ctx.war_hint.reset();
- for (unsigned t : live) {
- Temp renamed = handle_live_in(ctx, Temp(t, program->temp_rc[t]), &block);
- assignment& var = ctx.assignments[renamed.id()];
- /* due to live-range splits, the live-in might be a phi, now */
- if (var.assigned)
- register_file.fill(Definition(renamed.id(), var.reg, var.rc));
- }
-
std::vector<aco_ptr<Instruction>> instructions;
std::vector<aco_ptr<Instruction>>::iterator instr_it;
More information about the mesa-commit
mailing list