}
void
-process_block(spill_ctx& ctx, unsigned block_idx, Block* block,
- std::map<Temp, uint32_t>& current_spills, RegisterDemand spilled_registers)
+process_block(spill_ctx& ctx, unsigned block_idx, Block* block, RegisterDemand spilled_registers)
{
assert(!ctx.processed[block_idx]);
/* We won't use local_next_use_distance, so no initialization needed */
}
+ auto& current_spills = ctx.spills_exit[block_idx];
+
while (idx < block->instructions.size()) {
aco_ptr<Instruction>& instr = block->instructions[idx];
bool can_rematerialize = ctx.remat.count(pair.first);
if (((pair.second > distance && can_rematerialize == do_rematerialize) ||
(can_rematerialize && !do_rematerialize && pair.second > idx)) &&
- current_spills.find(pair.first) == current_spills.end() &&
- ctx.spills_exit[block_idx].find(pair.first) ==
- ctx.spills_exit[block_idx].end()) {
+ current_spills.find(pair.first) == current_spills.end()) {
to_spill = pair.first;
distance = pair.second;
do_rematerialize = can_rematerialize;
}
block->instructions = std::move(instructions);
- ctx.spills_exit[block_idx].insert(current_spills.begin(), current_spills.end());
}
void
add_coupling_code(ctx, block, block_idx);
}
- std::map<Temp, uint32_t> current_spills = ctx.spills_entry[block_idx];
+ const std::map<Temp, uint32_t>& current_spills = ctx.spills_entry[block_idx];
/* check conditions to process this block */
bool process = (block->register_demand - spilled_registers).exceeds(ctx.target_pressure) ||
process = true;
}
- if (process)
- process_block(ctx, block_idx, block, current_spills, spilled_registers);
- else
- ctx.spills_exit[block_idx].insert(current_spills.begin(), current_spills.end());
+ assert(ctx.spills_exit[block_idx].empty());
+ ctx.spills_exit[block_idx] = current_spills;
+ if (process) {
+ process_block(ctx, block_idx, block, spilled_registers);
+ }
ctx.processed[block_idx] = true;