ir3: Add loop depth to ir3_block

And while we're at it, fix adding loop_id for the continue block.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12033>
This commit is contained in:
Connor Abbott 2021-07-23 13:05:50 +02:00 committed by Marge Bot
parent 7d3e5dc487
commit be3ab7ded4
3 changed files with 7 additions and 0 deletions

View file

@ -588,6 +588,7 @@ struct ir3_block {
uint32_t dom_post_index;
uint32_t loop_id;
uint32_t loop_depth;
#ifdef DEBUG
uint32_t serialno;

View file

@ -2984,6 +2984,7 @@ emit_block(struct ir3_context *ctx, nir_block *nblock)
list_addtail(&ctx->block->node, &ctx->ir->block_list);
ctx->block->loop_id = ctx->loop_id;
ctx->block->loop_depth = ctx->loop_depth;
/* re-emit addr register in each block if needed: */
for (int i = 0; i < ARRAY_SIZE(ctx->addr0_ht); i++) {
@ -3056,6 +3057,7 @@ emit_loop(struct ir3_context *ctx, nir_loop *nloop)
{
unsigned old_loop_id = ctx->loop_id;
ctx->loop_id = ctx->so->loops + 1;
ctx->loop_depth++;
struct nir_block *nstart = nir_loop_first_block(nloop);
struct ir3_block *continue_blk = NULL;
@ -3075,10 +3077,13 @@ emit_loop(struct ir3_context *ctx, nir_loop *nloop)
struct ir3_block *start = get_block(ctx, nstart);
continue_blk->successors[0] = start;
continue_blk->physical_successors[0] = start;
continue_blk->loop_id = ctx->loop_id;
continue_blk->loop_depth = ctx->loop_depth;
list_addtail(&continue_blk->node, &ctx->ir->block_list);
}
ctx->so->loops++;
ctx->loop_depth--;
ctx->loop_id = old_loop_id;
}

View file

@ -114,6 +114,7 @@ struct ir3_context {
unsigned stack, max_stack;
unsigned loop_id;
unsigned loop_depth;
/* a common pattern for indirect addressing is to request the
* same address register multiple times. To avoid generating