summaryrefslogtreecommitdiffstats
path: root/src/glsl/nir/nir.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2015-12-26 10:00:47 -0800
committerJason Ekstrand <[email protected]>2015-12-28 09:59:53 -0800
commit237f2f2d8b45d9d956102eec6f9be63193e5269b (patch)
tree1b092bc0121132385b14f3a7ca6c9e7898fd365f /src/glsl/nir/nir.c
parent109c348284843054f708f4403260739b7db18275 (diff)
nir: Get rid of function overloads
When Connor originally drafted NIR, he copied the same function+overload system that GLSL IR had with a few names changed. However, this double-indirection is not really needed and has only served to confuse people. Instead, let's just have functions which may not have unique names and may or may not have an implementation. If someone wants to do overload resolving, they can hav a hash table based function+overload system in the overload resolving pass. There's no good reason to keep it in core NIR. Reviewed-by: Connor Abbott <[email protected]> Acked-by: Kenneth Graunke <[email protected]> ir3 bits are Reviewed-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/glsl/nir/nir.c')
-rw-r--r--src/glsl/nir/nir.c38
1 files changed, 12 insertions, 26 deletions
diff --git a/src/glsl/nir/nir.c b/src/glsl/nir/nir.c
index 35fc1de2e01..60395ae3ab0 100644
--- a/src/glsl/nir/nir.c
+++ b/src/glsl/nir/nir.c
@@ -163,7 +163,7 @@ nir_variable *
nir_local_variable_create(nir_function_impl *impl,
const struct glsl_type *type, const char *name)
{
- nir_variable *var = rzalloc(impl->overload->function->shader, nir_variable);
+ nir_variable *var = rzalloc(impl->function->shader, nir_variable);
var->name = ralloc_strdup(var, name);
var->type = type;
var->data.mode = nir_var_local;
@@ -179,31 +179,17 @@ nir_function_create(nir_shader *shader, const char *name)
nir_function *func = ralloc(shader, nir_function);
exec_list_push_tail(&shader->functions, &func->node);
- exec_list_make_empty(&func->overload_list);
+
func->name = ralloc_strdup(func, name);
func->shader = shader;
+ func->num_params = 0;
+ func->params = NULL;
+ func->return_type = glsl_void_type();
+ func->impl = NULL;
return func;
}
-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();
- overload->impl = NULL;
-
- exec_list_push_tail(&func->overload_list, &overload->node);
- overload->function = func;
-
- return overload;
-}
-
void nir_src_copy(nir_src *dest, const nir_src *src, void *mem_ctx)
{
dest->is_ssa = src->is_ssa;
@@ -268,16 +254,16 @@ cf_init(nir_cf_node *node, nir_cf_node_type type)
}
nir_function_impl *
-nir_function_impl_create(nir_function_overload *overload)
+nir_function_impl_create(nir_function *function)
{
- assert(overload->impl == NULL);
+ assert(function->impl == NULL);
- void *mem_ctx = ralloc_parent(overload);
+ void *mem_ctx = ralloc_parent(function);
nir_function_impl *impl = ralloc(mem_ctx, nir_function_impl);
- overload->impl = impl;
- impl->overload = overload;
+ function->impl = impl;
+ impl->function = function;
cf_init(&impl->cf_node, nir_cf_node_function);
@@ -474,7 +460,7 @@ nir_intrinsic_instr_create(nir_shader *shader, nir_intrinsic_op op)
}
nir_call_instr *
-nir_call_instr_create(nir_shader *shader, nir_function_overload *callee)
+nir_call_instr_create(nir_shader *shader, nir_function *callee)
{
nir_call_instr *instr = ralloc(shader, nir_call_instr);
instr_init(&instr->instr, nir_instr_type_call);