v3d: Add some debug code for forcing register spilling.
authorEric Anholt <eric@anholt.net>
Thu, 2 Aug 2018 00:38:25 +0000 (17:38 -0700)
committerEric Anholt <eric@anholt.net>
Mon, 6 Aug 2018 20:03:23 +0000 (13:03 -0700)
This is useful for periodically testing out register spilling to see how
it goes on simple shaders, rather than only failing on insanely
complicated ones.

src/broadcom/compiler/vir_register_allocate.c

index 5a856acd7ed3052dc6441c5e75ffb63d6621ded2..598c4085235eb042604169f23366c5f11cc325ad 100644 (file)
@@ -520,6 +520,20 @@ v3d_register_allocate(struct v3d_compile *c, bool *spilled)
                 }
         }
 
+        /* Debug code to force a bit of register spilling, for running across
+         * conformance tests to make sure that spilling works.
+         */
+        int force_register_spills = 0;
+        if (c->spill_size < 16 * sizeof(uint32_t) * force_register_spills) {
+                int node = v3d_choose_spill_node(c, g, temp_to_node);
+                if (node != -1) {
+                        v3d_spill_reg(c, map[node].temp);
+                        ralloc_free(g);
+                        *spilled = true;
+                        return NULL;
+                }
+        }
+
         bool ok = ra_allocate(g);
         if (!ok) {
                 /* Try to spill, if we can't reduce threading first. */