- if (rld->rematted_node != NULL) {
- new_val = rld->rematted_node;
- remats++;
- sched_add_before(rld->reloader, new_val);
+ remat_cost_delta = remat_cost - env->reload_cost;
+ rld->remat_cost_delta = remat_cost_delta;
+ block = is_Block(reloader) ? reloader : get_nodes_block(reloader);
+ freq = get_block_execfreq(exec_freq, block);
+ all_remat_costs += remat_cost_delta * freq;
+ DBG((dbg, LEVEL_2, "\tremat costs delta before %+F: "
+ "%d (rel %f)\n", reloader, remat_cost_delta,
+ remat_cost_delta * freq));
+ }
+ if(all_remat_costs < REMAT_COST_INFINITE) {
+ ir_node *block = get_nodes_block(to_spill);
+ double freq = get_block_execfreq(exec_freq, block);
+ /* we don't need the costs for the spill if we can remat
+ all reloaders */
+ all_remat_costs -= env->spill_cost * freq;
+
+ DBG((dbg, LEVEL_2, "\tspill costs %d (rel %f)\n",
+ env->spill_cost, env->spill_cost * freq));