beifg: Factorise code to count interference components.
[libfirm] / ir / be / beverify.c
index 71f1e20..7cf0047 100644 (file)
@@ -1,20 +1,6 @@
 /*
- * Copyright (C) 1995-2010 University of Karlsruhe.  All right reserved.
- *
  * This file is part of libFirm.
- *
- * This file may be distributed and/or modified under the terms of the
- * GNU General Public License version 2 as published by the Free Software
- * Foundation and appearing in the file LICENSE.GPL included in the
- * packaging of this file.
- *
- * Licensees holding valid libFirm Professional Edition licenses may use
- * this file in accordance with the libFirm Commercial License.
- * Agreement provided with the Software.
- *
- * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
- * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE.
+ * Copyright (C) 2012 University of Karlsruhe.
  */
 
 /**
@@ -206,8 +192,8 @@ static void verify_schedule_walker(ir_node *block, void *data)
                                cfchange_found = node;
                        }
                } else if (cfchange_found != NULL) {
-                       /* proj and keepany aren't real instructions... */
-                       if (!is_Proj(node) && !be_is_Keep(node)) {
+                       /* keepany isn't a real instruction. */
+                       if (!be_is_Keep(node)) {
                                ir_fprintf(stderr, "Verify Warning: Node %+F scheduled after control flow changing node in block %+F (%s)\n",
                                           node, block, get_irg_name(env->irg));
                                env->problem_found = true;
@@ -381,8 +367,6 @@ static void collect_spill(be_verify_spillslots_env_t *env, ir_node *node, ir_nod
 
 static void collect_memperm(be_verify_spillslots_env_t *env, ir_node *node, ir_node *reload, ir_entity* ent)
 {
-       assert(is_Proj(node));
-
        ir_node *memperm = get_Proj_pred(node);
        int      out     = get_Proj_proj(node);
 
@@ -445,13 +429,6 @@ static void collect(be_verify_spillslots_env_t *env, ir_node *node, ir_node *rel
                collect_memperm(env, node, reload, ent);
        } else if (is_Phi(node) && get_irn_mode(node) == mode_M) {
                collect_memphi(env, node, reload, ent);
-       } else {
-               /* Disabled for now, spills might get transformed by the backend */
-#if 0
-               ir_fprintf(stderr, "Verify warning: No spill, memperm or memphi attached to node %+F found from node %+F in block %+F(%s)\n",
-                       node, reload, get_nodes_block(node), get_irg_name(env->irg));
-               env->problem_found = true;
-#endif
        }
 }
 
@@ -760,17 +737,10 @@ static void verify_block_register_allocation(ir_node *block, void *data)
        }
 
        sched_foreach_reverse(block, node) {
-
-               if (get_irn_mode(node) == mode_T) {
-                       foreach_out_edge(node, edge) {
-                               ir_node *def = get_edge_src_irn(edge);
-                               value_def(def);
-                               check_output_constraints(def);
-                       }
-               } else {
-                       value_def(node);
-                       check_output_constraints(node);
-               }
+               be_foreach_value(node, value,
+                       value_def(value);
+                       check_output_constraints(value);
+               );
 
                check_input_constraints(node);