From e88385016800d3c56c3fa09770e9f7995c42e106 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Mon, 24 Jan 2011 23:31:53 +0000 Subject: [PATCH] Fixed a lot of size_t related warnings, most of them due to array implementation change. [r28272] --- ir/ana/callgraph.c | 11 +++++++---- ir/ana/cgana.c | 29 +++++++++++++++++------------ ir/ana/interval_analysis.c | 2 +- ir/ana/irbackedge.c | 2 +- ir/ana/irbackedge_t.h | 4 ++-- ir/ana/ircfscc.c | 2 +- ir/ana/irextbb_t.h | 4 ++-- ir/ana/irscc.c | 13 ++++++++----- ir/be/amd64/amd64_emitter.c | 4 ++-- ir/be/beabi.c | 4 ++-- ir/be/bearch.h | 4 ++-- ir/ir/ircons.c | 4 ++-- ir/ir/irdump.c | 22 +++++++++++----------- ir/ir/iredges.c | 8 ++++---- ir/ir/iredges_t.h | 4 ++-- ir/ir/irmode.c | 6 +++--- ir/ir/irnode_t.h | 4 ++-- ir/ir/irprog.c | 22 +++++++++++----------- ir/ir/irprog_t.h | 8 ++++---- ir/lower/lower_calls.c | 18 ++++++++++-------- ir/lower/lower_mode_b.c | 11 +++++------ ir/lower/lower_mux.c | 4 ++-- ir/lower/lower_switch.c | 6 +++--- ir/opt/combo.c | 2 +- ir/opt/ldstopt.c | 6 +++--- ir/opt/loop.c | 10 +++++----- ir/opt/opt_blocks.c | 2 +- ir/opt/opt_osr.c | 6 +++--- ir/opt/proc_cloning.c | 4 ++-- ir/tr/compound_path.c | 4 ++-- ir/tr/type_t.h | 6 +++--- 31 files changed, 124 insertions(+), 112 deletions(-) diff --git a/ir/ana/callgraph.c b/ir/ana/callgraph.c index 5fa2bb1c0..d8ff40ee6 100644 --- a/ir/ana/callgraph.c +++ b/ir/ana/callgraph.c @@ -206,7 +206,7 @@ int get_irg_callee_loop_depth(const ir_graph *irg, int pos) static double get_irg_callee_execution_frequency(const ir_graph *irg, int pos) { ir_node **arr = irg->callees[pos]->call_list; - int i, n_Calls = ARR_LEN(arr); + size_t i, n_Calls = ARR_LEN(arr); double freq = 0.0; for (i = 0; i < n_Calls; ++i) { @@ -537,7 +537,7 @@ static inline int get_irg_dfn(ir_graph *irg) /**********************************************************************/ static ir_graph **stack = NULL; -static int tos = 0; /**< top of stack */ +static size_t tos = 0; /**< top of stack */ /** * Initialize the irg stack. @@ -559,7 +559,7 @@ static inline void init_stack(void) static inline void push(ir_graph *irg) { if (tos == ARR_LEN(stack)) { - int nlen = ARR_LEN(stack) * 2; + size_t nlen = ARR_LEN(stack) * 2; ARR_RESIZE(ir_graph*, stack, nlen); } stack [tos++] = irg; @@ -571,7 +571,10 @@ static inline void push(ir_graph *irg) */ static inline ir_graph *pop(void) { - ir_graph *irg = stack[--tos]; + ir_graph *irg; + + assert(tos > 0); + irg = stack[--tos]; mark_irg_not_in_stack(irg); return irg; } diff --git a/ir/ana/cgana.c b/ir/ana/cgana.c index 96391388c..9f97c3f1d 100644 --- a/ir/ana/cgana.c +++ b/ir/ana/cgana.c @@ -285,7 +285,7 @@ static ir_entity ** get_Sel_arr(ir_node * sel) * * @param sel the Sel node */ -static int get_Sel_n_methods(ir_node * sel) +static size_t get_Sel_n_methods(ir_node * sel) { return ARR_LEN(get_Sel_arr(sel)); } @@ -293,10 +293,10 @@ static int get_Sel_n_methods(ir_node * sel) /** * Returns the ith possible called method entity at a Sel node. */ -static ir_entity * get_Sel_method(ir_node * sel, int pos) +static ir_entity * get_Sel_method(ir_node * sel, size_t pos) { ir_entity ** arr = get_Sel_arr(sel); - assert(pos >= 0 && pos < ARR_LEN(arr)); + assert(pos < ARR_LEN(arr)); return arr[pos]; } @@ -360,7 +360,7 @@ static void free_mark_proj(ir_node * node, long n, eset * set) */ static void free_mark(ir_node *node, eset * set) { - int i; + size_t i, n; if (get_irn_link(node) == MARK) return; /* already visited */ @@ -371,7 +371,7 @@ static void free_mark(ir_node *node, eset * set) case iro_Sel: { ir_entity *ent = get_Sel_entity(node); if (is_method_entity(ent)) { - for (i = get_Sel_n_methods(node) - 1; i >= 0; --i) { + for (i = 0, n = get_Sel_n_methods(node); i < n; ++i) { eset_insert(set, get_Sel_method(node, i)); } } @@ -387,10 +387,13 @@ static void free_mark(ir_node *node, eset * set) break; case iro_Phi: - for (i = get_Phi_n_preds(node) - 1; i >= 0; --i) { + { + int i, n; + for (i = 0, n = get_Phi_n_preds(node); i < n; ++i) { free_mark(get_Phi_pred(node, i), set); } break; + } case iro_Proj: free_mark_proj(get_Proj_pred(node), get_Proj_proj(node), set); break; @@ -648,8 +651,6 @@ static void callee_ana_proj(ir_node *node, long n, eset *methods) */ static void callee_ana_node(ir_node *node, eset *methods) { - int i; - assert(mode_is_reference(get_irn_mode(node)) || is_Bad(node)); /* Beware of recursion */ if (get_irn_link(node) == MARK) { @@ -672,9 +673,10 @@ static void callee_ana_node(ir_node *node, eset *methods) break; } - case iro_Sel: + case iro_Sel: { /* polymorphic method */ - for (i = get_Sel_n_methods(node) - 1; i >= 0; --i) { + size_t i, n; + for (i = 0, n = get_Sel_n_methods(node); i < n; ++i) { ir_entity *ent = get_Sel_method(node, i); if (ent != NULL) { eset_insert(methods, ent); @@ -683,16 +685,19 @@ static void callee_ana_node(ir_node *node, eset *methods) } } break; + } case iro_Bad: /* nothing */ break; - case iro_Phi: + case iro_Phi: { + int i; for (i = get_Phi_n_preds(node) - 1; i >= 0; --i) { callee_ana_node(get_Phi_pred(node, i), methods); } break; + } case iro_Mux: callee_ana_node(get_Mux_false(node), methods); @@ -731,7 +736,7 @@ static void callee_walker(ir_node *call, void *env) eset *methods = eset_create(); ir_entity *ent; ir_entity **arr; - int i; + size_t i; callee_ana_node(get_Call_ptr(call), methods); arr = NEW_ARR_F(ir_entity *, eset_count(methods)); diff --git a/ir/ana/interval_analysis.c b/ir/ana/interval_analysis.c index fca431122..2d0ad8ec0 100644 --- a/ir/ana/interval_analysis.c +++ b/ir/ana/interval_analysis.c @@ -106,7 +106,7 @@ static inline region_attr *get_region_attr(void *region) int get_region_n_ins(void *region) { - return ARR_LEN(get_region_attr(region)->in_array); + return (int)ARR_LEN(get_region_attr(region)->in_array); } void *get_region_in(void *region, int pos) diff --git a/ir/ana/irbackedge.c b/ir/ana/irbackedge.c index 9bc7b3a30..13fee326f 100644 --- a/ir/ana/irbackedge.c +++ b/ir/ana/irbackedge.c @@ -163,7 +163,7 @@ void clear_backedges(ir_node *n) } /* Allocate a new backedge array on the obstack for given size. */ -bitset_t *new_backedge_arr(struct obstack *obst, unsigned size) +bitset_t *new_backedge_arr(struct obstack *obst, size_t size) { return bitset_obstack_alloc(obst, size); } diff --git a/ir/ana/irbackedge_t.h b/ir/ana/irbackedge_t.h index 3a45a23e2..808fdfc91 100644 --- a/ir/ana/irbackedge_t.h +++ b/ir/ana/irbackedge_t.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2011 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -33,7 +33,7 @@ * @param obst the obstack to allocate the array on * @param size the size of the backedge array */ -bitset_t *new_backedge_arr(struct obstack *obst, unsigned size); +bitset_t *new_backedge_arr(struct obstack *obst, size_t size); /** * Adapts backedges array to new size. diff --git a/ir/ana/ircfscc.c b/ir/ana/ircfscc.c index d4455417f..bb31ac1e5 100644 --- a/ir/ana/ircfscc.c +++ b/ir/ana/ircfscc.c @@ -178,7 +178,7 @@ static void finish_stack(void) static inline void push(ir_node *n) { if (tos == ARR_LEN(stack)) { - int nlen = ARR_LEN(stack) * 2; + size_t nlen = ARR_LEN(stack) * 2; ARR_RESIZE(ir_node *, stack, nlen); } stack[tos++] = n; diff --git a/ir/ana/irextbb_t.h b/ir/ana/irextbb_t.h index 0ebdb0621..1837d65c9 100644 --- a/ir/ana/irextbb_t.h +++ b/ir/ana/irextbb_t.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2011 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -126,7 +126,7 @@ static inline void _set_extbb_link(ir_extblk *blk, void *link) static inline int _get_extbb_n_blocks(const ir_extblk *blk) { assert(blk); - return ARR_LEN(blk->blks); + return (int)ARR_LEN(blk->blks); } /** diff --git a/ir/ana/irscc.c b/ir/ana/irscc.c index 0da5fd65a..aa8b4fb42 100644 --- a/ir/ana/irscc.c +++ b/ir/ana/irscc.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2011 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -197,7 +197,7 @@ ir_loop * get_irn_loop(ir_node *n) /**********************************************************************/ static ir_node **stack = NULL; -static int tos = 0; /* top of stack */ +static size_t tos = 0; /* top of stack */ /** * initializes the stack @@ -229,10 +229,10 @@ static void finish_stack(void) static inline void push(ir_node *n) { if (tos == ARR_LEN(stack)) { - int nlen = ARR_LEN(stack) * 2; + size_t nlen = ARR_LEN(stack) * 2; ARR_RESIZE(ir_node *, stack, nlen); } - stack [tos++] = n; + stack[tos++] = n; mark_irn_in_stack(n); } @@ -243,7 +243,10 @@ static inline void push(ir_node *n) */ static inline ir_node *pop(void) { - ir_node *n = stack[--tos]; + ir_node *n; + + assert(tos > 0); + n = stack[--tos]; mark_irn_not_in_stack(n); return n; } diff --git a/ir/be/amd64/amd64_emitter.c b/ir/be/amd64/amd64_emitter.c index 88b8ecd9a..7f38b80d3 100644 --- a/ir/be/amd64/amd64_emitter.c +++ b/ir/be/amd64/amd64_emitter.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2011 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -629,7 +629,7 @@ void amd64_gen_routine(ir_graph *irg) { ir_entity *entity = get_irg_entity(irg); ir_node **blk_sched; - int i, n; + size_t i, n; /* register all emitter functions */ amd64_register_emitters(); diff --git a/ir/be/beabi.c b/ir/be/beabi.c index 167d19793..2adfa3af0 100644 --- a/ir/be/beabi.c +++ b/ir/be/beabi.c @@ -644,8 +644,8 @@ static ir_node *adjust_call(be_abi_irg_t *env, ir_node *irn, ir_node *curr_sp) if (arg->in_reg) { /* remove register from destroyed regs */ - int j; - int n = ARR_LEN(destroyed_regs); + size_t j; + size_t n = ARR_LEN(destroyed_regs); for (j = 0; j < n; ++j) { if (destroyed_regs[j] == arg->reg) { destroyed_regs[j] = destroyed_regs[n-1]; diff --git a/ir/be/bearch.h b/ir/be/bearch.h index f6f133c43..8218df061 100644 --- a/ir/be/bearch.h +++ b/ir/be/bearch.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2011 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -628,7 +628,7 @@ static inline unsigned arch_irn_get_n_outs(const ir_node *node) if (info->out_infos == NULL) return 0; - return ARR_LEN(info->out_infos); + return (unsigned)ARR_LEN(info->out_infos); } static inline const arch_irn_ops_t *get_irn_ops_simple(const ir_node *node) diff --git a/ir/ir/ircons.c b/ir/ir/ircons.c index 438e82e7c..4b43f07f7 100644 --- a/ir/ir/ircons.c +++ b/ir/ir/ircons.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2011 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -308,7 +308,7 @@ static ir_node *get_r_value_internal(ir_node *block, int pos, ir_mode *mode) */ void mature_immBlock(ir_node *block) { - int n_preds; + size_t n_preds; ir_node *next; ir_node *phi; ir_graph *irg; diff --git a/ir/ir/irdump.c b/ir/ir/irdump.c index cf6c87ad3..f371e045c 100644 --- a/ir/ir/irdump.c +++ b/ir/ir/irdump.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2010 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2011 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -614,7 +614,7 @@ typedef struct list_tuple { static list_tuple *construct_extblock_lists(ir_graph *irg) { ir_node **blk_list = construct_block_lists(irg); - int i; + size_t i, n; ir_graph *rem = current_ir_graph; list_tuple *lists = XMALLOC(list_tuple); @@ -624,7 +624,7 @@ static list_tuple *construct_extblock_lists(ir_graph *irg) lists->extbb_list = NEW_ARR_F(ir_extblk *, 0); inc_irg_block_visited(irg); - for (i = ARR_LEN(blk_list) - 1; i >= 0; --i) { + for (i = 0, n = ARR_LEN(blk_list); i < n; ++i) { ir_extblk *ext; if (is_Block(blk_list[i])) { @@ -1620,13 +1620,13 @@ static void dump_whole_block(FILE *F, ir_node *block) * The outermost nodes: blocks and nodes not op_pin_state_pinned, Bad, Unknown. */ static void dump_block_graph(FILE *F, ir_graph *irg) { - int i; + size_t i, n; ir_graph *rem = current_ir_graph; ir_node **arr = (ir_node**)ird_get_irg_link(irg); current_ir_graph = irg; - for (i = ARR_LEN(arr) - 1; i >= 0; --i) { - ir_node * node = arr[i]; + for (i = 0, n = ARR_LEN(arr); i < n; ++i) { + ir_node *node = arr[i]; if (is_Block(node)) { /* Dumps the block and all the nodes in the block, which are to be found in Block->link. */ @@ -2206,23 +2206,23 @@ static void dump_blocks_as_subgraphs(FILE *out, ir_graph *irg) * The outermost nodes: blocks and nodes not op_pin_state_pinned, Bad, Unknown. */ static void dump_extblock_graph(FILE *F, ir_graph *irg) { - int i; + size_t i, arr_len; ir_graph *rem = current_ir_graph; ir_extblk **arr = (ir_extblk**)ird_get_irg_link(irg); current_ir_graph = irg; - for (i = ARR_LEN(arr) - 1; i >= 0; --i) { + for (i = 0, arr_len = ARR_LEN(arr); i < arr_len; ++i) { ir_extblk *extbb = arr[i]; ir_node *leader = get_extbb_leader(extbb); - int j; + size_t j, n_blks; fprintf(F, "graph: { title: \""); PRINT_EXTBBID(leader); fprintf(F, "\" label: \"ExtBB %ld\" status:clustered color:lightgreen\n", get_irn_node_nr(leader)); - for (j = ARR_LEN(extbb->blks) - 1; j >= 0; --j) { - ir_node * node = extbb->blks[j]; + for (j = 0, n_blks = ARR_LEN(extbb->blks); j < n_blks; ++j) { + ir_node *node = extbb->blks[j]; if (is_Block(node)) { /* Dumps the block and all the nodes in the block, which are to be found in Block->link. */ diff --git a/ir/ir/iredges.c b/ir/ir/iredges.c index e09b3220b..356c21196 100644 --- a/ir/ir/iredges.c +++ b/ir/ir/iredges.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2011 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -134,7 +134,7 @@ static int edges_used = 0; * Summed size of all users private data */ -static int edges_private_size = 0; +static size_t edges_private_size = 0; #define EDGE_SIZE (sizeof(ir_edge_t) + edges_private_size) /** @@ -170,9 +170,9 @@ static inline long edge_get_id(const ir_edge_t *e) * Each user has to remember his given offset and the size of his private data. * To be called before FIRM is initialized. */ -int edges_register_private_data(size_t n) +size_t edges_register_private_data(size_t n) { - int res = edges_private_size; + size_t res = edges_private_size; assert(!edges_used && "you cannot register private edge data, if edges have been initialized"); diff --git a/ir/ir/iredges_t.h b/ir/ir/iredges_t.h index 13c807149..ccf5e6a4e 100644 --- a/ir/ir/iredges_t.h +++ b/ir/ir/iredges_t.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2011 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -147,7 +147,7 @@ void edges_invalidate_kind(ir_node *irn, ir_edge_kind_t kind, ir_graph *irg); * edges_get_private_data() * to get a pointer to your data. */ -int edges_register_private_data(size_t n); +size_t edges_register_private_data(size_t n); /** * Get a pointer to the private data you registered. diff --git a/ir/ir/irmode.c b/ir/ir/irmode.c index 5cf574fe3..ccac04ad7 100644 --- a/ir/ir/irmode.c +++ b/ir/ir/irmode.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2011 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -90,8 +90,8 @@ static inline int modes_are_equal(const ir_mode *m, const ir_mode *n) */ static ir_mode *find_mode(const ir_mode *m) { - int i; - for (i = ARR_LEN(mode_list) - 1; i >= 0; --i) { + size_t i, n_modes; + for (i = 0, n_modes = ARR_LEN(mode_list); i < n_modes; ++i) { ir_mode *n = mode_list[i]; if (modes_are_equal(n, m)) return n; diff --git a/ir/ir/irnode_t.h b/ir/ir/irnode_t.h index 3a2c1fb96..c14b2ac75 100644 --- a/ir/ir/irnode_t.h +++ b/ir/ir/irnode_t.h @@ -135,7 +135,7 @@ static inline unsigned _get_irn_opcode(const ir_node *node) */ static inline int _get_irn_arity(const ir_node *node) { - return ARR_LEN(node->in) - 1; + return (int)(ARR_LEN(node->in) - 1); } /** @@ -167,7 +167,7 @@ static inline unsigned hash_irn(const ir_node *node) } static inline int _get_irn_deps(const ir_node *node) { - return node->deps ? ARR_LEN(node->deps) : 0; + return node->deps ? (int)ARR_LEN(node->deps) : 0; } static inline ir_node *_get_irn_dep(const ir_node *node, int pos) { diff --git a/ir/ir/irprog.c b/ir/ir/irprog.c index d41f6fbb1..26464feba 100644 --- a/ir/ir/irprog.c +++ b/ir/ir/irprog.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2011 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -214,14 +214,13 @@ void add_irp_irg(ir_graph *irg) /* Removes irg from the list or irgs, shrinks the list by one. */ void remove_irp_irg_from_list(ir_graph *irg) { - int i, l, found = 0; + size_t i, l; assert(irg); l = ARR_LEN(irp->graphs); - for (i = 0; i < l; i++) { + for (i = 0; i < l; ++i) { if (irp->graphs[i] == irg) { - found = 1; - for (; i < l - 1; i++) { + for (; i < l - 1; ++i) { irp->graphs[i] = irp->graphs[i+1]; } ARR_SETLEN(ir_graph*, irp->graphs, l - 1); @@ -270,15 +269,16 @@ void add_irp_type(ir_type *typ) /* Remove type from the list of types in irp. */ void remove_irp_type(ir_type *typ) { - int i; + size_t i, l; assert(typ); - for (i = ARR_LEN(irp->types) - 1; i >= 0; i--) { + l = ARR_LEN(irp->types); + for (i = 0; i < l; ++i) { if (irp->types[i] == typ) { - for (; i < (ARR_LEN(irp->types)) - 1; i++) { + for (; i < l - 1; ++i) { irp->types[i] = irp->types[i+1]; } - ARR_SETLEN(ir_type *, irp->types, (ARR_LEN(irp->types)) - 1); + ARR_SETLEN(ir_type *, irp->types, l - 1); break; } } @@ -324,13 +324,13 @@ void add_irp_mode(ir_mode *mode) /* Adds opcode to the list of opcodes in irp. */ void add_irp_opcode(ir_op *opcode) { - int len; + size_t len; size_t code; assert(opcode != NULL); assert(irp); len = ARR_LEN(irp->opcodes); code = opcode->code; - if ((int) code >= len) { + if (code >= len) { ARR_RESIZE(ir_op*, irp->opcodes, code+1); memset(&irp->opcodes[len], 0, (code-len+1) * sizeof(irp->opcodes[0])); } diff --git a/ir/ir/irprog_t.h b/ir/ir/irprog_t.h index 07e73edc4..03511039f 100644 --- a/ir/ir/irprog_t.h +++ b/ir/ir/irprog_t.h @@ -61,7 +61,7 @@ static inline ir_type *_get_tls_type(void) static inline int _get_irp_n_irgs(void) { assert(irp && irp->graphs); - return ARR_LEN(irp->graphs); + return (int)ARR_LEN(irp->graphs); } static inline ir_graph *_get_irp_irg(int pos) @@ -73,7 +73,7 @@ static inline ir_graph *_get_irp_irg(int pos) static inline int _get_irp_n_types(void) { assert(irp && irp->types); - return ARR_LEN(irp->types); + return (int)ARR_LEN(irp->types); } static inline ir_type *_get_irp_type(int pos) @@ -86,7 +86,7 @@ static inline ir_type *_get_irp_type(int pos) static inline int _get_irp_n_modes(void) { assert(irp->modes); - return ARR_LEN(irp->modes); + return (int)ARR_LEN(irp->modes); } static inline ir_mode *_get_irp_mode(int pos) @@ -98,7 +98,7 @@ static inline ir_mode *_get_irp_mode(int pos) static inline int _get_irp_n_opcodes(void) { assert(irp && irp->opcodes); - return ARR_LEN(irp->opcodes); + return (int)ARR_LEN(irp->opcodes); } static inline ir_op *_get_irp_opcode(int pos) diff --git a/ir/lower/lower_calls.c b/ir/lower/lower_calls.c index 86bc3b6df..f2f88286a 100644 --- a/ir/lower/lower_calls.c +++ b/ir/lower/lower_calls.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2011 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -468,13 +468,12 @@ typedef struct cr_pair { */ static void do_copy_return_opt(ir_node *n, void *ctx) { - cr_pair *arr = (cr_pair*)ctx; - int i; - if (is_Sel(n)) { ir_entity *ent = get_Sel_entity(n); + cr_pair *arr = (cr_pair*)ctx; + size_t i, l; - for (i = ARR_LEN(arr) - 1; i >= 0; --i) { + for (i = 0, l = ARR_LEN(arr); i < l; ++i) { if (ent == arr[i].ent) { exchange(n, arr[i].arg); break; @@ -657,10 +656,11 @@ static void fix_call_list(ir_graph *irg, wlk_env *env) */ static void transform_irg(const lower_params_t *lp, ir_graph *irg) { - ir_graph * rem = current_ir_graph; + ir_graph *rem = current_ir_graph; ir_entity *ent = get_irg_entity(irg); ir_type *mtp, *lowered_mtp, *tp, *ft; - int i, j, k, n_ress = 0, n_ret_com = 0, n_cr_opt; + int i, j, k, n_ress = 0, n_ret_com = 0; + size_t n_cr_opt; ir_node **new_in, *ret, *endbl, *bl, *mem, *copy; cr_pair *cr_opt; wlk_env env; @@ -812,9 +812,11 @@ static void transform_irg(const lower_params_t *lp, ir_graph *irg) set_irn_in(ret, j, new_in); if (n_cr_opt > 0) { + size_t i, n; + irg_walk_graph(irg, NULL, do_copy_return_opt, cr_opt); - for (i = ARR_LEN(cr_opt) - 1; i >= 0; --i) { + for (i = 0, n = ARR_LEN(cr_opt); i < n; ++i) { free_entity(cr_opt[i].ent); } } diff --git a/ir/lower/lower_mode_b.c b/ir/lower/lower_mode_b.c index d2a16dd88..4dcd711f6 100644 --- a/ir/lower/lower_mode_b.c +++ b/ir/lower/lower_mode_b.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2011 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -435,8 +435,8 @@ void ir_lower_mode_b(ir_graph *irg, const lower_mode_b_config_t *nconfig) ir_entity *entity = get_irg_entity(irg); ir_type *type = get_entity_type(entity); bool changed = false; - int i; - int n; + size_t i; + size_t n; config = nconfig; lowered_nodes = NEW_ARR_F(ir_node*, 0); @@ -455,13 +455,12 @@ void ir_lower_mode_b(ir_graph *irg, const lower_mode_b_config_t *nconfig) irg_walk_graph(irg, firm_clear_link, NULL, NULL); irg_walk_graph(irg, lower_mode_b_walker, NULL, &changed); - for (i = 0; i < ARR_LEN(check_later); ++i) { + for (i = 0, n = ARR_LEN(check_later); i < n; ++i) { ir_node *node = check_later[i]; irg_walk_core(node, lower_mode_b_walker, NULL, &changed); } - n = ARR_LEN(lowered_nodes); - for (i = 0; i < n; ++i) { + for (i = 0, n = ARR_LEN(lowered_nodes); i < n; ++i) { ir_node *node = lowered_nodes[i]; maybe_kill_node(node); } diff --git a/ir/lower/lower_mux.c b/ir/lower/lower_mux.c index 11de6ae4a..e1c80c023 100644 --- a/ir/lower/lower_mux.c +++ b/ir/lower/lower_mux.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2011 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -114,7 +114,7 @@ static void lower_mux_node(ir_node* mux) void lower_mux(ir_graph *irg, lower_mux_callback *cb_func) { - int i, n_muxes; + size_t i, n_muxes; walk_env_t env; /* Scan the graph for mux nodes to lower. */ diff --git a/ir/lower/lower_switch.c b/ir/lower/lower_switch.c index ed1f294f0..8235df95b 100644 --- a/ir/lower/lower_switch.c +++ b/ir/lower/lower_switch.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2011 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -218,7 +218,7 @@ static void create_out_of_bounds_check(cond_env_t *env, ir_node *cond) ir_node *oob_cond; ir_node *in[1]; ir_node *new_block; - int n_default_preds; + size_t n_default_preds; int i; ir_node *proj; @@ -275,7 +275,7 @@ static void create_out_of_bounds_check(cond_env_t *env, ir_node *cond) /* adapt default block */ n_default_preds = ARR_LEN(default_preds); if (n_default_preds > 1) { - int i; + size_t i; /* create new intermediate blocks so we don't have critical edges */ for (i = 0; i < n_default_preds; ++i) { diff --git a/ir/opt/combo.c b/ir/opt/combo.c index 497a20a57..5f7c6800a 100644 --- a/ir/opt/combo.c +++ b/ir/opt/combo.c @@ -3564,7 +3564,7 @@ void combo(ir_graph *irg) ir_node *initial_bl; node_t *start; ir_graph *rem = current_ir_graph; - int len; + size_t len; current_ir_graph = irg; diff --git a/ir/opt/ldstopt.c b/ir/opt/ldstopt.c index 0795b849b..15964a359 100644 --- a/ir/opt/ldstopt.c +++ b/ir/opt/ldstopt.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2011 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -1692,7 +1692,7 @@ typedef struct node_entry { typedef struct loop_env { ir_phase ph; /**< the phase object */ ir_node **stack; /**< the node stack */ - int tos; /**< tos index */ + size_t tos; /**< tos index */ unsigned nextDFSnum; /**< the current DFS number */ unsigned POnum; /**< current post order number */ @@ -1726,7 +1726,7 @@ static void push(loop_env *env, ir_node *n) node_entry *e; if (env->tos == ARR_LEN(env->stack)) { - int nlen = ARR_LEN(env->stack) * 2; + size_t nlen = ARR_LEN(env->stack) * 2; ARR_RESIZE(ir_node *, env->stack, nlen); } env->stack[env->tos++] = n; diff --git a/ir/opt/loop.c b/ir/opt/loop.c index d3a61862c..d11b0f722 100644 --- a/ir/opt/loop.c +++ b/ir/opt/loop.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2010 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2011 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -859,8 +859,8 @@ static void copy_walk_n(ir_node *node, walker_condition *walk_condition, /* Removes alle Blocks with non marked predecessors from the condition chain. */ static void unmark_not_allowed_cc_blocks(void) { - int blocks = ARR_LEN(cc_blocks); - int i; + size_t blocks = ARR_LEN(cc_blocks); + size_t i; for(i = 0; i < blocks; ++i) { ir_node *block = cc_blocks[i]; @@ -888,8 +888,8 @@ static void unmark_not_allowed_cc_blocks(void) * TODO: invert head for unrolling? */ static void unmark_cc_blocks(void) { - int blocks = ARR_LEN(cc_blocks); - int i; + size_t blocks = ARR_LEN(cc_blocks); + size_t i; for(i = 0; i < blocks; ++i) { ir_node *block = cc_blocks[i]; diff --git a/ir/opt/opt_blocks.c b/ir/opt/opt_blocks.c index 5e88fe4b5..a2a045206 100644 --- a/ir/opt/opt_blocks.c +++ b/ir/opt/opt_blocks.c @@ -1175,7 +1175,7 @@ static void add_roots(ir_graph *irg, environment_t *env) * Else, we will split identical blocks if we start which different roots. */ for (bl = env->all_blocks; bl != NULL; bl = bl->all_next) { - int i, n = ARR_LEN(bl->roots); + size_t i, n = ARR_LEN(bl->roots); #if 1 /* TODO: is this really needed? The roots are already in diff --git a/ir/opt/opt_osr.c b/ir/opt/opt_osr.c index a566f205b..1d3908409 100644 --- a/ir/opt/opt_osr.c +++ b/ir/opt/opt_osr.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2011 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -79,7 +79,7 @@ typedef struct node_entry { typedef struct iv_env { struct obstack obst; /**< an obstack for allocations */ ir_node **stack; /**< the node stack */ - int tos; /**< tos index */ + size_t tos; /**< tos index */ unsigned nextDFSnum; /**< the current DFS number */ unsigned POnum; /**< current post order number */ set *quad_map; /**< a map from (op, iv, rc) to node */ @@ -950,7 +950,7 @@ static void push(iv_env *env, ir_node *n) node_entry *e; if (env->tos == ARR_LEN(env->stack)) { - int nlen = ARR_LEN(env->stack) * 2; + size_t nlen = ARR_LEN(env->stack) * 2; ARR_RESIZE(ir_node *, env->stack, nlen); } env->stack[env->tos++] = n; diff --git a/ir/opt/proc_cloning.c b/ir/opt/proc_cloning.c index 5e886c353..93d1333fc 100644 --- a/ir/opt/proc_cloning.c +++ b/ir/opt/proc_cloning.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2011 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -522,7 +522,7 @@ static float calculate_weight(const entry_t *entry) static void reorder_weights(q_set *hmap, float threshold) { entry_t **adr, *p, *entry; - int i, len; + size_t i, len; ir_entity *callee; restart: diff --git a/ir/tr/compound_path.c b/ir/tr/compound_path.c index 583dff0f0..1236b3a98 100644 --- a/ir/tr/compound_path.c +++ b/ir/tr/compound_path.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2011 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -230,7 +230,7 @@ ir_node *get_compound_ent_value_by_path(const ir_entity *ent, void remove_compound_ent_value(ir_entity *ent, ir_entity *value_ent) { - int i, n; + size_t i, n; assert(is_compound_entity(ent)); n = ARR_LEN(ent->attr.cmpd_attr.val_paths); diff --git a/ir/tr/type_t.h b/ir/tr/type_t.h index 3ff584254..0c54a2012 100644 --- a/ir/tr/type_t.h +++ b/ir/tr/type_t.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2011 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -412,10 +412,10 @@ static inline int _is_class_type(const ir_type *clss) return (clss->type_op == type_class); } -static inline int _get_class_n_members (const ir_type *clss) +static inline int _get_class_n_members(const ir_type *clss) { assert(clss && (clss->type_op == type_class)); - return (ARR_LEN (clss->attr.ca.members)); + return (int)(ARR_LEN(clss->attr.ca.members)); } static inline ir_entity *_get_class_member(const ir_type *clss, int pos) -- 2.20.1