pan/bi: Implement spilling

Now that all the helpers are in place, we can wire it up.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7206>
diff --git a/src/panfrost/bifrost/bi_ra.c b/src/panfrost/bifrost/bi_ra.c
index 82ecb3c..b586969 100644
--- a/src/panfrost/bifrost/bi_ra.c
+++ b/src/panfrost/bifrost/bi_ra.c
@@ -349,6 +349,9 @@
 
         unsigned iter_count = 100; /* max iterations */
 
+        /* Number of bytes of memory we've spilled into */
+        unsigned spill_count = 0;
+
         /* For instructions that both read and write from a data register, it's
          * the *same* data register. We enforce that constraint by just doing a
          * quick rewrite. TODO: are there cases where this causes RA to have no
@@ -372,13 +375,15 @@
                         if (spill_node == -1)
                                 unreachable("Failed to choose spill node\n");
 
-                        unreachable("Spilling not implemented");
+                        spill_count += bi_spill_register(ctx, spill_node, spill_count);
                 }
 
                 bi_invalidate_liveness(ctx);
                 l = bi_allocate_registers(ctx, &success);
         } while(!success && ((iter_count--) > 0));
 
+        assert(success);
+
         bi_install_registers(ctx, l);
 
         lcra_free(l);