From: Matthias Braun Date: Mon, 23 Jul 2012 11:26:52 +0000 (+0200) Subject: get_Call_n_params: use int for consistency X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=c32482bc042c9f0591bec432ccb6dfcadbad4cb7;p=libfirm get_Call_n_params: use int for consistency 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) --- diff --git a/include/libfirm/irnode.h b/include/libfirm/irnode.h index 7fca36760..80e9cfa8e 100644 --- a/include/libfirm/irnode.h +++ b/include/libfirm/irnode.h @@ -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. */ diff --git a/ir/be/beabi.c b/ir/be/beabi.c index da579fdbe..e56c13e77 100644 --- a/ir/be/beabi.c +++ b/ir/be/beabi.c @@ -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); diff --git a/ir/ir/irnode.c b/ir/ir/irnode.c index 84d149ecb..ea6e47e95 100644 --- a/ir/ir/irnode.c +++ b/ir/ir/irnode.c @@ -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) diff --git a/ir/ir/irverify.c b/ir/ir/irverify.c index 727f5a1d1..9b697e003 100644 --- a/ir/ir/irverify.c +++ b/ir/ir/irverify.c @@ -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",