[Mesa-dev] [PATCH 2/7] nir: some small cleanups
Jason Ekstrand
jason at jlekstrand.net
Mon Oct 26 10:54:16 PDT 2015
On Sat, Oct 24, 2015 at 10:07 AM, Rob Clark <robdclark at gmail.com> wrote:
> The various cf nodes all get allocated w/ shader as their ralloc_parent,
> so lets make this more explicit. Plus couple other corrections/
> clarifications.
>
> Signed-off-by: Rob Clark <robclark at freedesktop.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand at intel.com>
> ---
> src/glsl/nir/nir.c | 18 +++++++++---------
> src/glsl/nir/nir.h | 10 +++++-----
> 2 files changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/src/glsl/nir/nir.c b/src/glsl/nir/nir.c
> index caa9ffc..300e43f 100644
> --- a/src/glsl/nir/nir.c
> +++ b/src/glsl/nir/nir.c
> @@ -306,9 +306,9 @@ nir_function_impl_create(nir_function_overload *overload)
> }
>
> nir_block *
> -nir_block_create(void *mem_ctx)
> +nir_block_create(nir_shader *shader)
> {
> - nir_block *block = ralloc(mem_ctx, nir_block);
> + nir_block *block = ralloc(shader, nir_block);
>
> cf_init(&block->cf_node, nir_cf_node_block);
>
> @@ -334,19 +334,19 @@ src_init(nir_src *src)
> }
>
> nir_if *
> -nir_if_create(void *mem_ctx)
> +nir_if_create(nir_shader *shader)
> {
> - nir_if *if_stmt = ralloc(mem_ctx, nir_if);
> + nir_if *if_stmt = ralloc(shader, nir_if);
>
> cf_init(&if_stmt->cf_node, nir_cf_node_if);
> src_init(&if_stmt->condition);
>
> - nir_block *then = nir_block_create(mem_ctx);
> + nir_block *then = nir_block_create(shader);
> exec_list_make_empty(&if_stmt->then_list);
> exec_list_push_tail(&if_stmt->then_list, &then->cf_node.node);
> then->cf_node.parent = &if_stmt->cf_node;
>
> - nir_block *else_stmt = nir_block_create(mem_ctx);
> + nir_block *else_stmt = nir_block_create(shader);
> exec_list_make_empty(&if_stmt->else_list);
> exec_list_push_tail(&if_stmt->else_list, &else_stmt->cf_node.node);
> else_stmt->cf_node.parent = &if_stmt->cf_node;
> @@ -355,13 +355,13 @@ nir_if_create(void *mem_ctx)
> }
>
> nir_loop *
> -nir_loop_create(void *mem_ctx)
> +nir_loop_create(nir_shader *shader)
> {
> - nir_loop *loop = ralloc(mem_ctx, nir_loop);
> + nir_loop *loop = ralloc(shader, nir_loop);
>
> cf_init(&loop->cf_node, nir_cf_node_loop);
>
> - nir_block *body = nir_block_create(mem_ctx);
> + nir_block *body = nir_block_create(shader);
> exec_list_make_empty(&loop->body);
> exec_list_push_tail(&loop->body, &body->cf_node.node);
> body->cf_node.parent = &loop->cf_node;
> diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
> index 79c0666..097d65b 100644
> --- a/src/glsl/nir/nir.h
> +++ b/src/glsl/nir/nir.h
> @@ -395,10 +395,10 @@ typedef struct {
> */
> bool is_packed;
>
> - /** set of nir_instr's where this register is used (read from) */
> + /** set of nir_src's where this register is used (read from) */
> struct list_head uses;
>
> - /** set of nir_instr's where this register is defined (written to) */
> + /** set of nir_dest's where this register is defined (written to) */
> struct list_head defs;
>
> /** set of nir_if's where this register is used as a condition */
> @@ -1622,9 +1622,9 @@ nir_function_overload *nir_function_overload_create(nir_function *func);
>
> nir_function_impl *nir_function_impl_create(nir_function_overload *func);
>
> -nir_block *nir_block_create(void *mem_ctx);
> -nir_if *nir_if_create(void *mem_ctx);
> -nir_loop *nir_loop_create(void *mem_ctx);
> +nir_block *nir_block_create(nir_shader *shader);
> +nir_if *nir_if_create(nir_shader *shader);
> +nir_loop *nir_loop_create(nir_shader *shader);
>
> nir_function_impl *nir_cf_node_get_function(nir_cf_node *node);
>
> --
> 2.5.0
>
More information about the mesa-dev
mailing list