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 */
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);
}
}