pan/bi: Clean up useless casts
authorAlyssa Rosenzweig <alyssa@collabora.com>
Fri, 16 Jul 2021 22:40:39 +0000 (18:40 -0400)
committerMarge Bot <eric+marge@anholt.net>
Sun, 18 Jul 2021 01:49:26 +0000 (01:49 +0000)
Left over from removing inheritance with sed instead of coccinelle.

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

src/panfrost/bifrost/bi_helper_invocations.c
src/panfrost/bifrost/bi_layout.c
src/panfrost/bifrost/bi_opt_cse.c
src/panfrost/bifrost/bi_opt_dce.c
src/panfrost/bifrost/bi_pack.c
src/panfrost/bifrost/bi_print.c
src/panfrost/bifrost/bi_ra.c
src/panfrost/bifrost/bi_schedule.c
src/panfrost/bifrost/bi_scoreboard.c
src/panfrost/bifrost/bifrost_compile.c
src/panfrost/bifrost/bir.c

index be92632..946ae8c 100644 (file)
@@ -120,8 +120,8 @@ static bool
 bi_block_terminates_helpers(bi_block *block)
 {
         /* Can't terminate if a successor needs helpers */
-        bi_foreach_successor((block), succ) {
-                if (((bi_block *) succ)->pass_flags & 1)
+        bi_foreach_successor(block, succ) {
+                if (succ->pass_flags & 1)
                         return false;
         }
 
@@ -148,12 +148,11 @@ bi_analyze_helper_terminate(bi_context *ctx)
                         _mesa_hash_pointer,
                         _mesa_key_pointer_equal);
 
-        bi_foreach_block(ctx, _block) {
-                bi_block *block = (bi_block *) _block;
+        bi_foreach_block(ctx, block) {
                 block->pass_flags = bi_block_uses_helpers(block) ? 1 : 0;
 
                 if (block->pass_flags & 1)
-                        _mesa_set_add(worklist, _block);
+                        _mesa_set_add(worklist, block);
         }
 
         /* Next, propagate back. Since there are a finite number of blocks, the
@@ -172,7 +171,7 @@ bi_analyze_helper_terminate(bi_context *ctx)
                 /* Its predecessors also require helpers */
                 bi_foreach_predecessor(blk, pred) {
                         if (!_mesa_set_search(visited, pred)) {
-                                ((bi_block *) pred)->pass_flags |= 1;
+                                pred->pass_flags |= 1;
                                 _mesa_set_add(worklist, pred);
                         }
                 }
@@ -184,9 +183,7 @@ bi_analyze_helper_terminate(bi_context *ctx)
         _mesa_set_destroy(worklist, NULL);
 
         /* Finally, mark clauses requiring helpers */
-        bi_foreach_block(ctx, _block) {
-                bi_block *block = (bi_block *) _block;
-
+        bi_foreach_block(ctx, block) {
                 /* At the end, there are helpers iff we don't terminate */
                 bool helpers = !bi_block_terminates_helpers(block);
 
@@ -261,7 +258,7 @@ bi_analyze_helper_requirements(bi_context *ctx)
                 bi_block *blk = (struct bi_block *) cur->key;
                 _mesa_set_remove(work_list, cur);
 
-                bool progress = bi_helper_block_update(deps, (bi_block *) blk);
+                bool progress = bi_helper_block_update(deps, blk);
 
                 if (progress || !_mesa_set_search(visited, blk)) {
                         bi_foreach_predecessor(blk, pred)
index aae81ba..500bda1 100644 (file)
@@ -124,9 +124,7 @@ bi_block_offset(bi_context *ctx, bi_clause *start, bi_block *target)
 
                 /* We then need to jump through every clause of every following
                  * block until the target */
-                bi_foreach_block_from(ctx, start->block, _blk) {
-                        bi_block *blk = (bi_block *) _blk;
-
+                bi_foreach_block_from(ctx, start->block, blk) {
                         /* Don't double-count the first block */
                         if (blk == start->block)
                                 continue;
@@ -153,9 +151,7 @@ bi_block_offset(bi_context *ctx, bi_clause *start, bi_block *target)
                 /* And jump back every clause of preceding blocks up through
                  * and including the target to get to the beginning of the
                  * target */
-                bi_foreach_block_from_rev(ctx, start->block, _blk) {
-                        bi_block *blk = (bi_block *) _blk;
-
+                bi_foreach_block_from_rev(ctx, start->block, blk) {
                         if (blk == start->block)
                                 continue;
 
index 832bae0..4d70a44 100644 (file)
@@ -157,7 +157,7 @@ bi_opt_cse(bi_context *ctx)
                 bi_index *replacement = calloc(sizeof(bi_index), ((ctx->ssa_alloc + 1) << 2));
                 _mesa_set_clear(instr_set, NULL);
 
-                bi_foreach_instr_in_block((bi_block *) block, instr) {
+                bi_foreach_instr_in_block(block, instr) {
                         /* Rewrite before trying to CSE anything so we converge
                          * locally in one iteration */
                         bi_foreach_src(instr, s) {
index a568f4f..254cd68 100644 (file)
@@ -35,11 +35,10 @@ bi_opt_dead_code_eliminate(bi_context *ctx)
         bi_invalidate_liveness(ctx);
         bi_compute_liveness(ctx);
 
-        bi_foreach_block_rev(ctx, _block) {
-                bi_block *block = (bi_block *) _block;
-                uint16_t *live = rzalloc_array(_block, uint16_t, temp_count);
+        bi_foreach_block_rev(ctx, block) {
+                uint16_t *live = rzalloc_array(block, uint16_t, temp_count);
 
-                bi_foreach_successor(_block, succ) {
+                bi_foreach_successor(block, succ) {
                         for (unsigned i = 0; i < temp_count; ++i)
                                 live[i] |= succ->live_in[i];
                 }
@@ -94,10 +93,8 @@ bi_postra_liveness_ins(uint64_t live, bi_instr *ins)
 static bool
 bi_postra_liveness_block(bi_block *blk)
 {
-        bi_foreach_successor((blk), _succ) {
-                bi_block *succ = (bi_block *) _succ;
+        bi_foreach_successor(blk, succ)
                 blk->reg_live_out |= succ->reg_live_in;
-        }
 
         uint64_t live = blk->reg_live_out;
 
@@ -129,8 +126,7 @@ bi_postra_liveness(bi_context *ctx)
         struct set_entry *cur;
         cur = _mesa_set_add(work_list, pan_exit_block(&ctx->blocks));
 
-        bi_foreach_block(ctx, _block) {
-                bi_block *block = (bi_block *) _block;
+        bi_foreach_block(ctx, block) {
                 block->reg_live_out = block->reg_live_in = 0;
         }
 
@@ -160,8 +156,7 @@ bi_opt_dce_post_ra(bi_context *ctx)
 {
         bi_postra_liveness(ctx);
 
-        bi_foreach_block_rev(ctx, _block) {
-                bi_block *block = (bi_block *) _block;
+        bi_foreach_block_rev(ctx, block) {
                 uint64_t live = block->reg_live_out;
 
                 bi_foreach_instr_in_block_rev(block, ins) {
index ebe3ac1..01b7ea5 100644 (file)
@@ -714,9 +714,7 @@ bi_pack(bi_context *ctx, struct util_dynarray *emission)
 {
         unsigned previous_size = emission->size;
 
-        bi_foreach_block(ctx, _block) {
-                bi_block *block = (bi_block *) _block;
-
+        bi_foreach_block(ctx, block) {
                 bi_assign_branch_offset(ctx, block);
 
                 bi_foreach_clause_in_block(block, clause) {
@@ -732,7 +730,7 @@ bi_pack(bi_context *ctx, struct util_dynarray *emission)
                                 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);
+                                next = bi_next_clause(ctx, block, clause);
                         }
 
 
index d27ae71..c242a93 100644 (file)
@@ -163,5 +163,5 @@ void
 bi_print_shader(bi_context *ctx, FILE *fp)
 {
         bi_foreach_block(ctx, block)
-                bi_print_block((bi_block *) block, fp);
+                bi_print_block(block, fp);
 }
index 628ad88..f62a650 100644 (file)
@@ -264,9 +264,8 @@ bi_compute_interference(bi_context *ctx, struct lcra_state *l, bool full_regs)
         bi_compute_liveness(ctx);
         bi_postra_liveness(ctx);
 
-        bi_foreach_block_rev(ctx, _blk) {
-                bi_block *blk = (bi_block *) _blk;
-                uint16_t *live = mem_dup(_blk->live_out, node_count * sizeof(uint16_t));
+        bi_foreach_block_rev(ctx, blk) {
+                uint16_t *live = mem_dup(blk->live_out, node_count * sizeof(uint16_t));
 
                 bi_mark_interference(blk, l, live, blk->reg_live_out,
                                 node_count, ctx->inputs->is_blend, !full_regs);
index 63f15e8..c22cd74 100644 (file)
@@ -1928,8 +1928,7 @@ bi_schedule(bi_context *ctx)
         bi_postra_liveness(ctx);
 
         bi_foreach_block(ctx, block) {
-                bi_block *bblock = (bi_block *) block;
-                bi_schedule_block(ctx, bblock);
+                bi_schedule_block(ctx, block);
         }
 
         bi_opt_dce_post_ra(ctx);
index 05b731a..1e7ca0e 100644 (file)
@@ -95,14 +95,12 @@ bi_assign_scoreboard(bi_context *ctx)
         struct bi_scoreboard_state st = {};
 
         /* Assign slots */
-        bi_foreach_block(ctx, _block) {
-                bi_block *block = (bi_block *) _block;
-
+        bi_foreach_block(ctx, block) {
                 bi_foreach_clause_in_block(block, clause) {
                         unsigned slot = bi_choose_scoreboard_slot(&st, clause->message);
                         clause->scoreboard_id = slot;
 
-                        bi_clause *next = bi_next_clause(ctx, _block, clause);
+                        bi_clause *next = bi_next_clause(ctx, block, clause);
                         if (next)
                                 next->dependencies |= (1 << slot);
                 }
index a370c81..4b347fe 100644 (file)
@@ -74,13 +74,13 @@ bi_block_add_successor(bi_block *block, bi_block *successor)
 
         for (unsigned i = 0; i < ARRAY_SIZE(block->successors); ++i) {
                 if (block->successors[i]) {
-                       if (block->successors[i] == (bi_block *) successor)
+                       if (block->successors[i] == successor)
                                return;
                        else
                                continue;
                 }
 
-                block->successors[i] = (void *) successor;
+                block->successors[i] = successor;
                 _mesa_set_add(successor->predecessors, block);
                 return;
         }
@@ -3042,9 +3042,7 @@ bi_print_stats(bi_context *ctx, unsigned size, FILE *fp)
          * cycle counts are surely more complicated.
          */
 
-        bi_foreach_block(ctx, _block) {
-                bi_block *block = (bi_block *) _block;
-
+        bi_foreach_block(ctx, block) {
                 bi_foreach_clause_in_block(block, clause) {
                         stats.nr_clauses++;
                         stats.nr_tuples += clause->tuple_count;
@@ -3567,9 +3565,7 @@ bifrost_compile_shader_nir(nir_shader *nir,
 
         unsigned block_source_count = 0;
 
-        bi_foreach_block(ctx, _block) {
-                bi_block *block = (bi_block *) _block;
-
+        bi_foreach_block(ctx, block) {
                 /* Name blocks now that we're done emitting so the order is
                  * consistent */
                 block->name = block_source_count++;
@@ -3584,7 +3580,7 @@ bifrost_compile_shader_nir(nir_shader *nir,
 
         if (need_dummy_atest) {
                 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_builder b = bi_init_builder(ctx, bi_after_block(end));
                 bi_emit_atest(&b, bi_zero());
         }
 
@@ -3602,8 +3598,7 @@ bifrost_compile_shader_nir(nir_shader *nir,
         bi_opt_cse(ctx);
         bi_opt_dead_code_eliminate(ctx);
 
-        bi_foreach_block(ctx, _block) {
-                bi_block *block = (bi_block *) _block;
+        bi_foreach_block(ctx, block) {
                 bi_lower_branch(block);
         }
 
index e4993a3..abe16c0 100644 (file)
@@ -122,21 +122,19 @@ bi_next_clause(bi_context *ctx, bi_block *block, bi_clause *clause)
                 return NULL;
 
         /* Try the first clause in this block if we're starting from scratch */
-        if (!clause && !list_is_empty(&((bi_block *) block)->clauses))
-                return list_first_entry(&((bi_block *) block)->clauses, bi_clause, link);
+        if (!clause && !list_is_empty(&block->clauses))
+                return list_first_entry(&block->clauses, bi_clause, link);
 
         /* Try the next clause in this block */
-        if (clause && clause->link.next != &((bi_block *) block)->clauses)
+        if (clause && clause->link.next != &block->clauses)
                 return list_first_entry(&(clause->link), bi_clause, link);
 
         /* Try the next block, or the one after that if it's empty, etc .*/
         bi_block *next_block = bi_next_block(block);
 
         bi_foreach_block_from(ctx, next_block, block) {
-                bi_block *blk = (bi_block *) block;
-
-                if (!list_is_empty(&blk->clauses))
-                        return list_first_entry(&(blk->clauses), bi_clause, link);
+                if (!list_is_empty(&block->clauses))
+                        return list_first_entry(&block->clauses, bi_clause, link);
         }
 
         return NULL;