summaryrefslogtreecommitdiff
path: root/src/compiler/nir/nir_remove_dead_variables.c
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2018-03-22 16:41:18 -0700
committerJason Ekstrand <jason.ekstrand@intel.com>2018-06-22 20:15:58 -0700
commitc11833ab24dcba26de1b0a5805e35a5d6761514e (patch)
tree724a419f448204358d7dd732d51b724dea80bc17 /src/compiler/nir/nir_remove_dead_variables.c
parent58799b6a5b3e281365bce91fac2e54903fbd2c41 (diff)
nir,spirv: Rework function calls
This commit completely reworks function calls in NIR. Instead of having a set of variables for the parameters and return value, nir_call_instr now has simply has a number of sources which get mapped to load_param intrinsics inside the functions. It's up to the client API to build an ABI on top of that. In SPIR-V, out parameters are handled by passing the result of a deref through as an SSA value and storing to it. This virtue of this approach can be seen by how much it allows us to delete from core NIR. In particular, nir_inline_functions gets halved and goes from a fairly difficult pass to understand in detail to almost trivial. It also simplifies spirv_to_nir somewhat because NIR functions never were a good fit for SPIR-V. Unfortunately, there is no good way to do this without a mega-commit. Core NIR and SPIR-V have to be changed at the same time. This also requires changes to anv and radv because nir_inline_functions couldn't handle deref instructions before this change and can't work without them after this change. Acked-by: Rob Clark <robdclark@gmail.com> Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Acked-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Diffstat (limited to 'src/compiler/nir/nir_remove_dead_variables.c')
-rw-r--r--src/compiler/nir/nir_remove_dead_variables.c20
1 files changed, 1 insertions, 19 deletions
diff --git a/src/compiler/nir/nir_remove_dead_variables.c b/src/compiler/nir/nir_remove_dead_variables.c
index 89e544f9e1f..41dddd9387f 100644
--- a/src/compiler/nir/nir_remove_dead_variables.c
+++ b/src/compiler/nir/nir_remove_dead_variables.c
@@ -52,7 +52,7 @@ deref_used_for_not_store(nir_deref_instr *deref)
default:
/* If it's used by any other instruction type (most likely a texture
- * instruction), consider it used.
+ * or call instruction), consider it used.
*/
return true;
}
@@ -114,20 +114,6 @@ add_var_use_intrinsic(nir_intrinsic_instr *instr, struct set *live,
}
static void
-add_var_use_call(nir_call_instr *instr, struct set *live)
-{
- if (instr->return_deref != NULL) {
- nir_variable *var = instr->return_deref->var;
- _mesa_set_add(live, var);
- }
-
- for (unsigned i = 0; i < instr->num_params; i++) {
- nir_variable *var = instr->params[i]->var;
- _mesa_set_add(live, var);
- }
-}
-
-static void
add_var_use_tex(nir_tex_instr *instr, struct set *live)
{
if (instr->texture != NULL) {
@@ -158,10 +144,6 @@ add_var_use_shader(nir_shader *shader, struct set *live, nir_variable_mode modes
modes);
break;
- case nir_instr_type_call:
- add_var_use_call(nir_instr_as_call(instr), live);
- break;
-
case nir_instr_type_tex:
add_var_use_tex(nir_instr_as_tex(instr), live);
break;