st,zink,sfn: Use nir_foreach_def instead of nir_foreach_dest
authorFaith Ekstrand <faith.ekstrand@collabora.com>
Sun, 13 Aug 2023 00:18:51 +0000 (19:18 -0500)
committerMarge Bot <emma+marge@anholt.net>
Sun, 13 Aug 2023 17:12:52 +0000 (17:12 +0000)
It's basically the same code in all three.

Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24658>

src/gallium/drivers/r600/sfn/sfn_instr_alu.cpp
src/gallium/drivers/zink/zink_compiler.c
src/mesa/state_tracker/st_glsl_to_nir.cpp

index d5e00ea..eda5108 100644 (file)
@@ -1471,9 +1471,9 @@ check_64_bit_op_src(nir_src *src, void *state)
 }
 
 static bool
-check_64_bit_op_dest(nir_dest *dest, void *state)
+check_64_bit_op_def(nir_def *def, void *state)
 {
-   if (nir_dest_bit_size(*dest) == 64) {
+   if (def->bit_size == 64) {
       *(bool *)state = true;
       return false;
    }
@@ -1486,7 +1486,7 @@ AluInstr::from_nir(nir_alu_instr *alu, Shader& shader)
    bool is_64bit_op = false;
    nir_foreach_src(&alu->instr, check_64_bit_op_src, &is_64bit_op);
    if (!is_64bit_op)
-      nir_foreach_dest(&alu->instr, check_64_bit_op_dest, &is_64bit_op);
+      nir_foreach_def(&alu->instr, check_64_bit_op_def, &is_64bit_op);
 
    if (is_64bit_op) {
       switch (alu->op) {
index e77751c..0732d8e 100644 (file)
@@ -1420,10 +1420,10 @@ zink_tgsi_to_nir(struct pipe_screen *screen, const struct tgsi_token *tokens)
 
 
 static bool
-dest_is_64bit(nir_dest *dest, void *state)
+def_is_64bit(nir_def *def, void *state)
 {
    bool *lower = (bool *)state;
-   if (dest && (nir_dest_bit_size(*dest) == 64)) {
+   if (def && (def->bit_size == 64)) {
       *lower = true;
       return false;
    }
@@ -1449,7 +1449,7 @@ filter_64_bit_instr(const nir_instr *const_instr, UNUSED const void *data)
     * doesn't have const variants, so do the ugly const_cast here. */
    nir_instr *instr = (nir_instr *)const_instr;
 
-   nir_foreach_dest(instr, dest_is_64bit, &lower);
+   nir_foreach_def(instr, def_is_64bit, &lower);
    if (lower)
       return true;
    nir_foreach_src(instr, src_is_64bit, &lower);
index 3af38da..a83a0f7 100644 (file)
@@ -231,10 +231,10 @@ st_nir_assign_uniform_locations(struct gl_context *ctx,
 }
 
 static bool
-dest_is_64bit(nir_dest *dest, void *state)
+def_is_64bit(nir_def *def, void *state)
 {
    bool *lower = (bool *)state;
-   if (dest && (nir_dest_bit_size(*dest) == 64)) {
+   if (def && (def->bit_size == 64)) {
       *lower = true;
       return false;
    }
@@ -260,7 +260,7 @@ filter_64_bit_instr(const nir_instr *const_instr, UNUSED const void *data)
     * doesn't have const variants, so do the ugly const_cast here. */
    nir_instr *instr = const_cast<nir_instr *>(const_instr);
 
-   nir_foreach_dest(instr, dest_is_64bit, &lower);
+   nir_foreach_def(instr, def_is_64bit, &lower);
    if (lower)
       return true;
    nir_foreach_src(instr, src_is_64bit, &lower);