diff options
author | Tom Stellard <[email protected]> | 2012-06-24 14:23:26 -0400 |
---|---|---|
committer | Tom Stellard <[email protected]> | 2012-08-26 20:39:49 -0400 |
commit | 07c71d6ede4f2ad62bcaab8d3f84452485979e2e (patch) | |
tree | 325dfe7872fc0c4b6ed3bd1ae56286ffb47da702 /src/gallium/drivers | |
parent | 7540f25a345ed8d35d97ba4fbf66227a281eff6a (diff) |
r300/compiler: Use variable lists in the rename_regs pass
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/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 cafa0579734..7b29eceb684 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); } } |