fixed some depencies between irdump.c and irdumptxt.c
[libfirm] / ir / ir / irvrfy.c
index 722a7f3..9006b8f 100644 (file)
@@ -36,7 +36,8 @@
 #define ASSERT_AND_RET(expr, string, ret) \
 do { \
   if (opt_do_node_verification == NODE_VERIFICATION_ON) {\
-    if (!(expr)) dump_ir_block_graph(current_ir_graph, "-assert"); \
+    if (!(expr) && current_ir_graph != get_const_code_irg()) \
+    dump_ir_block_graph(current_ir_graph, "-assert"); \
     assert((expr) && string); } \
   if (!(expr)) { \
     if (opt_do_node_verification == NODE_VERIFICATION_REPORT) \
@@ -324,18 +325,7 @@ vrfy_Proj_proj(ir_node *p, ir_graph *irg) {
         "wrong Proj from Call", 0,
         show_proj_failure(p);
       );
-      break;
 
-    case iro_FuncCall:
-      ASSERT_AND_RET_DBG(
-        ((proj == pn_Call_M_regular        && mode == mode_M) ||
-         (proj == pn_Call_X_except         && mode == mode_X) ||
-         (proj == pn_Call_T_result         && mode == mode_T) ||
-         (proj == pn_Call_M_except         && mode == mode_M) ||
-     (proj == pn_Call_P_value_res_base && mode == mode_P)),
-        "wrong Proj from FuncCall", 0,
-        show_proj_failure(p);
-      );
       break;
 
     case iro_Quot:
@@ -365,7 +355,7 @@ vrfy_Proj_proj(ir_node *p, ir_graph *irg) {
          (proj == pn_Div_X_except && mode == mode_X) ||
          (proj == pn_Div_res      && mode_is_int(mode))),
         "wrong Proj from Div or Mod", 0,
-    show_proj_failure(p);
+       show_proj_failure(p);
       );
       break;
 
@@ -492,24 +482,7 @@ vrfy_Proj_proj(ir_node *p, ir_graph *irg) {
               ASSERT_AND_RET(
                   (mode == get_type_mode(get_method_res_type(mt, proj))),
                   "Mode of Proj from Call doesn't match mode of result type.", 0);
-            }
-            break;
 
-          case iro_FuncCall:
-            {
-              ASSERT_AND_RET(
-                  (proj >= 0 && mode_is_data(mode)),
-                  "wrong Proj from Proj from FuncCall", 0);
-              mt = get_FuncCall_type(pred);
-              ASSERT_AND_RET(
-                  (proj < get_method_n_ress(mt)),
-                  "More Projs for results than results in type.", 0);
-              if ((mode_is_reference(mode)) && is_compound_type(get_method_res_type(mt, proj)))
-                /* value result */ break;
-
-              ASSERT_AND_RET(
-                  (mode == get_type_mode(get_method_res_type(mt, proj))),
-                  "Mode of Proj from FuncCall doesn't match mode of result type.", 0);
             }
             break;
 
@@ -559,7 +532,7 @@ int irn_vrfy_irg(ir_node *n, ir_graph *irg)
 
   if (!opt_do_node_verification) return 1;
 
-  if (! interprocedural_view) {
+  if (! get_interprocedural_view()) {
     /*
      * do NOT check placement in interprocedural view, as we don't always know
      * the "right" graph ...
@@ -609,7 +582,7 @@ int irn_vrfy_irg(ir_node *n, ir_graph *irg)
                          "End Block node", 0);
         }
       /*  irg attr must == graph we are in. */
-      if (! interprocedural_view) {
+      if (! get_interprocedural_view()) {
         ASSERT_AND_RET(((get_irn_irg(n) && get_irn_irg(n) == irg)), "Block node has wrong irg attribute", 0);
       }
 
@@ -745,12 +718,17 @@ int irn_vrfy_irg(ir_node *n, ir_graph *irg)
       /* Call: BB x M x ref x data1 x ... x datan
          --> M x datan+1 x ... x data n+m */
       ASSERT_AND_RET( op1mode == mode_M && mode_is_reference(op2mode), "Call node", 0 );  /* operand M x ref */
+
+      mt = get_Call_type(n);
+      if(get_unknown_type() == mt) {
+       break;
+      }
+
       for (i=3; i < get_irn_arity(n); i++) {
         ASSERT_AND_RET( mode_is_data(get_irn_mode(in[i])), "Call node", 0 );  /* operand datai */
       };
       ASSERT_AND_RET( mymode == mode_T, "Call result not a tuple", 0 );   /* result T */
       /* Compare arguments of node with those of type */
-      mt = get_Call_type(n);
 
       if (get_method_variadicity(mt) == variadicity_variadic) {
         ASSERT_AND_RET_DBG(
@@ -769,24 +747,32 @@ int irn_vrfy_irg(ir_node *n, ir_graph *irg)
       }
 
       for (i = 0; i < get_method_n_params(mt); i++) {
-    type *t = get_method_param_type(mt, i);
+       type *t = get_method_param_type(mt, i);
 
-    if (is_atomic_type(t)) {
-      ASSERT_AND_RET_DBG(
-          get_irn_mode(get_Call_param(n, i)) == get_type_mode(t),
-          "Mode of arg for Call doesn't match mode of arg type.", 0,
-      show_call_param(n, mt);
-      );
-    }
-    else {
-      /* call with a compound type, mode must be reference */
-      ASSERT_AND_RET_DBG(
-          mode_is_reference(get_irn_mode(get_Call_param(n, i))),
-          "Mode of arg for Call doesn't match mode of arg type.", 0,
-      show_call_param(n, mt);
-      );
-    }
+       if (is_atomic_type(t)) {
+         ASSERT_AND_RET_DBG(
+                            get_irn_mode(get_Call_param(n, i)) == get_type_mode(t),
+                            "Mode of arg for Call doesn't match mode of arg type.", 0,
+                            show_call_param(n, mt);
+                            );
+       }
+       else {
+         /* call with a compound type, mode must be reference */
+         ASSERT_AND_RET_DBG(
+                            mode_is_reference(get_irn_mode(get_Call_param(n, i))),
+                            "Mode of arg for Call doesn't match mode of arg type.", 0,
+                            show_call_param(n, mt);
+                            );
+       }
       }
+
+#if 0
+      if (Call_has_callees(n)) {
+       for (i = 0; i < get_Call_n_callees(n); i++) {
+         ASSERT_AND_RET(is_entity(get_Call_callee(n, i)), "callee array must contain entities.", 0);
+       }
+      }
+#endif
       break;
 
     case iro_Add: