pan/bi: Use bi_worklist for post-RA liveness

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16279>
This commit is contained in:
Alyssa Rosenzweig 2022-04-19 14:06:09 -04:00 committed by Marge Bot
parent 9ca625cf24
commit dbe4947c66

View file

@ -115,40 +115,29 @@ bi_postra_liveness_block(bi_block *blk)
void
bi_postra_liveness(bi_context *ctx)
{
struct set *work_list = _mesa_set_create(NULL,
_mesa_hash_pointer,
_mesa_key_pointer_equal);
struct set *visited = _mesa_set_create(NULL,
_mesa_hash_pointer,
_mesa_key_pointer_equal);
struct set_entry *cur;
cur = _mesa_set_add(work_list, pan_exit_block(&ctx->blocks));
u_worklist worklist;
bi_worklist_init(ctx, &worklist);
bi_foreach_block(ctx, block) {
block->reg_live_out = block->reg_live_in = 0;
bi_worklist_push_tail(&worklist, block);
}
do {
bi_block *blk = (struct bi_block *) cur->key;
_mesa_set_remove(work_list, cur);
while (!u_worklist_is_empty(&worklist)) {
/* Pop off in reverse order since liveness is backwards */
bi_block *blk = bi_worklist_pop_tail(&worklist);
/* Update its liveness information */
bool progress = bi_postra_liveness_block(blk);
/* If we made progress, we need to process the predecessors */
if (progress || !_mesa_set_search(visited, blk)) {
bi_foreach_predecessor((blk), pred)
_mesa_set_add(work_list, pred);
/* Update liveness information. If we made progress, we need to
* reprocess the predecessors
*/
if (bi_postra_liveness_block(blk)) {
bi_foreach_predecessor(blk, pred)
bi_worklist_push_head(&worklist, pred);
}
}
_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);
u_worklist_fini(&worklist);
}
void