* returns whether progress was made. */
static void
-bi_liveness_ins_update_ra(uint8_t *live, bi_instr *ins, unsigned max)
+bi_liveness_ins_update_ra(uint8_t *live, bi_instr *ins)
{
/* live_in[s] = GEN[s] + (live_out[s] - KILL[s]) */
memcpy(live, blk->live_out, temp_count);
bi_foreach_instr_in_block_rev(blk, ins)
- bi_liveness_ins_update_ra(live, ins, temp_count);
+ bi_liveness_ins_update_ra(live, ins);
/* To figure out progress, diff live_in */
static void
bi_compute_liveness_ra(bi_context *ctx)
{
- unsigned temp_count = bi_max_temp(ctx);
-
u_worklist worklist;
bi_worklist_init(ctx, &worklist);
if (block->live_out)
ralloc_free(block->live_out);
- block->live_in = rzalloc_array(block, uint8_t, temp_count);
- block->live_out = rzalloc_array(block, uint8_t, temp_count);
+ block->live_in = rzalloc_array(block, uint8_t, ctx->ssa_alloc);
+ block->live_out = rzalloc_array(block, uint8_t, ctx->ssa_alloc);
bi_worklist_push_tail(&worklist, block);
}
/* Update liveness information. If we made progress, we need to
* reprocess the predecessors
*/
- if (liveness_block_update(blk, temp_count)) {
+ if (liveness_block_update(blk, ctx->ssa_alloc)) {
bi_foreach_predecessor(blk, pred)
bi_worklist_push_head(&worklist, *pred);
}
/* Update live_in */
preload_live = bi_postra_liveness_ins(preload_live, ins);
- bi_liveness_ins_update_ra(live, ins, node_count);
+ bi_liveness_ins_update_ra(live, ins);
}
block->reg_live_in = preload_live;
static void
bi_compute_interference(bi_context *ctx, struct lcra_state *l, bool full_regs)
{
- unsigned node_count = bi_max_temp(ctx);
-
bi_compute_liveness_ra(ctx);
bi_postra_liveness(ctx);
bi_foreach_block_rev(ctx, blk) {
- uint8_t *live = mem_dup(blk->live_out, node_count);
+ uint8_t *live = mem_dup(blk->live_out, ctx->ssa_alloc);
bi_mark_interference(blk, l, live, blk->reg_live_out,
- node_count, ctx->inputs->is_blend, !full_regs,
- ctx->arch >= 9);
+ ctx->ssa_alloc, ctx->inputs->is_blend,
+ !full_regs, ctx->arch >= 9);
free(live);
}
static struct lcra_state *
bi_allocate_registers(bi_context *ctx, bool *success, bool full_regs)
{
- unsigned node_count = bi_max_temp(ctx);
- struct lcra_state *l = lcra_alloc_equations(node_count);
+ struct lcra_state *l = lcra_alloc_equations(ctx->ssa_alloc);
/* Blend shaders are restricted to R0-R15. Other shaders at full
* occupancy also can access R48-R63. At half occupancy they can access
ASSERTED bool is_offset = (index.offset > 0) &&
(index.type != BI_INDEX_FAU);
- unsigned node_count = bi_max_temp(ctx);
/* Did we run RA for this index at all */
if (!bi_is_ssa(index)) {
free(remap);
/* After generating a pile of moves, clean up */
- unsigned temp_count = bi_max_temp(ctx);
-
bi_compute_liveness_ra(ctx);
bi_foreach_block_rev(ctx, block) {
- uint8_t *live = rzalloc_array(block, uint8_t, temp_count);
+ uint8_t *live = rzalloc_array(block, uint8_t, ctx->ssa_alloc);
bi_foreach_successor(block, succ) {
- for (unsigned i = 0; i < temp_count; ++i)
+ for (unsigned i = 0; i < ctx->ssa_alloc; ++i)
live[i] |= succ->live_in[i];
}
if (all_null && !bi_side_effects(ins))
bi_remove_instruction(ins);
else
- bi_liveness_ins_update_ra(live, ins, temp_count);
+ bi_liveness_ins_update_ra(live, ins);
}
ralloc_free(block->live_in);