From 6dc5e90bc1a5668446ced758a30d4492ede78939 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Mon, 10 Sep 2012 20:39:35 -0400 Subject: [PATCH 1/2] r300/compiler: Use variable lists for dataflow swizzles pass --- .../r300/compiler/radeon_dataflow_swizzles.c | 29 +++++++++++++------ 1 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/gallium/drivers/r300/compiler/radeon_dataflow_swizzles.c b/src/gallium/drivers/r300/compiler/radeon_dataflow_swizzles.c index 133a9f7..3e1528c 100644 --- a/src/gallium/drivers/r300/compiler/radeon_dataflow_swizzles.c +++ b/src/gallium/drivers/r300/compiler/radeon_dataflow_swizzles.c @@ -28,7 +28,9 @@ #include "radeon_dataflow.h" #include "radeon_compiler.h" +#include "radeon_list.h" #include "radeon_swizzle.h" +#include "radeon_variable.h" static void rewrite_source(struct radeon_compiler * c, @@ -89,15 +91,24 @@ static void rewrite_source(struct radeon_compiler * c, void rc_dataflow_swizzles(struct radeon_compiler * c, void *user) { - struct rc_instruction * inst; - - for(inst = c->Program.Instructions.Next; inst != &c->Program.Instructions; inst = inst->Next) { - const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode); - unsigned int src; - - for(src = 0; src < opcode->NumSrcRegs; ++src) { - if (!c->SwizzleCaps->IsNative(inst->U.I.Opcode, inst->U.I.SrcReg[src])) - rewrite_source(c, inst, src); + struct rc_list *var_ptr; + struct rc_list *variables; + + variables = rc_get_variables(c); + + for (var_ptr = variables; var_ptr; var_ptr = var_ptr->Next) { + struct rc_variable *var; + for (var = var_ptr->Item; var; var = var->Friend) { + unsigned int src; + struct rc_instruction *inst = var->Inst; + const struct rc_opcode_info *opcode_info = + rc_get_opcode_info(inst->U.I.Opcode); + for(src = 0; src < opcode_info->NumSrcRegs; ++src) { + if (!c->SwizzleCaps->IsNative(inst->U.I.Opcode, + inst->U.I.SrcReg[src])) { + rewrite_source(c, inst, src); + } + } } } } -- 1.7.8.6