Mesa (main): pan/bi: Extract bit_block helper
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Jun 1 16:29:30 UTC 2022
Module: Mesa
Branch: main
Commit: d7c6b7c9d2e354ec17cc1d8b38d0010fec5ea679
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d7c6b7c9d2e354ec17cc1d8b38d0010fec5ea679
Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date: Fri May 20 11:09:43 2022 -0400
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 at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16804>
---
src/panfrost/bifrost/bi_test.h | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
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,19 +32,28 @@
#include "compiler.h"
/* Helper to generate a bi_builder suitable for creating test instructions */
+static inline bi_block *
+bit_block(bi_context *ctx)
+{
+ 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->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);
+ bi_block *blk = bit_block(ctx);
bi_builder *b = rzalloc(memctx, bi_builder);
b->shader = ctx;
More information about the mesa-commit
mailing list