}
bool lp_build_nir_llvm(struct lp_build_nir_context *bld_base,
- struct nir_shader *nir)
+ struct nir_shader *nir,
+ nir_function_impl *impl)
{
- struct nir_function *func;
-
nir_foreach_shader_out_variable(variable, nir)
handle_shader_output_decl(bld_base, nir, variable);
_mesa_key_pointer_equal);
bld_base->range_ht = _mesa_pointer_hash_table_create(NULL);
- func = (struct nir_function *)exec_list_get_head(&nir->functions);
-
- nir_foreach_reg_decl(reg, func->impl) {
+ nir_foreach_reg_decl(reg, impl) {
LLVMTypeRef type = get_register_type(bld_base, reg);
LLVMValueRef reg_alloc = lp_build_alloca(bld_base->base.gallivm,
type, "reg");
_mesa_hash_table_insert(bld_base->regs, reg, reg_alloc);
}
- nir_index_ssa_defs(func->impl);
- bld_base->ssa_defs = calloc(func->impl->ssa_alloc, sizeof(LLVMValueRef));
- visit_cf_list(bld_base, &func->impl->body);
+ nir_index_ssa_defs(impl);
+ bld_base->ssa_defs = calloc(impl->ssa_alloc, sizeof(LLVMValueRef));
+ visit_cf_list(bld_base, &impl->body);
free(bld_base->ssa_defs);
ralloc_free(bld_base->vars);
const struct lp_build_tgsi_params *params,
LLVMValueRef (*outputs)[4]);
+void lp_build_nir_soa_func(struct gallivm_state *gallivm,
+ struct nir_shader *shader,
+ nir_function_impl *impl,
+ const struct lp_build_tgsi_params *params,
+ LLVMValueRef (*outputs)[4]);
+
void lp_build_nir_aos(struct gallivm_state *gallivm,
struct nir_shader *shader,
struct lp_type type,
bool
lp_build_nir_llvm(struct lp_build_nir_context *bld_base,
- struct nir_shader *nir);
+ struct nir_shader *nir,
+ nir_function_impl *impl);
void
lp_build_opt_nir(struct nir_shader *nir);
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);
+ lp_build_nir_llvm(&bld.bld_base, shader,
+ nir_shader_get_entrypoint(shader));
}
dst[1] = lp_build_broadcast_scalar(uint_bld, hi);
}
-void lp_build_nir_soa(struct gallivm_state *gallivm,
- struct nir_shader *shader,
- const struct lp_build_tgsi_params *params,
- LLVMValueRef (*outputs)[4])
+void lp_build_nir_soa_func(struct gallivm_state *gallivm,
+ struct nir_shader *shader,
+ nir_function_impl *impl,
+ const struct lp_build_tgsi_params *params,
+ LLVMValueRef (*outputs)[4])
{
struct lp_build_nir_soa_context bld;
const struct lp_type type = params->type;
}
emit_prologue(&bld);
- lp_build_nir_prepasses(shader);
- lp_build_nir_llvm(&bld.bld_base, shader);
+ lp_build_nir_llvm(&bld.bld_base, shader, impl);
if (bld.gs_iface) {
LLVMBuilderRef builder = bld.bld_base.base.gallivm->builder;
}
lp_exec_mask_fini(&bld.exec_mask);
}
+
+void lp_build_nir_soa(struct gallivm_state *gallivm,
+ struct nir_shader *shader,
+ const struct lp_build_tgsi_params *params,
+ LLVMValueRef (*outputs)[4])
+{
+ lp_build_nir_prepasses(shader);
+ lp_build_nir_soa_func(gallivm, shader,
+ nir_shader_get_entrypoint(shader),
+ params, outputs);
+}