nir: Move phi src setup to a helper.
Cleans up the ralloc/list push code all over the tree. Reviewed-by: Matt Turner <mattst88@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11772>
This commit is contained in:
@@ -1590,11 +1590,9 @@ read_phi(read_ctx *ctx, nir_block *blk, union packed_instr header)
|
||||
nir_instr_insert_after_block(blk, &phi->instr);
|
||||
|
||||
for (unsigned i = 0; i < header.phi.num_srcs; i++) {
|
||||
nir_phi_src *src = ralloc(phi, nir_phi_src);
|
||||
|
||||
src->src.is_ssa = true;
|
||||
src->src.ssa = (nir_ssa_def *)(uintptr_t) blob_read_uint32(ctx->blob);
|
||||
src->pred = (nir_block *)(uintptr_t) blob_read_uint32(ctx->blob);
|
||||
nir_ssa_def *def = (nir_ssa_def *)(uintptr_t) blob_read_uint32(ctx->blob);
|
||||
nir_block *pred = (nir_block *)(uintptr_t) blob_read_uint32(ctx->blob);
|
||||
nir_phi_src *src = nir_phi_instr_add_src(phi, pred, nir_src_for_ssa(def));
|
||||
|
||||
/* Since we're not letting nir_insert_instr handle use/def stuff for us,
|
||||
* we have to set the parent_instr manually. It doesn't really matter
|
||||
@@ -1606,8 +1604,6 @@ read_phi(read_ctx *ctx, nir_block *blk, union packed_instr header)
|
||||
* sources at the very end of read_function_impl.
|
||||
*/
|
||||
list_add(&src->src.use_link, &ctx->phi_srcs);
|
||||
|
||||
exec_list_push_tail(&phi->srcs, &src->node);
|
||||
}
|
||||
|
||||
return phi;
|
||||
|
||||
Reference in New Issue
Block a user