summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2015-12-26 10:00:47 -0800
committerJason Ekstrand <jason.ekstrand@intel.com>2015-12-28 09:59:53 -0800
commit237f2f2d8b45d9d956102eec6f9be63193e5269b (patch)
tree1b092bc0121132385b14f3a7ca6c9e7898fd365f /src/mesa
parent109c348284843054f708f4403260739b7db18275 (diff)
downloadexternal_mesa3d-237f2f2d8b45d9d956102eec6f9be63193e5269b.zip
external_mesa3d-237f2f2d8b45d9d956102eec6f9be63193e5269b.tar.gz
external_mesa3d-237f2f2d8b45d9d956102eec6f9be63193e5269b.tar.bz2
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 <cwabbott0@gmail.com> Acked-by: Kenneth Graunke <kenneth@whitecape.org> ir3 bits are Reviewed-by: Rob Clark <robclark@gmail.com>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_nir.cpp16
-rw-r--r--src/mesa/drivers/dri/i965/brw_nir.c50
-rw-r--r--src/mesa/drivers/dri/i965/brw_nir_analyze_boolean_resolves.c7
-rw-r--r--src/mesa/drivers/dri/i965/brw_nir_opt_peephole_ffma.c6
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_nir.cpp16
-rw-r--r--src/mesa/program/prog_to_nir.c3
6 files changed, 49 insertions, 49 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
index 9728e2a..bb6ab53 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
@@ -43,10 +43,10 @@ fs_visitor::emit_nir_code()
nir_emit_system_values();
/* get the main function and emit it */
- nir_foreach_overload(nir, overload) {
- assert(strcmp(overload->function->name, "main") == 0);
- assert(overload->impl);
- nir_emit_impl(overload->impl);
+ nir_foreach_function(nir, function) {
+ assert(strcmp(function->name, "main") == 0);
+ assert(function->impl);
+ nir_emit_impl(function->impl);
}
}
@@ -338,10 +338,10 @@ fs_visitor::nir_emit_system_values()
nir_system_values[i] = fs_reg();
}
- nir_foreach_overload(nir, overload) {
- assert(strcmp(overload->function->name, "main") == 0);
- assert(overload->impl);
- nir_foreach_block(overload->impl, emit_system_values_block, this);
+ nir_foreach_function(nir, function) {
+ assert(strcmp(function->name, "main") == 0);
+ assert(function->impl);
+ nir_foreach_block(function->impl, emit_system_values_block, this);
}
}
diff --git a/src/mesa/drivers/dri/i965/brw_nir.c b/src/mesa/drivers/dri/i965/brw_nir.c
index eebd2a3..e031173 100644
--- a/src/mesa/drivers/dri/i965/brw_nir.c
+++ b/src/mesa/drivers/dri/i965/brw_nir.c
@@ -224,11 +224,11 @@ brw_nir_lower_inputs(nir_shader *nir,
/* This pass needs actual constants */
nir_opt_constant_folding(nir);
- nir_foreach_overload(nir, overload) {
- if (overload->impl) {
- nir_builder_init(&params.b, overload->impl);
- nir_foreach_block(overload->impl, add_const_offset_to_base, &params);
- nir_foreach_block(overload->impl, remap_vs_attrs, &inputs_read);
+ nir_foreach_function(nir, function) {
+ if (function->impl) {
+ nir_builder_init(&params.b, function->impl);
+ nir_foreach_block(function->impl, add_const_offset_to_base, &params);
+ nir_foreach_block(function->impl, remap_vs_attrs, &inputs_read);
}
}
}
@@ -270,11 +270,11 @@ brw_nir_lower_inputs(nir_shader *nir,
/* This pass needs actual constants */
nir_opt_constant_folding(nir);
- nir_foreach_overload(nir, overload) {
- if (overload->impl) {
- nir_builder_init(&params.b, overload->impl);
- nir_foreach_block(overload->impl, add_const_offset_to_base, &params);
- nir_foreach_block(overload->impl, remap_inputs_with_vue_map,
+ nir_foreach_function(nir, function) {
+ if (function->impl) {
+ nir_builder_init(&params.b, function->impl);
+ nir_foreach_block(function->impl, add_const_offset_to_base, &params);
+ nir_foreach_block(function->impl, remap_inputs_with_vue_map,
&input_vue_map);
}
}
@@ -296,12 +296,12 @@ brw_nir_lower_inputs(nir_shader *nir,
/* This pass needs actual constants */
nir_opt_constant_folding(nir);
- nir_foreach_overload(nir, overload) {
- if (overload->impl) {
- nir_builder_init(&params.b, overload->impl);
- nir_foreach_block(overload->impl, add_const_offset_to_base, &params);
- nir_builder_init(&state.b, overload->impl);
- nir_foreach_block(overload->impl, remap_patch_urb_offsets, &state);
+ nir_foreach_function(nir, function) {
+ if (function->impl) {
+ nir_builder_init(&params.b, function->impl);
+ nir_foreach_block(function->impl, add_const_offset_to_base, &params);
+ nir_builder_init(&state.b, function->impl);
+ nir_foreach_block(function->impl, remap_patch_urb_offsets, &state);
}
}
break;
@@ -356,12 +356,12 @@ brw_nir_lower_outputs(nir_shader *nir,
/* This pass needs actual constants */
nir_opt_constant_folding(nir);
- nir_foreach_overload(nir, overload) {
- if (overload->impl) {
- nir_builder_init(&params.b, overload->impl);
- nir_foreach_block(overload->impl, add_const_offset_to_base, &params);
- nir_builder_init(&state.b, overload->impl);
- nir_foreach_block(overload->impl, remap_patch_urb_offsets, &state);
+ nir_foreach_function(nir, function) {
+ if (function->impl) {
+ nir_builder_init(&params.b, function->impl);
+ nir_foreach_block(function->impl, add_const_offset_to_base, &params);
+ nir_builder_init(&state.b, function->impl);
+ nir_foreach_block(function->impl, remap_patch_urb_offsets, &state);
}
}
break;
@@ -565,9 +565,9 @@ brw_postprocess_nir(nir_shader *nir,
if (unlikely(debug_enabled)) {
/* Re-index SSA defs so we print more sensible numbers. */
- nir_foreach_overload(nir, overload) {
- if (overload->impl)
- nir_index_ssa_defs(overload->impl);
+ nir_foreach_function(nir, function) {
+ if (function->impl)
+ nir_index_ssa_defs(function->impl);
}
fprintf(stderr, "NIR (SSA form) for %s shader:\n",
diff --git a/src/mesa/drivers/dri/i965/brw_nir_analyze_boolean_resolves.c b/src/mesa/drivers/dri/i965/brw_nir_analyze_boolean_resolves.c
index f4d23d8..56e15ef 100644
--- a/src/mesa/drivers/dri/i965/brw_nir_analyze_boolean_resolves.c
+++ b/src/mesa/drivers/dri/i965/brw_nir_analyze_boolean_resolves.c
@@ -260,7 +260,8 @@ analyze_boolean_resolves_impl(nir_function_impl *impl)
void
brw_nir_analyze_boolean_resolves(nir_shader *shader)
{
- nir_foreach_overload(shader, overload)
- if (overload->impl)
- analyze_boolean_resolves_impl(overload->impl);
+ nir_foreach_function(shader, function) {
+ if (function->impl)
+ analyze_boolean_resolves_impl(function->impl);
+ }
}
diff --git a/src/mesa/drivers/dri/i965/brw_nir_opt_peephole_ffma.c b/src/mesa/drivers/dri/i965/brw_nir_opt_peephole_ffma.c
index 5603129..5ff2cba 100644
--- a/src/mesa/drivers/dri/i965/brw_nir_opt_peephole_ffma.c
+++ b/src/mesa/drivers/dri/i965/brw_nir_opt_peephole_ffma.c
@@ -290,9 +290,9 @@ brw_nir_opt_peephole_ffma(nir_shader *shader)
{
bool progress = false;
- nir_foreach_overload(shader, overload) {
- if (overload->impl)
- progress |= brw_nir_opt_peephole_ffma_impl(overload->impl);
+ nir_foreach_function(shader, function) {
+ if (function->impl)
+ progress |= brw_nir_opt_peephole_ffma_impl(function->impl);
}
return progress;
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
index 2599628..ab71304 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
@@ -41,10 +41,10 @@ vec4_visitor::emit_nir_code()
nir_setup_system_values();
/* get the main function and emit it */
- nir_foreach_overload(nir, overload) {
- assert(strcmp(overload->function->name, "main") == 0);
- assert(overload->impl);
- nir_emit_impl(overload->impl);
+ nir_foreach_function(nir, function) {
+ assert(strcmp(function->name, "main") == 0);
+ assert(function->impl);
+ nir_emit_impl(function->impl);
}
}
@@ -107,10 +107,10 @@ vec4_visitor::nir_setup_system_values()
nir_system_values[i] = dst_reg();
}
- nir_foreach_overload(nir, overload) {
- assert(strcmp(overload->function->name, "main") == 0);
- assert(overload->impl);
- nir_foreach_block(overload->impl, setup_system_values_block, this);
+ nir_foreach_function(nir, function) {
+ assert(strcmp(function->name, "main") == 0);
+ assert(function->impl);
+ nir_foreach_block(function->impl, setup_system_values_block, this);
}
}
diff --git a/src/mesa/program/prog_to_nir.c b/src/mesa/program/prog_to_nir.c
index 14a339c..c5d4f27 100644
--- a/src/mesa/program/prog_to_nir.c
+++ b/src/mesa/program/prog_to_nir.c
@@ -1098,8 +1098,7 @@ prog_to_nir(const struct gl_program *prog,
}
nir_function *func = nir_function_create(s, "main");
- nir_function_overload *overload = nir_function_overload_create(func);
- nir_function_impl *impl = nir_function_impl_create(overload);
+ nir_function_impl *impl = nir_function_impl_create(func);
c->build.shader = s;
c->build.impl = impl;