BugFix: equivalent_node_Bound() was too greedy, reduced to a safe minimum (now mostly...
[libfirm] / ir / ir / irvrfy.c
index 360530d..39a87d5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1995-2007 University of Karlsruhe.  All right reserved.
+ * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
  *
  * This file is part of libFirm.
  *
@@ -277,11 +277,15 @@ static void show_phi_inputs(ir_node *phi, ir_node *block) {
 
 #endif /* #ifndef NDEBUG */
 
-/** If the address is Sel or SymConst, return the entity. */
+/**
+ * If the address is Sel or SymConst, return the entity.
+ *
+ * @param ptr  the node representing the address
+ */
 static ir_entity *get_ptr_entity(ir_node *ptr) {
        if (get_irn_op(ptr) == op_Sel) {
                return get_Sel_entity(ptr);
-       } else if ((get_irn_op(ptr) == op_SymConst) && (get_SymConst_kind(ptr) == symconst_addr_ent)) {
+       } else if (is_SymConst_addr_ent(ptr)) {
                return get_SymConst_entity(ptr);
        }
        return NULL;
@@ -388,6 +392,7 @@ static int verify_node_Proj_Call(ir_node *n, ir_node *p) {
                "wrong Proj from Call", 0,
                show_proj_failure(p);
        );
+       /* if we have exception flow, we must have a real Memory input */
        if (proj == pn_Call_X_regular)
                ASSERT_AND_RET(
                        get_irn_op(get_Call_mem(n)) != op_NoMem,
@@ -545,6 +550,11 @@ static int verify_node_Proj_Cmp(ir_node *n, ir_node *p) {
                "wrong Proj from Cmp", 0,
                show_proj_failure(p);
        );
+       ASSERT_AND_RET_DBG(
+               (mode_is_float(get_irn_mode(get_Cmp_left(n))) || !(proj & pn_Cmp_Uo)),
+               "unordered Proj for non-float Cmp", 0,
+               show_proj_failure(p);
+       );
        return 1;
 }
 
@@ -1169,14 +1179,17 @@ static int verify_node_Call(ir_node *n, ir_graph *irg) {
                        get_Call_n_params(n) >= get_method_n_params(mt),
                        "Number of args for Call doesn't match number of args in variadic type.",
                        0,
-                       fprintf(stderr, "Call has %d params, method %s type %d\n",
-                       get_Call_n_params(n), get_type_name(mt), get_method_n_params(mt));
+                       ir_fprintf(stderr, "Call %+F has %d params, method %s type %d\n",
+                       n, get_Call_n_params(n), get_type_name(mt), get_method_n_params(mt));
                );
        } else {
-               ASSERT_AND_RET(
+               ASSERT_AND_RET_DBG(
                        get_Call_n_params(n) == get_method_n_params(mt),
                        "Number of args for Call doesn't match number of args in non variadic type.",
-                       0);
+                       0,
+                       ir_fprintf(stderr, "Call %+F has %d params, method %s type %d\n",
+                       n, get_Call_n_params(n), get_type_name(mt), get_method_n_params(mt));
+               );
        }
 
        for (i = 0; i < get_method_n_params(mt); i++) {
@@ -2018,7 +2031,10 @@ int irg_verify(ir_graph *irg, unsigned flags) {
 
        rem = current_ir_graph;
        current_ir_graph = irg;
-       last_irg_error = NULL;
+
+#ifndef NDEBUG
+    last_irg_error = NULL;
+#endif /* NDEBUG */
 
        assert(get_irg_pinned(irg) == op_pin_state_pinned && "Verification need pinned graph");