st/glsl: start spilling out common st glsl conversion code

The NIR and TGSI paths are currently intertwined which makes it
not only hard to follow but also makes it hard to take advantage
of the differences in IR.

Here we take the first step to splitting that path apart. With
this we take the opportunity to no longer call the GLSL IR
optimisation passes after the final lowering calls for NIR. We
can instead just use the NIR passes which can produce better code
and should also result in faster compile times.

The speed-up can be measured in some dolphin uber shaders due to
no longer calling lower_if_to_cond_assign() for example
dolphin/ubershaders/120.shader_test goes from ~1.63 -> ~1.53
seconds on my machine.

There are some code changes as a result of not calling
lower_if_to_cond_assign(), this is because it flattens ifs that
contain UBOs where as NIR's peephole select doesn't. This is
were most of the regressions in Max Waves happens with shader-db.

shader-db results (VEGA):

Totals from affected shaders:
SGPRS: 2349056 -> 2349640 (0.02 %)
VGPRS: 1322160 -> 1323300 (0.09 %)
Spilled SGPRs: 21190 -> 21527 (1.59 %)
Spilled VGPRs: 99 -> 99 (0.00 %)
Private memory VGPRs: 0 -> 0 (0.00 %)
Scratch size: 72 -> 72 (0.00 %) dwords per thread
Code Size: 57260904 -> 57270932 (0.02 %) bytes
Compile Time: 1107186 -> 1022942 (-7.61 %) milliseconds
LDS: 786 -> 786 (0.00 %) blocks
Max Waves: 391932 -> 391619 (-0.08 %)
Wait states: 0 -> 0 (0.00 %)

Reviewed-by: Eric Anholt <eric@anholt.net>
25 jobs for !290 with st_nir_linker_improvements in 70 minutes and 41 seconds (queued for 17 minutes and 32 seconds)
detached
Status Job ID Name Coverage
  Containers Build
passed #157489
ubuntu

00:00:47

 
  Build+Test
passed #157504
make-gallium-drivers-other

00:14:57

passed #157503
make-gallium-drivers-radeonsi

00:08:24

passed #157502
make-gallium-drivers-swr

00:14:46

passed #157505
make-gallium-st-clover-llvm-39

00:08:00

passed #157506
make-gallium-st-clover-llvm-4

00:09:16

passed #157507
make-gallium-st-clover-llvm-5

00:10:16

passed #157508
make-gallium-st-clover-llvm-6

00:09:02

passed #157509
make-gallium-st-clover-llvm-7

00:11:54

passed #157510
make-gallium-st-other

00:11:40

passed #157501
make-loader-classic-dri

00:13:23

passed #157500
make-vulkan

00:06:08

passed #157496
meson-gallium-clover-llvm5

00:02:36

passed #157497
meson-gallium-clover-llvm6

00:03:58

passed #157498
meson-gallium-clover-llvm7

00:03:05

passed #157495
meson-gallium-drivers-other

00:05:55

passed #157494
meson-gallium-radeonsi

00:03:46

passed #157499
meson-gallium-st-other

00:03:58

passed #157493
meson-gallium-swr

00:09:29

passed #157492
meson-glvnd

00:03:20

passed #157491
meson-loader-classic-dri

00:07:08

passed #157490
meson-vulkan

00:03:43

passed #157512
scons-llvm

00:06:54

passed #157511
scons-nollvm

00:06:37

passed #157513
scons-swr

00:07:48