+static const ir_op_ops be_node_op_ops = {
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ dump_node,
+ NULL
+};
+
+pset *nodes_live_at(const arch_env_t *arch_env, const arch_register_class_t *cls, const ir_node *pos, pset *live)
+{
+ firm_dbg_module_t *dbg = firm_dbg_register("firm.be.node");
+ ir_node *bl = get_nodes_block(pos);
+ ir_node *irn;
+ irn_live_t *li;
+
+ live_foreach(bl, li) {
+ ir_node *irn = (ir_node *) li->irn;
+ if(live_is_end(li) && arch_irn_consider_in_reg_alloc(arch_env, cls, irn))
+ pset_insert_ptr(live, irn);
+ }
+
+ sched_foreach_reverse(bl, irn) {
+ int i, n;
+ ir_node *x;
+
+ /*
+ * If we encounter the node we want to insert the Perm after,
+ * exit immediately, so that this node is still live
+ */
+ if(irn == pos)
+ return live;
+
+ DBG((dbg, LEVEL_1, "%+F\n", irn));
+ for(x = pset_first(live); x; x = pset_next(live))
+ DBG((dbg, LEVEL_1, "\tlive: %+F\n", x));
+
+ if(arch_irn_has_reg_class(arch_env, irn, -1, cls))
+ pset_remove_ptr(live, irn);
+
+ for(i = 0, n = get_irn_arity(irn); i < n; ++i) {
+ ir_node *op = get_irn_n(irn, i);
+
+ if(arch_irn_consider_in_reg_alloc(arch_env, cls, op))
+ pset_insert_ptr(live, op);
+ }
+ }
+
+ return NULL;
+}