Module: Mesa
Branch: main
Commit: 019e5cbd399d7c2e5fbbe9476d83acf27b489d82
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=019e5cbd399d7c2e5fbbe9476d83acf27b489d82

Author: Christian Gmeiner <[email protected]>
Date:   Wed Jul 19 13:55:13 2023 +0200

nir/print: print instr pass_flags

>From time to time it can be helpful to "see" the pass_flags.

Signed-off-by: Christian Gmeiner <[email protected]>
Reviewed-by: Rhys Perry <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24234>

---

 src/compiler/nir/nir.c       | 2 ++
 src/compiler/nir/nir.h       | 1 +
 src/compiler/nir/nir_print.c | 3 +++
 3 files changed, 6 insertions(+)

diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c
index 7e2ff889c9a..7214c550854 100644
--- a/src/compiler/nir/nir.c
+++ b/src/compiler/nir/nir.c
@@ -89,6 +89,8 @@ static const struct debug_named_value nir_debug_control[] = {
      "Do not print const value near each use of const SSA variable" },
    { "print_internal", NIR_DEBUG_PRINT_INTERNAL,
      "Print shaders even if they are marked as internal" },
+   { "print_pass_flags", NIR_DEBUG_PRINT_PASS_FLAGS,
+     "Print pass_flags for every instruction when pass_flags are non-zero" },
    DEBUG_NAMED_VALUE_END
 };
 
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index a05ae3fc26d..fbf74e6798a 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -89,6 +89,7 @@ extern bool nir_debug_print_shader[MESA_SHADER_KERNEL + 1];
 #define NIR_DEBUG_PRINT_KS               (1u << 19)
 #define NIR_DEBUG_PRINT_NO_INLINE_CONSTS (1u << 20)
 #define NIR_DEBUG_PRINT_INTERNAL         (1u << 21)
+#define NIR_DEBUG_PRINT_PASS_FLAGS       (1u << 22)
 
 #define NIR_DEBUG_PRINT (NIR_DEBUG_PRINT_VS  | \
                          NIR_DEBUG_PRINT_TCS | \
diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c
index bbaa45fa1c3..7c2bc3e4fd9 100644
--- a/src/compiler/nir/nir_print.c
+++ b/src/compiler/nir/nir_print.c
@@ -1829,6 +1829,9 @@ print_instr(const nir_instr *instr, print_state *state, 
unsigned tabs)
       unreachable("Invalid instruction type");
       break;
    }
+
+   if (NIR_DEBUG(PRINT_PASS_FLAGS) && instr->pass_flags)
+      fprintf(fp, " (pass_flags: 0x%x)", instr->pass_flags);
 }
 
 static bool

Reply via email to