-static void det_interference(ir_node *n) {
- pset *pc;
- ir_node **members, *p;
- int count, i, o;
- int doit;
-
- pc = get_phi_class(n);
- if (!pc)
- return;
-
- count = pset_count(pc);
- members = (ir_node **) malloc(count * sizeof(ir_node*));
-
- ir_debugf("\nChecking phi class of node %n:\n", n);
- for (i=0, p = (ir_node *)pset_first(pc); p; p = (ir_node *)pset_next(pc))
- members[i++] = p;
- assert(i == count);
-
- //determine interference of phi args
- for (i = 0; i < count-1; ++i) {
- doit = 1;
- for (o = i+1; o < count; ++o) {
- ir_debugf("Checking %n\t%n", members[i], members[o]);
- if (phi_ops_interfere(members[i], members[o])) {
- ir_debugf("\tinterfere\n");
- get_irn_phi_info(n)->interf_pairs++;
- if (doit) {
- get_irn_phi_info(n)->interf_vals++;
- doit = 0;
- }
-
- } else {
- ir_debugf("\tclean\n");
- }
- }
+pset *be_phi_congr_classes(pset *all_phi_nodes) {
+ int i;
+ ir_node *phi;
+ pset *phi_class, *all_phi_classes;
+
+ /* determine all phi classes */
+ for (i = 0, phi = (ir_node *)pset_first(all_phi_nodes); phi; phi = (ir_node *)pset_next(all_phi_nodes))
+ det_phi_congr_class(phi);
+
+ /* store them in a pset for fast retrieval */
+ all_phi_classes = pset_new_ptr(64);
+ for (i = 0, phi = (ir_node *)pset_first(all_phi_nodes); phi; phi = (ir_node *)pset_next(all_phi_nodes)) {
+ phi_class = get_phi_class(phi);
+ if (phi_class)
+ pset_insert_ptr(all_phi_classes, phi_class);