From a022dfade2b2de57daa058ee57693e8ded9f146e Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Sun, 24 Jun 2012 14:23:26 -0400 Subject: [PATCH 1/2] r300/compiler: Use variable lists in the rename_regs pass --- .../drivers/r300/compiler/radeon_rename_regs.c | 31 +++++++++----------- 1 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/gallium/drivers/r300/compiler/radeon_rename_regs.c b/src/gallium/drivers/r300/compiler/radeon_rename_regs.c index cafa057..7b29ece 100644 --- a/src/gallium/drivers/r300/compiler/radeon_rename_regs.c +++ b/src/gallium/drivers/r300/compiler/radeon_rename_regs.c @@ -32,8 +32,9 @@ #include "radeon_rename_regs.h" #include "radeon_compiler.h" -#include "radeon_dataflow.h" +#include "radeon_list.h" #include "radeon_program.h" +#include "radeon_variable.h" /** * This function renames registers in an attempt to get the code close to @@ -45,11 +46,11 @@ */ void rc_rename_regs(struct radeon_compiler *c, void *user) { - unsigned int i, used_length; - int new_index; + unsigned int used_length; struct rc_instruction * inst; - struct rc_reader_data reader_data; unsigned char * used; + struct rc_list * variables; + struct rc_list * var_ptr; /* XXX Remove this once the register allocation works with flow control. */ for(inst = c->Program.Instructions.Next; @@ -64,18 +65,16 @@ void rc_rename_regs(struct radeon_compiler *c, void *user) memset(used, 0, sizeof(unsigned char) * used_length); rc_get_used_temporaries(c, used, used_length); - for(inst = c->Program.Instructions.Next; - inst != &c->Program.Instructions; - inst = inst->Next) { + variables = rc_get_variables(c); - if (inst->U.I.DstReg.File != RC_FILE_TEMPORARY) - continue; + for (var_ptr = variables; var_ptr; var_ptr = var_ptr->Next) { + unsigned new_index; + unsigned writemask; + struct rc_variable * var = var_ptr->Item; - reader_data.ExitOnAbort = 1; - rc_get_readers(c, inst, &reader_data, NULL, NULL, NULL); - - if (reader_data.Abort || reader_data.ReaderCount == 0) + if (var->Inst->U.I.DstReg.File != RC_FILE_TEMPORARY) { continue; + } new_index = rc_find_free_temporary_list(c, used, used_length, RC_MASK_XYZW); @@ -84,9 +83,7 @@ void rc_rename_regs(struct radeon_compiler *c, void *user) return; } - reader_data.Writer->U.I.DstReg.Index = new_index; - for(i = 0; i < reader_data.ReaderCount; i++) { - reader_data.Readers[i].U.I.Src->Index = new_index; - } + writemask = rc_variable_writemask_sum(var); + rc_variable_change_dst(var, new_index, writemask); } } -- 1.7.3.4