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:
committed by
Marge Bot
parent
62239f68b7
commit
eca516ebdb
@@ -807,6 +807,21 @@ bi_last_instr_in_clause(bi_clause *clause)
|
||||
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
|
||||
bi_before_clause(bi_clause *clause)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user