summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_split_var_copies.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-12-24 09:42:34 -0800
committerJason Ekstrand <[email protected]>2016-12-30 12:38:04 -0800
commit134a5ad31c8d39219f241f7a7cad246a6864c74b (patch)
treef31ba3874da61a7d6a75fd13c9dc89f42339a873 /src/compiler/nir/nir_split_var_copies.c
parent832dddcf91f168ab057cb5c7f6914b24ae6b864c (diff)
nir: Make nir_copy_deref follow the "clone" pattern
We rename it to nir_deref_clone, re-order the sources to match the other clone functions, and expose nir_deref_var_clone. This past part, in particular, lets us get rid of quite a few lines since we no longer have to call nir_copy_deref and wrap it in deref_as_var. Reviewed-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_split_var_copies.c')
-rw-r--r--src/compiler/nir/nir_split_var_copies.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/compiler/nir/nir_split_var_copies.c b/src/compiler/nir/nir_split_var_copies.c
index 63a7611b914..cfebb0bb948 100644
--- a/src/compiler/nir/nir_split_var_copies.c
+++ b/src/compiler/nir/nir_split_var_copies.c
@@ -82,7 +82,7 @@ struct split_var_copies_state {
*/
static void
split_var_copy_instr(nir_intrinsic_instr *old_copy,
- nir_deref *dest_head, nir_deref *src_head,
+ nir_deref_var *dest_head, nir_deref_var *src_head,
nir_deref *dest_tail, nir_deref *src_tail,
struct split_var_copies_state *state)
{
@@ -182,11 +182,8 @@ split_var_copy_instr(nir_intrinsic_instr *old_copy,
* belongs to the copy instruction and b) the deref chains may
* have some of the same links due to the way we constructed them
*/
- nir_deref *src = nir_copy_deref(new_copy, src_head);
- nir_deref *dest = nir_copy_deref(new_copy, dest_head);
-
- new_copy->variables[0] = nir_deref_as_var(dest);
- new_copy->variables[1] = nir_deref_as_var(src);
+ new_copy->variables[0] = nir_deref_var_clone(dest_head, new_copy);
+ new_copy->variables[1] = nir_deref_var_clone(src_head, new_copy);
/* Emit the copy instruction after the old instruction. We'll
* remove the old one later.
@@ -216,10 +213,10 @@ split_var_copies_block(nir_block *block, struct split_var_copies_state *state)
if (intrinsic->intrinsic != nir_intrinsic_copy_var)
continue;
- nir_deref *dest_head = &intrinsic->variables[0]->deref;
- nir_deref *src_head = &intrinsic->variables[1]->deref;
- nir_deref *dest_tail = nir_deref_tail(dest_head);
- nir_deref *src_tail = nir_deref_tail(src_head);
+ nir_deref_var *dest_head = intrinsic->variables[0];
+ nir_deref_var *src_head = intrinsic->variables[1];
+ nir_deref *dest_tail = nir_deref_tail(&dest_head->deref);
+ nir_deref *src_tail = nir_deref_tail(&src_head->deref);
switch (glsl_get_base_type(src_tail->type)) {
case GLSL_TYPE_ARRAY: