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

Fixed some size_t related warnings.

parent 4879e4b5
......@@ -1777,7 +1777,7 @@ FIRM_API int is_Union_type(const ir_type *uni);
* The entity for array elements is built automatically.
* Set dimension sizes after call to constructor with set_* routines.
*/
FIRM_API ir_type *new_type_array(int n_dims, ir_type *element_type);
FIRM_API ir_type *new_type_array(size_t n_dims, ir_type *element_type);
/** Create a new type array with debug information.
*
......@@ -1787,7 +1787,7 @@ FIRM_API ir_type *new_type_array(int n_dims, ir_type *element_type);
* Set dimension sizes after call to constructor with set_* routines.
* A legal array type must have at least one dimension set.
*/
FIRM_API ir_type *new_d_type_array(int n_dims, ir_type *element_type,
FIRM_API ir_type *new_d_type_array(size_t n_dims, ir_type *element_type,
type_dbg_info* db);
/* --- manipulate private fields of array type --- */
......@@ -1839,16 +1839,16 @@ FIRM_API ir_node *get_array_upper_bound(const ir_type *array, size_t dimension);
FIRM_API long get_array_upper_bound_int(const ir_type *array, size_t dimension);
/** Sets an array dimension to a specific order. */
FIRM_API void set_array_order(ir_type *array, size_t dimension, int order);
FIRM_API void set_array_order(ir_type *array, size_t dimension, size_t order);
/** Returns the order of an array dimension. */
FIRM_API int get_array_order(const ir_type *array, size_t dimension);
FIRM_API size_t get_array_order(const ir_type *array, size_t dimension);
/** Find the array dimension that is placed at order order. */
FIRM_API size_t find_array_dimension(const ir_type *array, int order);
FIRM_API size_t find_array_dimension(const ir_type *array, size_t order);
/** Sets the array element type. */
FIRM_API void set_array_element_type(ir_type *array, ir_type* tp);
FIRM_API void set_array_element_type(ir_type *array, ir_type *tp);
/** Gets the array element type. */
FIRM_API ir_type *get_array_element_type(const ir_type *array);
......
......@@ -336,18 +336,18 @@ static void gen_pointer_type(wenv_t *env, ir_type *tp)
static void print_array_type(stabs_handle *h, ir_type *tp, int local)
{
ir_type *etp = get_array_element_type(tp);
int i, n = get_array_n_dimensions(tp);
size_t i, n = get_array_n_dimensions(tp);
unsigned type_num = local ? h->next_type_nr++ : get_type_number(h, tp);
int *perm;
be_emit_irprintf("%u=a", type_num);
NEW_ARR_A(int, perm, n);
NEW_ARR_A(size_t, perm, n);
for (i = 0; i < n; ++i) {
perm[i] = get_array_order(tp, i);
}
for (i = 0; i < n; ++i) {
int dim = perm[i];
size_t dim = perm[i];
if (is_Const(get_array_lower_bound(tp, dim)) && is_Const(get_array_upper_bound(tp, dim))) {
long min = get_array_lower_bound_int(tp, dim);
......
......@@ -1921,8 +1921,8 @@ static void dump_type_info(type_or_ent tore, void *env)
--i;
upper = get_array_upper_bound(tp, i);
lower = get_array_lower_bound(tp, i);
print_node_type_edge(F, upper, tp, "label: \"upper %d\"", get_array_order(tp, i));
print_node_type_edge(F, lower, tp, "label: \"lower %d\"", get_array_order(tp, i));
print_node_type_edge(F, upper, tp, "label: \"upper %zu\"", get_array_order(tp, i));
print_node_type_edge(F, lower, tp, "label: \"lower %zu\"", get_array_order(tp, i));
dump_const_expression(F, upper);
dump_const_expression(F, lower);
}
......
......@@ -752,7 +752,7 @@ void dump_type_to_file(FILE *F, ir_type *tp)
fprintf(F, "\n order: ");
for (i = 0; i < n_dim; ++i)
fprintf(F, "<%d>", get_array_order(tp, i));
fprintf(F, "<%zu>", get_array_order(tp, i));
fprintf(F, "\n");
......
......@@ -103,8 +103,8 @@ static void dump_edge_costs(pbqp_t *pbqp)
fputs("<p>", pbqp->dump_file);
for (src_index = 0; src_index < pbqp->num_nodes; ++src_index) {
pbqp_node_t *src_node = get_node(pbqp, src_index);
unsigned edge_index;
unsigned len;
size_t edge_index;
size_t len;
if (!src_node)
continue;
......
......@@ -44,8 +44,8 @@ pbqp_node_t *get_node(pbqp_t *pbqp, unsigned index)
pbqp_edge_t *get_edge(pbqp_t *pbqp, unsigned src_index, unsigned tgt_index)
{
int i;
int len;
size_t i;
size_t len;
pbqp_node_t *src_node;
pbqp_node_t *tgt_node;
......
......@@ -53,8 +53,8 @@ pbqp_node_t *alloc_node(pbqp_t *pbqp, unsigned node_index, vector_t *costs)
int is_connected(pbqp_node_t *node, pbqp_edge_t *edge)
{
pbqp_edge_t **edges;
unsigned edge_index;
unsigned edge_len;
size_t edge_index;
size_t edge_len;
assert(node);
if (edge->src != node && edge->tgt != node) return 0;
......@@ -75,8 +75,8 @@ int is_connected(pbqp_node_t *node, pbqp_edge_t *edge)
void disconnect_edge(pbqp_node_t *node, pbqp_edge_t *edge)
{
pbqp_edge_t **edges;
unsigned edge_index;
unsigned edge_len;
size_t edge_index;
size_t edge_len;
edges = node->edges;
edge_len = ARR_LEN(edges);
......
......@@ -71,18 +71,18 @@ static void lower_sel(ir_node *sel)
if (is_Array_type(owner)) {
ir_type *arr_ty = owner;
int dims = get_array_n_dimensions(arr_ty);
int *map = ALLOCAN(int, dims);
size_t dims = get_array_n_dimensions(arr_ty);
size_t *map = ALLOCAN(size_t, dims);
ir_mode *mode_Int = get_reference_mode_signed_eq(mode);
ir_tarval *tv;
ir_node *last_size;
int i;
size_t i;
assert(dims == get_Sel_n_indexs(sel)
&& "array dimension must match number of indices of Sel node");
for (i = 0; i < dims; i++) {
int order = get_array_order(arr_ty, i);
size_t order = get_array_order(arr_ty, i);
assert(order < dims &&
"order of a dimension must be smaller than the arrays dim");
......@@ -104,8 +104,8 @@ static void lower_sel(ir_node *sel)
* whereas u_i is the upper bound of the current dimension
* and l_i the lower bound of the current dimension.
*/
for (i = dims - 1; i >= 0; i--) {
int dim = map[i];
for (i = dims; i > 0;) {
size_t dim = map[--i];
ir_node *lb, *ub, *elms, *n, *ind;
elms = NULL;
......
......@@ -640,8 +640,8 @@ static ir_node *eval_strlen(ir_graph *irg, ir_entity *ent, ir_type *res_tp)
ir_type *tp = get_entity_type(ent);
ir_mode *mode;
ir_initializer_t *initializer;
unsigned size;
unsigned i;
size_t size;
size_t i;
if (! is_Array_type(tp))
return NULL;
......
......@@ -143,7 +143,7 @@ static ir_node *is_depend_alloc(ir_node *adr)
*/
static int can_escape(ir_node *n)
{
int i, j, k;
int i;
/* should always be pointer mode or we made some mistake */
assert(mode_is_reference(get_irn_mode(n)));
......@@ -183,30 +183,33 @@ static int can_escape(ir_node *n)
ir_entity *ent;
if (is_SymConst_addr_ent(ptr)) {
size_t j;
ent = get_SymConst_entity(ptr);
/* we know the called entity */
for (j = get_Call_n_params(succ) - 1; j >= 0; --j) {
if (get_Call_param(succ, j) == n) {
for (j = get_Call_n_params(succ); j > 0;) {
if (get_Call_param(succ, --j) == n) {
/* n is the j'th param of the call */
if (get_method_param_access(ent, j) & ptr_access_store)
/* n is store in ent */
return 1;
}
}
}
else if (is_Sel(ptr)) {
} else if (is_Sel(ptr)) {
size_t k;
/* go through all possible callees */
for (k = get_Call_n_callees(succ) - 1; k >= 0; --k) {
ent = get_Call_callee(succ, k);
for (k = get_Call_n_callees(succ); k > 0;) {
size_t j;
ent = get_Call_callee(succ, --k);
if (ent == unknown_entity) {
/* we don't know what will be called, a possible escape */
return 1;
}
for (j = get_Call_n_params(succ) - 1; j >= 0; --j) {
if (get_Call_param(succ, j) == n) {
for (j = get_Call_n_params(succ); j > 0;) {
if (get_Call_param(succ, --j) == n) {
/* n is the j'th param of the call */
if (get_method_param_access(ent, j) & ptr_access_store)
/* n is store in ent */
......@@ -214,8 +217,7 @@ static int can_escape(ir_node *n)
}
}
}
}
else /* we don't know want will called */
} else /* we don't know want will called */
return 1;
break;
......@@ -233,6 +235,7 @@ static int can_escape(ir_node *n)
case iro_Tuple: {
ir_node *proj;
int j, k;
/* Bad: trace the tuple backwards */
for (j = get_irn_arity(succ) - 1; j >= 0; --j)
......
......@@ -100,7 +100,7 @@ static void collect_const_and_pure_calls(ir_node *node, void *env)
is_Sel(ptr) &&
get_irg_callee_info_state(get_irn_irg(node)) == irg_callee_info_consistent) {
/* If all possible callees are const functions, we can remove the memory edge. */
int i, n_callees = get_Call_n_callees(call);
size_t i, n_callees = get_Call_n_callees(call);
if (n_callees == 0) {
/* This is kind of strange: dying code or a Call that will raise an exception
when executed as there is no implementation to call. So better not
......@@ -276,7 +276,7 @@ static void collect_nothrow_calls(ir_node *node, void *env)
is_Sel(ptr) &&
get_irg_callee_info_state(get_irn_irg(node)) == irg_callee_info_consistent) {
/* If all possible callees are nothrow functions, we can remove the exception edge. */
int i, n_callees = get_Call_n_callees(call);
size_t i, n_callees = get_Call_n_callees(call);
if (n_callees == 0) {
/* This is kind of strange: dying code or a Call that will raise an exception
when executed as there is no implementation to call. So better not
......@@ -722,11 +722,11 @@ static int is_stored(const ir_node *n)
ptr = get_Call_ptr(succ);
if (is_Global(ptr)) {
ir_entity *ent = get_Global_entity(ptr);
int i;
size_t i;
/* we know the called entity */
for (i = get_Call_n_params(succ) - 1; i >= 0; --i) {
if (get_Call_param(succ, i) == n) {
for (i = get_Call_n_params(succ); i > 0;) {
if (get_Call_param(succ, --i) == n) {
/* n is the i'th param of the call */
if (get_method_param_access(ent, i) & ptr_access_store) {
/* n is store in ent */
......@@ -755,17 +755,18 @@ static int is_stored(const ir_node *n)
static mtp_additional_properties check_stored_result(ir_graph *irg)
{
ir_node *end_blk = get_irg_end_block(irg);
int i, j;
int i;
mtp_additional_properties res = ~mtp_no_property;
int old_edges = edges_assure_kind(irg, EDGE_KIND_NORMAL);
for (i = get_Block_n_cfgpreds(end_blk) - 1; i >= 0; --i) {
ir_node *pred = get_Block_cfgpred(end_blk, i);
size_t j;
if (! is_Return(pred))
continue;
for (j = get_Return_n_ress(pred) - 1; j >= 0; --j) {
const ir_node *irn = get_Return_res(pred, j);
for (j = get_Return_n_ress(pred); j > 0;) {
const ir_node *irn = get_Return_res(pred, --j);
if (is_stored(irn)) {
/* bad, might create an alias */
......@@ -792,7 +793,7 @@ static mtp_additional_properties check_nothrow_or_malloc(ir_graph *irg, int top)
ir_node *end_blk = get_irg_end_block(irg);
ir_entity *ent;
ir_type *mtp;
int i, j;
int i;
if (IS_IRG_READY(irg)) {
/* already checked */
......@@ -816,9 +817,11 @@ static mtp_additional_properties check_nothrow_or_malloc(ir_graph *irg, int top)
if (is_Return(pred)) {
if (curr_prop & mtp_property_malloc) {
size_t j;
/* check, if malloc is called here */
for (j = get_Return_n_ress(pred) - 1; j >= 0; --j) {
ir_node *res = get_Return_res(pred, j);
for (j = get_Return_n_ress(pred); j > 0;) {
ir_node *res = get_Return_res(pred, --j);
/* skip Confirms and Casts */
res = skip_HighLevel_ops(res);
......@@ -847,7 +850,7 @@ static mtp_additional_properties check_nothrow_or_malloc(ir_graph *irg, int top)
is_Sel(ptr) &&
get_irg_callee_info_state(irg) == irg_callee_info_consistent) {
/* check if all possible callees are malloc functions. */
int i, n_callees = get_Call_n_callees(res);
size_t i, n_callees = get_Call_n_callees(res);
if (n_callees == 0) {
/* This is kind of strange: dying code or a Call that will raise an exception
when executed as there is no implementation to call. So better not
......@@ -905,7 +908,7 @@ static mtp_additional_properties check_nothrow_or_malloc(ir_graph *irg, int top)
is_Sel(ptr) &&
get_irg_callee_info_state(irg) == irg_callee_info_consistent) {
/* check if all possible callees are nothrow functions. */
int i, n_callees = get_Call_n_callees(pred);
size_t i, n_callees = get_Call_n_callees(pred);
if (n_callees == 0) {
/* This is kind of strange: dying code or a Call that will raise an exception
when executed as there is no implementation to call. So better not
......
......@@ -346,11 +346,11 @@ static long get_Sel_array_index_long(ir_node *n, int dim)
* @param depth current depth in steps upward from the root
* of the address
*/
static compound_graph_path *rec_get_accessed_path(ir_node *ptr, int depth)
static compound_graph_path *rec_get_accessed_path(ir_node *ptr, size_t depth)
{
compound_graph_path *res = NULL;
ir_entity *root, *field, *ent;
int path_len, pos, idx;
size_t path_len, pos, idx;
ir_tarval *tv;
ir_type *tp;
......@@ -505,7 +505,7 @@ static compound_graph_path *get_accessed_path(ir_node *ptr)
typedef struct path_entry {
ir_entity *ent;
struct path_entry *next;
long index;
size_t index;
} path_entry;
static ir_node *rec_find_compound_ent_value(ir_node *ptr, path_entry *next)
......@@ -515,7 +515,7 @@ static ir_node *rec_find_compound_ent_value(ir_node *ptr, path_entry *next)
ir_initializer_t *initializer;
ir_tarval *tv;
ir_type *tp;
unsigned n;
size_t n;
entry.next = next;
if (is_SymConst(ptr)) {
......@@ -538,7 +538,7 @@ static ir_node *rec_find_compound_ent_value(ir_node *ptr, path_entry *next)
continue;
}
}
if (p->index >= (int) n)
if (p->index >= n)
return NULL;
initializer = get_initializer_compound_value(initializer, p->index);
......@@ -571,7 +571,7 @@ static ir_node *rec_find_compound_ent_value(ir_node *ptr, path_entry *next)
assert(get_Sel_n_indexs(ptr) == 1 && "multi dim arrays not implemented");
entry.index = get_Sel_array_index_long(ptr, 0) - get_array_lower_bound_int(tp, 0);
} else {
int i, n_members = get_compound_n_members(tp);
size_t i, n_members = get_compound_n_members(tp);
for (i = 0; i < n_members; ++i) {
if (get_compound_member(tp, i) == field)
break;
......@@ -768,7 +768,7 @@ static int can_use_stored_value(ir_mode *old_mode, ir_mode *new_mode)
}
/**
* Check whether a Call is at least pure, ie. does only read memory.
* Check whether a Call is at least pure, i.e. does only read memory.
*/
static unsigned is_Call_pure(ir_node *call)
{
......
......@@ -640,11 +640,11 @@ static long get_Sel_array_index_long(ir_node *n, int dim)
* @param depth current depth in steps upward from the root
* of the address
*/
static compound_graph_path *rec_get_accessed_path(ir_node *ptr, int depth)
static compound_graph_path *rec_get_accessed_path(ir_node *ptr, size_t depth)
{
compound_graph_path *res = NULL;
ir_entity *root, *field, *ent;
int path_len, pos, idx;
size_t path_len, pos, idx;
ir_tarval *tv;
ir_type *tp;
......@@ -799,7 +799,7 @@ static compound_graph_path *get_accessed_path(ir_node *ptr)
typedef struct path_entry {
ir_entity *ent;
struct path_entry *next;
long index;
size_t index;
} path_entry;
static ir_node *rec_find_compound_ent_value(ir_node *ptr, path_entry *next)
......@@ -809,7 +809,7 @@ static ir_node *rec_find_compound_ent_value(ir_node *ptr, path_entry *next)
ir_initializer_t *initializer;
ir_tarval *tv;
ir_type *tp;
unsigned n;
size_t n;
entry.next = next;
if (is_SymConst(ptr)) {
......@@ -832,7 +832,7 @@ static ir_node *rec_find_compound_ent_value(ir_node *ptr, path_entry *next)
continue;
}
}
if (p->index >= (int) n)
if (p->index >= n)
return NULL;
initializer = get_initializer_compound_value(initializer, p->index);
......@@ -865,7 +865,7 @@ static ir_node *rec_find_compound_ent_value(ir_node *ptr, path_entry *next)
assert(get_Sel_n_indexs(ptr) == 1 && "multi dim arrays not implemented");
entry.index = get_Sel_array_index_long(ptr, 0) - get_array_lower_bound_int(tp, 0);
} else {
int i, n_members = get_compound_n_members(tp);
size_t i, n_members = get_compound_n_members(tp);
for (i = 0; i < n_members; ++i) {
if (get_compound_member(tp, i) == field)
break;
......@@ -923,7 +923,7 @@ ptr_arith:
for (ent = field;;) {
unsigned size;
ir_tarval *sz, *tv_index, *tlower, *tupper;
long index;
size_t index;
ir_node *bound;
tp = get_entity_type(ent);
......
......@@ -1513,11 +1513,11 @@ void set_union_size(ir_type *tp, unsigned size)
ir_type *new_d_type_array(int n_dimensions, ir_type *element_type,
ir_type *new_d_type_array(size_t n_dimensions, ir_type *element_type,
type_dbg_info *db)
{
ir_type *res;
int i;
size_t i;
ir_node *unk;
ir_graph *irg = get_const_code_irg();
......@@ -1527,7 +1527,7 @@ ir_type *new_d_type_array(int n_dimensions, ir_type *element_type,
res->attr.aa.n_dimensions = n_dimensions;
res->attr.aa.lower_bound = XMALLOCNZ(ir_node*, n_dimensions);
res->attr.aa.upper_bound = XMALLOCNZ(ir_node*, n_dimensions);
res->attr.aa.order = XMALLOCNZ(int, n_dimensions);
res->attr.aa.order = XMALLOCNZ(size_t, n_dimensions);
unk = new_r_Unknown(irg, mode_Iu);
for (i = 0; i < n_dimensions; i++) {
......@@ -1545,7 +1545,7 @@ ir_type *new_d_type_array(int n_dimensions, ir_type *element_type,
return res;
}
ir_type *new_type_array(int n_dimensions, ir_type *element_type)
ir_type *new_type_array(size_t n_dimensions, ir_type *element_type)
{
return new_d_type_array(n_dimensions, element_type, NULL);
}
......@@ -1668,19 +1668,19 @@ long get_array_upper_bound_int(const ir_type *array, size_t dimension)
return get_tarval_long(get_Const_tarval(node));
}
void set_array_order(ir_type *array, size_t dimension, int order)
void set_array_order(ir_type *array, size_t dimension, size_t order)
{
assert(array && (array->type_op == type_array));
array->attr.aa.order[dimension] = order;
}
int get_array_order(const ir_type *array, size_t dimension)
size_t get_array_order(const ir_type *array, size_t dimension)
{
assert(array && (array->type_op == type_array));
return array->attr.aa.order[dimension];
}
size_t find_array_dimension(const ir_type *array, int order)
size_t find_array_dimension(const ir_type *array, size_t order)
{
size_t dim;
......
......@@ -87,7 +87,7 @@ typedef struct {
size_t n_dimensions; /**< Number of array dimensions. */
ir_node **lower_bound; /**< Lower bounds of dimensions. Usually all 0. */
ir_node **upper_bound; /**< Upper bounds or dimensions. */
int *order; /**< Ordering of dimensions. */
size_t *order; /**< Ordering of dimensions. */
ir_type *element_type; /**< The type of the array elements. */
ir_entity *element_ent; /**< entity for the array elements, to be used for
element selection with a Sel node. */
......
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