-/**
- * 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);
+void be_spill_belady_spill_env(be_irg_t *birg, const arch_register_class_t *cls, spill_env_t *spill_env) {
+ belady_env_t env;
+ ir_graph *irg = be_get_birg_irg(birg);
+ int n_regs;