Mesa (master): freedreno/ir3/ra: add helper to map name to array
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sat Mar 28 00:15:16 UTC 2020
Module: Mesa
Branch: master
Commit: 0e7d24b532e1a52cb5b3da36d1ed5b2204fb0acb
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0e7d24b532e1a52cb5b3da36d1ed5b2204fb0acb
Author: Rob Clark <robdclark at chromium.org>
Date: Sat Mar 21 11:25:36 2020 -0700
freedreno/ir3/ra: add helper to map name to array
For vreg names that refer to arrays rather than SSA values, this is the
counterpart to name_to_instr().
Signed-off-by: Rob Clark <robdclark at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4272>
---
src/freedreno/ir3/ir3_ra.c | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/src/freedreno/ir3/ir3_ra.c b/src/freedreno/ir3/ir3_ra.c
index df5f115c0b3..ccba90be552 100644
--- a/src/freedreno/ir3/ir3_ra.c
+++ b/src/freedreno/ir3/ir3_ra.c
@@ -105,6 +105,9 @@
static struct ir3_instruction * name_to_instr(struct ir3_ra_ctx *ctx, unsigned name);
+static bool name_is_array(struct ir3_ra_ctx *ctx, unsigned name);
+static struct ir3_array * name_to_array(struct ir3_ra_ctx *ctx, unsigned name);
+
/* does it conflict? */
static inline bool
intersects(unsigned a_start, unsigned a_end, unsigned b_start, unsigned b_end)
@@ -500,10 +503,30 @@ ra_init(struct ir3_ra_ctx *ctx)
static struct ir3_instruction *
name_to_instr(struct ir3_ra_ctx *ctx, unsigned name)
{
+ assert(!name_is_array(ctx, name));
struct hash_entry *entry = _mesa_hash_table_search(ctx->name_to_instr, &name);
if (entry)
return entry->data;
- unreachable("invalid name");
+ unreachable("invalid instr name");
+ return NULL;
+}
+
+static bool
+name_is_array(struct ir3_ra_ctx *ctx, unsigned name)
+{
+ return name >= ctx->class_base[total_class_count];
+}
+
+static struct ir3_array *
+name_to_array(struct ir3_ra_ctx *ctx, unsigned name)
+{
+ assert(name_is_array(ctx, name));
+ foreach_array (arr, &ctx->ir->array_list) {
+ unsigned sz = reg_size_for_array(arr);
+ if (name < (arr->base + sz))
+ return arr;
+ }
+ unreachable("invalid array name");
return NULL;
}
More information about the mesa-commit
mailing list