nir: Remove reg-only dest manipulation
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Tue, 1 Aug 2023 15:45:49 +0000 (11:45 -0400)
committerMarge Bot <emma+marge@anholt.net>
Thu, 3 Aug 2023 22:40:28 +0000 (22:40 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24432>

src/compiler/nir/nir.c
src/compiler/nir/nir.h

index d820151..73b049f 100644 (file)
@@ -503,16 +503,6 @@ void nir_src_copy(nir_src *dest, const nir_src *src, nir_instr *instr)
    src_copy(dest, src, instr ? gc_get_context(instr) : NULL);
 }
 
-void nir_dest_copy(nir_dest *dest, const nir_dest *src, nir_instr *instr)
-{
-   /* Copying an SSA definition makes no sense whatsoever. */
-   assert(!src->is_ssa);
-
-   dest->is_ssa = false;
-
-   dest->reg.reg = src->reg.reg;
-}
-
 void
 nir_alu_src_copy(nir_alu_src *dest, const nir_alu_src *src,
                  nir_alu_instr *instr)
@@ -524,14 +514,6 @@ nir_alu_src_copy(nir_alu_src *dest, const nir_alu_src *src,
       dest->swizzle[i] = src->swizzle[i];
 }
 
-void
-nir_alu_dest_copy(nir_alu_dest *dest, const nir_alu_dest *src,
-                  nir_alu_instr *instr)
-{
-   nir_dest_copy(&dest->dest, &src->dest, &instr->instr);
-   dest->write_mask = src->write_mask;
-}
-
 bool
 nir_alu_src_is_trivial_ssa(const nir_alu_instr *alu, unsigned srcn)
 {
@@ -1660,25 +1642,6 @@ nir_if_rewrite_condition(nir_if *if_stmt, nir_src new_src)
 }
 
 void
-nir_instr_rewrite_dest(nir_instr *instr, nir_dest *dest, nir_dest new_dest)
-{
-   if (dest->is_ssa) {
-      /* We can only overwrite an SSA destination if it has no uses. */
-      assert(nir_ssa_def_is_unused(&dest->ssa));
-   } else {
-      list_del(&dest->reg.def_link);
-   }
-
-   /* We can't re-write with an SSA def */
-   assert(!new_dest.is_ssa);
-
-   nir_dest_copy(dest, &new_dest, instr);
-
-   dest->reg.parent_instr = instr;
-   list_addtail(&dest->reg.def_link, &new_dest.reg.reg->defs);
-}
-
-void
 nir_ssa_def_init(nir_instr *instr, nir_ssa_def *def,
                  unsigned num_components,
                  unsigned bit_size)
index c93a1f1..81036ed 100644 (file)
@@ -1176,7 +1176,6 @@ nir_is_sequential_comp_swizzle(uint8_t *swiz, unsigned nr_comp)
 }
 
 void nir_src_copy(nir_src *dest, const nir_src *src, nir_instr *instr);
-void nir_dest_copy(nir_dest *dest, const nir_dest *src, nir_instr *instr);
 
 typedef struct {
    /** Base source */
@@ -1557,8 +1556,6 @@ typedef struct nir_alu_instr {
 
 void nir_alu_src_copy(nir_alu_src *dest, const nir_alu_src *src,
                       nir_alu_instr *instr);
-void nir_alu_dest_copy(nir_alu_dest *dest, const nir_alu_dest *src,
-                       nir_alu_instr *instr);
 
 bool nir_alu_instr_is_copy(nir_alu_instr *instr);
 
@@ -4521,8 +4518,6 @@ void nir_instr_rewrite_src(nir_instr *instr, nir_src *src, nir_src new_src);
 void nir_instr_move_src(nir_instr *dest_instr, nir_src *dest, nir_src *src);
 
 void nir_if_rewrite_condition(nir_if *if_stmt, nir_src new_src);
-void nir_instr_rewrite_dest(nir_instr *instr, nir_dest *dest,
-                            nir_dest new_dest);
 
 void nir_ssa_dest_init(nir_instr *instr, nir_dest *dest,
                        unsigned num_components, unsigned bit_size);