Mesa (main): agx: Count read registers as well

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jul 7 03:41:57 UTC 2021


Module: Mesa
Branch: main
Commit: 15b49a6795e9fad4497940705987005278bf17a1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=15b49a6795e9fad4497940705987005278bf17a1

Author: Alyssa Rosenzweig <alyssa at rosenzweig.io>
Date:   Sat Jun 19 14:33:30 2021 -0400

agx: Count read registers as well

Signed-off-by: Alyssa Rosenzweig <alyssa at rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11751>

---

 src/asahi/compiler/agx_register_allocate.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/asahi/compiler/agx_register_allocate.c b/src/asahi/compiler/agx_register_allocate.c
index f110af35e3b..0977d2be2d5 100644
--- a/src/asahi/compiler/agx_register_allocate.c
+++ b/src/asahi/compiler/agx_register_allocate.c
@@ -30,6 +30,20 @@
  * TODO: Handle phi nodes.
  */
 
+/** Returns number of registers read by an instruction. TODO: 16-bit */
+static unsigned
+agx_read_registers(agx_instr *I, unsigned s)
+{
+   unsigned size = I->src[s].size == AGX_SIZE_32 ? 2 : 1;
+
+   switch (I->op) {
+   case AGX_OPCODE_DEVICE_LOAD:
+      return 8;
+   default:
+      return size;
+   }
+}
+
 /** Returns number of registers written by an instruction */
 static unsigned
 agx_write_registers(agx_instr *I, unsigned d)



More information about the mesa-commit mailing list