From 1cde245f76416791faf96034d9d513019f2dcbe0 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 21 Jul 2021 12:25:53 -0400 Subject: [PATCH] pan/bi: Add discard flag to bi_index Needed to model Valhall instructions. Should also be useful to RA if we ever get around to doing something SSA based. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/bi_printer.c.py | 3 +++ src/panfrost/bifrost/compiler.h | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/panfrost/bifrost/bi_printer.c.py b/src/panfrost/bifrost/bi_printer.c.py index 7016d385dc6..f61e1996e43 100644 --- a/src/panfrost/bifrost/bi_printer.c.py +++ b/src/panfrost/bifrost/bi_printer.c.py @@ -75,6 +75,9 @@ bir_passthrough_name(unsigned idx) static void bi_print_index(FILE *fp, bi_index index) { + if (index.discard) + fputs("`", fp); + if (bi_is_null(index)) fprintf(fp, "_"); else if (index.type == BI_INDEX_CONSTANT) diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h index 8ee2cb17df4..12e89e3fdc2 100644 --- a/src/panfrost/bifrost/compiler.h +++ b/src/panfrost/bifrost/compiler.h @@ -83,6 +83,10 @@ typedef struct { bool abs : 1; bool neg : 1; + /* The last use of a value, should be purged from the register cache. + * Set by liveness analysis. */ + bool discard : 1; + /* For a source, the swizzle. For a destination, acts a bit like a * write mask. Identity for the full 32-bit, H00 for only caring about * the lower half, other values unused. */ @@ -207,6 +211,13 @@ bi_neg(bi_index idx) return idx; } +static inline bi_index +bi_discard(bi_index idx) +{ + idx.discard = true; + return idx; +} + /* Additive identity in IEEE 754 arithmetic */ static inline bi_index bi_negzero()