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)
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;
}
......
......@@ -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));
......
......@@ -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)
......
......@@ -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);
}
/*
* 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.
......
......@@ -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;
......
/*
* 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);
}
/**
......
/*
* 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;
}
......
/*
* 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();
......
......@@ -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];
......
/*
* 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)
......
/*
* 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;
......
/*
* 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. */
......
/*
* 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");
......
/*
* 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.
......
/*
* 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;
......
......@@ -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) {
......
/*
* 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]));
}
......
......@@ -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)
......
/*
* 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);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment