nir/algebraic: Use a cache to avoid re-emitting structs
authorJason Ekstrand <jason@jlekstrand.net>
Sat, 13 Apr 2019 15:35:07 +0000 (10:35 -0500)
committerJason Ekstrand <jason@jlekstrand.net>
Tue, 16 Apr 2019 16:40:15 +0000 (16:40 +0000)
commitba0f203ae82673ad050355e94386c849de7eaa92
treea11e66b5b8be9deb7eccf3cc0786d612fbae97af
parent0c712fd4042c91f715260fe5923e798372f38e1e
nir/algebraic: Use a cache to avoid re-emitting structs

This takes the stupid simplest and most reliable approach to reducing
redundancy that I could come up with:  Just use the struct declaration
as the cach key.  This cuts the size of the generated C file to about
half and takes about 50 KiB off the .data section.

size before (release build):

   text    data     bss     dec     hex filename
5363833  336880   13584 5714297  573179 _install/lib64/libvulkan_intel.so

size after (release build):

   text    data     bss     dec     hex filename
5229017  285264   13584 5527865  545939 _install/lib64/libvulkan_intel.so

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
src/compiler/nir/nir_algebraic.py