agx: add helpers for multiblock unit tests

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28483>
This commit is contained in:
Alyssa Rosenzweig 2024-02-22 08:42:39 -04:00 committed by Marge Bot
parent a181f3caf4
commit 0dbf1b48d1

View file

@ -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.
*/