From: Urja Rannikko Date: Fri, 6 Dec 2019 02:41:31 +0000 (+0000) Subject: panfrost: add lcra_free() to free lcra state X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=12e393bacf02e45bded02375aabc8329d42bb085;p=mesa.git panfrost: add lcra_free() to free lcra state Signed-off-by: Urja Rannikko Reviewed-by: Alyssa Rosenzweig --- diff --git a/src/panfrost/midgard/lcra.c b/src/panfrost/midgard/lcra.c index f5e2ff2d8fe..7c0a3a96bab 100644 --- a/src/panfrost/midgard/lcra.c +++ b/src/panfrost/midgard/lcra.c @@ -66,6 +66,22 @@ lcra_alloc_equations( return l; } +void +lcra_free(struct lcra_state *l) +{ + free(l->alignment); + free(l->linear); + free(l->modulus); + free(l->class); + free(l->class_start); + free(l->class_disjoint); + free(l->class_size); + free(l->spill_cost); + free(l->solutions); + + free(l); +} + void lcra_set_alignment(struct lcra_state *l, unsigned node, unsigned align_log2) { diff --git a/src/panfrost/midgard/lcra.h b/src/panfrost/midgard/lcra.h index a9bdd57026c..68afc4a848e 100644 --- a/src/panfrost/midgard/lcra.h +++ b/src/panfrost/midgard/lcra.h @@ -85,6 +85,8 @@ lcra_alloc_equations( unsigned min_alignment, unsigned max_alignment, unsigned bound, unsigned class_count); +void +lcra_free(struct lcra_state *l); void lcra_set_disjoint_class(struct lcra_state *l, unsigned c1, unsigned c2); diff --git a/src/panfrost/midgard/midgard_schedule.c b/src/panfrost/midgard/midgard_schedule.c index 5e6ac15e539..dcf3764d688 100644 --- a/src/panfrost/midgard/midgard_schedule.c +++ b/src/panfrost/midgard/midgard_schedule.c @@ -1427,7 +1427,11 @@ schedule_program(compiler_context *ctx) mir_squeeze_index(ctx); mir_invalidate_liveness(ctx); - l = NULL; + if (l) { + lcra_free(l); + l = NULL; + } + l = allocate_registers(ctx, &spilled); } while(spilled && ((iter_count--) > 0)); @@ -1442,4 +1446,6 @@ schedule_program(compiler_context *ctx) ctx->tls_size = spill_count * 16; install_registers(ctx, l); + + lcra_free(l); }