aboutsummaryrefslogtreecommitdiffstats
path: root/src/panfrost/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/panfrost/util')
-rw-r--r--src/panfrost/util/pan_ir.c22
-rw-r--r--src/panfrost/util/pan_ir.h4
-rw-r--r--src/panfrost/util/pan_liveness.c2
3 files changed, 25 insertions, 3 deletions
diff --git a/src/panfrost/util/pan_ir.c b/src/panfrost/util/pan_ir.c
index 95f8e6b5326..fbe8f66bff4 100644
--- a/src/panfrost/util/pan_ir.c
+++ b/src/panfrost/util/pan_ir.c
@@ -70,3 +70,25 @@ pan_to_bytemask(unsigned bytes, unsigned mask)
unreachable("Invalid register mode");
}
}
+
+void
+pan_block_add_successor(pan_block *block, pan_block *successor)
+{
+ assert(block);
+ assert(successor);
+
+ for (unsigned i = 0; i < ARRAY_SIZE(block->successors); ++i) {
+ if (block->successors[i]) {
+ if (block->successors[i] == successor)
+ return;
+ else
+ continue;
+ }
+
+ block->successors[i] = successor;
+ _mesa_set_add(successor->predecessors, block);
+ return;
+ }
+
+ unreachable("Too many successors");
+}
diff --git a/src/panfrost/util/pan_ir.h b/src/panfrost/util/pan_ir.h
index 6b132228ddd..be02dc7576e 100644
--- a/src/panfrost/util/pan_ir.h
+++ b/src/panfrost/util/pan_ir.h
@@ -128,8 +128,6 @@ typedef struct pan_block {
/* Control flow graph */
struct pan_block *successors[2];
- unsigned nr_successors;
-
struct set *predecessors;
/* In liveness analysis, these are live masks (per-component) for
@@ -179,4 +177,6 @@ void pan_free_liveness(struct list_head *blocks);
uint16_t
pan_to_bytemask(unsigned bytes, unsigned mask);
+void pan_block_add_successor(pan_block *block, pan_block *successor);
+
#endif
diff --git a/src/panfrost/util/pan_liveness.c b/src/panfrost/util/pan_liveness.c
index 48ec71b253a..a46a11d9d3c 100644
--- a/src/panfrost/util/pan_liveness.c
+++ b/src/panfrost/util/pan_liveness.c
@@ -108,7 +108,7 @@ static inline pan_block *
pan_exit_block(struct list_head *blocks)
{
pan_block *last = list_last_entry(blocks, pan_block, link);
- assert(last->nr_successors == 0);
+ assert(!last->successors[0] && !last->successors[1]);
return last;
}