+ irn = new_ir_node(NULL, irg, bl, op, get_irn_mode(in), 1, ins);
+ init_node_attr(irn, factory, 1);
+
+ return irn;
+}
+
+ir_node *be_spill(
+ const be_node_factory_t *factory,
+ const arch_env_t *arch_env,
+ ir_node *irn, ir_node *ctx)
+{
+ const arch_register_class_t *cls = arch_get_irn_reg_class(arch_env, irn, -1);
+
+ ir_node *bl = get_nodes_block(irn);
+ ir_graph *irg = get_irn_irg(bl);
+ ir_node *spill = new_Spill(factory, cls, irg, bl, irn, ctx);
+ ir_node *insert;
+
+ /*
+ * search the right insertion point. a spill of a phi cannot be put
+ * directly after the phi, if there are some phis behind the one which
+ * is spilled.
+ */
+ insert = sched_next(irn);
+ while(is_Phi(insert) && !sched_is_end(insert))
+ insert = sched_next(insert);
+
+ sched_add_before(insert, spill);
+ return spill;
+}
+
+ir_node *be_reload(const be_node_factory_t *factory,
+ const arch_env_t *arch_env,
+ const arch_register_class_t *cls,
+ ir_node *irn, int pos, ir_mode *mode, ir_node *spill)
+{
+ ir_node *reload;
+
+ ir_node *bl = get_nodes_block(irn);
+ ir_graph *irg = get_irn_irg(bl);
+
+ assert(is_Spill(factory, spill)
+ || (is_Phi(spill) && get_irn_mode(spill) == mode_M));
+
+ reload = new_Reload(factory, cls, irg, bl, mode, spill);
+
+ set_irn_n(irn, pos, reload);
+ sched_add_before(irn, reload);
+ return reload;