From 19a4662a540a8c940310a75f19bc8cd75be651e0 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Wed, 14 Mar 2018 21:45:38 -0700 Subject: nir: Add a deref instruction type This commit adds a new instruction type to NIR for handling derefs. Nothing uses it yet but this adds the data structure as well as all of the code to validate, print, clone, and [de]serialize them. Reviewed-by: Caio Marcelo de Oliveira Filho Acked-by: Rob Clark Acked-by: Bas Nieuwenhuizen Acked-by: Dave Airlie Reviewed-by: Kenneth Graunke --- src/compiler/nir/nir_opt_dce.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/compiler/nir/nir_opt_dce.c') diff --git a/src/compiler/nir/nir_opt_dce.c b/src/compiler/nir/nir_opt_dce.c index 570e43000c0..c9b338862e6 100644 --- a/src/compiler/nir/nir_opt_dce.c +++ b/src/compiler/nir/nir_opt_dce.c @@ -52,6 +52,7 @@ static void init_instr(nir_instr *instr, nir_instr_worklist *worklist) { nir_alu_instr *alu_instr; + nir_deref_instr *deref_instr; nir_intrinsic_instr *intrin_instr; nir_tex_instr *tex_instr; @@ -73,6 +74,12 @@ init_instr(nir_instr *instr, nir_instr_worklist *worklist) mark_and_push(worklist, instr); break; + case nir_instr_type_deref: + deref_instr = nir_instr_as_deref(instr); + if (!deref_instr->dest.is_ssa) + mark_and_push(worklist, instr); + break; + case nir_instr_type_intrinsic: intrin_instr = nir_instr_as_intrinsic(instr); if (nir_intrinsic_infos[intrin_instr->intrinsic].flags & -- cgit v1.2.3