-/**
- * Removes all used reloads from bel->reloads.
- * The remaining nodes in bel->reloads will be removed from the graph.
- */
-static void rescue_used_reloads(ir_node *irn, void *env) {
- pset *rlds = (pset *)env;
- if (pset_find_ptr(rlds, irn))
- pset_remove_ptr(rlds, irn);
-}
-
-/**
- * Removes all copies introduced for phi-spills
- */
-static void remove_copies(belady_env_t *bel) {
- ir_node *irn;
-
- foreach_pset(bel->copies, irn) {
- ir_node *src, *user;
-
- assert(be_is_Copy(irn));
- assert(get_irn_n_edges(irn) == 1 && "This is not a copy introduced in 'compute_block_start_info()'. Who created it?");
-
- user = get_irn_edge(get_irn_irg(irn), irn, 0)->src;
-
- src = be_get_Copy_op(irn);
- set_irn_n(user, 0, src);
- }
-}
-
-/**
- * Finds all unused reloads and remove them from the schedule
- * Also removes spills if they are not used anymore after removing reloads
- */
-static void remove_unused_reloads(ir_graph *irg, belady_env_t *bel) {
- ir_node *irn;
-
- irg_walk_graph(irg, rescue_used_reloads, NULL, bel->reloads);
- foreach_pset(bel->reloads, irn) {
- ir_node *spill;
- DBG((dbg, DBG_SPILL, "Removing %+F before %+F in %+F\n", irn, sched_next(irn), get_nodes_block(irn)));
-
- if (be_is_Reload(irn))
- spill = get_irn_n(irn, be_pos_Reload_mem);
-
- /* remove reload */
- set_irn_n(irn, 0, new_Bad());
- sched_remove(irn);
-
- if (be_is_Reload(irn)) {
- /* if spill not used anymore, remove it too
- * test of regclass is necessary since spill may be a phi-M */
- if (get_irn_n_edges(spill) == 0 && bel->cls == arch_get_irn_reg_class(bel->arch, spill, -1)) {
- set_irn_n(spill, 0, new_Bad());
- sched_remove(spill);
- }
- }
- }
-}
-