freedreno/ir3: assert that only single address
authorRob Clark <robdclark@chromium.org>
Mon, 2 Sep 2019 17:08:37 +0000 (10:08 -0700)
committerRob Clark <robdclark@gmail.com>
Fri, 6 Sep 2019 00:13:44 +0000 (00:13 +0000)
An instruction can reference only a single address register value.
Add an assert to catch bugs.

Also, address value should also be local to the same block as the
instruction.

(The one spot where changing the instruction address is actually legit
needs to clear the address first.)

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/freedreno/ir3/ir3.c
src/freedreno/ir3/ir3_sched.c

index 5c049a5..feec723 100644 (file)
@@ -1041,6 +1041,10 @@ ir3_instr_set_address(struct ir3_instruction *instr,
 {
        if (instr->address != addr) {
                struct ir3 *ir = instr->block->shader;
+
+               debug_assert(!instr->address);
+               debug_assert(instr->block == addr->block);
+
                instr->address = addr;
                array_insert(ir, ir->indirects, instr);
        }
index 9a544a8..96897f6 100644 (file)
@@ -709,6 +709,7 @@ split_addr(struct ir3_sched_ctx *ctx)
                                /* original addr is scheduled, but new one isn't: */
                                new_addr->flags &= ~IR3_INSTR_MARK;
                        }
+                       indirect->address = NULL;
                        ir3_instr_set_address(indirect, new_addr);
                }
        }