summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2018-07-26 13:17:42 -0700
committerIan Romanick <ian.d.romanick@intel.com>2018-08-02 11:20:02 -0700
commit63cc9f4b6bf5cf1add9e261c1e538fe008b9d51e (patch)
tree85f0c521340aeece6b2e8808835877c4d46b8c4b
parentb47bb3e5dd0b3a3c0124f4037e2b1742f5464ce4 (diff)
nir/opt_bool: Debug logging
-rw-r--r--src/compiler/nir/nir_opt_minimize_boolean.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_opt_minimize_boolean.c b/src/compiler/nir/nir_opt_minimize_boolean.c
index 1366f68d5cc..f7d337961f7 100644
--- a/src/compiler/nir/nir_opt_minimize_boolean.c
+++ b/src/compiler/nir/nir_opt_minimize_boolean.c
@@ -31,6 +31,36 @@
#define MAX_VARS 8
#define MAX_TERMS (1u << MAX_VARS)
+//#define DUMP_EXPRESSIONS
+#ifdef DUMP_EXPRESSIONS
+static void
+print_logic_expression(const nir_src *src,
+ const struct boolean_match_state *state)
+{
+ for (unsigned i = 0; i < state->num_variables; i++) {
+ if (state->variables[i].ssa == src->ssa) {
+ printf(" ");
+ nir_print_instr(src->ssa->parent_instr, stdout);
+ printf("\n");
+ return;
+ }
+ }
+
+ const struct nir_instr *const instr = src->ssa->parent_instr;
+
+ if (instr->type == nir_instr_type_alu) {
+ const struct nir_alu_instr *const alu_instr = nir_instr_as_alu(instr);
+
+ for (unsigned i = 0; i < nir_op_infos[alu_instr->op].num_inputs; i++)
+ print_logic_expression(&alu_instr->src[i].src, state);
+ }
+
+ printf(" ");
+ nir_print_instr(instr, stdout);
+ printf("\n");
+}
+#endif
+
struct implicant {
union {
uint8_t *term_ptr;