summaryrefslogtreecommitdiffstats
path: root/src/glsl/nir/nir_clone.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/glsl/nir/nir_clone.c')
-rw-r--r--src/glsl/nir/nir_clone.c50
1 files changed, 19 insertions, 31 deletions
diff --git a/src/glsl/nir/nir_clone.c b/src/glsl/nir/nir_clone.c
index 33ff5261b21..5eff743d835 100644
--- a/src/glsl/nir/nir_clone.c
+++ b/src/glsl/nir/nir_clone.c
@@ -420,7 +420,7 @@ clone_jump(clone_state *state, const nir_jump_instr *jmp)
static nir_call_instr *
clone_call(clone_state *state, const nir_call_instr *call)
{
- nir_function_overload *ncallee = lookup_ptr(state, call->callee);
+ nir_function *ncallee = lookup_ptr(state, call->callee);
nir_call_instr *ncall = nir_call_instr_create(state->ns, ncallee);
for (unsigned i = 0; i < ncall->num_params; i++)
@@ -547,9 +547,9 @@ clone_cf_list(clone_state *state, struct exec_list *dst,
static nir_function_impl *
clone_function_impl(clone_state *state, const nir_function_impl *fi,
- nir_function_overload *nfo)
+ nir_function *nfxn)
{
- nir_function_impl *nfi = nir_function_impl_create(nfo);
+ nir_function_impl *nfi = nir_function_impl_create(nfxn);
clone_var_list(state, &nfi->locals, &fi->locals);
clone_reg_list(state, &nfi->registers, &fi->registers);
@@ -588,39 +588,27 @@ clone_function_impl(clone_state *state, const nir_function_impl *fi,
return nfi;
}
-static nir_function_overload *
-clone_function_overload(clone_state *state, const nir_function_overload *fo,
- nir_function *nfxn)
+static nir_function *
+clone_function(clone_state *state, const nir_function *fxn, nir_shader *ns)
{
- nir_function_overload *nfo = nir_function_overload_create(nfxn);
+ assert(ns == state->ns);
+ nir_function *nfxn = nir_function_create(ns, fxn->name);
/* Needed for call instructions */
- store_ptr(state, nfo, fo);
+ store_ptr(state, nfxn, fxn);
- nfo->num_params = fo->num_params;
- nfo->params = ralloc_array(state->ns, nir_parameter, fo->num_params);
- memcpy(nfo->params, fo->params, sizeof(nir_parameter) * fo->num_params);
+ nfxn->num_params = fxn->num_params;
+ nfxn->params = ralloc_array(state->ns, nir_parameter, fxn->num_params);
+ memcpy(nfxn->params, fxn->params, sizeof(nir_parameter) * fxn->num_params);
- nfo->return_type = fo->return_type;
+ nfxn->return_type = fxn->return_type;
/* At first glance, it looks like we should clone the function_impl here.
* However, call instructions need to be able to reference at least the
- * overload and those will get processed as we clone the function_impl's.
+ * function and those will get processed as we clone the function_impl's.
* We stop here and do function_impls as a second pass.
*/
- return nfo;
-}
-
-static nir_function *
-clone_function(clone_state *state, const nir_function *fxn, nir_shader *ns)
-{
- assert(ns == state->ns);
- nir_function *nfxn = nir_function_create(ns, fxn->name);
-
- foreach_list_typed(nir_function_overload, fo, node, &fxn->overload_list)
- clone_function_overload(state, fo, nfxn);
-
return nfxn;
}
@@ -639,18 +627,18 @@ nir_shader_clone(void *mem_ctx, const nir_shader *s)
clone_var_list(&state, &ns->globals, &s->globals);
clone_var_list(&state, &ns->system_values, &s->system_values);
- /* Go through and clone functions and overloads */
+ /* Go through and clone functions */
foreach_list_typed(nir_function, fxn, node, &s->functions)
clone_function(&state, fxn, ns);
- /* Only after all overloads are cloned can we clone the actual function
+ /* Only after all functions are cloned can we clone the actual function
* implementations. This is because nir_call_instr's need to reference the
- * overloads of other functions and we don't know what order the functions
+ * functions of other functions and we don't know what order the functions
* will have in the list.
*/
- nir_foreach_overload(s, fo) {
- nir_function_overload *nfo = lookup_ptr(&state, fo);
- clone_function_impl(&state, fo->impl, nfo);
+ nir_foreach_function(s, fxn) {
+ nir_function *nfxn = lookup_ptr(&state, fxn);
+ clone_function_impl(&state, fxn->impl, nfxn);
}
clone_reg_list(&state, &ns->registers, &s->registers);