-/**
- * Walk through the block schedule and skip all barrier nodes.
- */
-static void skip_barrier(ir_node *ret_blk, ir_graph *irg) {
- ir_node *irn;
-
- sched_foreach_reverse(ret_blk, irn) {
- const ir_edge_t *edge, *next;
-
- if (!be_is_Barrier(irn))
- continue;
-
- foreach_out_edge_safe(irn, edge, next) {
- ir_node *proj = get_edge_src_irn(edge);
- int pn = (int)get_Proj_proj(proj);
- ir_node *pred = get_irn_n(irn, pn);
-
- edges_reroute_kind(proj, pred, EDGE_KIND_NORMAL, irg);
- edges_reroute_kind(proj, pred, EDGE_KIND_DEP, irg);
+bool be_can_move_before(ir_heights_t *heights, const ir_node *node,
+ const ir_node *before)
+{
+ int node_arity = get_irn_arity(node);
+ ir_node *schedpoint = sched_next(node);
+
+ while (schedpoint != before) {
+ int i;
+ unsigned n_outs = arch_get_irn_n_outs(schedpoint);
+
+ /* the node must not use our computed values */
+ if (heights_reachable_in_block(heights, schedpoint, node))
+ return false;
+
+ /* the node must not overwrite registers of our inputs */
+ for (i = 0; i < node_arity; ++i) {
+ ir_node *in = get_irn_n(node, i);
+ const arch_register_t *reg = arch_get_irn_register(in);
+ const arch_register_req_t *in_req
+ = arch_get_irn_register_req_in(node, i);
+ unsigned o;
+ if (reg == NULL)
+ continue;
+ for (o = 0; o < n_outs; ++o) {
+ const arch_register_t *outreg
+ = arch_get_irn_register_out(schedpoint, o);
+ const arch_register_req_t *outreq
+ = arch_get_irn_register_req_out(schedpoint, o);
+ if (outreg == NULL)
+ continue;
+ if (outreg->global_index >= reg->global_index
+ && outreg->global_index
+ < (unsigned)reg->global_index + in_req->width)
+ return false;
+ if (reg->global_index >= outreg->global_index
+ && reg->global_index
+ < (unsigned)outreg->global_index + outreq->width)
+ return false;
+ }