diff --git a/src/asahi/compiler/test/agx_test.h b/src/asahi/compiler/test/agx_test.h index 3ac0cd913b9..bed608853c9 100644 --- a/src/asahi/compiler/test/agx_test.h +++ b/src/asahi/compiler/test/agx_test.h @@ -20,6 +20,7 @@ agx_test_builder(void *memctx) agx_block *blk = rzalloc(ctx, agx_block); util_dynarray_init(&blk->predecessors, NULL); + ctx->num_blocks = 1; list_addtail(&blk->link, &ctx->blocks); list_inithead(&blk->instructions); @@ -31,6 +32,20 @@ agx_test_builder(void *memctx) return b; } +static inline agx_block * +agx_test_block(agx_context *ctx) +{ + agx_block *blk = rzalloc(ctx, agx_block); + + util_dynarray_init(&blk->predecessors, blk); + list_addtail(&blk->link, &ctx->blocks); + list_inithead(&blk->instructions); + + blk->index = ctx->num_blocks++; + + return blk; +} + /* Helper to compare for logical equality of instructions. Need to compare the * pointers, then compare raw data. */