summaryrefslogtreecommitdiffstats
path: root/src/gallium
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/gallium
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/gallium')
-rw-r--r--src/gallium/auxiliary/nir/tgsi_to_nir.c3
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c8
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3_nir_lower_if_else.c6
-rw-r--r--src/gallium/drivers/vc4/vc4_nir_lower_blend.c8
-rw-r--r--src/gallium/drivers/vc4/vc4_nir_lower_io.c6
-rw-r--r--src/gallium/drivers/vc4/vc4_nir_lower_txf_ms.c6
-rw-r--r--src/gallium/drivers/vc4/vc4_program.c14
7 files changed, 25 insertions, 26 deletions
diff --git a/src/gallium/auxiliary/nir/tgsi_to_nir.c b/src/gallium/auxiliary/nir/tgsi_to_nir.c
index 2cb723c5793..01426e86e61 100644
--- a/src/gallium/auxiliary/nir/tgsi_to_nir.c
+++ b/src/gallium/auxiliary/nir/tgsi_to_nir.c
@@ -1972,8 +1972,7 @@ tgsi_to_nir(const void *tgsi_tokens,
options);
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);
nir_builder_init(&c->build, impl);
c->build.cursor = nir_after_cf_list(&impl->body);
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
index 44c74b84e34..224f7806b3c 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
@@ -2351,10 +2351,10 @@ emit_instructions(struct ir3_compile *ctx)
nir_function_impl *fxn = NULL;
/* Find the main function: */
- nir_foreach_overload(ctx->s, overload) {
- compile_assert(ctx, strcmp(overload->function->name, "main") == 0);
- compile_assert(ctx, overload->impl);
- fxn = overload->impl;
+ nir_foreach_function(ctx->s, function) {
+ compile_assert(ctx, strcmp(function->name, "main") == 0);
+ compile_assert(ctx, function->impl);
+ fxn = function->impl;
break;
}
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_nir_lower_if_else.c b/src/gallium/drivers/freedreno/ir3/ir3_nir_lower_if_else.c
index 4ec0e2bd2ac..6eee2ebbab6 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_nir_lower_if_else.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_nir_lower_if_else.c
@@ -328,9 +328,9 @@ ir3_nir_lower_if_else(nir_shader *shader)
{
bool progress = false;
- nir_foreach_overload(shader, overload) {
- if (overload->impl)
- progress |= lower_if_else_impl(overload->impl);
+ nir_foreach_function(shader, function) {
+ if (function->impl)
+ progress |= lower_if_else_impl(function->impl);
}
return progress;
diff --git a/src/gallium/drivers/vc4/vc4_nir_lower_blend.c b/src/gallium/drivers/vc4/vc4_nir_lower_blend.c
index a1ec4c70918..6d9a624c9b0 100644
--- a/src/gallium/drivers/vc4/vc4_nir_lower_blend.c
+++ b/src/gallium/drivers/vc4/vc4_nir_lower_blend.c
@@ -712,12 +712,12 @@ vc4_nir_lower_blend_block(nir_block *block, void *state)
void
vc4_nir_lower_blend(struct vc4_compile *c)
{
- nir_foreach_overload(c->s, overload) {
- if (overload->impl) {
- nir_foreach_block(overload->impl,
+ nir_foreach_function(c->s, function) {
+ if (function->impl) {
+ nir_foreach_block(function->impl,
vc4_nir_lower_blend_block, c);
- nir_metadata_preserve(overload->impl,
+ nir_metadata_preserve(function->impl,
nir_metadata_block_index |
nir_metadata_dominance);
}
diff --git a/src/gallium/drivers/vc4/vc4_nir_lower_io.c b/src/gallium/drivers/vc4/vc4_nir_lower_io.c
index 465b28840b4..bf6631e944e 100644
--- a/src/gallium/drivers/vc4/vc4_nir_lower_io.c
+++ b/src/gallium/drivers/vc4/vc4_nir_lower_io.c
@@ -467,8 +467,8 @@ vc4_nir_lower_io_impl(struct vc4_compile *c, nir_function_impl *impl)
void
vc4_nir_lower_io(struct vc4_compile *c)
{
- nir_foreach_overload(c->s, overload) {
- if (overload->impl)
- vc4_nir_lower_io_impl(c, overload->impl);
+ nir_foreach_function(c->s, function) {
+ if (function->impl)
+ vc4_nir_lower_io_impl(c, function->impl);
}
}
diff --git a/src/gallium/drivers/vc4/vc4_nir_lower_txf_ms.c b/src/gallium/drivers/vc4/vc4_nir_lower_txf_ms.c
index 54873e6186a..2490819c297 100644
--- a/src/gallium/drivers/vc4/vc4_nir_lower_txf_ms.c
+++ b/src/gallium/drivers/vc4/vc4_nir_lower_txf_ms.c
@@ -165,8 +165,8 @@ vc4_nir_lower_txf_ms_impl(struct vc4_compile *c, nir_function_impl *impl)
void
vc4_nir_lower_txf_ms(struct vc4_compile *c)
{
- nir_foreach_overload(c->s, overload) {
- if (overload->impl)
- vc4_nir_lower_txf_ms_impl(c, overload->impl);
+ nir_foreach_function(c->s, function) {
+ if (function->impl)
+ vc4_nir_lower_txf_ms_impl(c, function->impl);
}
}
diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c
index d11c4e3b7ca..da0d21111a0 100644
--- a/src/gallium/drivers/vc4/vc4_program.c
+++ b/src/gallium/drivers/vc4/vc4_program.c
@@ -1705,10 +1705,10 @@ nir_to_qir(struct vc4_compile *c)
ntq_setup_registers(c, &c->s->registers);
/* Find the main function and emit the body. */
- nir_foreach_overload(c->s, overload) {
- assert(strcmp(overload->function->name, "main") == 0);
- assert(overload->impl);
- ntq_emit_impl(c, overload->impl);
+ nir_foreach_function(c->s, function) {
+ assert(strcmp(function->name, "main") == 0);
+ assert(function->impl);
+ ntq_emit_impl(c, function->impl);
}
}
@@ -1735,10 +1735,10 @@ static int
count_nir_instrs(nir_shader *nir)
{
int count = 0;
- nir_foreach_overload(nir, overload) {
- if (!overload->impl)
+ nir_foreach_function(nir, function) {
+ if (!function->impl)
continue;
- nir_foreach_block(overload->impl, count_nir_instrs_in_block, &count);
+ nir_foreach_block(function->impl, count_nir_instrs_in_block, &count);
}
return count;
}