aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler/spirv/vtn_cfg.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-06-28 02:50:33 -0700
committerJason Ekstrand <[email protected]>2017-07-18 09:43:12 -0700
commit182950ceaf9034e0f6f6e641784af2641d8d178f (patch)
tree879a69a5220c2f211912a3ba74e7d00583f1929e /src/compiler/spirv/vtn_cfg.c
parent868456fbf7418f318ea965c2ce151781dbe42e67 (diff)
nir/spirv: Add a helper for pushing SSA values
Reviewed-by: Iago Toral Quiroga <[email protected]>
Diffstat (limited to 'src/compiler/spirv/vtn_cfg.c')
-rw-r--r--src/compiler/spirv/vtn_cfg.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/compiler/spirv/vtn_cfg.c b/src/compiler/spirv/vtn_cfg.c
index df54b3c4851..c81a62d7a8e 100644
--- a/src/compiler/spirv/vtn_cfg.c
+++ b/src/compiler/spirv/vtn_cfg.c
@@ -112,12 +112,12 @@ vtn_cfg_handle_prepass_instruction(struct vtn_builder *b, SpvOp opcode,
val->pointer = vtn_pointer_for_variable(b, vtn_var, type);
} else {
/* We're a regular SSA value. */
- struct vtn_value *val = vtn_push_value(b, w[2], vtn_value_type_ssa);
+ struct vtn_ssa_value *param_ssa =
+ vtn_local_load(b, nir_deref_var_create(b, param));
+ struct vtn_value *val = vtn_push_ssa(b, w[2], type, param_ssa);
/* Name the parameter so it shows up nicely in NIR */
param->name = ralloc_strdup(param, val->name);
-
- val->ssa = vtn_local_load(b, nir_deref_var_create(b, param));
}
break;
}
@@ -504,14 +504,13 @@ vtn_handle_phis_first_pass(struct vtn_builder *b, SpvOp opcode,
* algorithm all over again. It's easier if we just let
* lower_vars_to_ssa do that for us instead of repeating it here.
*/
- struct vtn_value *val = vtn_push_value(b, w[2], vtn_value_type_ssa);
-
struct vtn_type *type = vtn_value(b, w[1], vtn_value_type_type)->type;
nir_variable *phi_var =
nir_local_variable_create(b->nb.impl, type->type, "phi");
_mesa_hash_table_insert(b->phi_table, w, phi_var);
- val->ssa = vtn_local_load(b, nir_deref_var_create(b, phi_var));
+ vtn_push_ssa(b, w[2], type,
+ vtn_local_load(b, nir_deref_var_create(b, phi_var)));
return true;
}