r300/compiler: Add more info to struct rc_reader
authorTom Stellard <tstellar@gmail.com>
Sat, 19 Mar 2011 04:34:56 +0000 (21:34 -0700)
committerTom Stellard <tstellar@gmail.com>
Sat, 30 Apr 2011 18:00:15 +0000 (11:00 -0700)
For pair instructions we need a reference to both the arg
and source.

src/mesa/drivers/dri/r300/compiler/radeon_dataflow.c
src/mesa/drivers/dri/r300/compiler/radeon_dataflow.h
src/mesa/drivers/dri/r300/compiler/radeon_optimize.c
src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c
src/mesa/drivers/dri/r300/compiler/radeon_rename_regs.c

index d1a7eab50f7e58cf86889b0c8d0582acaee416e1..b4837091d949cd180a80d60cae8d50b78da84a39 100644 (file)
@@ -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);
 }
 
 /**
index ef971c5b23456d73553222b99bef616d852c0f40..77d5d74d859025a3e865c3850c1389100ec2b61b 100644 (file)
@@ -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;
 };
 
index 79898e1047eabff254eae71421d27e4ab8692ba2..104f7bf6baf2a71004c227999212b210f94f4eb0 100644 (file)
@@ -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);
                }
        }
index 8e10813ff069745cb1ed6c525690db83828b5acb..dad8ef59355b358936295ba0ba4ed076da126774 100644 (file)
@@ -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;
index 5bd19c0b9c615c9d57d77a2bee0eff665923b042..d4d96b4c0ca4454f8478fa3188c32c4fa2b33862 100644 (file)
@@ -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;
                }
        }
 }