aboutsummaryrefslogtreecommitdiffstats
path: root/src/panfrost
diff options
context:
space:
mode:
authorUrja Rannikko <[email protected]>2019-12-06 02:41:31 +0000
committerAlyssa Rosenzweig <[email protected]>2019-12-06 15:26:13 +0000
commit12e393bacf02e45bded02375aabc8329d42bb085 (patch)
treee7330cc6a20230a3ea00d25489d463993e1fcbb8 /src/panfrost
parent5b6108834bddd34846722440b40b459b81a95cd8 (diff)
panfrost: add lcra_free() to free lcra state
Signed-off-by: Urja Rannikko <[email protected]> Reviewed-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/panfrost')
-rw-r--r--src/panfrost/midgard/lcra.c16
-rw-r--r--src/panfrost/midgard/lcra.h2
-rw-r--r--src/panfrost/midgard/midgard_schedule.c8
3 files changed, 25 insertions, 1 deletions
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
@@ -67,6 +67,22 @@ lcra_alloc_equations(
}
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)
{
l->alignment[node] = align_log2 + 1;
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);
}