-
-static void imm_scheduler(ir_node *irn, void *env) {
- if(is_Imm(irn)) {
- const ir_edge_t *e;
- ir_node *user, *user_block, *before, *tgt_block;
-
- // assert(1 == get_irn_n_edges(irn)); why is this wrong ?
-
- e = get_irn_out_edge_first(irn);
- user = e->src;
- user_block = get_nodes_block(user);
- if (is_Phi(user)) {
- before = get_Block_cfgpred_block(user_block, e->pos);
- tgt_block = before;
- } else {
- before = user;
- tgt_block = user_block;
- }
-
- sched_remove(irn);
- set_nodes_block(irn, tgt_block);
- sched_add_before(before, irn);
- }
-}
-
-void be_sched_imm(ir_graph *irg) {
- irg_walk_graph(irg, imm_scheduler, NULL, NULL);
-}