panfrost: Track preloaded registers
authorAlyssa Rosenzweig <alyssa@collabora.com>
Thu, 9 Dec 2021 21:50:21 +0000 (16:50 -0500)
committerMarge Bot <emma+marge@anholt.net>
Mon, 20 Dec 2021 18:21:40 +0000 (18:21 +0000)
We already collect this information. We may as well make use of it.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14154>

src/panfrost/bifrost/bifrost_compile.c
src/panfrost/util/pan_ir.h

index 9333550..a5478a5 100644 (file)
@@ -3830,6 +3830,10 @@ bifrost_compile_shader_nir(nir_shader *nir,
         /* Analyze after scheduling since we depend on instruction order. */
         bi_analyze_helper_terminate(ctx);
 
+        /* A register is preloaded <==> it is live before the first block */
+        bi_block *first_block = list_first_entry(&ctx->blocks, bi_block, link);
+        info->preload = first_block->reg_live_in;
+
         if (bifrost_debug & BIFROST_DBG_SHADERS && !skip_internal)
                 bi_print_shader(ctx, stdout);
 
index 8d6bb1f..a5b8b60 100644 (file)
@@ -204,6 +204,9 @@ struct pan_shader_info {
         unsigned tls_size;
         unsigned wls_size;
 
+        /* Bit mask of preloaded registers */
+        uint64_t preload;
+
         union {
                 struct {
                         bool reads_frag_coord;