pan/bi: Move bi_next_clause to bir.c

Not really packing specific anyway.

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:
Alyssa Rosenzweig 2021-01-08 22:57:53 -05:00 committed by Marge Bot
parent 2492074d3d
commit 19b195d3bf
3 changed files with 25 additions and 24 deletions

View File

@ -635,30 +635,6 @@ bi_pack_clause(bi_context *ctx, bi_clause *clause,
}
}
static bi_clause *
bi_next_clause(bi_context *ctx, pan_block *block, bi_clause *clause)
{
/* Try the first clause in this block if we're starting from scratch */
if (!clause && !list_is_empty(&((bi_block *) block)->clauses))
return list_first_entry(&((bi_block *) block)->clauses, bi_clause, link);
/* Try the next clause in this block */
if (clause && clause->link.next != &((bi_block *) block)->clauses)
return list_first_entry(&(clause->link), bi_clause, link);
/* Try the next block, or the one after that if it's empty, etc .*/
pan_block *next_block = pan_next_block(block);
bi_foreach_block_from(ctx, next_block, block) {
bi_block *blk = (bi_block *) block;
if (!list_is_empty(&blk->clauses))
return list_first_entry(&(blk->clauses), bi_clause, link);
}
return NULL;
}
/* We should terminate discarded threads if there may be discarded threads (a
* fragment shader) and helper invocations are not used. Further logic may be
* required for future discard/demote differentiation

View File

@ -128,3 +128,27 @@ bi_writemask(bi_instr *ins)
unsigned shift = ins->dest[0].offset * 4; /* 32-bit words */
return (mask << shift);
}
bi_clause *
bi_next_clause(bi_context *ctx, pan_block *block, bi_clause *clause)
{
/* Try the first clause in this block if we're starting from scratch */
if (!clause && !list_is_empty(&((bi_block *) block)->clauses))
return list_first_entry(&((bi_block *) block)->clauses, bi_clause, link);
/* Try the next clause in this block */
if (clause && clause->link.next != &((bi_block *) block)->clauses)
return list_first_entry(&(clause->link), bi_clause, link);
/* Try the next block, or the one after that if it's empty, etc .*/
pan_block *next_block = pan_next_block(block);
bi_foreach_block_from(ctx, next_block, block) {
bi_block *blk = (bi_block *) block;
if (!list_is_empty(&blk->clauses))
return list_first_entry(&(blk->clauses), bi_clause, link);
}
return NULL;
}

View File

@ -692,6 +692,7 @@ bool bi_has_arg(bi_instr *ins, bi_index arg);
unsigned bi_count_read_registers(bi_instr *ins, unsigned src);
uint16_t bi_bytemask_of_read_components(bi_instr *ins, bi_index node);
unsigned bi_writemask(bi_instr *ins);
bi_clause * bi_next_clause(bi_context *ctx, pan_block *block, bi_clause *clause);
void bi_print_instr(bi_instr *I, FILE *fp);
void bi_print_slots(bi_registers *regs, FILE *fp);