[Mesa-dev] [PATCH 005/133] nir: add core helper functions
Eric Anholt
eric at anholt.net
Tue Dec 16 15:47:26 PST 2014
Jason Ekstrand <jason at jlekstrand.net> writes:
> From: Connor Abbott <connor.abbott at intel.com>
>
> These include functions for adding and removing various bits of IR and
> helpers for iterating over all the sources and destinations of an
> instruction. This is similar to ir.cpp.
> +nir_function_overload *
> +nir_function_overload_create(nir_function *func)
> +{
> + void *mem_ctx = ralloc_parent(func);
> +
> + nir_function_overload *overload = ralloc(mem_ctx, nir_function_overload);
> +
> + overload->num_params = 0;
> + overload->params = NULL;
> + overload->return_type = glsl_void_type();
> +
> + exec_list_push_tail(&func->overload_list, &overload->node);
> + overload->function = func;
> +
> + return overload;
> +}
Looks like overload->impl is left undefined.
> +nir_tex_instr *
> +nir_tex_instr_create(void *mem_ctx, unsigned num_srcs)
> +{
> + nir_tex_instr *instr = ralloc(mem_ctx, nir_tex_instr);
> + instr_init(&instr->instr, nir_instr_type_texture);
> +
> + instr->num_srcs = num_srcs;
> + for (unsigned i = 0; i < num_srcs; i++)
> + src_init(&instr->src[i]);
Having to compute the num_srcs up front kind of sucked. It seems
important for the ALU ops, but if we're not mallocing less memory based
on num_srcs, it would be nice to avoid. Not necessary to change in the
review process, though.
Also, missing this line that other instruction allocators have:
dest_init(&instr->dest);
I didn't review the details of CFG manipulation, but other than these
little comments the rest is:
Reviewed-by: Eric Anholt <eric at anholt.net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20141216/a04cda2a/attachment-0001.sig>
More information about the mesa-dev
mailing list