ir_node *instr; /**< current instruction */
unsigned instr_nr; /**< current instruction number (relative to block start) */
pset *used; /**< holds the values used (so far) in the current BB */
ir_node *instr; /**< current instruction */
unsigned instr_nr; /**< current instruction number (relative to block start) */
pset *used; /**< holds the values used (so far) in the current BB */
ir_node *arg = get_irn_n(irn, o);
ir_node *pred_block = get_Block_cfgpred_block(get_nodes_block(irn), o);
ir_node *cpy = be_new_Copy(bel->cls, irg, pred_block, arg);
ir_node *arg = get_irn_n(irn, o);
ir_node *pred_block = get_Block_cfgpred_block(get_nodes_block(irn), o);
ir_node *cpy = be_new_Copy(bel->cls, irg, pred_block, arg);
DBG((dbg, DBG_START, " place a %+F of %+F in %+F\n", cpy, arg, pred_block));
sched_add_before(pred_block, cpy);
set_irn_n(irn, o, cpy);
DBG((dbg, DBG_START, " place a %+F of %+F in %+F\n", cpy, arg, pred_block));
sched_add_before(pred_block, cpy);
set_irn_n(irn, o, cpy);
* Removes all used reloads from bel->reloads.
* The remaining nodes in bel->reloads will be removed from the graph.
*/
* Removes all used reloads from bel->reloads.
* The remaining nodes in bel->reloads will be removed from the graph.
*/
pset *rlds = (pset *)env;
if (pset_find_ptr(rlds, irn))
pset_remove_ptr(rlds, irn);
pset *rlds = (pset *)env;
if (pset_find_ptr(rlds, irn))
pset_remove_ptr(rlds, irn);
assert(get_irn_n_edges(irn) == 1 && "This is not a copy introduced in 'compute_block_start_info()'. Who created it?");
spill = get_irn_edge(get_irn_irg(irn), irn, 0)->src;
assert(get_irn_n_edges(irn) == 1 && "This is not a copy introduced in 'compute_block_start_info()'. Who created it?");
spill = get_irn_edge(get_irn_irg(irn), irn, 0)->src;
* Finds all unused reloads and remove them from the schedule
* Also removes spills if they are not used anymore after removing reloads
*/
* Finds all unused reloads and remove them from the schedule
* Also removes spills if they are not used anymore after removing reloads
*/
- irg_walk_graph(irg, rescue_used_reloads_and_remove_copies, NULL, bel->reloads);
+ irg_walk_graph(irg, rescue_used_reloads, NULL, bel->reloads);
for(irn = pset_first(bel->reloads); irn; irn = pset_next(bel->reloads)) {
ir_node *spill;
DBG((dbg, DBG_SPILL, "Removing %+F before %+F in %+F\n", irn, sched_next(irn), get_nodes_block(irn)));
for(irn = pset_first(bel->reloads); irn; irn = pset_next(bel->reloads)) {
ir_node *spill;
DBG((dbg, DBG_SPILL, "Removing %+F before %+F in %+F\n", irn, sched_next(irn), get_nodes_block(irn)));
bel.uses = be_begin_uses(chordal_env->irg, chordal_env->main_env->arch_env, bel.cls);
bel.senv = be_new_spill_env(dbg, chordal_env, is_mem_phi, NULL);
bel.reloads = pset_new_ptr_default();
bel.uses = be_begin_uses(chordal_env->irg, chordal_env->main_env->arch_env, bel.cls);
bel.senv = be_new_spill_env(dbg, chordal_env, is_mem_phi, NULL);
bel.reloads = pset_new_ptr_default();
/* do the work */
irg_block_walk_graph(chordal_env->irg, compute_block_start_info, NULL, &bel);
irg_block_walk_graph(chordal_env->irg, belady, NULL, &bel);
irg_block_walk_graph(chordal_env->irg, fix_block_borders, NULL, &bel);
be_insert_spills_reloads(bel.senv, bel.reloads);
/* do the work */
irg_block_walk_graph(chordal_env->irg, compute_block_start_info, NULL, &bel);
irg_block_walk_graph(chordal_env->irg, belady, NULL, &bel);
irg_block_walk_graph(chordal_env->irg, fix_block_borders, NULL, &bel);
be_insert_spills_reloads(bel.senv, bel.reloads);