diff options
author | Jason Ekstrand <[email protected]> | 2014-12-15 17:44:37 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-01-15 07:20:22 -0800 |
commit | 675ffdef3010400567a5f6f790f1f7bd2fede717 (patch) | |
tree | 8054dc07405551cf185b45b29bf7547368f1849f /src/glsl | |
parent | 951a7f23a076c1570f68b50fc7d03a33eb5145e7 (diff) |
nir: Make nir_ssa_undef_instr_create initialize the destination
Reviewed-by: Connor Abbott <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r-- | src/glsl/nir/nir.c | 5 | ||||
-rw-r--r-- | src/glsl/nir/nir.h | 3 | ||||
-rw-r--r-- | src/glsl/nir/nir_lower_variables.c | 11 | ||||
-rw-r--r-- | src/glsl/nir/nir_to_ssa.c | 5 |
4 files changed, 11 insertions, 13 deletions
diff --git a/src/glsl/nir/nir.c b/src/glsl/nir/nir.c index 94840e2edcc..a7bf82bd9b8 100644 --- a/src/glsl/nir/nir.c +++ b/src/glsl/nir/nir.c @@ -483,13 +483,12 @@ nir_parallel_copy_instr_create(void *mem_ctx) } nir_ssa_undef_instr * -nir_ssa_undef_instr_create(void *mem_ctx) +nir_ssa_undef_instr_create(void *mem_ctx, unsigned num_components) { nir_ssa_undef_instr *instr = ralloc(mem_ctx, nir_ssa_undef_instr); instr_init(&instr->instr, nir_instr_type_ssa_undef); - instr->def.name = NULL; - instr->def.parent_instr = &instr->instr; + nir_ssa_def_init(&instr->instr, &instr->def, num_components, NULL); return instr; } diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h index 301e58fcc3d..b33d9c84909 100644 --- a/src/glsl/nir/nir.h +++ b/src/glsl/nir/nir.h @@ -1294,7 +1294,8 @@ nir_phi_instr *nir_phi_instr_create(void *mem_ctx); nir_parallel_copy_instr *nir_parallel_copy_instr_create(void *mem_ctx); -nir_ssa_undef_instr *nir_ssa_undef_instr_create(void *mem_ctx); +nir_ssa_undef_instr *nir_ssa_undef_instr_create(void *mem_ctx, + unsigned num_components); nir_deref_var *nir_deref_var_create(void *mem_ctx, nir_variable *var); nir_deref_array *nir_deref_array_create(void *mem_ctx); diff --git a/src/glsl/nir/nir_lower_variables.c b/src/glsl/nir/nir_lower_variables.c index 95ced8254b4..e3d5cde321d 100644 --- a/src/glsl/nir/nir_lower_variables.c +++ b/src/glsl/nir/nir_lower_variables.c @@ -688,9 +688,9 @@ get_ssa_def_for_block(struct deref_node *node, nir_block *block, /* If we got here then we don't have a definition that dominates the * given block. This means that we need to add an undef and use that. */ - nir_ssa_undef_instr *undef = nir_ssa_undef_instr_create(state->mem_ctx); - nir_ssa_def_init(&undef->instr, &undef->def, - glsl_get_vector_elements(node->type), NULL); + nir_ssa_undef_instr *undef = + nir_ssa_undef_instr_create(state->mem_ctx, + glsl_get_vector_elements(node->type)); nir_instr_insert_before_cf_list(&state->impl->body, &undef->instr); def_stack_push(node, &undef->def, state); return &undef->def; @@ -758,9 +758,8 @@ rename_variables_block(nir_block *block, struct lower_variables_state *state) * should result in an undefined value. */ nir_ssa_undef_instr *undef = - nir_ssa_undef_instr_create(state->mem_ctx); - nir_ssa_def_init(&undef->instr, &undef->def, - intrin->num_components, NULL); + nir_ssa_undef_instr_create(state->mem_ctx, + intrin->num_components); nir_instr_insert_before(&intrin->instr, &undef->instr); nir_instr_remove(&intrin->instr); diff --git a/src/glsl/nir/nir_to_ssa.c b/src/glsl/nir/nir_to_ssa.c index 3725ddbe226..58e8829e1c4 100644 --- a/src/glsl/nir/nir_to_ssa.c +++ b/src/glsl/nir/nir_to_ssa.c @@ -159,9 +159,8 @@ static nir_ssa_def *get_ssa_src(nir_register *reg, rewrite_state *state) * We're using an undefined register, create a new undefined SSA value * to preserve the information that this source is undefined */ - nir_ssa_undef_instr *instr = nir_ssa_undef_instr_create(state->mem_ctx); - nir_ssa_def_init(&instr->instr, &instr->def, - reg->num_components, NULL); + nir_ssa_undef_instr *instr = + nir_ssa_undef_instr_create(state->mem_ctx, reg->num_components); /* * We could just insert the undefined instruction before the instruction |