freedreno/ir3: "boost" the depth of if/else condition
authorRob Clark <robdclark@gmail.com>
Sun, 4 Feb 2018 17:52:24 +0000 (12:52 -0500)
committerRob Clark <robdclark@gmail.com>
Sat, 10 Feb 2018 19:54:58 +0000 (14:54 -0500)
Account for the move to predicate register, to try to avoid needing to
insert extra NOPs later.

Signed-off-by: Rob Clark <robdclark@gmail.com>
src/gallium/drivers/freedreno/ir3/ir3_depth.c

index b58bf8ff3aee74446fe71667f3fc564c55e9606c..270d53dbed7b4fa5122cc6f61a2a6b3026693034 100644 (file)
@@ -133,7 +133,7 @@ ir3_insert_by_depth(struct ir3_instruction *instr, struct list_head *list)
 }
 
 static void
-ir3_instr_depth(struct ir3_instruction *instr)
+ir3_instr_depth(struct ir3_instruction *instr, unsigned boost)
 {
        struct ir3_instruction *src;
 
@@ -147,13 +147,14 @@ ir3_instr_depth(struct ir3_instruction *instr)
                unsigned sd;
 
                /* visit child to compute it's depth: */
-               ir3_instr_depth(src);
+               ir3_instr_depth(src, boost);
 
                /* for array writes, no need to delay on previous write: */
                if (i == 0)
                        continue;
 
                sd = ir3_delayslots(src, instr, i) + src->depth;
+               sd += boost;
 
                instr->depth = MAX2(instr->depth, sd);
        }
@@ -189,15 +190,15 @@ ir3_depth(struct ir3 *ir)
        ir3_clear_mark(ir);
        for (i = 0; i < ir->noutputs; i++)
                if (ir->outputs[i])
-                       ir3_instr_depth(ir->outputs[i]);
+                       ir3_instr_depth(ir->outputs[i], 0);
 
        list_for_each_entry (struct ir3_block, block, &ir->block_list, node) {
                for (i = 0; i < block->keeps_count; i++)
-                       ir3_instr_depth(block->keeps[i]);
+                       ir3_instr_depth(block->keeps[i], 0);
 
                /* We also need to account for if-condition: */
                if (block->condition)
-                       ir3_instr_depth(block->condition);
+                       ir3_instr_depth(block->condition, 6);
        }
 
        /* mark un-used instructions: */