summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_print.c
diff options
context:
space:
mode:
authorCaio Marcelo de Oliveira Filho <[email protected]>2018-12-19 12:13:46 -0800
committerCaio Marcelo de Oliveira Filho <[email protected]>2019-01-02 10:09:04 -0800
commit7d6babf995d48d64e383c4180f9b660522958f86 (patch)
tree9f1b69d71c0431280b52b22710eecf643f03231a /src/compiler/nir/nir_print.c
parenta2596450ac7330c8965c819491038fb1ad454333 (diff)
nir: add a way to print the deref chain
Makes debugging easier when we care about the deref chain and not the deref instruction itself. To make it take a const pointer, constify some of the static functions in nir_print.c. Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_print.c')
-rw-r--r--src/compiler/nir/nir_print.c17
1 files changed, 13 insertions, 4 deletions
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);
+}