spirv: Emit NIR deref instructions on-the-fly
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 25 Oct 2018 15:34:34 +0000 (10:34 -0500)
committerJason Ekstrand <jason@jlekstrand.net>
Tue, 8 Jan 2019 00:38:29 +0000 (00:38 +0000)
commit639c236e74e99524245c22f1fa0758603f558cf2
tree51ba30915624b144e1e416789593619d196a324e
parentc59f07684c0c99fad0c246dd4a475f6bef5d3cbc
spirv: Emit NIR deref instructions on-the-fly

This simplifies our deref handling by emitting the actual NIR deref
instructions on-the-fly instead of of building up a deref chain and then
emitting them at the last moment.  In order for this to work with the
parts of the compiler that assume they can chase deref chains, we have
to run nir_rematerialize_derefs_in_use_blocks_impl to put the derefs
back in the right places.  Otherwise, in cases such as loop continues
where the SPIR-V blocks are not in the same order as the NIR blocks, we
may end up with a deref chain with a parent that does not dominate it's
child and nir_repair_ssa_impl will insert phis in the deref chain.

Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
src/compiler/spirv/vtn_cfg.c
src/compiler/spirv/vtn_private.h
src/compiler/spirv/vtn_variables.c