st/glsl: move nir linking loop to new function st_link_nir()