mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-22 09:10:11 +01:00
pan/bi: Add bi_foreach_instr_in_clause iterators
These are convenient for post-sched passes, in particular register allocation. They work by noting the underlying linked list of instructions in the block must be preserved by scheduling. It isn't necessary iterate the clause structure directly, it can simply be used to bound a iteration within the block by recalling clauses are strictly contained in a single block. <alyssa> I don't think I'm enough of a C ninja to write fancy iterator macros yet. <zmike> sometimes those can get pretty mind-bendy Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723>
This commit is contained in:
parent
62239f68b7
commit
eca516ebdb
1 changed files with 15 additions and 0 deletions
|
|
@ -807,6 +807,21 @@ bi_last_instr_in_clause(bi_clause *clause)
|
||||||
return bundle.add ?: bundle.fma;
|
return bundle.add ?: bundle.fma;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Implemented by expanding bi_foreach_instr_in_block_from(_rev) with the start
|
||||||
|
* (end) of the clause and adding a condition for the clause boundary */
|
||||||
|
|
||||||
|
#define bi_foreach_instr_in_clause(block, clause, pos) \
|
||||||
|
for (bi_instr *pos = LIST_ENTRY(bi_instr, bi_first_instr_in_clause(clause), link); \
|
||||||
|
(&pos->link != &(block)->base.instructions) \
|
||||||
|
&& (pos != bi_next_op(bi_last_instr_in_clause(clause))); \
|
||||||
|
pos = LIST_ENTRY(bi_instr, pos->link.next, link))
|
||||||
|
|
||||||
|
#define bi_foreach_instr_in_clause_rev(block, clause, pos) \
|
||||||
|
for (bi_instr *pos = LIST_ENTRY(bi_instr, bi_last_instr_in_clause(clause), link); \
|
||||||
|
(&pos->link != &(block)->base.instructions) \
|
||||||
|
&& pos != bi_prev_op(bi_first_instr_in_clause(clause)); \
|
||||||
|
pos = LIST_ENTRY(bi_instr, pos->link.prev, link))
|
||||||
|
|
||||||
static inline bi_cursor
|
static inline bi_cursor
|
||||||
bi_before_clause(bi_clause *clause)
|
bi_before_clause(bi_clause *clause)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue