summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/compiler/nir/nir.h1
-rw-r--r--src/compiler/nir/nir_print.c17
2 files changed, 14 insertions, 4 deletions
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 39041ec084b..c6aeba96ba4 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -2725,6 +2725,7 @@ void nir_index_blocks(nir_function_impl *impl);
void nir_print_shader(nir_shader *shader, FILE *fp);
void nir_print_shader_annotated(nir_shader *shader, FILE *fp, struct hash_table *errors);
void nir_print_instr(const nir_instr *instr, FILE *fp);
+void nir_print_deref(const nir_deref_instr *deref, FILE *fp);
nir_shader *nir_shader_clone(void *mem_ctx, const nir_shader *s);
nir_function_impl *nir_function_impl_clone(const nir_function_impl *fi);
diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c
index 47932e99639..5f1b547ea37 100644
--- a/src/compiler/nir/nir_print.c
+++ b/src/compiler/nir/nir_print.c
@@ -123,10 +123,10 @@ print_ssa_use(nir_ssa_def *def, print_state *state)
fprintf(fp, "ssa_%u", def->index);
}
-static void print_src(nir_src *src, print_state *state);
+static void print_src(const nir_src *src, print_state *state);
static void
-print_reg_src(nir_reg_src *src, print_state *state)
+print_reg_src(const nir_reg_src *src, print_state *state)
{
FILE *fp = state->fp;
print_register(src->reg, state);
@@ -156,7 +156,7 @@ print_reg_dest(nir_reg_dest *dest, print_state *state)
}
static void
-print_src(nir_src *src, print_state *state)
+print_src(const nir_src *src, print_state *state)
{
if (src->is_ssa)
print_ssa_use(src->ssa, state);
@@ -577,7 +577,7 @@ print_var_decl(nir_variable *var, print_state *state)
}
static void
-print_deref_link(nir_deref_instr *instr, bool whole_chain, print_state *state)
+print_deref_link(const nir_deref_instr *instr, bool whole_chain, print_state *state)
{
FILE *fp = state->fp;
@@ -1386,3 +1386,12 @@ nir_print_instr(const nir_instr *instr, FILE *fp)
print_instr(instr, &state, 0);
}
+
+void
+nir_print_deref(const nir_deref_instr *deref, FILE *fp)
+{
+ print_state state = {
+ .fp = fp,
+ };
+ print_deref_link(deref, true, &state);
+}