Those either depend on information filled by the NIR linking steps OR are restricted by those:
gl_nir_lower_samplers: depends on UniformStorage being set by the linker.
brw_nir_lower_image_load_store: After 6981069f "i965: Ignore uniform storage for samplers or images, use binding info" we want this pass to happen after gl_nir_lower_samplers.
gl_nir_lower_buffers: depends on UniformBlocks and SharedStorageBlocks being set by the linker.
For the regular GLSL code path, those datastructures are filled earlier. For NIR linking code path we need to generate the nir_shader first then process it -- and currently the processing works with all shaders together. So move the passes out of brw_create_nir into its own function, called by the brwProgramStringNotify and brw_link_shader().
This patch prepares ground for ARB_gl_spirv, that will make use of NIR linker.