freedreno/ir3/group: report progress
authorRob Clark <robdclark@chromium.org>
Thu, 14 May 2020 23:01:29 +0000 (16:01 -0700)
committerMarge Bot <eric+marge@anholt.net>
Tue, 19 May 2020 16:06:17 +0000 (16:06 +0000)
Not iterative, but this will let IR3_PASS() macro know if there are any
changes to print.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5048>

src/freedreno/ir3/ir3.h
src/freedreno/ir3/ir3_group.c

index a33050956aa0211eec26a5f1395e7fdecea668c8..e40cd0b374c7357421818a4d2fb329f5084d71f7 100644 (file)
@@ -1201,7 +1201,7 @@ bool ir3_cf(struct ir3 *ir);
 bool ir3_cp(struct ir3 *ir, struct ir3_shader_variant *so);
 
 /* group neighbors and insert mov's to resolve conflicts: */
-void ir3_group(struct ir3 *ir);
+bool ir3_group(struct ir3 *ir);
 
 /* scheduling: */
 bool ir3_sched_add_deps(struct ir3 *ir);
index 4fc236708d701844ce82db2103a1261fef2f14b1..c9859197a1e73118b4d4d2d36cc82320995142c4 100644 (file)
@@ -139,45 +139,53 @@ restart:
        }
 }
 
-static void
+static bool
 instr_find_neighbors(struct ir3_instruction *instr)
 {
        struct ir3_instruction *src;
+       bool progress = false;
 
        if (ir3_instr_check_mark(instr))
-               return;
+               return false;
 
-       if (instr->opc == OPC_META_COLLECT)
+       if (instr->opc == OPC_META_COLLECT) {
                group_collect(instr);
+               progress = true;
+       }
 
        foreach_ssa_src (src, instr)
-               instr_find_neighbors(src);
+               progress |= instr_find_neighbors(src);
+
+       return progress;
 }
 
-static void
+static bool
 find_neighbors(struct ir3 *ir)
 {
+       bool progress = false;
        unsigned i;
 
        struct ir3_instruction *out;
        foreach_output (out, ir)
-               instr_find_neighbors(out);
+               progress |= instr_find_neighbors(out);
 
        foreach_block (block, &ir->block_list) {
                for (i = 0; i < block->keeps_count; i++) {
                        struct ir3_instruction *instr = block->keeps[i];
-                       instr_find_neighbors(instr);
+                       progress |= instr_find_neighbors(instr);
                }
 
                /* We also need to account for if-condition: */
                if (block->condition)
-                       instr_find_neighbors(block->condition);
+                       progress |= instr_find_neighbors(block->condition);
        }
+
+       return progress;
 }
 
-void
+bool
 ir3_group(struct ir3 *ir)
 {
        ir3_clear_mark(ir);
-       find_neighbors(ir);
+       return find_neighbors(ir);
 }