summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
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/mesa/drivers
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/mesa/drivers')
-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
5 files changed, 48 insertions, 47 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
index 9728e2a2ad8..bb6ab53fbc5 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 eebd2a386b6..e031173036a 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 f4d23d81260..56e15ef935f 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 5603129bde7..5ff2cba0464 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 25996281131..ab713047a8c 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);
}
}