gallivm/nir: split prepasses out to make per-function work easier.

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24687>
This commit is contained in:
Dave Airlie
2023-09-06 16:33:45 +10:00
committed by Marge Bot
parent a74e98547c
commit 3cd20feed0
4 changed files with 13 additions and 9 deletions

View File

@@ -2859,22 +2859,20 @@ get_register_type(struct lp_build_nir_context *bld_base,
return type;
}
bool lp_build_nir_llvm(struct lp_build_nir_context *bld_base,
struct nir_shader *nir)
void
lp_build_nir_prepasses(struct nir_shader *nir)
{
struct nir_function *func;
NIR_PASS_V(nir, nir_convert_to_lcssa, true, true);
NIR_PASS_V(nir, nir_convert_from_ssa, true);
NIR_PASS_V(nir, nir_lower_locals_to_regs, 32);
NIR_PASS_V(nir, nir_remove_dead_derefs);
NIR_PASS_V(nir, nir_remove_dead_variables, nir_var_function_temp, NULL);
}
if (is_aos(bld_base)) {
NIR_PASS_V(nir, nir_move_vec_src_uses_to_dest);
NIR_PASS_V(nir, nir_lower_vec_to_regs, NULL, NULL);
}
bool lp_build_nir_llvm(struct lp_build_nir_context *bld_base,
struct nir_shader *nir)
{
struct nir_function *func;
nir_foreach_shader_out_variable(variable, nir)
handle_shader_output_decl(bld_base, nir, variable);

View File

@@ -295,6 +295,8 @@ struct lp_build_nir_soa_context
unsigned gs_vertex_streams;
};
void
lp_build_nir_prepasses(struct nir_shader *nir);
bool
lp_build_nir_llvm(struct lp_build_nir_context *bld_base,

View File

@@ -394,5 +394,8 @@ lp_build_nir_aos(struct gallivm_state *gallivm,
bld.bld_base.tex = emit_tex;
bld.bld_base.emit_var_decl = emit_var_decl;
lp_build_nir_prepasses(shader);
NIR_PASS_V(shader, nir_move_vec_src_uses_to_dest);
NIR_PASS_V(shader, nir_lower_vec_to_regs, NULL, NULL);
lp_build_nir_llvm(&bld.bld_base, shader);
}

View File

@@ -2973,6 +2973,7 @@ void lp_build_nir_soa(struct gallivm_state *gallivm,
}
emit_prologue(&bld);
lp_build_nir_prepasses(shader);
lp_build_nir_llvm(&bld.bld_base, shader);
if (bld.gs_iface) {