diff options
author | Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> | 2020-05-28 15:01:14 -0400 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2020-05-29 20:34:56 +0000 |
commit | db2c10d0325cc9c127209b11b8c36f2e5625d185 (patch) | |
tree | 75686f1052f4702fe1dd4e5734ecb601cc847730 | |
parent | a42731536d59ec2c028138d303d15c18158e85c9 (diff) |
pan/bi: Measure backwards branches as well
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5260>
-rw-r--r-- | src/panfrost/bifrost/bi_layout.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/panfrost/bifrost/bi_layout.c b/src/panfrost/bifrost/bi_layout.c index 77e97e85ee9..c00cdc760fe 100644 --- a/src/panfrost/bifrost/bi_layout.c +++ b/src/panfrost/bifrost/bi_layout.c @@ -130,7 +130,32 @@ bi_block_offset(bi_context *ctx, bi_clause *start, bi_block *target) } } } else { - unreachable("Backwards branching is to-do"); + /* We start at the beginning of the clause but have to jump + * through the clauses before us in the block */ + bi_foreach_clause_in_block_from_rev(start->block, clause, start) { + if (clause == start) + continue; + + ret -= bi_clause_quadwords(clause); + } + + /* 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; + + if (blk == start->block) + continue; + + bi_foreach_clause_in_block(blk, clause) { + ret -= bi_clause_quadwords(clause); + } + + /* End just after the target */ + if (blk == target) + break; + } } return ret; |