pan/bi: Add branch constant field to IR
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Thu, 28 May 2020 16:53:22 +0000 (12:53 -0400)
committerMarge Bot <eric+marge@anholt.net>
Fri, 29 May 2020 20:34:55 +0000 (20:34 +0000)
The offsets used for branches need some extra bits twiddled, so add a
field to the clause to indicate this is happening. This is not ambiguous
since a clause can only have a single branch.

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

src/panfrost/bifrost/bi_print.c
src/panfrost/bifrost/compiler.h

index 681075c6c7eb7b3e560a3363ce3372b3aa06512d..7b8164e4f43367d8f7640512676e6697450c25ca 100644 (file)
@@ -479,6 +479,9 @@ bi_print_clause(bi_clause *clause, FILE *fp)
                 for (unsigned i = 0; i < clause->constant_count; ++i)
                         fprintf(fp, "%" PRIx64 " ", clause->constants[i]);
 
+                if (clause->branch_constant)
+                        fprintf(fp, "*");
+
                 fprintf(fp, "\n");
         }
 }
index b1f7887e58706de036dc8008f5aab03a61a9921d..fb95c6d83df8350153feda0a3b1f0ade45210f65 100644 (file)
@@ -376,6 +376,12 @@ typedef struct {
         uint64_t constants[8];
         unsigned constant_count;
 
+        /* Branches encode a constant offset relative to the program counter
+         * with some magic flags. By convention, if there is a branch, its
+         * constant will be last. Set this flag to indicate this is required.
+         */
+        bool branch_constant;
+
         /* What type of high latency instruction is here, basically */
         unsigned clause_type;
 } bi_clause;