adapted to new callback
[libfirm] / ir / be / belower.c
index 88f9d4c..abdd5ea 100644 (file)
@@ -23,6 +23,7 @@
 #include "bechordal_t.h"
 #include "besched_t.h"
 #include "bestat.h"
+#include "benodesets.h"
 
 #include "irgmod.h"
 #include "iredges_t.h"
@@ -36,7 +37,7 @@
 #endif
 
 #undef is_Perm
-#define is_Perm(arch_env, irn) (arch_irn_classify(arch_env, irn) == arch_irn_class_perm)
+#define is_Perm(arch_env, irn) (arch_irn_class_is(arch_env, irn, perm))
 
 /* associates op with it's copy and CopyKeep */
 typedef struct {
@@ -269,8 +270,9 @@ static void lower_perm_node(ir_node *irn, void *walk_env) {
        const arch_register_class_t *reg_class;
        const arch_env_t            *arch_env;
        lower_env_t     *env         = walk_env;
-       int              real_size   = 0;
-       int              n, i, pn, do_copy, j, n_ops;
+       int             real_size    = 0;
+       int             keep_perm    = 0;
+       int             n, i, pn, do_copy, j, n_ops;
        reg_pair_t      *pairs;
        const ir_edge_t *edge;
        perm_cycle_t    *cycle;
@@ -372,6 +374,7 @@ static void lower_perm_node(ir_node *irn, void *walk_env) {
                */
                if (n == 2 && cycle->type == PERM_CYCLE) {
                        free(cycle);
+                       keep_perm = 1;
                        continue;
                }
 
@@ -495,10 +498,9 @@ static void lower_perm_node(ir_node *irn, void *walk_env) {
                free(cycle);
        }
 
-
-
        /* remove the perm from schedule */
-       sched_remove(irn);
+       if (! keep_perm)
+               sched_remove(irn);
 }
 
 
@@ -567,7 +569,7 @@ static void gen_assure_different_pattern(ir_node *irn, ir_node *other_different,
        /* insert the other different and it's copies into the set */
        key.op         = other_different;
        key.copies     = NULL;
-       entry          = pset_find(op_set, &key, HASH_PTR(other_different));
+       entry          = pset_find(op_set, &key, nodeset_hash(other_different));
 
        if (! entry) {
                entry         = obstack_alloc(&env->obst, sizeof(*entry));
@@ -582,7 +584,7 @@ static void gen_assure_different_pattern(ir_node *irn, ir_node *other_different,
        if (be_is_CopyKeep(keep))
                pset_insert_ptr(entry->copies, keep);
 
-       pset_insert(op_set, entry, HASH_PTR(other_different));
+       pset_insert(op_set, entry, nodeset_hash(other_different));
 
        DBG((mod, LEVEL_1, "created %+F for %+F to assure should_be_different\n", keep, irn));
 }