Mesa (main): pan/bi: Copy block bi_block

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Jul 18 02:03:17 UTC 2021


Module: Mesa
Branch: main
Commit: 1fcea302954c97d53cfe836ffae707664585f7b1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1fcea302954c97d53cfe836ffae707664585f7b1

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Fri Jul 16 18:33:43 2021 -0400

pan/bi: Copy block bi_block

Gets rid of the silly inheritance everywhere, which has caused _far_
more problems in practice than it has fixed. It was an idea I tried
before the pandemic. It didn't work. I'm finally cleaning it up.

Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11936>

---

 src/panfrost/bifrost/bi_helper_invocations.c | 10 ++--
 src/panfrost/bifrost/bi_layout.c             |  2 +-
 src/panfrost/bifrost/bi_liveness.c           | 16 +++----
 src/panfrost/bifrost/bi_opt_dce.c            | 10 ++--
 src/panfrost/bifrost/bi_pack.c               |  4 +-
 src/panfrost/bifrost/bi_print.c              | 10 ++--
 src/panfrost/bifrost/bi_printer.c.py         |  2 +-
 src/panfrost/bifrost/bi_schedule.c           | 22 ++++-----
 src/panfrost/bifrost/bifrost_compile.c       | 26 +++++-----
 src/panfrost/bifrost/bir.c                   |  4 +-
 src/panfrost/bifrost/compiler.h              | 72 +++++++++++++++++-----------
 11 files changed, 98 insertions(+), 80 deletions(-)

diff --git a/src/panfrost/bifrost/bi_helper_invocations.c b/src/panfrost/bifrost/bi_helper_invocations.c
index a8d2c61c1e2..be926321f52 100644
--- a/src/panfrost/bifrost/bi_helper_invocations.c
+++ b/src/panfrost/bifrost/bi_helper_invocations.c
@@ -120,7 +120,7 @@ static bool
 bi_block_terminates_helpers(bi_block *block)
 {
         /* Can't terminate if a successor needs helpers */
-        pan_foreach_successor((&block->base), succ) {
+        bi_foreach_successor((block), succ) {
                 if (((bi_block *) succ)->pass_flags & 1)
                         return false;
         }
@@ -166,11 +166,11 @@ bi_analyze_helper_terminate(bi_context *ctx)
 
         while((cur = _mesa_set_next_entry(worklist, NULL)) != NULL) {
                 /* Pop off a block requiring helpers */
-                pan_block *blk = (struct pan_block *) cur->key;
+                bi_block *blk = (struct bi_block *) cur->key;
                 _mesa_set_remove(worklist, cur);
 
                 /* Its predecessors also require helpers */
-                pan_foreach_predecessor(blk, pred) {
+                bi_foreach_predecessor(blk, pred) {
                         if (!_mesa_set_search(visited, pred)) {
                                 ((bi_block *) pred)->pass_flags |= 1;
                                 _mesa_set_add(worklist, pred);
@@ -258,13 +258,13 @@ bi_analyze_helper_requirements(bi_context *ctx)
         struct set_entry *cur = _mesa_set_add(work_list, pan_exit_block(&ctx->blocks));
 
         do {
-                pan_block *blk = (struct pan_block *) cur->key;
+                bi_block *blk = (struct bi_block *) cur->key;
                 _mesa_set_remove(work_list, cur);
 
                 bool progress = bi_helper_block_update(deps, (bi_block *) blk);
 
                 if (progress || !_mesa_set_search(visited, blk)) {
-                        pan_foreach_predecessor(blk, pred)
+                        bi_foreach_predecessor(blk, pred)
                                 _mesa_set_add(work_list, pred);
                 }
 
diff --git a/src/panfrost/bifrost/bi_layout.c b/src/panfrost/bifrost/bi_layout.c
index db66ed04f77..aae81ba7d0d 100644
--- a/src/panfrost/bifrost/bi_layout.c
+++ b/src/panfrost/bifrost/bi_layout.c
@@ -113,7 +113,7 @@ bi_block_offset(bi_context *ctx, bi_clause *start, bi_block *target)
 
         /* Determine if the block we're branching to is strictly greater in
          * source order */
-        bool forwards = target->base.name > start->block->base.name;
+        bool forwards = target->name > start->block->name;
 
         if (forwards) {
                 /* We have to jump through this block from the start of this
diff --git a/src/panfrost/bifrost/bi_liveness.c b/src/panfrost/bifrost/bi_liveness.c
index 9ac03da3e68..b6796a566a4 100644
--- a/src/panfrost/bifrost/bi_liveness.c
+++ b/src/panfrost/bifrost/bi_liveness.c
@@ -55,12 +55,12 @@ bi_liveness_ins_update(uint16_t *live, bi_instr *ins, unsigned max)
 }
 
 static bool
-liveness_block_update(pan_block *blk, unsigned temp_count)
+liveness_block_update(bi_block *blk, unsigned temp_count)
 {
         bool progress = false;
 
         /* live_out[s] = sum { p in succ[s] } ( live_in[p] ) */
-        pan_foreach_successor(blk, succ) {
+        bi_foreach_successor(blk, succ) {
                 for (unsigned i = 0; i < temp_count; ++i)
                         blk->live_out[i] |= succ->live_in[i];
         }
@@ -68,7 +68,7 @@ liveness_block_update(pan_block *blk, unsigned temp_count)
         uint16_t *live = ralloc_array(blk, uint16_t, temp_count);
         memcpy(live, blk->live_out, temp_count * sizeof(uint16_t));
 
-        pan_foreach_instr_in_block_rev(blk, ins)
+        bi_foreach_instr_in_block_rev(blk, ins)
                 bi_liveness_ins_update(live, (bi_instr *) ins, temp_count);
 
         /* To figure out progress, diff live_in */
@@ -91,7 +91,7 @@ liveness_block_update(pan_block *blk, unsigned temp_count)
 static void
 free_liveness(struct list_head *blocks)
 {
-        list_for_each_entry(pan_block, block, blocks, link) {
+        list_for_each_entry(bi_block, block, blocks, link) {
                 if (block->live_in)
                         ralloc_free(block->live_in);
 
@@ -111,7 +111,7 @@ bi_compute_liveness(bi_context *ctx)
 
         unsigned temp_count = bi_max_temp(ctx);
 
-        /* Set of pan_block */
+        /* Set of bi_block */
         struct set *work_list = _mesa_set_create(NULL,
                         _mesa_hash_pointer,
                         _mesa_key_pointer_equal);
@@ -124,7 +124,7 @@ bi_compute_liveness(bi_context *ctx)
 
         free_liveness(&ctx->blocks);
 
-        list_for_each_entry(pan_block, block, &ctx->blocks, link) {
+        list_for_each_entry(bi_block, block, &ctx->blocks, link) {
                 block->live_in = rzalloc_array(block, uint16_t, temp_count);
                 block->live_out = rzalloc_array(block, uint16_t, temp_count);
         }
@@ -138,7 +138,7 @@ bi_compute_liveness(bi_context *ctx)
 
         do {
                 /* Pop off a block */
-                pan_block *blk = (struct pan_block *) cur->key;
+                bi_block *blk = (struct bi_block *) cur->key;
                 _mesa_set_remove(work_list, cur);
 
                 /* Update its liveness information */
@@ -147,7 +147,7 @@ bi_compute_liveness(bi_context *ctx)
                 /* If we made progress, we need to process the predecessors */
 
                 if (progress || !_mesa_set_search(visited, blk)) {
-                        pan_foreach_predecessor(blk, pred)
+                        bi_foreach_predecessor(blk, pred)
                                 _mesa_set_add(work_list, pred);
                 }
 
diff --git a/src/panfrost/bifrost/bi_opt_dce.c b/src/panfrost/bifrost/bi_opt_dce.c
index 44ffd2ec0dc..a568f4f3481 100644
--- a/src/panfrost/bifrost/bi_opt_dce.c
+++ b/src/panfrost/bifrost/bi_opt_dce.c
@@ -39,7 +39,7 @@ bi_opt_dead_code_eliminate(bi_context *ctx)
                 bi_block *block = (bi_block *) _block;
                 uint16_t *live = rzalloc_array(_block, uint16_t, temp_count);
 
-                pan_foreach_successor(_block, succ) {
+                bi_foreach_successor(_block, succ) {
                         for (unsigned i = 0; i < temp_count; ++i)
                                 live[i] |= succ->live_in[i];
                 }
@@ -62,8 +62,8 @@ bi_opt_dead_code_eliminate(bi_context *ctx)
                                 bi_liveness_ins_update(live, ins, temp_count);
                 }
 
-                ralloc_free(block->base.live_in);
-                block->base.live_in = live;
+                ralloc_free(block->live_in);
+                block->live_in = live;
         }
 }
 
@@ -94,7 +94,7 @@ bi_postra_liveness_ins(uint64_t live, bi_instr *ins)
 static bool
 bi_postra_liveness_block(bi_block *blk)
 {
-        pan_foreach_successor((&blk->base), _succ) {
+        bi_foreach_successor((blk), _succ) {
                 bi_block *succ = (bi_block *) _succ;
                 blk->reg_live_out |= succ->reg_live_in;
         }
@@ -144,7 +144,7 @@ bi_postra_liveness(bi_context *ctx)
                 /* If we made progress, we need to process the predecessors */
 
                 if (progress || !_mesa_set_search(visited, blk)) {
-                        pan_foreach_predecessor((&blk->base), pred)
+                        bi_foreach_predecessor((blk), pred)
                                 _mesa_set_add(work_list, pred);
                 }
 
diff --git a/src/panfrost/bifrost/bi_pack.c b/src/panfrost/bifrost/bi_pack.c
index a9a1a415fd4..ebe3ac1da4d 100644
--- a/src/panfrost/bifrost/bi_pack.c
+++ b/src/panfrost/bifrost/bi_pack.c
@@ -729,8 +729,8 @@ bi_pack(bi_context *ctx, struct util_dynarray *emission)
                         bi_clause *next = NULL, *next_2 = NULL;
 
                         if (is_last) {
-                                next = bi_next_clause(ctx, block->base.successors[0], NULL);
-                                next_2 = bi_next_clause(ctx, block->base.successors[1], NULL);
+                                next = bi_next_clause(ctx, block->successors[0], NULL);
+                                next_2 = bi_next_clause(ctx, block->successors[1], NULL);
                         } else {
                                 next = bi_next_clause(ctx, _block, clause);
                         }
diff --git a/src/panfrost/bifrost/bi_print.c b/src/panfrost/bifrost/bi_print.c
index aea95cc071d..d27ae71a430 100644
--- a/src/panfrost/bifrost/bi_print.c
+++ b/src/panfrost/bifrost/bi_print.c
@@ -130,7 +130,7 @@ bi_print_clause(bi_clause *clause, FILE *fp)
 void
 bi_print_block(bi_block *block, FILE *fp)
 {
-        fprintf(fp, "block%u {\n", block->base.name);
+        fprintf(fp, "block%u {\n", block->name);
 
         if (block->scheduled) {
                 bi_foreach_clause_in_block(block, clause)
@@ -142,18 +142,18 @@ bi_print_block(bi_block *block, FILE *fp)
 
         fprintf(fp, "}");
 
-        if (block->base.successors[0]) {
+        if (block->successors[0]) {
                 fprintf(fp, " -> ");
 
-                pan_foreach_successor((&block->base), succ)
+                bi_foreach_successor((block), succ)
                         fprintf(fp, "block%u ", succ->name);
         }
 
-        if (block->base.predecessors->entries) {
+        if (block->predecessors->entries) {
                 fprintf(fp, " from");
 
                 bi_foreach_predecessor(block, pred)
-                        fprintf(fp, " block%u", pred->base.name);
+                        fprintf(fp, " block%u", pred->name);
         }
 
         fprintf(fp, "\n\n");
diff --git a/src/panfrost/bifrost/bi_printer.c.py b/src/panfrost/bifrost/bi_printer.c.py
index 306124b5811..cd487550a09 100644
--- a/src/panfrost/bifrost/bi_printer.c.py
+++ b/src/panfrost/bifrost/bi_printer.c.py
@@ -194,7 +194,7 @@ bi_print_instr(bi_instr *I, FILE *fp)
     }
 
     if (I->branch_target)
-            fprintf(fp, " -> block%u", I->branch_target->base.name);
+            fprintf(fp, " -> block%u", I->branch_target->name);
 
     fputs("\\n", fp);
 
diff --git a/src/panfrost/bifrost/bi_schedule.c b/src/panfrost/bifrost/bi_schedule.c
index 225eeab5fa6..63f15e8cba1 100644
--- a/src/panfrost/bifrost/bi_schedule.c
+++ b/src/panfrost/bifrost/bi_schedule.c
@@ -395,10 +395,10 @@ bi_lower_dtsel(bi_context *ctx,
 static bi_instr **
 bi_flatten_block(bi_block *block, unsigned *len)
 {
-        if (list_is_empty(&block->base.instructions))
+        if (list_is_empty(&block->instructions))
                 return NULL;
 
-        *len = list_length(&block->base.instructions);
+        *len = list_length(&block->instructions);
         bi_instr **instructions = malloc(sizeof(bi_instr *) * (*len));
 
         unsigned i = 0;
@@ -476,16 +476,16 @@ static bool
 bi_back_to_back(bi_block *block)
 {
         /* Last block of a program */
-        if (!block->base.successors[0]) {
-                assert(!block->base.successors[1]);
+        if (!block->successors[0]) {
+                assert(!block->successors[1]);
                 return false;
         }
 
         /* Multiple successors? We're branching */
-        if (block->base.successors[1])
+        if (block->successors[1])
                 return false;
 
-        struct pan_block *succ = block->base.successors[0];
+        struct bi_block *succ = block->successors[0];
         assert(succ->predecessors);
         unsigned count = succ->predecessors->entries;
 
@@ -1790,7 +1790,7 @@ bi_schedule_block(bi_context *ctx, bi_block *block)
         bi_foreach_clause_in_block(block, clause) {
                 for (unsigned i = 0; i < clause->tuple_count; ++i)  {
                         bi_foreach_instr_in_tuple(&clause->tuples[i], ins) {
-                                list_addtail(&ins->link, &block->base.instructions);
+                                list_addtail(&ins->link, &block->instructions);
                         }
                 }
         }
@@ -1895,7 +1895,7 @@ bi_add_nop_for_atest(bi_context *ctx)
                 return;
 
         /* Fetch the first clause of the shader */
-        pan_block *block = list_first_entry(&ctx->blocks, pan_block, link);
+        bi_block *block = list_first_entry(&ctx->blocks, bi_block, link);
         bi_clause *clause = bi_next_clause(ctx, block, NULL);
 
         if (!clause || clause->message_type != BIFROST_MESSAGE_ATEST)
@@ -1946,12 +1946,12 @@ bit_builder(void *memctx)
 
         bi_block *blk = rzalloc(ctx, bi_block);
 
-        blk->base.predecessors = _mesa_set_create(blk,
+        blk->predecessors = _mesa_set_create(blk,
                         _mesa_hash_pointer,
                         _mesa_key_pointer_equal);
 
-        list_addtail(&blk->base.link, &ctx->blocks);
-        list_inithead(&blk->base.instructions);
+        list_addtail(&blk->link, &ctx->blocks);
+        list_inithead(&blk->instructions);
 
         bi_builder *b = rzalloc(memctx, bi_builder);
         b->shader = ctx;
diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c
index 84bc4d2bd0a..a370c818b7c 100644
--- a/src/panfrost/bifrost/bifrost_compile.c
+++ b/src/panfrost/bifrost/bifrost_compile.c
@@ -69,19 +69,19 @@ bi_block_add_successor(bi_block *block, bi_block *successor)
         assert(block != NULL && successor != NULL);
 
         /* Cull impossible edges */
-        if (block->base.unconditional_jumps)
+        if (block->unconditional_jumps)
                 return;
 
-        for (unsigned i = 0; i < ARRAY_SIZE(block->base.successors); ++i) {
-                if (block->base.successors[i]) {
-                       if (block->base.successors[i] == (pan_block *) successor)
+        for (unsigned i = 0; i < ARRAY_SIZE(block->successors); ++i) {
+                if (block->successors[i]) {
+                       if (block->successors[i] == (bi_block *) successor)
                                return;
                        else
                                continue;
                 }
 
-                block->base.successors[i] = (void *) successor;
-                _mesa_set_add(successor->base.predecessors, block);
+                block->successors[i] = (void *) successor;
+                _mesa_set_add(successor->predecessors, block);
                 return;
         }
 
@@ -105,7 +105,7 @@ bi_emit_jump(bi_builder *b, nir_jump_instr *instr)
         }
 
         bi_block_add_successor(b->shader->current_block, branch->branch_target);
-        b->shader->current_block->base.unconditional_jumps = true;
+        b->shader->current_block->unconditional_jumps = true;
 }
 
 static bi_index
@@ -2827,7 +2827,7 @@ create_empty_block(bi_context *ctx)
 {
         bi_block *blk = rzalloc(ctx, bi_block);
 
-        blk->base.predecessors = _mesa_set_create(blk,
+        blk->predecessors = _mesa_set_create(blk,
                         _mesa_hash_pointer,
                         _mesa_key_pointer_equal);
 
@@ -2844,8 +2844,8 @@ emit_block(bi_context *ctx, nir_block *block)
                 ctx->current_block = create_empty_block(ctx);
         }
 
-        list_addtail(&ctx->current_block->base.link, &ctx->blocks);
-        list_inithead(&ctx->current_block->base.instructions);
+        list_addtail(&ctx->current_block->link, &ctx->blocks);
+        list_inithead(&ctx->current_block->instructions);
 
         bi_builder _b = bi_init_builder(ctx, bi_after_block(ctx->current_block));
 
@@ -3572,7 +3572,7 @@ bifrost_compile_shader_nir(nir_shader *nir,
 
                 /* Name blocks now that we're done emitting so the order is
                  * consistent */
-                block->base.name = block_source_count++;
+                block->name = block_source_count++;
         }
 
         /* If the shader doesn't write any colour or depth outputs, it may
@@ -3583,7 +3583,7 @@ bifrost_compile_shader_nir(nir_shader *nir,
                 !bi_skip_atest(ctx, false);
 
         if (need_dummy_atest) {
-                pan_block *end = list_last_entry(&ctx->blocks, pan_block, link);
+                bi_block *end = list_last_entry(&ctx->blocks, bi_block, link);
                 bi_builder b = bi_init_builder(ctx, bi_after_block((bi_block *) end));
                 bi_emit_atest(&b, bi_zero());
         }
@@ -3633,7 +3633,7 @@ bifrost_compile_shader_nir(nir_shader *nir,
 
         /* If we need to wait for ATEST or BLEND in the first clause, pass the
          * corresponding bits through to the renderer state descriptor */
-        pan_block *first_block = list_first_entry(&ctx->blocks, pan_block, link);
+        bi_block *first_block = list_first_entry(&ctx->blocks, bi_block, link);
         bi_clause *first_clause = bi_next_clause(ctx, first_block, NULL);
 
         unsigned first_deps = first_clause ? first_clause->dependencies : 0;
diff --git a/src/panfrost/bifrost/bir.c b/src/panfrost/bifrost/bir.c
index 2bbc71b0f0b..e4993a3913f 100644
--- a/src/panfrost/bifrost/bir.c
+++ b/src/panfrost/bifrost/bir.c
@@ -116,7 +116,7 @@ bi_writemask(bi_instr *ins, unsigned d)
 }
 
 bi_clause *
-bi_next_clause(bi_context *ctx, pan_block *block, bi_clause *clause)
+bi_next_clause(bi_context *ctx, bi_block *block, bi_clause *clause)
 {
         if (!block && !clause)
                 return NULL;
@@ -130,7 +130,7 @@ bi_next_clause(bi_context *ctx, pan_block *block, bi_clause *clause)
                 return list_first_entry(&(clause->link), bi_clause, link);
 
         /* Try the next block, or the one after that if it's empty, etc .*/
-        pan_block *next_block = pan_next_block(block);
+        bi_block *next_block = bi_next_block(block);
 
         bi_foreach_block_from(ctx, next_block, block) {
                 bi_block *blk = (bi_block *) block;
diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h
index 4bc29dcc96a..3e1e7e3afb0 100644
--- a/src/panfrost/bifrost/compiler.h
+++ b/src/panfrost/bifrost/compiler.h
@@ -523,7 +523,25 @@ typedef struct {
 } bi_clause;
 
 typedef struct bi_block {
-        pan_block base; /* must be first */
+        /* Link to next block. Must be first for mir_get_block */
+        struct list_head link;
+
+        /* List of instructions emitted for the current block */
+        struct list_head instructions;
+
+        /* Index of the block in source order */
+        unsigned name;
+
+        /* Control flow graph */
+        struct bi_block *successors[2];
+        struct set *predecessors;
+        bool unconditional_jumps;
+
+        /* In liveness analysis, these are live masks (per-component) for
+         * indices for the block. Scalar compilers have the luxury of using
+         * simple bit fields, but for us, liveness is a vector idea. */
+        uint16_t *live_in;
+        uint16_t *live_out;
 
         /* If true, uses clauses; if false, uses instructions */
         bool scheduled;
@@ -669,34 +687,34 @@ bi_node_to_index(unsigned node, unsigned node_count)
 /* Iterators for Bifrost IR */
 
 #define bi_foreach_block(ctx, v) \
-        list_for_each_entry(pan_block, v, &ctx->blocks, link)
+        list_for_each_entry(bi_block, v, &ctx->blocks, link)
 
 #define bi_foreach_block_rev(ctx, v) \
-        list_for_each_entry_rev(pan_block, v, &ctx->blocks, link)
+        list_for_each_entry_rev(bi_block, v, &ctx->blocks, link)
 
 #define bi_foreach_block_from(ctx, from, v) \
-        list_for_each_entry_from(pan_block, v, from, &ctx->blocks, link)
+        list_for_each_entry_from(bi_block, v, from, &ctx->blocks, link)
 
 #define bi_foreach_block_from_rev(ctx, from, v) \
-        list_for_each_entry_from_rev(pan_block, v, from, &ctx->blocks, link)
+        list_for_each_entry_from_rev(bi_block, v, from, &ctx->blocks, link)
 
 #define bi_foreach_instr_in_block(block, v) \
-        list_for_each_entry(bi_instr, v, &(block)->base.instructions, link)
+        list_for_each_entry(bi_instr, v, &(block)->instructions, link)
 
 #define bi_foreach_instr_in_block_rev(block, v) \
-        list_for_each_entry_rev(bi_instr, v, &(block)->base.instructions, link)
+        list_for_each_entry_rev(bi_instr, v, &(block)->instructions, link)
 
 #define bi_foreach_instr_in_block_safe(block, v) \
-        list_for_each_entry_safe(bi_instr, v, &(block)->base.instructions, link)
+        list_for_each_entry_safe(bi_instr, v, &(block)->instructions, link)
 
 #define bi_foreach_instr_in_block_safe_rev(block, v) \
-        list_for_each_entry_safe_rev(bi_instr, v, &(block)->base.instructions, link)
+        list_for_each_entry_safe_rev(bi_instr, v, &(block)->instructions, link)
 
 #define bi_foreach_instr_in_block_from(block, v, from) \
-        list_for_each_entry_from(bi_instr, v, from, &(block)->base.instructions, link)
+        list_for_each_entry_from(bi_instr, v, from, &(block)->instructions, link)
 
 #define bi_foreach_instr_in_block_from_rev(block, v, from) \
-        list_for_each_entry_from_rev(bi_instr, v, from, &(block)->base.instructions, link)
+        list_for_each_entry_from_rev(bi_instr, v, from, &(block)->instructions, link)
 
 #define bi_foreach_clause_in_block(block, v) \
         list_for_each_entry(bi_clause, v, &(block)->clauses, link)
@@ -715,19 +733,19 @@ bi_node_to_index(unsigned node, unsigned node_count)
 
 #define bi_foreach_instr_global(ctx, v) \
         bi_foreach_block(ctx, v_block) \
-                bi_foreach_instr_in_block((bi_block *) v_block, v)
+                bi_foreach_instr_in_block(v_block, v)
 
 #define bi_foreach_instr_global_rev(ctx, v) \
         bi_foreach_block_rev(ctx, v_block) \
-                bi_foreach_instr_in_block_rev((bi_block *) v_block, v)
+                bi_foreach_instr_in_block_rev(v_block, v)
 
 #define bi_foreach_instr_global_safe(ctx, v) \
         bi_foreach_block(ctx, v_block) \
-                bi_foreach_instr_in_block_safe((bi_block *) v_block, v)
+                bi_foreach_instr_in_block_safe(v_block, v)
 
 #define bi_foreach_instr_global_rev_safe(ctx, v) \
         bi_foreach_block_rev(ctx, v_block) \
-                bi_foreach_instr_in_block_rev_safe((bi_block *) v_block, v)
+                bi_foreach_instr_in_block_rev_safe(v_block, v)
 
 #define bi_foreach_instr_in_tuple(tuple, v) \
         for (bi_instr *v = (tuple)->fma ?: (tuple)->add; \
@@ -747,10 +765,10 @@ bi_node_to_index(unsigned node, unsigned node_count)
 #define bi_foreach_predecessor(blk, v) \
         struct set_entry *_entry_##v; \
         bi_block *v; \
-        for (_entry_##v = _mesa_set_next_entry(blk->base.predecessors, NULL), \
+        for (_entry_##v = _mesa_set_next_entry(blk->predecessors, NULL), \
                 v = (bi_block *) (_entry_##v ? _entry_##v->key : NULL);  \
                 _entry_##v != NULL; \
-                _entry_##v = _mesa_set_next_entry(blk->base.predecessors, _entry_##v), \
+                _entry_##v = _mesa_set_next_entry(blk->predecessors, _entry_##v), \
                 v = (bi_block *) (_entry_##v ? _entry_##v->key : NULL))
 
 #define bi_foreach_src(ins, v) \
@@ -775,10 +793,10 @@ bi_next_op(bi_instr *ins)
         return list_first_entry(&(ins->link), bi_instr, link);
 }
 
-static inline pan_block *
-pan_next_block(pan_block *block)
+static inline bi_block *
+bi_next_block(bi_block *block)
 {
-        return list_first_entry(&(block->link), pan_block, link);
+        return list_first_entry(&(block->link), bi_block, link);
 }
 
 /* BIR manipulation */
@@ -788,7 +806,7 @@ unsigned bi_count_read_registers(bi_instr *ins, unsigned src);
 unsigned bi_count_write_registers(bi_instr *ins, unsigned dest);
 bool bi_is_regfmt_16(enum bi_register_format fmt);
 unsigned bi_writemask(bi_instr *ins, unsigned dest);
-bi_clause * bi_next_clause(bi_context *ctx, pan_block *block, bi_clause *clause);
+bi_clause * bi_next_clause(bi_context *ctx, bi_block *block, bi_clause *clause);
 bool bi_side_effects(enum bi_opcode op);
 
 void bi_print_instr(bi_instr *I, FILE *fp);
@@ -844,9 +862,9 @@ static inline bool
 bi_is_terminal_block(bi_block *block)
 {
         return (block == NULL) ||
-                (list_is_empty(&block->base.instructions) &&
-                 bi_is_terminal_block((bi_block *) block->base.successors[0]) &&
-                 bi_is_terminal_block((bi_block *) block->base.successors[1]));
+                (list_is_empty(&block->instructions) &&
+                 bi_is_terminal_block(block->successors[0]) &&
+                 bi_is_terminal_block(block->successors[1]));
 }
 
 /* Code emit */
@@ -960,13 +978,13 @@ bi_last_instr_in_clause(bi_clause *clause)
 
 #define bi_foreach_instr_in_clause(block, clause, pos) \
    for (bi_instr *pos = LIST_ENTRY(bi_instr, bi_first_instr_in_clause(clause), link); \
-	(&pos->link != &(block)->base.instructions) \
+	(&pos->link != &(block)->instructions) \
                 && (pos != bi_next_op(bi_last_instr_in_clause(clause))); \
 	pos = LIST_ENTRY(bi_instr, pos->link.next, link))
 
 #define bi_foreach_instr_in_clause_rev(block, clause, pos) \
    for (bi_instr *pos = LIST_ENTRY(bi_instr, bi_last_instr_in_clause(clause), link); \
-	(&pos->link != &(block)->base.instructions) \
+	(&pos->link != &(block)->instructions) \
 	        && pos != bi_prev_op(bi_first_instr_in_clause(clause)); \
 	pos = LIST_ENTRY(bi_instr, pos->link.prev, link))
 
@@ -1016,7 +1034,7 @@ bi_builder_insert(bi_cursor *cursor, bi_instr *I)
         return;
 
     case bi_cursor_after_block:
-        list_addtail(&I->link, &cursor->block->base.instructions);
+        list_addtail(&I->link, &cursor->block->instructions);
         cursor->option = bi_cursor_after_instr;
         cursor->instr = I;
         return;



More information about the mesa-commit mailing list