[Mesa-dev] [PATCH 2/2] i965: Stop doing remapping of "special" regs.

Kenneth Graunke kenneth at whitecape.org
Fri May 9 13:32:37 PDT 2014


On 05/06/2014 03:47 PM, Eric Anholt wrote:
> Now that we aren't using pixel_[xy] in live variables, nothing is looking
> at these regs after the visitor stage.
> ---
>  src/mesa/drivers/dri/i965/brw_fs.cpp | 37 ------------------------------------
>  1 file changed, 37 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
> index c550c41..6b1b866 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
> @@ -1740,34 +1740,6 @@ fs_visitor::compact_virtual_grfs()
>        }
>     }
>  
> -   /* In addition to registers used in instructions, fs_visitor keeps
> -    * direct references to certain special values which must be patched:
> -    */
> -   struct {
> -      fs_reg *reg;
> -      unsigned count;
> -   } special[] = {
> -      { &frag_depth, 1 },
> -      { &pixel_x, 1 },
> -      { &pixel_y, 1 },
> -      { &pixel_w, 1 },
> -      { &wpos_w, 1 },
> -      { &dual_src_output, 1 },
> -      { outputs, ARRAY_SIZE(outputs) },
> -      { delta_x, ARRAY_SIZE(delta_x) },
> -      { delta_y, ARRAY_SIZE(delta_y) },
> -      { &sample_mask, 1 },
> -      { &shader_start_time, 1 },
> -   };
> -
> -   /* Treat all special values as used, to be conservative */
> -   for (unsigned i = 0; i < ARRAY_SIZE(special); i++) {
> -      for (unsigned j = 0; j < special[i].count; j++) {
> -         if (special[i].reg[j].file == GRF)
> -            remap_table[special[i].reg[j].reg] = 0;
> -      }
> -   }
> -
>     /* Compact the GRF arrays. */
>     int new_index = 0;
>     for (int i = 0; i < this->virtual_grf_count; i++) {
> @@ -1793,15 +1765,6 @@ fs_visitor::compact_virtual_grfs()
>              inst->src[i].reg = remap_table[inst->src[i].reg];
>        }
>     }
> -
> -   /* Patch all the references to special values */
> -   for (unsigned i = 0; i < ARRAY_SIZE(special); i++) {
> -      for (unsigned j = 0; j < special[i].count; j++) {
> -         fs_reg *reg = &special[i].reg[j];
> -         if (reg->file == GRF && remap_table[reg->reg] != -1)
> -            reg->reg = remap_table[reg->reg];
> -      }
> -   }
>  }
>  
>  /*
> 

Although I gave this patch a Reviewed-by, I am somewhat uncomfortable
with the idea that fs_visitor now has references to fs_regs which are
total lies once optimization happens.  (Then again, they're probably
broken in other ways anyway...)

Perhaps we can eventually break up the giant fs_visitor class, so those
fs_regs are only available during the initial code generation.  I may
take a look at that when I do some other refactoring.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140509/d5d68932/attachment-0001.sig>


More information about the mesa-dev mailing list