From 44f2715777436cc7ef1ae2c7288dc47e1d094b6b Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 19 Apr 2022 13:35:19 -0400 Subject: [PATCH] pan/bi: Use bi_worklist in analyze_helper_requirements Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/bi_helper_invocations.c | 32 ++++++++++------------------ 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/src/panfrost/bifrost/bi_helper_invocations.c b/src/panfrost/bifrost/bi_helper_invocations.c index 327f2d5..fb2f1cc 100644 --- a/src/panfrost/bifrost/bi_helper_invocations.c +++ b/src/panfrost/bifrost/bi_helper_invocations.c @@ -231,33 +231,23 @@ bi_analyze_helper_requirements(bi_context *ctx) } /* Propagate that up */ + u_worklist worklist; + bi_worklist_init(ctx, &worklist); - 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 = _mesa_set_add(work_list, pan_exit_block(&ctx->blocks)); - - do { - bi_block *blk = (struct bi_block *) cur->key; - _mesa_set_remove(work_list, cur); + bi_foreach_block(ctx, block) { + bi_worklist_push_tail(&worklist, block); + } - bool progress = bi_helper_block_update(deps, blk); + while (!u_worklist_is_empty(&worklist)) { + bi_block *blk = bi_worklist_pop_tail(&worklist); - if (progress || !_mesa_set_search(visited, blk)) { + if (bi_helper_block_update(deps, blk)) { bi_foreach_predecessor(blk, pred) - _mesa_set_add(work_list, 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); /* Set the execute bits */ -- 2.7.4