From b43b1535e25b3e7ec59065235ccc466c7de42dd3 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 14 Oct 2020 20:45:19 -0400 Subject: [PATCH] pan/bi: Implement spilling Now that all the helpers are in place, we can wire it up. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/bi_ra.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/panfrost/bifrost/bi_ra.c b/src/panfrost/bifrost/bi_ra.c index 82ecb3c3c09..b5869696791 100644 --- a/src/panfrost/bifrost/bi_ra.c +++ b/src/panfrost/bifrost/bi_ra.c @@ -349,6 +349,9 @@ bi_register_allocate(bi_context *ctx) 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 @@ bi_register_allocate(bi_context *ctx) 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);