pan/midgard: Move bounds checking into LCRA

This simplifies the cost calculation code a bit.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
This commit is contained in:
Alyssa Rosenzweig
2019-12-06 11:38:10 -05:00
parent e985ae25a6
commit 3c0f1ea58c
2 changed files with 5 additions and 9 deletions
+2 -1
View File
@@ -197,7 +197,8 @@ lcra_solve(struct lcra_state *l)
void
lcra_set_node_spill_cost(struct lcra_state *l, unsigned node, signed cost)
{
l->spill_cost[node] = cost;
if (node < l->node_count)
l->spill_cost[node] = cost;
}
/* Count along the lower triangle */
+3 -8
View File
@@ -689,15 +689,10 @@ mir_choose_spill_node(
mir_foreach_instr_global(ctx, ins) {
if (ins->no_spill) {
if (ins->dest < ctx->temp_count)
lcra_set_node_spill_cost(l, ins->dest, -1);
lcra_set_node_spill_cost(l, ins->dest, -1);
mir_foreach_src(ins, s) {
unsigned src = ins->src[s];
if (src < ctx->temp_count)
lcra_set_node_spill_cost(l, src, -1);
}
mir_foreach_src(ins, s)
lcra_set_node_spill_cost(l, ins->src[s], -1);
}
}