summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_inline_functions.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-07-15 17:17:40 -0700
committerJason Ekstrand <[email protected]>2016-12-05 15:40:09 -0800
commit50e0b0bee3fb97089cf9913af7a0c980dfce6dce (patch)
tree943f3e970522698601dfc8871797d06cc50c8551 /src/compiler/nir/nir_inline_functions.c
parent2f19c19b5de66c4966fc5f5926efe5d435e505db (diff)
nir: Delete most of the constant_initializer support
Constant initializers have been a constant (ha!) pain for quite some time. While they're useful from a language perspective, people writing passes or backends really don't want deal with them most of the time. This commit removes most of the constant initializer support from NIR. It is expected that you call nir_lower_constant_initializers VERY EARLY to ensure that they're gone before you do anything interesting. Reviewed-by: Iago Toral Quiroga <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_inline_functions.c')
-rw-r--r--src/compiler/nir/nir_inline_functions.c42
1 files changed, 2 insertions, 40 deletions
diff --git a/src/compiler/nir/nir_inline_functions.c b/src/compiler/nir/nir_inline_functions.c
index cf31e144608..c36748d6cf5 100644
--- a/src/compiler/nir/nir_inline_functions.c
+++ b/src/compiler/nir/nir_inline_functions.c
@@ -25,20 +25,6 @@
#include "nir_builder.h"
#include "nir_control_flow.h"
-static bool
-deref_apply_constant_initializer(nir_deref_var *deref, void *state)
-{
- struct nir_builder *b = state;
-
- nir_load_const_instr *initializer =
- nir_deref_get_const_initializer_load(b->shader, deref);
- nir_builder_instr_insert(b, &initializer->instr);
-
- nir_store_deref_var(b, deref, &initializer->def, 0xf);
-
- return true;
-}
-
static bool inline_function_impl(nir_function_impl *impl, struct set *inlined);
static void
@@ -188,35 +174,11 @@ inline_functions_block(nir_block *block, nir_builder *b,
/* Add copies of all in parameters */
assert(call->num_params == callee_copy->num_params);
- b->cursor = nir_before_instr(&call->instr);
-
- /* Before we insert the copy of the function, we need to lower away
- * constant initializers on local variables. This is because constant
- * initializers happen (effectively) at the top of the function and,
- * since these are about to become locals of the calling function,
- * initialization will happen at the top of the caller rather than at
- * the top of the callee. This isn't usually a problem, but if we are
- * being inlined inside of a loop, it can result in the variable not
- * getting re-initialized properly for all loop iterations.
- */
- nir_foreach_variable(local, &callee_copy->locals) {
- if (!local->constant_initializer)
- continue;
-
- nir_deref_var deref;
- deref.deref.deref_type = nir_deref_type_var,
- deref.deref.child = NULL;
- deref.deref.type = local->type,
- deref.var = local;
-
- nir_deref_foreach_leaf(&deref, deref_apply_constant_initializer, b);
-
- local->constant_initializer = NULL;
- }
-
exec_list_append(&b->impl->locals, &callee_copy->locals);
exec_list_append(&b->impl->registers, &callee_copy->registers);
+ b->cursor = nir_before_instr(&call->instr);
+
/* We now need to tie the two functions together using the
* parameters. There are two ways we do this: One is to turn the
* parameter into a local variable and do a shadow-copy. The other