pan/midgard: Extend default_phys_reg to !32-bit
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Thu, 31 Oct 2019 18:57:54 +0000 (14:57 -0400)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 4 Nov 2019 20:36:08 +0000 (15:36 -0500)
We can pass through a size.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/panfrost/midgard/midgard_ra.c

index 87eedfd7c2eb17f0e031759677bfd296de21489a..2589aa5f41a910c3e1c53fbc613a61a04673d400 100644 (file)
@@ -98,12 +98,12 @@ offset_swizzle(unsigned *swizzle, unsigned reg_offset, unsigned srcsize, unsigne
 /* Helper to return the default phys_reg for a given register */
 
 static struct phys_reg
-default_phys_reg(int reg)
+default_phys_reg(int reg, midgard_reg_mode size)
 {
         struct phys_reg r = {
                 .reg = reg,
                 .offset = 0,
-                .size = 4
+                .size = mir_bytes_for_mode(size)
         };
 
         return r;
@@ -117,11 +117,11 @@ index_to_reg(compiler_context *ctx, struct ra_graph *g, unsigned reg, midgard_re
 {
         /* Check for special cases */
         if (reg == ~0)
-                return default_phys_reg(REGISTER_UNUSED);
+                return default_phys_reg(REGISTER_UNUSED, size);
         else if (reg >= SSA_FIXED_MINIMUM)
-                return default_phys_reg(SSA_REG_FROM_FIXED(reg));
+                return default_phys_reg(SSA_REG_FROM_FIXED(reg), size);
         else if (!g)
-                return default_phys_reg(REGISTER_UNUSED);
+                return default_phys_reg(REGISTER_UNUSED, size);
 
         /* Special cases aside, we pick the underlying register */
         int virt = ra_get_node_reg(g, reg);