summaryrefslogtreecommitdiffstats
path: root/src/broadcom/compiler/vir_register_allocate.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2018-08-01 17:38:25 -0700
committerEric Anholt <[email protected]>2018-08-06 13:03:23 -0700
commitf9d54dc3cf45ba6f15f74627b8ec527975ce5297 (patch)
treee864030d62daf5ad329f01e83b7ed2fd90fcb65d /src/broadcom/compiler/vir_register_allocate.c
parentaaa41cd297f91583f0e5bddb11b736c0d03e333d (diff)
v3d: Add some debug code for forcing register spilling.
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.
Diffstat (limited to 'src/broadcom/compiler/vir_register_allocate.c')
-rw-r--r--src/broadcom/compiler/vir_register_allocate.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/broadcom/compiler/vir_register_allocate.c b/src/broadcom/compiler/vir_register_allocate.c
index 5a856acd7ed..598c4085235 100644
--- a/src/broadcom/compiler/vir_register_allocate.c
+++ b/src/broadcom/compiler/vir_register_allocate.c
@@ -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. */