nir/large_constants: Add read/write_const_values helpers
The write helper is just pulling code we already have out into a helper
and flipping the order of the loop and the switch. The read helper will
be useful in the next commit where we add small constant support. This
keeps the two helpers right next to each other in the file where they're
easy to compare and we can ensure that they stay in sync.
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9000>