Commit bb5461e3 authored by Matthias Braun's avatar Matthias Braun
Browse files

fixed a bunch of warnings (and some bugs)

[r14557]
parent 10e8d874
......@@ -133,6 +133,7 @@ static int be_omit_fp = 1;
static int cmp_call_arg(const void *a, const void *b, size_t n)
{
const be_abi_call_arg_t *p = a, *q = b;
(void) n;
return !(p->is_res == q->is_res && p->pos == q->pos);
}
......
......@@ -82,7 +82,7 @@ static lc_opt_enum_int_var_t algo_var = {
static const lc_opt_table_entry_t be_blocksched_options[] = {
LC_OPT_ENT_ENUM_INT ("algo", "the block scheduling algorithm", &algo_var),
{ NULL }
LC_OPT_ENT_NULL
};
/*
......@@ -362,6 +362,7 @@ static ir_node **create_blocksched_array(blocksched_env_t *env, blocksched_entry
int i = 0;
ir_node **block_list;
blocksched_entry_t *entry;
(void) env;
block_list = NEW_ARR_D(ir_node *, obst, count);
DBG((dbg, LEVEL_1, "Blockschedule:\n"));
......
......@@ -75,6 +75,7 @@ static int get_width(const plotter_t *_self) {
}
static void plotter_default_free(plotter_t *self) {
(void) self;
}
typedef struct {
......@@ -348,6 +349,8 @@ static color_t *reg_to_color(const draw_chordal_env_t *env,
{
int phi_arg = 0;
const ir_edge_t *edge;
(void) env;
(void) rel_bl;
foreach_out_edge(irn, edge)
phi_arg |= is_Phi(edge->src);
......
......@@ -98,6 +98,8 @@ static be_ra_chordal_opts_t options = {
BE_CH_DUMP_NONE,
BE_CH_LOWER_PERM_SWAP,
BE_CH_VRFY_WARN,
"",
""
};
typedef struct _post_spill_env_t {
......@@ -170,7 +172,7 @@ static const lc_opt_table_entry_t be_chordal_options[] = {
LC_OPT_ENT_ENUM_PTR ("perm", "perm lowering options", &lower_perm_var),
LC_OPT_ENT_ENUM_MASK("dump", "select dump phases", &dump_var),
LC_OPT_ENT_ENUM_PTR ("vrfy", "verify options", &be_ch_vrfy_var),
{ NULL }
LC_OPT_ENT_NULL
};
static void dump(unsigned mask, ir_graph *irg,
......
......@@ -84,7 +84,7 @@ static const lc_opt_table_entry_t options[] = {
LC_OPT_ENT_INT ("iter", "iterations for subtree nodes", &subtree_iter),
LC_OPT_ENT_DBL ("cf", "factor of constraint importance (between 0.0 and 1.0)", &constr_factor),
LC_OPT_ENT_INT ("max", "maximum recursion depth", &max_depth),
{ NULL }
LC_OPT_ENT_NULL
};
void be_init_copyheur2(void)
......
......@@ -80,7 +80,7 @@ static lc_opt_enum_mask_var_t dump_var = {
static const lc_opt_table_entry_t options[] = {
LC_OPT_ENT_ENUM_MASK("dump", "dump ifg cloud", &dump_var),
LC_OPT_ENT_INT ("dbg", "debug level for the Java coalescer", &dbg_level),
{ NULL }
LC_OPT_ENT_NULL
};
void be_init_copyheur3(void)
......
......@@ -130,7 +130,7 @@ typedef int decide_func_t(const co_mst_irn_t *node, int col);
* Write a chunk to stderr for debugging.
*/
static void dbg_aff_chunk(const co_mst_env_t *env, const aff_chunk_t *c) {
int idx;
bitset_pos_t idx;
if (c->weight_consistent)
ir_fprintf(stderr, " $%d ", c->weight);
ir_fprintf(stderr, "{");
......@@ -145,7 +145,9 @@ static void dbg_aff_chunk(const co_mst_env_t *env, const aff_chunk_t *c) {
* Dump all admissible colors to stderr.
*/
static void dbg_admissible_colors(const co_mst_env_t *env, const co_mst_irn_t *node) {
int idx;
bitset_pos_t idx;
(void) env;
if (bitset_popcnt(node->adm_colors) < 1)
fprintf(stderr, "no admissible colors?!?");
else {
......@@ -191,6 +193,8 @@ static int decider_hasnot_color(const co_mst_irn_t *node, int col) {
* Always returns true.
*/
static int decider_always_yes(const co_mst_irn_t *node, int col) {
(void) node;
(void) col;
return 1;
}
......@@ -324,6 +328,7 @@ static void *co_mst_irn_init(ir_phase *ph, ir_node *irn, void *old) {
* Check if affinity chunk @p chunk interferes with node @p irn.
*/
static INLINE int aff_chunk_interferes(co_mst_env_t *env, const aff_chunk_t *chunk, ir_node *irn) {
(void) env;
return bitset_is_set(chunk->interfere, get_irn_idx(irn));
}
......
......@@ -81,7 +81,8 @@ static void build_coloring_cstr(ilp_env_t *ienv) {
be_ifg_foreach_node(ifg, iter, irn)
if (!sr_is_removed(ienv->sr, irn)) {
int col, cst_idx;
bitset_pos_t col;
int cst_idx;
const arch_register_req_t *req;
int curr_node_color = get_irn_col(ienv->co, irn);
int node_nr = (int)get_irn_node_nr(irn);
......@@ -104,7 +105,7 @@ static void build_coloring_cstr(ilp_env_t *ienv) {
bitset_foreach(colors, col) {
int var_idx = lpp_add_var(ienv->lp, name_cdd(buf, 'x', node_nr, col), lpp_binary, 0.0);
lpp_set_start_value(ienv->lp, var_idx, (col == curr_node_color) ? 1.0 : 0.0);
lpp_set_start_value(ienv->lp, var_idx, (col == (unsigned) curr_node_color) ? 1.0 : 0.0);
lpp_set_factor_fast(ienv->lp, cst_idx, var_idx, 1);
lenv->last_x_var = var_idx;
......@@ -218,6 +219,7 @@ typedef struct _edge_t {
static int compare_edge_t(const void *k1, const void *k2, size_t size) {
const edge_t *e1 = k1;
const edge_t *e2 = k2;
(void) size;
return ! (e1->n1 == e2->n1 && e1->n2 == e2->n2);
}
......
......@@ -149,7 +149,7 @@ static const lc_opt_table_entry_t options[] = {
LC_OPT_ENT_ENUM_MASK ("style", "dump style for ifg dumping", &style_var),
LC_OPT_ENT_BOOL ("stats", "dump statistics after each optimization", &do_stats),
LC_OPT_ENT_BOOL ("improve", "run heur3 before if algo can exploit start solutions", &improve),
{ NULL }
LC_OPT_ENT_NULL
};
/* Insert additional options registration functions here. */
......@@ -245,6 +245,8 @@ int co_get_costs_loop_depth(const copy_opt_t *co, ir_node *root, ir_node* arg, i
int cost = 0;
ir_loop *loop;
ir_node *root_block = get_nodes_block(root);
(void) co;
(void) arg;
if (is_Phi(root)) {
/* for phis the copies are placed in the corresponding pred-block */
......@@ -264,6 +266,7 @@ int co_get_costs_exec_freq(const copy_opt_t *co, ir_node *root, ir_node* arg, in
int res;
ir_node *root_bl = get_nodes_block(root);
ir_node *copy_bl = is_Phi(root) ? get_Block_cfgpred_block(root_bl, pos) : root_bl;
(void) arg;
res = get_block_execfreq_ulong(co->cenv->birg->exec_freq, copy_bl);
/* don't allow values smaller than one. */
......@@ -272,6 +275,10 @@ int co_get_costs_exec_freq(const copy_opt_t *co, ir_node *root, ir_node* arg, in
int co_get_costs_all_one(const copy_opt_t *co, ir_node *root, ir_node *arg, int pos) {
(void) co;
(void) root;
(void) arg;
(void) pos;
return 1;
}
......@@ -295,7 +302,8 @@ static int ou_max_ind_set_costs(unit_t *ou) {
ir_node **safe, **unsafe;
int i, o, safe_count, safe_costs, unsafe_count, *unsafe_costs;
bitset_t *curr;
int max, pos, curr_weight, best_weight = 0;
bitset_pos_t pos;
int max, curr_weight, best_weight = 0;
/* assign the nodes into two groups.
* safe: node has no interference, hence it is in every max stable set.
......@@ -702,6 +710,7 @@ void co_complete_stats(const copy_opt_t *co, co_complete_stats_t *stat)
static int compare_affinity_node_t(const void *k1, const void *k2, size_t size) {
const affinity_node_t *n1 = k1;
const affinity_node_t *n2 = k2;
(void) size;
return (n1->irn != n2->irn);
}
......@@ -913,6 +922,7 @@ static int appel_aff_weight(const appel_clique_walker_t *env, ir_node *bl)
return res == 0 ? 1 : res;
#else
ir_loop *loop = get_irn_loop(bl);
(void) env;
if(loop) {
int d = get_loop_depth(loop);
return 1 + d * d;
......@@ -924,6 +934,7 @@ static int appel_aff_weight(const appel_clique_walker_t *env, ir_node *bl)
static void *appel_clique_walker_irn_init(ir_phase *phase, ir_node *irn, void *old)
{
appel_block_info_t *res = NULL;
(void) old;
if(is_Block(irn)) {
appel_clique_walker_t *d = (void *) phase;
......@@ -1214,7 +1225,7 @@ void co_dump_appel_graph_cliques(const copy_opt_t *co, FILE *f)
|_| |___/
*/
static const char *get_dot_color_name(int col)
static const char *get_dot_color_name(size_t col)
{
static const char *names[] = {
"blue",
......@@ -1260,6 +1271,7 @@ typedef struct _co_ifg_dump_t {
static void ifg_dump_graph_attr(FILE *f, void *self)
{
(void) self;
fprintf(f, "overlap=scale");
}
......@@ -1355,11 +1367,12 @@ void co_dump_ifg_dot(const copy_opt_t *co, FILE *f, unsigned flags)
void co_solve_park_moon(copy_opt_t *opt)
{
(void) opt;
}
static int void_algo(copy_opt_t *co)
{
(void) co;
return 0;
}
......@@ -1421,7 +1434,7 @@ void co_driver(be_chordal_env_t *cenv)
co_algo_t *algo_func;
int was_optimal = 0;
if (algo < 0 || algo >= CO_ALGO_LAST)
if (algo >= CO_ALGO_LAST)
return;
be_liveness_assure_chk(be_get_birg_liveness(cenv->birg));
......
......@@ -81,6 +81,8 @@ size_t (be_ifg_cliques_iter_size)(const be_ifg_t *ifg)
static void *regs_irn_data_init(ir_phase *ph, ir_node *irn, void *data)
{
coloring_t *coloring = (coloring_t *) ph;
(void) data;
return (void *) arch_get_irn_register(coloring->arch_env, irn);
}
......@@ -720,7 +722,7 @@ static lc_opt_enum_int_var_t ifg_flavor_var = {
static const lc_opt_table_entry_t be_ifg_options[] = {
LC_OPT_ENT_ENUM_PTR ("ifg", "interference graph flavour", &ifg_flavor_var),
{ NULL }
LC_OPT_ENT_NULL
};
void be_init_ifg(void)
......
......@@ -472,12 +472,14 @@ static ir_node *ifg_clique_neighbours_begin(const void *self, void *iter, const
static ir_node *ifg_clique_neighbours_next(const void *self, void *iter)
{
(void) self;
return get_next_neighbour(iter);
}
static void ifg_clique_neighbours_break(const void *self, void *iter)
{
cli_iter_t *it = iter;
(void) self;
bitset_free(it->visited_neighbours);
......@@ -492,12 +494,14 @@ static ir_node *ifg_clique_nodes_begin(const void *self, void *iter)
static ir_node *ifg_clique_nodes_next(const void *self, void *iter)
{
(void) self;
return get_next_node(iter);
}
static void ifg_clique_nodes_break(const void *self, void *iter)
{
cli_iter_t *it = iter;
(void) self;
bitset_free(it->visited_nodes);
......
......@@ -362,12 +362,14 @@ static ir_node *ifg_list_nodes_begin(const void *self, void *iter)
static ir_node *ifg_list_nodes_next(const void *self, void *iter)
{
(void) self;
return get_next_node(iter);
}
static void ifg_list_nodes_break(const void *self, void *iter)
{
nodes_iter_t *it = iter;
(void) self;
it->curr_node_idx = 0;
it->ifg = NULL;
}
......@@ -380,12 +382,14 @@ static ir_node *ifg_list_neighbours_begin(const void *self, void *iter,const ir_
static ir_node *ifg_list_neighbours_next(const void *self, void *iter)
{
(void) self;
return get_next_neighbour(iter);
}
static void ifg_list_neighbours_break(const void *self, void *iter)
{
adj_iter_t *it= iter;
(void) self;
it->curr_adj_element = NULL;
it->ifg = NULL;
}
......
......@@ -88,6 +88,8 @@ typedef struct _ptr_iter_t {
static void *ptr_irn_data_init(ir_phase *ph, ir_node *irn, void *data)
{
ptr_head_t *head = phase_alloc(ph, sizeof(*head));
(void) irn;
(void) data;
INIT_LIST_HEAD(&head->list);
return head;
}
......@@ -109,7 +111,7 @@ static ptr_head_t *ptr_get_new_head(ifg_pointer_t *ifg)
static void write_pointers(bitset_t *live, ifg_pointer_t *ifg)
{
ir_node *live_irn;
bitset_pos_t elm;
bitset_pos_t elm;
bitset_foreach_irn(ifg->env->irg, live, elm, live_irn)
{
......
......@@ -130,11 +130,13 @@ static ir_node *ifg_std_nodes_begin(const void *self, void *iter)
static ir_node *ifg_std_nodes_next(const void *self, void *iter)
{
(void) self;
return get_next_node(iter);
}
static void ifg_std_nodes_break(const void *self, void *iter)
{
(void) self;
node_break(iter, 1);
}
......@@ -192,6 +194,7 @@ static void find_neighbours(const ifg_std_t *ifg, adj_iter_t *it, const ir_node
static INLINE void neighbours_break(adj_iter_t *it, int force)
{
(void) force;
assert(it->valid == 1);
ir_nodeset_destroy(&it->neighbours);
it->valid = 0;
......@@ -215,11 +218,13 @@ static ir_node *ifg_std_neighbours_begin(const void *self, void *iter, const ir_
static ir_node *ifg_std_neighbours_next(const void *self, void *iter)
{
(void) self;
return get_next_neighbour(iter);
}
static void ifg_std_neighbours_break(const void *self, void *iter)
{
(void) self;
neighbours_break(iter, 1);
}
......@@ -325,11 +330,13 @@ static int ifg_std_cliques_begin(const void *self, void *iter, ir_node **buf)
static int ifg_std_cliques_next(const void *self, void *iter)
{
(void) self;
return get_next_clique(iter);
}
static void ifg_std_cliques_break(const void *self, void *iter)
{
(void) self;
free_clique_iter(iter);
}
......
......@@ -209,7 +209,7 @@ static const lc_opt_table_entry_t ilpsched_option_table[] = {
LC_OPT_ENT_BOOL("regpress", "Use register pressure constraints", &ilp_opts.regpress),
LC_OPT_ENT_INT("time_limit", "ILP time limit per block", &ilp_opts.time_limit),
LC_OPT_ENT_STR("lpp_log", "LPP logfile (stderr and stdout are supported)", ilp_opts.log_file, sizeof(ilp_opts.log_file)),
{ NULL }
LC_OPT_ENT_NULL
};
/*
......@@ -376,7 +376,7 @@ static void collect_alap_root_nodes(ir_node *irn, void *walk_env) {
unsigned n_consumer = 0;
ir_edge_kind_t ekind[2] = { EDGE_KIND_NORMAL, EDGE_KIND_DEP };
ir_node **consumer;
int idx;
unsigned idx;
if (! consider_for_sched(env->arch_env->isa, irn))
return;
......
......@@ -474,6 +474,8 @@ static void lv_dump_block(void *context, FILE *f, const ir_node *bl)
static void *lv_phase_data_init(ir_phase *phase, ir_node *irn, void *old)
{
struct _be_lv_info_t *info = phase_alloc(phase, LV_STD_SIZE * sizeof(info[0]));
(void) irn;
memset(info, 0, LV_STD_SIZE * sizeof(info[0]));
info[0].u.head.n_size = LV_STD_SIZE - 1;
return info;
......
......@@ -160,7 +160,7 @@ static const lc_opt_table_entry_t be_main_options[] = {
LC_OPT_ENT_STR ("ilp.server", "the ilp server name", be_options.ilp_server, sizeof(be_options.ilp_server)),
LC_OPT_ENT_STR ("ilp.solver", "the ilp solver name", be_options.ilp_solver, sizeof(be_options.ilp_solver)),
#endif /* WITH_ILP */
{ NULL }
LC_OPT_ENT_NULL
};
static be_module_list_entry_t *isa_ifs = NULL;
......@@ -203,7 +203,7 @@ int be_parse_arg(const char *arg) {
}
/** The be parameters returned by default, all off. */
const static backend_params be_params = {
static const backend_params be_params = {
0, /* need dword lowering */
0, /* don't support inlien assembler yet */
0, /* no different calling conventions */
......
......@@ -359,7 +359,7 @@ int is_be_node(const ir_node *irn)
be_opcode_t be_get_irn_opcode(const ir_node *irn)
{
return is_be_node(irn) ? get_irn_opcode(irn) - beo_base : beo_NoBeOp;
return is_be_node(irn) ? (be_opcode_t) get_irn_opcode(irn) - beo_base : beo_NoBeOp;
}
/**
......@@ -407,9 +407,10 @@ static be_reg_data_t *retrieve_reg_data(const ir_node *node)
}
static void
be_node_set_irn_reg(const void *_self, ir_node *irn, const arch_register_t *reg)
be_node_set_irn_reg(const void *self, ir_node *irn, const arch_register_t *reg)
{
be_reg_data_t *r = retrieve_reg_data(irn);
(void) self;
r->reg = reg;
}
......@@ -1213,6 +1214,7 @@ be_node_get_irn_reg_req(const void *self, const ir_node *irn, int pos)
{
int out_pos = pos;
(void) self;
if (pos < 0) {
if (get_irn_mode(irn) == mode_T)
return arch_no_register_req;
......@@ -1236,20 +1238,22 @@ be_node_get_irn_reg_req(const void *self, const ir_node *irn, int pos)
}
const arch_register_t *
be_node_get_irn_reg(const void *_self, const ir_node *irn)
be_node_get_irn_reg(const void *self, const ir_node *irn)
{
be_reg_data_t *r;
(void) self;
if (get_irn_mode(irn) == mode_T)
return NULL;
r = retrieve_reg_data(irn);
return r->reg;
}
static arch_irn_class_t be_node_classify(const void *_self, const ir_node *irn)
static arch_irn_class_t be_node_classify(const void *self, const ir_node *irn)
{
redir_proj((const ir_node **) &irn);
(void) self;
switch(be_get_irn_opcode(irn)) {
#define XXX(a,b) case beo_ ## a: return arch_irn_class_ ## b
XXX(Spill, spill);
......@@ -1266,10 +1270,11 @@ static arch_irn_class_t be_node_classify(const void *_self, const ir_node *irn)
return 0;
}
static arch_irn_flags_t be_node_get_flags(const void *_self, const ir_node *node)
static arch_irn_flags_t be_node_get_flags(const void *self, const ir_node *node)
{
be_req_t *bereq;
int pos = -1;
(void) self;
if(is_Proj(node)) {
pos = OUT_POS(get_Proj_proj(node));
......@@ -1283,12 +1288,14 @@ static arch_irn_flags_t be_node_get_flags(const void *_self, const ir_node *node
static ir_entity *be_node_get_frame_entity(const void *self, const ir_node *irn)
{
(void) self;
return be_get_frame_entity(irn);
}
static void be_node_set_frame_entity(const void *self, ir_node *irn, ir_entity *ent)
{
be_frame_attr_t *a;
(void) self;
assert(be_has_frame_entity(irn));
......@@ -1298,6 +1305,7 @@ static void be_node_set_frame_entity(const void *self, ir_node *irn, ir_entity *
static void be_node_set_frame_offset(const void *self, ir_node *irn, int offset)
{
(void) self;
if(be_has_frame_entity(irn)) {
be_frame_attr_t *a = get_irn_attr(irn);
a->offset = offset;
......@@ -1306,6 +1314,7 @@ static void be_node_set_frame_offset(const void *self, ir_node *irn, int offset)
static int be_node_get_sp_bias(const void *self, const ir_node *irn)
{
(void) self;
return be_is_IncSP(irn) ? be_get_IncSP_offset(irn) : 0;
}
......@@ -1341,6 +1350,7 @@ static const arch_irn_ops_t be_node_irn_ops = {
const void *be_node_get_irn_ops(const arch_irn_handler_t *self, const ir_node *irn)
{
redir_proj((const ir_node **) &irn);
(void) self;
return is_be_node(irn) ? &be_node_irn_ops : NULL;
}
......@@ -1449,6 +1459,8 @@ const arch_register_req_t *phi_get_irn_reg_req(const void *self,
{
phi_handler_t *phi_handler = get_phi_handler_from_ops(self);
phi_attr_t *attr;
(void) self;
(void) pos;
if(!mode_is_datab(get_irn_mode(irn)))
return arch_no_register_req;
......@@ -1516,6 +1528,8 @@ const arch_register_t *phi_get_irn_reg(const void *self, const ir_node *irn)
static
arch_irn_class_t phi_classify(const void *self, const ir_node *irn)
{
(void) self;
(void) irn;
return arch_irn_class_normal;
}
......@@ -1524,30 +1538,41 @@ arch_irn_flags_t phi_get_flags(const void *self, const ir_node *irn)
{
phi_handler_t *h = get_phi_handler_from_ops(self);
phi_attr_t *attr = get_Phi_attr(h, irn);
(void) self;
return attr->flags;
}
static
ir_entity *phi_get_frame_entity(const void *_self, const ir_node *irn)
ir_entity *phi_get_frame_entity(const void *self, const ir_node *irn)
{
(void) self;
(void) irn;
return NULL;
}
static
void phi_set_frame_entity(const void *_self, ir_node *irn, ir_entity *ent)
void phi_set_frame_entity(const void *self, ir_node *irn, ir_entity *ent)
{
(void) self;
(void) irn;
(void) ent;
assert(0);
}
static
void phi_set_frame_offset(const void *_self, ir_node *irn, int bias)
void phi_set_frame_offset(const void *self, ir_node *irn, int bias)
{
(void) self;
(void) irn;
(void) bias;
assert(0);
}
static
int phi_get_sp_bias(const void* self, const ir_node *irn)
{
(void) self;
(void) irn;
return 0;
}
......
......@@ -88,6 +88,7 @@ typedef struct _execcount_t {
static int
cmp_execcount(const void * a, const void * b, size_t size)
{
(void) size;
return ((execcount_t*)a)->block != ((execcount_t*)b)->block;
}
......@@ -95,6 +96,7 @@ static void
block_counter(ir_node * bb, void * data)
{
unsigned int *count = data;
(void) bb;
*count = *count + 1;
}
......@@ -522,6 +524,7 @@ be_profile_instrument(const char *filename, unsigned flags)
static void
profile_node_info(void *ctx, FILE *f, const ir_node *irn)