aboutsummaryrefslogtreecommitdiffstats
path: root/src/panfrost/midgard/midgard_liveness.c
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2020-03-11 08:03:28 -0400
committerMarge Bot <[email protected]>2020-03-11 20:28:20 +0000
commit3bbec3bc64378c25f03c841c443b7e7c4222cd83 (patch)
tree2af85d26e32100ef8e40ea7a3c5e77d8709ff016 /src/panfrost/midgard/midgard_liveness.c
parent218785c4a95319145b194db4ca9fe9fbc0713461 (diff)
pan/midgard: Localize `visited` tracking
Instead of a property on the block, just track it within the function to minimize IR dependencies. Signed-off-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4150>
Diffstat (limited to 'src/panfrost/midgard/midgard_liveness.c')
-rw-r--r--src/panfrost/midgard/midgard_liveness.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/panfrost/midgard/midgard_liveness.c b/src/panfrost/midgard/midgard_liveness.c
index fd93339ed94..a1cb8436f11 100644
--- a/src/panfrost/midgard/midgard_liveness.c
+++ b/src/panfrost/midgard/midgard_liveness.c
@@ -129,11 +129,15 @@ mir_compute_liveness(compiler_context *ctx)
_mesa_hash_pointer,
_mesa_key_pointer_equal);
+ struct set *visited = _mesa_set_create(ctx,
+ _mesa_hash_pointer,
+ _mesa_key_pointer_equal);
+
/* Allocate */
mir_foreach_block(ctx, block) {
- block->live_in = rzalloc_array(ctx, uint16_t, ctx->temp_count);
- block->live_out = rzalloc_array(ctx, uint16_t, ctx->temp_count);
+ block->live_in = rzalloc_array(NULL, uint16_t, ctx->temp_count);
+ block->live_out = rzalloc_array(NULL, uint16_t, ctx->temp_count);
}
/* Initialize the work list with the exit block */
@@ -154,20 +158,19 @@ mir_compute_liveness(compiler_context *ctx)
/* If we made progress, we need to process the predecessors */
- if (progress || !blk->visited) {
+ if (progress || !_mesa_set_search(visited, blk)) {
mir_foreach_predecessor(blk, pred)
_mesa_set_add(work_list, pred);
}
- blk->visited = true;
+ _mesa_set_add(visited, blk);
} while((cur = _mesa_set_next_entry(work_list, NULL)) != NULL);
+ _mesa_set_destroy(visited, NULL);
+ _mesa_set_destroy(work_list, NULL);
+
/* Liveness is now valid */
ctx->metadata |= MIDGARD_METADATA_LIVENESS;
-
- mir_foreach_block(ctx, block) {
- block->visited = false;
- }
}
/* Once liveness data is no longer valid, call this */