diff options
author | Jason Ekstrand <[email protected]> | 2015-12-26 10:00:47 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-12-28 09:59:53 -0800 |
commit | 237f2f2d8b45d9d956102eec6f9be63193e5269b (patch) | |
tree | 1b092bc0121132385b14f3a7ca6c9e7898fd365f /src/glsl/nir/nir.h | |
parent | 109c348284843054f708f4403260739b7db18275 (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.h')
-rw-r--r-- | src/glsl/nir/nir.h | 46 |
1 files changed, 16 insertions, 30 deletions
diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h index 9dbda448dd6..562c5c5cc8c 100644 --- a/src/glsl/nir/nir.h +++ b/src/glsl/nir/nir.h @@ -65,7 +65,6 @@ name(const in_type *parent) \ return exec_node_data(out_type, parent, field); \ } -struct nir_function_overload; struct nir_function; struct nir_shader; struct nir_instr; @@ -785,7 +784,7 @@ typedef struct { nir_deref_var **params; nir_deref_var *return_deref; - struct nir_function_overload *callee; + struct nir_function *callee; } nir_call_instr; #define INTRINSIC(name, num_srcs, src_components, has_dest, dest_components, \ @@ -1339,8 +1338,8 @@ typedef enum { typedef struct { nir_cf_node cf_node; - /** pointer to the overload of which this is an implementation */ - struct nir_function_overload *overload; + /** pointer to the function of which this is an implementation */ + struct nir_function *function; struct exec_list body; /** < list of nir_cf_node */ @@ -1425,31 +1424,23 @@ typedef struct { const struct glsl_type *type; } nir_parameter; -typedef struct nir_function_overload { +typedef struct nir_function { struct exec_node node; + const char *name; + struct nir_shader *shader; + unsigned num_params; nir_parameter *params; const struct glsl_type *return_type; - nir_function_impl *impl; /** < NULL if the overload is only declared yet */ - - /** pointer to the function of which this is an overload */ - struct nir_function *function; -} nir_function_overload; - -typedef struct nir_function { - struct exec_node node; - - struct exec_list overload_list; /** < list of nir_function_overload */ - const char *name; - struct nir_shader *shader; + /** The implementation of this function. + * + * If the function is only declared and not implemented, this is NULL. + */ + nir_function_impl *impl; } nir_function; -#define nir_function_first_overload(func) \ - exec_node_data(nir_function_overload, \ - exec_list_get_head(&(func)->overload_list), node) - typedef struct nir_shader_compiler_options { bool lower_ffma; bool lower_flrp; @@ -1610,10 +1601,8 @@ typedef struct nir_shader { gl_shader_stage stage; } nir_shader; -#define nir_foreach_overload(shader, overload) \ - foreach_list_typed(nir_function, func, node, &(shader)->functions) \ - foreach_list_typed(nir_function_overload, overload, node, \ - &(func)->overload_list) +#define nir_foreach_function(shader, func) \ + foreach_list_typed(nir_function, func, node, &(shader)->functions) nir_shader *nir_shader_create(void *mem_ctx, gl_shader_stage stage, @@ -1649,10 +1638,7 @@ nir_variable *nir_local_variable_create(nir_function_impl *impl, /** creates a function and adds it to the shader's list of functions */ nir_function *nir_function_create(nir_shader *shader, const char *name); -/** creates a null function returning null */ -nir_function_overload *nir_function_overload_create(nir_function *func); - -nir_function_impl *nir_function_impl_create(nir_function_overload *func); +nir_function_impl *nir_function_impl_create(nir_function *func); nir_block *nir_block_create(nir_shader *shader); nir_if *nir_if_create(nir_shader *shader); @@ -1677,7 +1663,7 @@ nir_intrinsic_instr *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_function *callee); nir_tex_instr *nir_tex_instr_create(nir_shader *shader, unsigned num_srcs); |