r300/compiler: Add more info to struct rc_reader
For pair instructions we need a reference to both the arg and source.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user