OSDN Git Service

nir: Add an array splitting pass
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 24 Jul 2018 19:33:46 +0000 (12:33 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Fri, 24 Aug 2018 02:44:14 +0000 (21:44 -0500)
commitfa6417495c7096d337965345a0f2ad8a18115b19
tree1c6daa7e30a52999dd4835ce2b5d117cc1be1fed
parent26eb077ec486d0daf5a72d20bb5c03509592dce4
nir: Add an array splitting pass

This pass looks for array variables where at least one level of the
array is never indirected and splits it into multiple smaller variables.

This pass doesn't really do much now because nir_lower_vars_to_ssa can
already see through arrays of arrays and can detect indirects on just
one level or even see that arr[i][0][5] does not alias arr[i][1][j].
This pass exists to help other passes more easily see through arrays of
arrays.  If a back-end does implement arrays using scratch or indirects
on registers, having more smaller arrays is likely to have better memory
efficiency.

v2 (Jason Ekstrand):
 - Better comments and naming (some from Caio)
 - Rework to use one hash map instead of two

v2.1 (Jason Ekstrand):
 - Fix a couple of bugs that were added in the rework including one
   which basically prevented it from running

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
src/compiler/nir/nir.h
src/compiler/nir/nir_split_vars.c