summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_dataflow.c40
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_dataflow.h9
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_optimize.c4
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c2
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_rename_regs.c2
5 files changed, 41 insertions, 16 deletions
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.c b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.c
index d1a7eab50f7..b4837091d94 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.c
@@ -495,12 +495,11 @@ struct get_readers_callback_data {
struct branch_write_mask BranchMasks[R500_PFS_MAX_BRANCH_DEPTH_FULL + 1];
};
-static void add_reader(
+static struct rc_reader * add_reader(
struct memory_pool * pool,
struct rc_reader_data * data,
struct rc_instruction * inst,
- unsigned int mask,
- void * arg_or_src)
+ unsigned int mask)
{
struct rc_reader * new;
memory_pool_array_reserve(pool, struct rc_reader, data->Readers,
@@ -508,11 +507,32 @@ static void add_reader(
new = &data->Readers[data->ReaderCount++];
new->Inst = inst;
new->WriteMask = mask;
- if (inst->Type == RC_INSTRUCTION_NORMAL) {
- new->U.Src = arg_or_src;
- } else {
- new->U.Arg = arg_or_src;
- }
+ return new;
+}
+
+static void add_reader_normal(
+ struct memory_pool * pool,
+ struct rc_reader_data * data,
+ struct rc_instruction * inst,
+ unsigned int mask,
+ struct rc_src_register * src)
+{
+ struct rc_reader * new = add_reader(pool, data, inst, mask);
+ new->U.I.Src = src;
+}
+
+
+static void add_reader_pair(
+ struct memory_pool * pool,
+ struct rc_reader_data * data,
+ struct rc_instruction * inst,
+ unsigned int mask,
+ struct rc_pair_instruction_arg * arg,
+ struct rc_pair_instruction_source * src)
+{
+ struct rc_reader * new = add_reader(pool, data, inst, mask);
+ new->U.P.Src = src;
+ new->U.P.Arg = arg;
}
static unsigned int get_readers_read_callback(
@@ -575,7 +595,7 @@ static void get_readers_pair_read_callback(
if (d->ReaderData->Abort)
return;
- add_reader(&d->C->Pool, d->ReaderData, inst, shared_mask, arg);
+ add_reader_pair(&d->C->Pool, d->ReaderData, inst, shared_mask, arg, src);
}
/**
@@ -603,7 +623,7 @@ static void get_readers_normal_read_callback(
if (d->ReaderData->Abort)
return;
- add_reader(&d->C->Pool, d->ReaderData, inst, shared_mask, src);
+ add_reader_normal(&d->C->Pool, d->ReaderData, inst, shared_mask, src);
}
/**
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.h b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.h
index ef971c5b234..77d5d74d859 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.h
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.h
@@ -74,8 +74,13 @@ struct rc_reader {
struct rc_instruction * Inst;
unsigned int WriteMask;
union {
- struct rc_src_register * Src;
- struct rc_pair_instruction_arg * Arg;
+ struct {
+ struct rc_src_register * Src;
+ } I;
+ struct {
+ struct rc_pair_instruction_arg * Arg;
+ struct rc_pair_instruction_source * Src;
+ } P;
} U;
};
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c b/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c
index 79898e1047e..104f7bf6baf 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c
@@ -154,7 +154,7 @@ static void copy_propagate(struct radeon_compiler * c, struct rc_instruction * i
/* Propagate the MOV instruction. */
for (i = 0; i < reader_data.ReaderCount; i++) {
struct rc_instruction * inst = reader_data.Readers[i].Inst;
- *reader_data.Readers[i].U.Src = chain_srcregs(*reader_data.Readers[i].U.Src, inst_mov->U.I.SrcReg[0]);
+ *reader_data.Readers[i].U.I.Src = chain_srcregs(*reader_data.Readers[i].U.I.Src, inst_mov->U.I.SrcReg[0]);
if (inst_mov->U.I.SrcReg[0].File == RC_FILE_PRESUB)
inst->U.I.PreSub = inst_mov->U.I.PreSub;
@@ -466,7 +466,7 @@ static int presub_helper(
rc_get_opcode_info(reader.Inst->U.I.Opcode);
for (src_index = 0; src_index < info->NumSrcRegs; src_index++) {
- if (&reader.Inst->U.I.SrcReg[src_index] == reader.U.Src)
+ if (&reader.Inst->U.I.SrcReg[src_index] == reader.U.I.Src)
presub_replace(inst_add, reader.Inst, src_index);
}
}
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c b/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c
index 8e10813ff06..dad8ef59355 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c
@@ -739,7 +739,7 @@ static int convert_rgb_to_alpha(
for(i = 0; i < sched_inst->GlobalReaders.ReaderCount; i++) {
struct rc_reader reader = sched_inst->GlobalReaders.Readers[i];
- rgb_to_alpha_remap(reader.Inst, reader.U.Arg,
+ rgb_to_alpha_remap(reader.Inst, reader.U.P.Arg,
RC_FILE_TEMPORARY, old_swz, new_index);
}
return 1;
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_rename_regs.c b/src/mesa/drivers/dri/r300/compiler/radeon_rename_regs.c
index 5bd19c0b9c6..d4d96b4c0ca 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_rename_regs.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_rename_regs.c
@@ -85,7 +85,7 @@ void rc_rename_regs(struct radeon_compiler *c, void *user)
reader_data.Writer->U.I.DstReg.Index = new_index;
for(i = 0; i < reader_data.ReaderCount; i++) {
- reader_data.Readers[i].U.Src->Index = new_index;
+ reader_data.Readers[i].U.I.Src->Index = new_index;
}
}
}