gallium: Add a nir-to-TGSI pass.

The goal is to replace glsl_to_tgsi.cpp and its supporting code (~10k
LOC).  This code ends up being smaller because NIR has many lowering
passes that help it map better to TGSI than GLSL IR does.

As a benefit, this brings NIR optimizations to TGSI-only drivers.
Many of the softpipe shaders I've looked at end up being significantly
shorter.  Some potentially relevant changes to TGSI consumers:

- All immediates are now UINT typed.  This means they're less legible
  in printouts, but means that they get deduplicated better (no more
  multiple copies of 0x0!)
- Sampler views are not currently declared.
- nir_registers don't have their live ranges tracked, so TGSI temp usage
  may go up with a lot of control flow.
- nir_lower_vec_to_mov naively inserts movs instead of trying to coalesce
  the movs with the generators of the ssa values, sometimes increasing
  instruction count.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3395>
4 files changed