diff options
author | Jason Ekstrand <[email protected]> | 2016-03-23 15:05:55 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2016-03-23 15:26:11 -0700 |
commit | f849f53990c613a28c32826d09005e127adedeac (patch) | |
tree | d7dac108b1d1daa7d06170e4e833a937fa553eb8 /src/compiler/nir | |
parent | 5fe8959912f617fd0ada71f6b952e66305f48d67 (diff) |
nir/clone: Export nir_variable_clone
Reviewed-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/compiler/nir')
-rw-r--r-- | src/compiler/nir/nir.h | 1 | ||||
-rw-r--r-- | src/compiler/nir/nir_clone.c | 16 |
2 files changed, 13 insertions, 4 deletions
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 1e91207509e..02acbfc9d73 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -2052,6 +2052,7 @@ void nir_print_instr(const nir_instr *instr, FILE *fp); nir_shader *nir_shader_clone(void *mem_ctx, const nir_shader *s); nir_function_impl *nir_function_impl_clone(const nir_function_impl *fi); nir_constant *nir_constant_clone(const nir_constant *c, nir_variable *var); +nir_variable *nir_variable_clone(const nir_variable *c, nir_shader *shader); #ifdef DEBUG void nir_validate_shader(nir_shader *shader); diff --git a/src/compiler/nir/nir_clone.c b/src/compiler/nir/nir_clone.c index 0ef0289504e..a721552f6a6 100644 --- a/src/compiler/nir/nir_clone.c +++ b/src/compiler/nir/nir_clone.c @@ -127,11 +127,10 @@ nir_constant_clone(const nir_constant *c, nir_variable *nvar) /* NOTE: for cloning nir_variable's, bypass nir_variable_create to avoid * having to deal with locals and globals separately: */ -static nir_variable * -clone_variable(clone_state *state, const nir_variable *var) +nir_variable * +nir_variable_clone(const nir_variable *var, nir_shader *shader) { - nir_variable *nvar = rzalloc(state->ns, nir_variable); - add_remap(state, nvar, var); + nir_variable *nvar = rzalloc(shader, nir_variable); nvar->type = var->type; nvar->name = ralloc_strdup(nvar, var->name); @@ -149,6 +148,15 @@ clone_variable(clone_state *state, const nir_variable *var) return nvar; } +static nir_variable * +clone_variable(clone_state *state, const nir_variable *var) +{ + nir_variable *nvar = nir_variable_clone(var, state->ns); + add_remap(state, nvar, var); + + return nvar; +} + /* clone list of nir_variable: */ static void clone_var_list(clone_state *state, struct exec_list *dst, |