obstack access funcion fixed
[libfirm] / ir / ir / irvrfy.c
index 5fe17b1..c7d9549 100644 (file)
@@ -1,9 +1,9 @@
 /* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
-** All rights reserved.
-**
-** Authors: Christian Schaefer
-**
-**
+* All rights reserved.
+*
+* Authors: Christian Schaefer
+*
+*
 */
 
 /* $Id$ */
@@ -111,6 +111,8 @@ vrfy_Proj_proj(ir_node *p) {
       mt = get_entity_type(get_irg_ent(current_ir_graph));
       assert(proj < get_method_n_params(mt) &&
             "More Projs for args than args in type");
+      if ((mode == mode_P) && is_compound_type(get_method_param_type(mt, proj)))
+       /* value argument */ break;
       assert(mode == get_type_mode(get_method_param_type(mt, proj)) &&
       "Mode of Proj from Start doesn't match mode of param type.");
     } break;
@@ -120,6 +122,8 @@ vrfy_Proj_proj(ir_node *p) {
       mt = get_Call_type(pred);
       assert(proj < get_method_n_ress(mt) &&
             "More Projs for results than results in type.");
+      if ((mode == mode_P) && is_compound_type(get_method_res_type(mt, proj)))
+       /* value result */ break;
       assert(mode == get_type_mode(get_method_res_type(mt, proj)) &&
       "Mode of Proj from Call doesn't match mode of result type.");
     } break;
@@ -265,13 +269,25 @@ irn_vrfy (ir_node *n)
     };
     assert ( mymode == mode_T );   /* result T */
     /* Compare arguments of node with those of type */
-      mt = get_Call_type(n);
-      assert(get_Call_n_params(n) == get_method_n_params(mt) &&
-            "Number of args for Call doesn't match number of args in type.");
-      for (i = 0; i < get_Call_n_params(n); i++)
-       assert((get_irn_mode(get_Call_param(n, i))
-               == get_type_mode(get_method_param_type(mt, i))) &&
-              "Mode of arg for Call doesn't match mode of arg type.");
+    mt = get_Call_type(n);
+
+    if(get_method_variadicity(mt) == variadic)
+      {
+       assert(get_Call_n_params(n) >= get_method_n_params(mt) &&
+              "Number of args for Call doesn't match number of args in " \
+              " variadic type.");
+      }
+    else
+      {
+       assert(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.");
+      }
+
+    for (i = 0; i < get_method_n_params(mt); i++)
+      assert((get_irn_mode(get_Call_param(n, i))
+             == get_type_mode(get_method_param_type(mt, i))) &&
+            "Mode of arg for Call doesn't match mode of arg type.");
     break;
   case iro_Add:
     op1mode = get_irn_mode(in[1]);
@@ -279,7 +295,7 @@ irn_vrfy (ir_node *n)
     assert (
            /* common Add: BB x num x num --> num */
            ((mymode == op1mode && mymode == op2mode
-             && mode_is_num(mymode))
+             && (mode_is_num(mymode) || mymode == mode_P))
             ||  /* Pointer Add: BB x P x Is --> P */
             (op1mode == mode_P && op2mode == mode_Is && mymode == mode_P)
             ||  /* Pointer Add: BB x Is x P --> P */
@@ -495,7 +511,7 @@ irn_vrfy (ir_node *n)
 /* Verify the whole graph.                                         */
 /*******************************************************************/
 
-void
+static void
 vrfy_wrap (ir_node *node, void *env) {
   irn_vrfy(node);
 }