panfrost: Sync Midgard/Bifrost control flow

We can move e v e n more code to be shared and let bi_block inherit from
pan_block, which will allow us to use the shared data flow analysis.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4150>
diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h
index 49ecb19..1c01b2d 100644
--- a/src/panfrost/bifrost/compiler.h
+++ b/src/panfrost/bifrost/compiler.h
@@ -308,17 +308,11 @@
 } bi_clause;
 
 typedef struct bi_block {
-        struct list_head link; /* must be first */
-        unsigned name; /* Just for pretty-printing */
+        pan_block base; /* must be first */
 
         /* If true, uses clauses; if false, uses instructions */
         bool scheduled;
-        struct list_head instructions; /* pre-schedule, list of bi_instructions */
         struct list_head clauses; /* list of bi_clause */
-
-        /* Control flow graph */
-        struct set *predecessors;
-        struct bi_block *successors[2];
 } bi_block;
 
 typedef struct {
@@ -350,7 +344,7 @@
 {
         bi_instruction *u = rzalloc(ctx, bi_instruction);
         memcpy(u, &ins, sizeof(ins));
-        list_addtail(&u->link, &ctx->current_block->instructions);
+        list_addtail(&u->link, &ctx->current_block->base.instructions);
         return u;
 }
 
@@ -427,57 +421,49 @@
 /* Iterators for Bifrost IR */
 
 #define bi_foreach_block(ctx, v) \
-        list_for_each_entry(bi_block, v, &ctx->blocks, link)
+        list_for_each_entry(pan_block, v, &ctx->blocks, link)
 
 #define bi_foreach_block_from(ctx, from, v) \
-        list_for_each_entry_from(bi_block, v, from, &ctx->blocks, link)
+        list_for_each_entry_from(pan_block, v, from, &ctx->blocks, link)
 
 #define bi_foreach_instr_in_block(block, v) \
-        list_for_each_entry(bi_instruction, v, &block->instructions, link)
+        list_for_each_entry(bi_instruction, v, &block->base.instructions, link)
 
 #define bi_foreach_instr_in_block_rev(block, v) \
-        list_for_each_entry_rev(bi_instruction, v, &block->instructions, link)
+        list_for_each_entry_rev(bi_instruction, v, &block->base.instructions, link)
 
 #define bi_foreach_instr_in_block_safe(block, v) \
-        list_for_each_entry_safe(bi_instruction, v, &block->instructions, link)
+        list_for_each_entry_safe(bi_instruction, v, &block->base.instructions, link)
 
 #define bi_foreach_instr_in_block_safe_rev(block, v) \
-        list_for_each_entry_safe_rev(bi_instruction, v, &block->instructions, link)
+        list_for_each_entry_safe_rev(bi_instruction, v, &block->base.instructions, link)
 
 #define bi_foreach_instr_in_block_from(block, v, from) \
-        list_for_each_entry_from(bi_instruction, v, from, &block->instructions, link)
+        list_for_each_entry_from(bi_instruction, v, from, &block->base.instructions, link)
 
 #define bi_foreach_instr_in_block_from_rev(block, v, from) \
-        list_for_each_entry_from_rev(bi_instruction, v, from, &block->instructions, link)
+        list_for_each_entry_from_rev(bi_instruction, v, from, &block->base.instructions, link)
 
 #define bi_foreach_clause_in_block(block, v) \
         list_for_each_entry(bi_clause, v, &block->clauses, link)
 
 #define bi_foreach_instr_global(ctx, v) \
         bi_foreach_block(ctx, v_block) \
-                bi_foreach_instr_in_block(v_block, v)
+                bi_foreach_instr_in_block((pan_block *) v_block, v)
 
 #define bi_foreach_instr_global_safe(ctx, v) \
         bi_foreach_block(ctx, v_block) \
-                bi_foreach_instr_in_block_safe(v_block, v)
-
-#define bi_foreach_successor(blk, v) \
-        bi_block *v; \
-        bi_block **_v; \
-        for (_v = &blk->successors[0], \
-                v = *_v; \
-                v != NULL && _v < &blk->successors[2]; \
-                _v++, v = *_v) \
+                bi_foreach_instr_in_block_safe((pan_block *) v_block, v)
 
 /* Based on set_foreach, expanded with automatic type casts */
 
 #define bi_foreach_predecessor(blk, v) \
         struct set_entry *_entry_##v; \
         bi_block *v; \
-        for (_entry_##v = _mesa_set_next_entry(blk->predecessors, NULL), \
+        for (_entry_##v = _mesa_set_next_entry(blk->base.predecessors, NULL), \
                 v = (bi_block *) (_entry_##v ? _entry_##v->key : NULL);  \
                 _entry_##v != NULL; \
-                _entry_##v = _mesa_set_next_entry(blk->predecessors, _entry_##v), \
+                _entry_##v = _mesa_set_next_entry(blk->base.predecessors, _entry_##v), \
                 v = (bi_block *) (_entry_##v ? _entry_##v->key : NULL))
 
 #define bi_foreach_src(ins, v) \