diff --git a/src/panfrost/bifrost/bi_test.h b/src/panfrost/bifrost/bi_test.h index 749947c727f..f20c0b9c09b 100644 --- a/src/panfrost/bifrost/bi_test.h +++ b/src/panfrost/bifrost/bi_test.h @@ -32,20 +32,29 @@ #include "compiler.h" /* Helper to generate a bi_builder suitable for creating test instructions */ -static inline bi_builder * -bit_builder(void *memctx) +static inline bi_block * +bit_block(bi_context *ctx) { - bi_context *ctx = rzalloc(memctx, bi_context); - list_inithead(&ctx->blocks); - ctx->num_blocks = 1; - ctx->inputs = rzalloc(memctx, struct panfrost_compile_inputs); - bi_block *blk = rzalloc(ctx, bi_block); util_dynarray_init(&blk->predecessors, blk); list_addtail(&blk->link, &ctx->blocks); list_inithead(&blk->instructions); + blk->index = ctx->num_blocks++; + + return blk; +} + +static inline bi_builder * +bit_builder(void *memctx) +{ + bi_context *ctx = rzalloc(memctx, bi_context); + list_inithead(&ctx->blocks); + ctx->inputs = rzalloc(memctx, struct panfrost_compile_inputs); + + bi_block *blk = bit_block(ctx); + bi_builder *b = rzalloc(memctx, bi_builder); b->shader = ctx; b->cursor = bi_after_block(blk);