nir: Eliminate .data and .bss from nir_opt_algebraic

This came out to something like -30k relocations, -1400k .data, and
-300k .bss on my machine, ymmv. What's happening here is that the word
static doesn't just mean please limit my scope to the containing block
or CU, it also means allocate me at program startup. And for some reason
gcc honors this promise even for a const variable whose address provably
never leaves the scope of the compilation unit. So all those &foo
indirections have to be resolved at (dynamic!) link time, and that all
has to now live in writable (and thus per-process dirty) memory.

If you fold the tables into the function body and remove static, then
that all becomes expressions the compiler is allowed to optimize, and
boy howdy does it like to try to optimize this. On the machine I'm
typing on (admittedly a 2.3GHz Haswell) nir_opt_algebraic.c takes about
14 minutes to compile now.
114 jobs for !9927 with nir-opt-algebraic in 62 minutes and 1 second (queued for 7 seconds)
latest detached
Status Job ID Name Coverage
  Sanity
passed #8431525
sanity

00:01:21

 
  Container
passed #8431528
aarch64 manual
arm_build

00:00:17

passed #8431529
manual
arm_test-base

00:00:13

passed #8431530
windows shell 1809 mesa manual
windows_build_vs2019

00:00:08

passed #8431526
manual
x86_build-base

00:00:17

passed #8431527
manual
x86_test-base

00:00:14

 
  Container 2
passed #8431538
android_build

00:00:14

passed #8431541
arm64_test

00:00:15

passed #8431542
armhf_test

00:00:14

passed #8431535
i386_build

00:00:16

passed #8431531
kernel+rootfs_amd64

00:00:19

passed #8431532
aarch64
kernel+rootfs_arm64

00:00:50

passed #8431533
aarch64
kernel+rootfs_armhf

00:00:10

passed #8431536
ppc64el_build

00:00:15

passed #8431537
s390x_build

00:00:16

passed #8431534
x86_build

00:00:17

passed #8431539
x86_test-gl

00:00:15

passed #8431540
x86_test-vk

00:00:13

 
  Meson X86 64
passed #8431548
meson-clang

00:03:53

passed #8431549
meson-clover

00:02:43

failed #8431545
meson-clover-testing

01:00:02

passed #8431546
meson-gallium

00:04:41

passed #8431547
meson-release

00:25:15

failed #8431543
meson-testing

01:00:02

failed #8431544
meson-testing-asan

01:00:02

passed #8431550
meson-vulkan

00:01:19

 
  Build Misc
passed #8431551
meson-android

00:01:10

failed #8431553
aarch64
meson-arm64

01:00:02

failed #8431554
aarch64
meson-arm64-asan

01:00:02

failed #8431555
aarch64
meson-arm64-build-test

01:00:02

failed #8431552
aarch64
meson-armhf

01:00:02

passed #8431557
meson-i386

00:01:51

failed #8431560
meson-mingw32-x86_64

00:01:35

passed #8431559
kvm
meson-ppc64el

00:01:57

passed #8431558
kvm
meson-s390x

00:02:47

failed #8431556
docker windows 1809 mesa
meson-windows-vs2019

00:02:38

 
  Amd
skipped #8431562
mesa-ci-aarch64-lava-collabora
radeonsi-stoney-gles31:amd64
skipped #8431563
mesa-ci-aarch64-lava-collabora
radeonsi-stoney-traces:amd64
skipped #8431561
radv-fossils
 
  Arm
skipped #8431569
mesa-ci-aarch64-lava-collabora
panfrost-g52-gles2:arm64
skipped #8431570
mesa-ci-aarch64-lava-collabora
panfrost-g52-gles3:arm64
skipped #8431564
mesa-ci-aarch64-lava-collabora
panfrost-t720-gles2:arm64
skipped #8431565
mesa-ci-aarch64-lava-collabora
panfrost-t860-gles2:arm64
skipped #8431566
mesa-ci-aarch64-lava-collabora
panfrost-t860-gles3:arm64 1/2
skipped #8431567
mesa-ci-aarch64-lava-collabora
panfrost-t860-gles3:arm64 2/2
skipped #8431568
mesa-ci-aarch64-lava-collabora
panfrost-t860-traces:arm64
 
  Broadcom
skipped #8431581
igalia-rpi4
v3d-rpi4-gles2:armhf
skipped #8431575
igalia-rpi4
v3d-rpi4-gles31:armhf 1/2
skipped #8431576
igalia-rpi4
v3d-rpi4-gles31:armhf 2/2
skipped #8431577
igalia-rpi4
v3d-rpi4-gles3:armhf 1/4
skipped #8431578
igalia-rpi4
v3d-rpi4-gles3:armhf 2/4
skipped #8431579
igalia-rpi4
v3d-rpi4-gles3:armhf 3/4
skipped #8431580
igalia-rpi4
v3d-rpi4-gles3:armhf 4/4
skipped #8431582
igalia-rpi4
v3dv-rpi4-vk:armhf 1/6
skipped #8431583
igalia-rpi4
v3dv-rpi4-vk:armhf 2/6
skipped #8431584
igalia-rpi4
v3dv-rpi4-vk:armhf 3/6
skipped #8431585
igalia-rpi4
v3dv-rpi4-vk:armhf 4/6
skipped #8431586
igalia-rpi4
v3dv-rpi4-vk:armhf 5/6
skipped #8431587
igalia-rpi4
v3dv-rpi4-vk:armhf 6/6
skipped #8431571
igalia-rpi3
vc4-rpi3-gles2:armhf 1/4
skipped #8431572
igalia-rpi3
vc4-rpi3-gles2:armhf 2/4
skipped #8431573
igalia-rpi3
vc4-rpi3-gles2:armhf 3/4
skipped #8431574
igalia-rpi3
vc4-rpi3-gles2:armhf 4/4
 
  Freedreno
skipped #8431588
google-freedreno-db410c
a306_gles2
skipped #8431589
google-freedreno-db410c
a306_gles3 1/3
skipped #8431590
google-freedreno-db410c
a306_gles3 2/3
skipped #8431591
google-freedreno-db410c
a306_gles3 3/3
skipped #8431592
google-freedreno-db410c
a306_gles3_options
skipped #8431593
google-freedreno-db820c
a530_gles2
skipped #8431596
google-freedreno-db820c
a530_gles31 1/2
skipped #8431594
google-freedreno-db820c
a530_gles3 1/2
skipped #8431597
google-freedreno-db820c
a530_gles31 2/2
skipped #8431595
google-freedreno-db820c
a530_gles3 2/2
skipped #8431598
google-freedreno-db820c
a530_piglit_gl
skipped #8431599
google-freedreno-db820c
a530_piglit_shader
skipped #8431603
google-freedreno-cheza
a630_gl
skipped #8431600
google-freedreno-cheza
a630_gles2
skipped #8431602
google-freedreno-cheza
a630_gles3
skipped #8431601
google-freedreno-cheza
a630_gles31
skipped #8431605
google-freedreno-cheza
a630_gles_asan
skipped #8431604
google-freedreno-cheza
a630_gles_others
skipped #8431609
google-freedreno-cheza
a630_piglit_gl
skipped #8431610
google-freedreno-cheza
a630_piglit_shader
skipped #8431611
google-freedreno-cheza
a630-traces
skipped #8431606
google-freedreno-cheza
a630_vk 1/2
skipped #8431607
google-freedreno-cheza
a630_vk 2/2
skipped #8431608
google-freedreno-cheza
a630_vk_sysmem
 
  Software Renderer
skipped #8431625
lavapipe-vk
skipped #8431617
llvmpipe-gles2
skipped #8431612
llvmpipe-piglit-cl
skipped #8431614
llvmpipe-piglit-glslparser
skipped #8431613
llvmpipe-piglit-quick_gl
skipped #8431615
llvmpipe-piglit-quick_shader
skipped #8431616
llvmpipe-traces
skipped #8431622
softpipe-asan-gles31
skipped #8431624
softpipe-gl
skipped #8431618
softpipe-gles2
skipped #8431619
softpipe-gles3
skipped #8431620
softpipe-gles31 1/2
skipped #8431621
softpipe-gles31 2/2
skipped #8431623
softpipe-piglit-quick
 
  Layered Backends
skipped #8431638
docker windows 1809 mesa
test-d3d12-windows
skipped #8431630
virgl-gl30-on-gl
skipped #8431631
virgl-gl31-on-gl
skipped #8431632
virgl-gl32-on-gl
skipped #8431626
virgl-gles2-on-gl
skipped #8431628
virgl-gles31-on-gl 1/2
skipped #8431629
virgl-gles31-on-gl 2/2
skipped #8431627
virgl-gles3-on-gl
skipped #8431633
virgl-traces
skipped #8431637
zink-lvp-gl
skipped #8431635
zink-lvp-gles2
skipped #8431636
zink-lvp-gles3
skipped #8431634
zink-piglit-quick_gl
 
Name Stage Failure
failed
meson-mingw32-x86_64 Build Misc
Uploading artifacts for failed job
Uploading artifacts...
_build/meson-logs/*.txt: found 2 matching files and directories

WARNING: _build/meson-logs/strace: no matching files
WARNING: build/*/config.log: no matching files
WARNING: shader-db: no matching files
Uploading artifacts as "archive" to coordinator... ok
id=8431560 responseStatus=201 Created token=KzBr-u4s
Cleaning up file based variables
ERROR: Job failed: exit code 1
failed
meson-clover-testing Meson X86 64 The script exceeded the maximum execution time set for the job
[1237/1303] Compiling C++ object src/gallium/frontends/clover/libclllvm.a.p/llvm_invocation.cpp.o
[1238/1303] Compiling C++ object src/mesa/state_tracker/tests/st_array_merge_test.p/test_glsl_to_tgsi_array_merge.cpp.o
[1239/1303] Linking static target src/mesa/state_tracker/tests/libmesa_st_test_common.a
[1240/1303] Compiling C++ object src/mesa/state_tracker/tests/st_renumerate_test.p/test_glsl_to_tgsi_lifetime.cpp.o
[1241/1303] Linking static target src/gallium/frontends/clover/libclllvm.a
[1242/1303] Compiling C++ object src/gallium/frontends/clover/libclover.a.p/api_platform.cpp.o
[1243/1303] Compiling C++ object src/gallium/frontends/clover/libclover.a.p/api_device.cpp.o
[1244/1303] Linking static target src/gallium/frontends/clover/libclover.a
ERROR: Job failed: execution took longer than 1h0m0s seconds
failed
meson-arm64-build-test Build Misc The script exceeded the maximum execution time set for the job
[2126/2196] Compiling C++ object src/mesa/state_tracker/tests/libmesa_st_test_common.a.p/st_tests_common.cpp.o
[2127/2196] Linking static target src/mesa/state_tracker/tests/libmesa_st_test_common.a
[2128/2196] Compiling C++ object src/gallium/drivers/nouveau/libnouveau.a.p/codegen_nv50_ir_from_nir.cpp.o
[2129/2196] Linking static target src/gallium/drivers/nouveau/libnouveau.a
[2130/2196] Compiling C object src/mesa/libmesa_common.a.p/main_format_utils.c.o
[2131/2196] Compiling C++ object src/mesa/state_tracker/tests/st_array_merge_test.p/test_glsl_to_tgsi_array_merge.cpp.o
[2132/2196] Linking static target src/mesa/libmesa_common.a
[2133/2196] Compiling C++ object src/mesa/state_tracker/tests/st_renumerate_test.p/test_glsl_to_tgsi_lifetime.cpp.o
ERROR: Job failed: execution took longer than 1h0m0s seconds
failed
meson-windows-vs2019 Build Misc
Git branch:   13-9-stable
GO version: go1.13.8
Built: 2021-02-22T20:17:14+0000
OS/Arch: windows/amd64
Uploading artifacts...
_install/: found 1 matching files and directories

Uploading artifacts as "archive" to coordinator... ok
id=8431556 responseStatus=201 Created token=tZp2XTLa
Cleaning up file based variables
ERROR: Job failed: exit code 1
failed
meson-armhf Build Misc The script exceeded the maximum execution time set for the job
[1958/2023] Generating lima_nir_algebraic.c with a custom command (wrapped by meson to capture output)
[1959/2023] Compiling C object src/gallium/drivers/lima/liblima.a.p/meson-generated_.._lima_nir_algebraic.c.o
[1960/2023] Linking static target src/gallium/drivers/lima/liblima.a
[1961/2023] Generating nir_opt_algebraic.c with a custom command (wrapped by meson to capture output)
[1962/2023] Compiling C object src/panfrost/bifrost/libpanfrost_bifrost_disasm.a.p/meson-generated_.._bifrost_gen_disasm.c.o
[1963/2023] Linking static target src/panfrost/bifrost/libpanfrost_bifrost_disasm.a
[1964/2023] Compiling C object src/freedreno/isa/libir3encode.a.p/encode.c.o
[1965/2023] Linking static target src/freedreno/isa/libir3encode.a
ERROR: Job failed: execution took longer than 1h0m0s seconds
failed
meson-arm64 Build Misc The script exceeded the maximum execution time set for the job
[1956/2021] Linking target src/freedreno/fdl/fd5_layout
[1957/2021] Linking target src/freedreno/fdl/fd6_layout
[1958/2021] Linking target src/glx/libGL.so.1.2.0
[1959/2021] Linking target src/glx/tests/glx-test
[1960/2021] Generating symbol file src/gbm/libgbm.so.1.0.0.p/libgbm.so.1.0.0.symbols
[1961/2021] Linking target src/egl/libEGL.so.1.0.0
[1962/2021] Compiling C object src/freedreno/isa/libir3encode.a.p/encode.c.o
[1963/2021] Linking static target src/freedreno/isa/libir3encode.a
ERROR: Job failed: execution took longer than 1h0m0s seconds
failed
meson-testing Meson X86 64 The script exceeded the maximum execution time set for the job
[1874/1955] Compiling C object src/gallium/frontends/lavapipe/liblavapipe_st.a.p/lvp_query.c.o
[1875/1955] Compiling C object src/gallium/frontends/lavapipe/liblavapipe_st.a.p/lvp_wsi_x11.c.o
[1876/1955] Compiling C object src/gallium/frontends/lavapipe/liblavapipe_st.a.p/meson-generated_.._lvp_entrypoints.c.o
[1877/1955] Compiling C object src/gallium/frontends/lavapipe/liblavapipe_st.a.p/lvp_cmd_buffer.c.o
[1878/1955] Compiling C object src/gallium/drivers/zink/libzink.a.p/meson-generated_.._zink_nir_algebraic.c.o
[1879/1955] Linking static target src/gallium/drivers/zink/libzink.a
[1880/1955] Compiling C object src/gallium/frontends/lavapipe/liblavapipe_st.a.p/lvp_device.c.o
[1881/1955] Linking static target src/gallium/frontends/lavapipe/liblavapipe_st.a
ERROR: Job failed: execution took longer than 1h0m0s seconds
failed
meson-arm64-asan Build Misc The script exceeded the maximum execution time set for the job
[1956/2021] Compiling C object src/panfrost/bifrost/libpanfrost_bifrost_disasm.a.p/meson-generated_.._bifrost_gen_disasm.c.o
[1957/2021] Linking static target src/panfrost/bifrost/libpanfrost_bifrost_disasm.a
[1958/2021] Compiling C object src/freedreno/isa/libir3encode.a.p/encode.c.o
[1959/2021] Linking static target src/freedreno/isa/libir3encode.a
[1960/2021] Compiling C object src/panfrost/midgard/libpanfrost_midgard.a.p/meson-generated_.._midgard_nir_algebraic.c.o
[1961/2021] Linking static target src/panfrost/midgard/libpanfrost_midgard.a
[1962/2021] Compiling C object src/panfrost/bifrost/libpanfrost_bifrost.a.p/meson-generated_.._bifrost_nir_algebraic.c.o
[1963/2021] Linking static target src/panfrost/bifrost/libpanfrost_bifrost.a
ERROR: Job failed: execution took longer than 1h0m0s seconds
failed
meson-testing-asan Meson X86 64 The script exceeded the maximum execution time set for the job
[1874/1955] Compiling C object src/gallium/frontends/lavapipe/liblavapipe_st.a.p/lvp_pipeline_cache.c.o
[1875/1955] Compiling C object src/gallium/frontends/lavapipe/liblavapipe_st.a.p/lvp_pipeline.c.o
[1876/1955] Compiling C object src/gallium/frontends/lavapipe/liblavapipe_st.a.p/lvp_wsi_x11.c.o
[1877/1955] Compiling C object src/gallium/frontends/lavapipe/liblavapipe_st.a.p/lvp_wsi.c.o
[1878/1955] Compiling C object src/gallium/frontends/lavapipe/liblavapipe_st.a.p/lvp_query.c.o
[1879/1955] Compiling C object src/gallium/frontends/lavapipe/liblavapipe_st.a.p/lvp_cmd_buffer.c.o
[1880/1955] Compiling C object src/gallium/frontends/lavapipe/liblavapipe_st.a.p/lvp_device.c.o
[1881/1955] Linking static target src/gallium/frontends/lavapipe/liblavapipe_st.a
ERROR: Job failed: execution took longer than 1h0m0s seconds