pan/bi: Extract bit_block helper
Convenience for unit tests which need to create multiple blocks, to test global passes. Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16804>
This commit is contained in:
parent
b0edd92156
commit
d7c6b7c9d2
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue