-
- /* Now the color of the arg (arg may be a dupl now) and the phi-result are equal.
- * Pin it, so everyone knows and it never gets changed again.
- * An arg never is a phi, because perms were inserted. So the link field is free */
- DBG((dbg, LEVEL_1, " arg has correct color (now), so pin it\n"));
- pin_irn(arg, phi_block);
- }
-}
-
-
-static void insert_all_perms(be_main_session_env_t *session, be_chordal_env_t *chordal_env) {
- pmap_entry *pme;
- int i, max;
- ir_node *first_phi, *recent_phi;
-
- DBG((dbg, LEVEL_1, "Placing perms...\n"));
-
- /* place perms in cf-preds of phis */
- pmap_foreach(chordal_env->border_heads, pme) {
- border_t *curr;
- struct list_head *head = pme->value;
-
- first_phi = NULL;
- /* iterate over the first ops in the block until a non-phi is reached */
- list_for_each_entry(border_t, curr, head, list) {
- ir_node *phi = curr->irn;
-
- if (curr->is_def && curr->is_real && is_Phi(phi)) {
- set_irn_link(phi, NULL);
- /* chain of phis in a block */
- if (first_phi == NULL)
- first_phi = phi;
- else
- set_irn_link(recent_phi, phi);
- recent_phi = phi;
-
- /* insert perms */
- DBG((dbg, LEVEL_1, " for %+F\n", phi));
- for(i=0, max=get_irn_arity(phi); i<max; ++i) {
- ir_node *perm;
-
- perm = get_or_insert_perm(session, chordal_env, get_Block_cfgpred_block(get_nodes_block(phi), i));
- DBG((dbg, LEVEL_1, " %+F in block %N\n", perm, get_Block_cfgpred_block(get_nodes_block(phi), i)));
- set_irn_link(perm, NULL);
- }
- }
- }
- if (first_phi)
- set_irn_link(recent_phi, first_phi);
- }
-}
-
-static void set_regs_or_place_dupls(be_main_session_env_t *session, be_chordal_env_t *chordal_env) {
- pmap_entry *pme;
-
- DBG((dbg, LEVEL_1, "Setting regs and placing dupls...\n"));
-
- /* iterate over all blocks and correct color of arguments*/
- pmap_foreach(chordal_env->border_heads, pme) {
- border_t *curr;
- struct list_head *head = pme->value;
-
- /* iterate over the first ops in the block until a non-phi is reached */
- list_for_each_entry(border_t, curr, head, list)
- if (curr->is_def && curr->is_real && is_Phi(curr->irn))
- adjust_phi_arguments(session, chordal_env, curr->irn);