Commit e8838501 authored by Michael Beck's avatar Michael Beck
Browse files

Fixed a lot of size_t related warnings, most of them due to array implementation change.

[r28272]
parent 65f08a3f
...@@ -206,7 +206,7 @@ int get_irg_callee_loop_depth(const ir_graph *irg, int pos) ...@@ -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) static double get_irg_callee_execution_frequency(const ir_graph *irg, int pos)
{ {
ir_node **arr = irg->callees[pos]->call_list; 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; double freq = 0.0;
for (i = 0; i < n_Calls; ++i) { for (i = 0; i < n_Calls; ++i) {
...@@ -537,7 +537,7 @@ static inline int get_irg_dfn(ir_graph *irg) ...@@ -537,7 +537,7 @@ static inline int get_irg_dfn(ir_graph *irg)
/**********************************************************************/ /**********************************************************************/
static ir_graph **stack = NULL; static ir_graph **stack = NULL;
static int tos = 0; /**< top of stack */ static size_t tos = 0; /**< top of stack */
/** /**
* Initialize the irg stack. * Initialize the irg stack.
...@@ -559,7 +559,7 @@ static inline void init_stack(void) ...@@ -559,7 +559,7 @@ static inline void init_stack(void)
static inline void push(ir_graph *irg) static inline void push(ir_graph *irg)
{ {
if (tos == ARR_LEN(stack)) { if (tos == ARR_LEN(stack)) {
int nlen = ARR_LEN(stack) * 2; size_t nlen = ARR_LEN(stack) * 2;
ARR_RESIZE(ir_graph*, stack, nlen); ARR_RESIZE(ir_graph*, stack, nlen);
} }
stack [tos++] = irg; stack [tos++] = irg;
...@@ -571,7 +571,10 @@ static inline void push(ir_graph *irg) ...@@ -571,7 +571,10 @@ static inline void push(ir_graph *irg)
*/ */
static inline ir_graph *pop(void) 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); mark_irg_not_in_stack(irg);
return irg; return irg;
} }
......
...@@ -285,7 +285,7 @@ static ir_entity ** get_Sel_arr(ir_node * sel) ...@@ -285,7 +285,7 @@ static ir_entity ** get_Sel_arr(ir_node * sel)
* *
* @param sel the Sel node * @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)); return ARR_LEN(get_Sel_arr(sel));
} }
...@@ -293,10 +293,10 @@ static int get_Sel_n_methods(ir_node * 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. * 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); ir_entity ** arr = get_Sel_arr(sel);
assert(pos >= 0 && pos < ARR_LEN(arr)); assert(pos < ARR_LEN(arr));
return arr[pos]; return arr[pos];
} }
...@@ -360,7 +360,7 @@ static void free_mark_proj(ir_node * node, long n, eset * set) ...@@ -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) static void free_mark(ir_node *node, eset * set)
{ {
int i; size_t i, n;
if (get_irn_link(node) == MARK) if (get_irn_link(node) == MARK)
return; /* already visited */ return; /* already visited */
...@@ -371,7 +371,7 @@ static void free_mark(ir_node *node, eset * set) ...@@ -371,7 +371,7 @@ static void free_mark(ir_node *node, eset * set)
case iro_Sel: { case iro_Sel: {
ir_entity *ent = get_Sel_entity(node); ir_entity *ent = get_Sel_entity(node);
if (is_method_entity(ent)) { 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)); eset_insert(set, get_Sel_method(node, i));
} }
} }
...@@ -387,10 +387,13 @@ static void free_mark(ir_node *node, eset * set) ...@@ -387,10 +387,13 @@ static void free_mark(ir_node *node, eset * set)
break; break;
case iro_Phi: 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); free_mark(get_Phi_pred(node, i), set);
} }
break; break;
}
case iro_Proj: case iro_Proj:
free_mark_proj(get_Proj_pred(node), get_Proj_proj(node), set); free_mark_proj(get_Proj_pred(node), get_Proj_proj(node), set);
break; break;
...@@ -648,8 +651,6 @@ static void callee_ana_proj(ir_node *node, long n, eset *methods) ...@@ -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) static void callee_ana_node(ir_node *node, eset *methods)
{ {
int i;
assert(mode_is_reference(get_irn_mode(node)) || is_Bad(node)); assert(mode_is_reference(get_irn_mode(node)) || is_Bad(node));
/* Beware of recursion */ /* Beware of recursion */
if (get_irn_link(node) == MARK) { if (get_irn_link(node) == MARK) {
...@@ -672,9 +673,10 @@ static void callee_ana_node(ir_node *node, eset *methods) ...@@ -672,9 +673,10 @@ static void callee_ana_node(ir_node *node, eset *methods)
break; break;
} }
case iro_Sel: case iro_Sel: {
/* polymorphic method */ /* 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); ir_entity *ent = get_Sel_method(node, i);
if (ent != NULL) { if (ent != NULL) {
eset_insert(methods, ent); eset_insert(methods, ent);
...@@ -683,16 +685,19 @@ static void callee_ana_node(ir_node *node, eset *methods) ...@@ -683,16 +685,19 @@ static void callee_ana_node(ir_node *node, eset *methods)
} }
} }
break; break;
}
case iro_Bad: case iro_Bad:
/* nothing */ /* nothing */
break; break;
case iro_Phi: case iro_Phi: {
int i;
for (i = get_Phi_n_preds(node) - 1; i >= 0; --i) { for (i = get_Phi_n_preds(node) - 1; i >= 0; --i) {
callee_ana_node(get_Phi_pred(node, i), methods); callee_ana_node(get_Phi_pred(node, i), methods);
} }
break; break;
}
case iro_Mux: case iro_Mux:
callee_ana_node(get_Mux_false(node), methods); callee_ana_node(get_Mux_false(node), methods);
...@@ -731,7 +736,7 @@ static void callee_walker(ir_node *call, void *env) ...@@ -731,7 +736,7 @@ static void callee_walker(ir_node *call, void *env)
eset *methods = eset_create(); eset *methods = eset_create();
ir_entity *ent; ir_entity *ent;
ir_entity **arr; ir_entity **arr;
int i; size_t i;
callee_ana_node(get_Call_ptr(call), methods); callee_ana_node(get_Call_ptr(call), methods);
arr = NEW_ARR_F(ir_entity *, eset_count(methods)); arr = NEW_ARR_F(ir_entity *, eset_count(methods));
......
...@@ -106,7 +106,7 @@ static inline region_attr *get_region_attr(void *region) ...@@ -106,7 +106,7 @@ static inline region_attr *get_region_attr(void *region)
int get_region_n_ins(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) void *get_region_in(void *region, int pos)
......
...@@ -163,7 +163,7 @@ void clear_backedges(ir_node *n) ...@@ -163,7 +163,7 @@ void clear_backedges(ir_node *n)
} }
/* Allocate a new backedge array on the obstack for given size. */ /* 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); return bitset_obstack_alloc(obst, size);
} }
/* /*
* 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. * This file is part of libFirm.
* *
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
* @param obst the obstack to allocate the array on * @param obst the obstack to allocate the array on
* @param size the size of the backedge array * @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. * Adapts backedges array to new size.
......
...@@ -178,7 +178,7 @@ static void finish_stack(void) ...@@ -178,7 +178,7 @@ static void finish_stack(void)
static inline void push(ir_node *n) static inline void push(ir_node *n)
{ {
if (tos == ARR_LEN(stack)) { if (tos == ARR_LEN(stack)) {
int nlen = ARR_LEN(stack) * 2; size_t nlen = ARR_LEN(stack) * 2;
ARR_RESIZE(ir_node *, stack, nlen); ARR_RESIZE(ir_node *, stack, nlen);
} }
stack[tos++] = n; stack[tos++] = n;
......
/* /*
* 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. * This file is part of libFirm.
* *
...@@ -126,7 +126,7 @@ static inline void _set_extbb_link(ir_extblk *blk, void *link) ...@@ -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) static inline int _get_extbb_n_blocks(const ir_extblk *blk)
{ {
assert(blk); assert(blk);
return ARR_LEN(blk->blks); return (int)ARR_LEN(blk->blks);
} }
/** /**
......
/* /*
* 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. * This file is part of libFirm.
* *
...@@ -197,7 +197,7 @@ ir_loop * get_irn_loop(ir_node *n) ...@@ -197,7 +197,7 @@ ir_loop * get_irn_loop(ir_node *n)
/**********************************************************************/ /**********************************************************************/
static ir_node **stack = NULL; static ir_node **stack = NULL;
static int tos = 0; /* top of stack */ static size_t tos = 0; /* top of stack */
/** /**
* initializes the stack * initializes the stack
...@@ -229,10 +229,10 @@ static void finish_stack(void) ...@@ -229,10 +229,10 @@ static void finish_stack(void)
static inline void push(ir_node *n) static inline void push(ir_node *n)
{ {
if (tos == ARR_LEN(stack)) { if (tos == ARR_LEN(stack)) {
int nlen = ARR_LEN(stack) * 2; size_t nlen = ARR_LEN(stack) * 2;
ARR_RESIZE(ir_node *, stack, nlen); ARR_RESIZE(ir_node *, stack, nlen);
} }
stack [tos++] = n; stack[tos++] = n;
mark_irn_in_stack(n); mark_irn_in_stack(n);
} }
...@@ -243,7 +243,10 @@ static inline void push(ir_node *n) ...@@ -243,7 +243,10 @@ static inline void push(ir_node *n)
*/ */
static inline ir_node *pop(void) 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); mark_irn_not_in_stack(n);
return n; return n;
} }
......
/* /*
* 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. * This file is part of libFirm.
* *
...@@ -629,7 +629,7 @@ void amd64_gen_routine(ir_graph *irg) ...@@ -629,7 +629,7 @@ void amd64_gen_routine(ir_graph *irg)
{ {
ir_entity *entity = get_irg_entity(irg); ir_entity *entity = get_irg_entity(irg);
ir_node **blk_sched; ir_node **blk_sched;
int i, n; size_t i, n;
/* register all emitter functions */ /* register all emitter functions */
amd64_register_emitters(); amd64_register_emitters();
......
...@@ -644,8 +644,8 @@ static ir_node *adjust_call(be_abi_irg_t *env, ir_node *irn, ir_node *curr_sp) ...@@ -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) { if (arg->in_reg) {
/* remove register from destroyed regs */ /* remove register from destroyed regs */
int j; size_t j;
int n = ARR_LEN(destroyed_regs); size_t n = ARR_LEN(destroyed_regs);
for (j = 0; j < n; ++j) { for (j = 0; j < n; ++j) {
if (destroyed_regs[j] == arg->reg) { if (destroyed_regs[j] == arg->reg) {
destroyed_regs[j] = destroyed_regs[n-1]; destroyed_regs[j] = destroyed_regs[n-1];
......
/* /*
* 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. * This file is part of libFirm.
* *
...@@ -628,7 +628,7 @@ static inline unsigned arch_irn_get_n_outs(const ir_node *node) ...@@ -628,7 +628,7 @@ static inline unsigned arch_irn_get_n_outs(const ir_node *node)
if (info->out_infos == NULL) if (info->out_infos == NULL)
return 0; 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) static inline const arch_irn_ops_t *get_irn_ops_simple(const ir_node *node)
......
/* /*
* 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. * 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) ...@@ -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) void mature_immBlock(ir_node *block)
{ {
int n_preds; size_t n_preds;
ir_node *next; ir_node *next;
ir_node *phi; ir_node *phi;
ir_graph *irg; ir_graph *irg;
......
/* /*
* 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. * This file is part of libFirm.
* *
...@@ -614,7 +614,7 @@ typedef struct list_tuple { ...@@ -614,7 +614,7 @@ typedef struct list_tuple {
static list_tuple *construct_extblock_lists(ir_graph *irg) static list_tuple *construct_extblock_lists(ir_graph *irg)
{ {
ir_node **blk_list = construct_block_lists(irg); ir_node **blk_list = construct_block_lists(irg);
int i; size_t i, n;
ir_graph *rem = current_ir_graph; ir_graph *rem = current_ir_graph;
list_tuple *lists = XMALLOC(list_tuple); list_tuple *lists = XMALLOC(list_tuple);
...@@ -624,7 +624,7 @@ static list_tuple *construct_extblock_lists(ir_graph *irg) ...@@ -624,7 +624,7 @@ static list_tuple *construct_extblock_lists(ir_graph *irg)
lists->extbb_list = NEW_ARR_F(ir_extblk *, 0); lists->extbb_list = NEW_ARR_F(ir_extblk *, 0);
inc_irg_block_visited(irg); 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; ir_extblk *ext;
if (is_Block(blk_list[i])) { if (is_Block(blk_list[i])) {
...@@ -1620,13 +1620,13 @@ static void dump_whole_block(FILE *F, ir_node *block) ...@@ -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. */ * The outermost nodes: blocks and nodes not op_pin_state_pinned, Bad, Unknown. */
static void dump_block_graph(FILE *F, ir_graph *irg) static void dump_block_graph(FILE *F, ir_graph *irg)
{ {
int i; size_t i, n;
ir_graph *rem = current_ir_graph; ir_graph *rem = current_ir_graph;
ir_node **arr = (ir_node**)ird_get_irg_link(irg); ir_node **arr = (ir_node**)ird_get_irg_link(irg);
current_ir_graph = irg; current_ir_graph = irg;
for (i = ARR_LEN(arr) - 1; i >= 0; --i) { for (i = 0, n = ARR_LEN(arr); i < n; ++i) {
ir_node * node = arr[i]; ir_node *node = arr[i];
if (is_Block(node)) { if (is_Block(node)) {
/* Dumps the block and all the nodes in the block, which are to /* Dumps the block and all the nodes in the block, which are to
be found in Block->link. */ be found in Block->link. */
...@@ -2206,23 +2206,23 @@ static void dump_blocks_as_subgraphs(FILE *out, ir_graph *irg) ...@@ -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. */ * The outermost nodes: blocks and nodes not op_pin_state_pinned, Bad, Unknown. */
static void dump_extblock_graph(FILE *F, ir_graph *irg) static void dump_extblock_graph(FILE *F, ir_graph *irg)
{ {
int i; size_t i, arr_len;
ir_graph *rem = current_ir_graph; ir_graph *rem = current_ir_graph;
ir_extblk **arr = (ir_extblk**)ird_get_irg_link(irg); ir_extblk **arr = (ir_extblk**)ird_get_irg_link(irg);
current_ir_graph = 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_extblk *extbb = arr[i];
ir_node *leader = get_extbb_leader(extbb); ir_node *leader = get_extbb_leader(extbb);
int j; size_t j, n_blks;
fprintf(F, "graph: { title: \""); fprintf(F, "graph: { title: \"");
PRINT_EXTBBID(leader); PRINT_EXTBBID(leader);
fprintf(F, "\" label: \"ExtBB %ld\" status:clustered color:lightgreen\n", fprintf(F, "\" label: \"ExtBB %ld\" status:clustered color:lightgreen\n",
get_irn_node_nr(leader)); get_irn_node_nr(leader));
for (j = ARR_LEN(extbb->blks) - 1; j >= 0; --j) { for (j = 0, n_blks = ARR_LEN(extbb->blks); j < n_blks; ++j) {
ir_node * node = extbb->blks[j]; ir_node *node = extbb->blks[j];
if (is_Block(node)) { if (is_Block(node)) {
/* Dumps the block and all the nodes in the block, which are to /* Dumps the block and all the nodes in the block, which are to
be found in Block->link. */ be found in Block->link. */
......
/* /*
* 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. * This file is part of libFirm.
* *
...@@ -134,7 +134,7 @@ static int edges_used = 0; ...@@ -134,7 +134,7 @@ static int edges_used = 0;
* Summed size of all users private data * 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) #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) ...@@ -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. * Each user has to remember his given offset and the size of his private data.
* To be called before FIRM is initialized. * 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"); assert(!edges_used && "you cannot register private edge data, if edges have been initialized");
......
/* /*
* 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. * 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); ...@@ -147,7 +147,7 @@ void edges_invalidate_kind(ir_node *irn, ir_edge_kind_t kind, ir_graph *irg);
* edges_get_private_data() * edges_get_private_data()
* to get a pointer to your 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. * Get a pointer to the private data you registered.
......