get_Call_n_params: use int for consistency
authorMatthias Braun <matthias.braun@kit.edu>
Mon, 23 Jul 2012 11:26:52 +0000 (13:26 +0200)
committerMatthias Braun <matthias.braun@kit.edu>
Mon, 23 Jul 2012 12:38:02 +0000 (14:38 +0200)
This makes it consistent with other functions like get_irn_arity().
(Though I must admit that we should change all these functions from
 "int" to unsigned at some point)

include/libfirm/irnode.h
ir/be/beabi.c
ir/ir/irnode.c
ir/ir/irverify.c

index 7fca367..80e9cfa 100644 (file)
@@ -463,7 +463,7 @@ FIRM_API void set_Sel_index(ir_node *node, int pos, ir_node *index);
 /** Returns parameter inputs of Call node @p node as array. */
 FIRM_API ir_node **get_Call_param_arr(ir_node *node);
 /** Returns the number of parameters of a call. */
-FIRM_API size_t get_Call_n_params(const ir_node *node);
+FIRM_API int get_Call_n_params(const ir_node *node);
 /** Returns the call parameter at position pos. */
 FIRM_API ir_node *get_Call_param(const ir_node *node, int pos);
 /** Sets the call parameter at position pos. */
index da579fd..e56c13e 100644 (file)
@@ -390,7 +390,7 @@ static ir_node *adjust_call(be_abi_irg_t *env, ir_node *irn, ir_node *curr_sp)
        arch_env_get_call_abi(arch_env, call_tp, call);
 
        /* Insert code to put the stack arguments on the stack. */
-       assert(get_Call_n_params(irn) == n_params);
+       assert((size_t)get_Call_n_params(irn) == n_params);
        stack_param_idx = ALLOCAN(int, n_params);
        for (p = 0; p < n_params; ++p) {
                be_abi_call_arg_t *arg = get_call_arg(call, 0, p, 0);
index 84d149e..ea6e47e 100644 (file)
@@ -905,10 +905,10 @@ ir_node **get_Call_param_arr(ir_node *node)
        return &get_irn_in(node)[CALL_PARAM_OFFSET + 1];
 }
 
-size_t get_Call_n_params(const ir_node *node)
+int get_Call_n_params(const ir_node *node)
 {
        assert(is_Call(node));
-       return (size_t) (get_irn_arity(node) - CALL_PARAM_OFFSET);
+       return get_irn_arity(node) - CALL_PARAM_OFFSET;
 }
 
 ir_node *get_Call_param(const ir_node *node, int pos)
index 727f5a1..9b697e0 100644 (file)
@@ -233,18 +233,19 @@ static void show_node_on_graph(const ir_graph *irg, const ir_node *n)
  */
 static void show_call_param(const ir_node *n, ir_type *mt)
 {
-       size_t i;
        char type_name[256];
        ir_print_type(type_name, sizeof(type_name), mt);
 
        show_entity_failure(n);
        fprintf(stderr, "  Call type-check failed: %s(", type_name);
-       for (i = 0; i < get_method_n_params(mt); ++i) {
+       size_t n_method_params = get_method_n_params(mt);
+       for (size_t i = 0; i < n_method_params; ++i) {
                fprintf(stderr, "%s ", get_mode_name_ex(get_type_mode(get_method_param_type(mt, i))));
        }
        fprintf(stderr, ") != CALL(");
 
-       for (i = 0; i < get_Call_n_params(n); ++i) {
+       int n_params = get_Call_n_params(n);
+       for (int i = 0; i < n_params; ++i) {
                fprintf(stderr, "%s ", get_mode_name_ex(get_irn_mode(get_Call_param(n, i))));
        }
        fprintf(stderr, ")\n");
@@ -1108,7 +1109,7 @@ static int verify_node_Call(const ir_node *n)
 
        if (get_method_variadicity(mt) == variadicity_variadic) {
                ASSERT_AND_RET_DBG(
-                       get_Call_n_params(n) >= get_method_n_params(mt),
+                       (size_t)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,
                        ir_fprintf(stderr, "Call %+F has %d params, type %d\n",
@@ -1116,7 +1117,7 @@ static int verify_node_Call(const ir_node *n)
                );
        } else {
                ASSERT_AND_RET_DBG(
-                       get_Call_n_params(n) == get_method_n_params(mt),
+                       (size_t)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,
                        ir_fprintf(stderr, "Call %+F has %d params, type %d\n",