From 0057dfd673c62741bd9eba34759f3539940068a2 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Thu, 13 Nov 2014 21:19:28 -0800 Subject: nir: Add an expression matching framework This framework provides a simple way to do simple search-and-replace operations on NIR code. The nir_search.h header provides four simple data structures for representing expressions: nir_value and four subtypes: nir_variable, nir_constant, and nir_expression. An expression tree can then be represented by nesting these data structures as needed. The nir_replace_instr function takes an instruction, an expression, and a value; if the instruction matches the expression, it is replaced with a new chain of instructions to generate the given replacement value. The framework keeps track of swizzles on sources and automatically generates the currect swizzles for the replacement value. Reviewed-by: Connor Abbott --- src/glsl/Makefile.sources | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/glsl/Makefile.sources') diff --git a/src/glsl/Makefile.sources b/src/glsl/Makefile.sources index 12c1d83..201330d 100644 --- a/src/glsl/Makefile.sources +++ b/src/glsl/Makefile.sources @@ -41,6 +41,8 @@ NIR_FILES = \ $(GLSL_SRCDIR)/nir/nir_opt_peephole_select.c \ $(GLSL_SRCDIR)/nir/nir_print.c \ $(GLSL_SRCDIR)/nir/nir_remove_dead_variables.c \ + $(GLSL_SRCDIR)/nir/nir_search.c \ + $(GLSL_SRCDIR)/nir/nir_search.h \ $(GLSL_SRCDIR)/nir/nir_split_var_copies.c \ $(GLSL_SRCDIR)/nir/nir_to_ssa.c \ $(GLSL_SRCDIR)/nir/nir_validate.c \ -- cgit v1.1