From b2e280bcb4dcde092a0971ea045ee1269b114c4f Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Sun, 4 Nov 2007 13:00:20 +0000 Subject: [PATCH] fixed a bunch of warnings (in OPTIMIZE mode) [r16424] --- include/libfirm/adt/hashptr.h | 2 +- ir/ana/analyze_irg_args.c | 5 +-- ir/ana/trouts.c | 1 + ir/be/becopyheur2.c | 1 + ir/be/becopyilp2.c | 1 - ir/be/bespillbelady.c | 23 ++++++++---- ir/be/beuses.c | 1 + ir/be/ia32/bearch_ia32.c | 2 +- ir/be/ia32/ia32_transform.c | 4 +- ir/be/ppc32/ppc32_emitter.c | 2 +- ir/be/ppc32/ppc32_new_nodes.c | 69 ++++++++++++++++++----------------- ir/be/ppc32/ppc32_new_nodes.h | 21 ++++++----- ir/be/ppc32/ppc32_transform.c | 3 ++ ir/common/debug.c | 2 +- ir/debug/debugger.c | 2 +- ir/ir/irdumptxt.c | 3 +- ir/ir/irgopt.c | 4 +- ir/ir/irnode.c | 17 +++------ ir/ir/iropt.c | 3 +- ir/ir/irvrfy.c | 4 ++ ir/opt/gvn_pre.c | 9 +++-- ir/tr/trvrfy.c | 25 ++++++++----- ir/tv/fltcalc.c | 1 + ir/tv/tv.c | 5 ++- 24 files changed, 119 insertions(+), 91 deletions(-) diff --git a/include/libfirm/adt/hashptr.h b/include/libfirm/adt/hashptr.h index 03dd1087a..e868d60cd 100644 --- a/include/libfirm/adt/hashptr.h +++ b/include/libfirm/adt/hashptr.h @@ -65,7 +65,7 @@ static INLINE unsigned firm_fnv_hash_str(const char *data) * hash a pointer value: Pointer addresses are mostly aligned to 4 * or 8 bytes. So we remove the lowest 3 bits */ -#define HASH_PTR(ptr) (((char *) (ptr) - (char *)0) >> 3) +#define HASH_PTR(ptr) ((unsigned)(((char *) (ptr) - (char *)0) >> 3)) /** * Hash a string. diff --git a/ir/ana/analyze_irg_args.c b/ir/ana/analyze_irg_args.c index b3801de68..3482ff0b8 100644 --- a/ir/ana/analyze_irg_args.c +++ b/ir/ana/analyze_irg_args.c @@ -292,8 +292,8 @@ void analyze_irg_args(ir_graph *irg) */ ptr_access_kind get_method_param_access(ir_entity *ent, int pos) { - ir_type *mtp = get_entity_type(ent); #ifndef NDEBUG + ir_type *mtp = get_entity_type(ent); int is_variadic = get_method_variadicity(mtp) == variadicity_variadic; assert(0 <= pos && (is_variadic || pos < get_method_n_params(mtp))); @@ -450,9 +450,8 @@ static void analyze_method_params_weight(ir_entity *ent) */ float get_method_param_weight(ir_entity *ent, int pos) { - ir_type *mtp = get_entity_type(ent); - #ifndef NDEBUG + ir_type *mtp = get_entity_type(ent); int is_variadic = get_method_variadicity(mtp) == variadicity_variadic; assert(0 <= pos && (is_variadic || pos < get_method_n_params(mtp))); #endif diff --git a/ir/ana/trouts.c b/ir/ana/trouts.c index 6af8dd770..73e6f5897 100644 --- a/ir/ana/trouts.c +++ b/ir/ana/trouts.c @@ -514,6 +514,7 @@ static int get_addr_n_entities(ir_node *addr) { If Sel follow to outermost of compound. */ static ir_entity *get_addr_entity(ir_node *addr, int pos) { ir_entity *ent; + (void) pos; switch (get_irn_opcode(addr)) { case iro_Sel: diff --git a/ir/be/becopyheur2.c b/ir/be/becopyheur2.c index 7dc890e00..bd2a98eac 100644 --- a/ir/be/becopyheur2.c +++ b/ir/be/becopyheur2.c @@ -401,6 +401,7 @@ static void single_color_cost(co2_t *env, co2_irn_t *ci, col_t col, col_cost_pai seq[i].costs = INT_MAX; } + (void) ci; assert(is_color_admissible(env, ci, col)); seq[col].col = 0; seq[0].col = col; diff --git a/ir/be/becopyilp2.c b/ir/be/becopyilp2.c index 98ce4e32f..3d3de0b8f 100644 --- a/ir/be/becopyilp2.c +++ b/ir/be/becopyilp2.c @@ -74,7 +74,6 @@ typedef struct _local_env_t { } local_env_t; static void build_coloring_cstr(ilp_env_t *ienv) { - local_env_t *lenv = ienv->env; be_ifg_t *ifg = ienv->co->cenv->ifg; void *iter = be_ifg_nodes_iter_alloca(ifg); bitset_t *colors; diff --git a/ir/be/bespillbelady.c b/ir/be/bespillbelady.c index 8479cd55f..9b07e910c 100644 --- a/ir/be/bespillbelady.c +++ b/ir/be/bespillbelady.c @@ -185,6 +185,7 @@ static INLINE void workset_insert(belady_env_t *env, workset_t *ws, assert(ws->len < env->n_regs && "Workset already full!"); ws->vals[ws->len].irn = val; ws->vals[ws->len].reloaded_value = reloaded_value; + ws->vals[ws->len].time = 6666; ws->len++; } @@ -259,7 +260,8 @@ static INLINE void *new_block_info(struct obstack *ob) { static INLINE unsigned get_distance(belady_env_t *env, ir_node *from, unsigned from_step, const ir_node *def, int skip_from_uses) { be_next_use_t use; - int flags = arch_irn_get_flags(env->arch, def); + int flags = arch_irn_get_flags(env->arch, def); + unsigned time; assert(! (flags & arch_irn_flags_ignore)); @@ -271,6 +273,9 @@ static INLINE unsigned get_distance(belady_env_t *env, ir_node *from, unsigned f if(flags & arch_irn_flags_dont_spill) return 0; + time = use.time; + time += be_get_reload_costs_no_weight(env->senv, def, use.before) * 10; + return use.time; } @@ -312,7 +317,6 @@ static void displace(belady_env_t *env, workset_t *new_vals, int is_usage) { assert(is_usage); } } - //DBG((dbg, DBG_DECIDE, " demand = %d\n", demand)); /* 2. Make room for at least 'demand' slots @@ -341,12 +345,12 @@ static void displace(belady_env_t *env, workset_t *new_vals, int is_usage) { for (i = max_allowed; i < ws->len; ++i) { ir_node *irn = ws->vals[i].irn; - DBG((dbg, DBG_DECIDE, " disposing %+F (%u)\n", irn, + DBG((dbg, DBG_DECIDE, " disposing node %+F (%u)\n", irn, workset_get_time(ws, i))); if(!USES_IS_INFINITE(ws->vals[i].time) && !ws->vals[i].reloaded_value) { -// be_add_spill(env->senv, irn, env->instr); + //be_add_spill(env->senv, irn, env->instr); } if (is_Phi(irn)) @@ -375,7 +379,8 @@ static void displace(belady_env_t *env, workset_t *new_vals, int is_usage) { static void belady(ir_node *block, void *env); -/** Decides whether a specific node should be in the start workset or not +/** + * Decides whether a specific node should be in the start workset or not * * @param env belady environment * @param first @@ -390,7 +395,7 @@ static loc_t to_take_or_not_to_take(belady_env_t *env, ir_node* first, be_next_use_t next_use; loc_t loc; loc.time = USES_INFINITY; - loc.irn = node; + loc.irn = node; loc.reloaded_value = 0; (void) block; @@ -463,6 +468,8 @@ static void compute_live_ins(ir_node *block, void *data) { break; loc = to_take_or_not_to_take(env, first, irn, block, loop); + /* the phis can't be reloaded here (they just get defined) */ + loc.reloaded_value = 0; if (! USES_IS_INFINITE(loc.time)) { if (USES_IS_PENDING(loc.time)) @@ -701,14 +708,16 @@ static void fix_block_borders(ir_node *block, void *data) * workset */ } +#if 0 if(!found && be_is_live_out(env->lv, pred, node) && !workset_pred_end->vals[iter].reloaded_value) { ir_node *insert_point = be_get_end_of_block_insertion_point(pred); DBG((dbg, DBG_SPILL, "Spill %+F before %+F\n", node, insert_point)); -// be_add_spill(env->senv, node, insert_point); + be_add_spill(env->senv, node, insert_point); } +#endif } /* reload missing values in predecessors */ diff --git a/ir/be/beuses.c b/ir/be/beuses.c index aa97898be..f17775ec1 100644 --- a/ir/be/beuses.c +++ b/ir/be/beuses.c @@ -284,6 +284,7 @@ static be_next_use_t get_next_use(be_uses_t *env, ir_node *from, ir_graph *irg = get_irn_irg(block); ir_node *startblock = get_irg_start_block(irg); + result.before = NULL; outermost_loop = loopdepth; foreach_block_succ(block, edge) { const be_use_t *use; diff --git a/ir/be/ia32/bearch_ia32.c b/ir/be/ia32/bearch_ia32.c index 59127ede4..4cbc141e0 100644 --- a/ir/be/ia32/bearch_ia32.c +++ b/ir/be/ia32/bearch_ia32.c @@ -1610,9 +1610,9 @@ static ia32_isa_t ia32_isa_template = { NULL, /* types */ NULL, /* tv_ents */ NULL, /* current code generator */ + NULL, /* abstract machine */ #ifndef NDEBUG NULL, /* name obstack */ - 0 /* name obst size */ #endif }; diff --git a/ir/be/ia32/ia32_transform.c b/ir/be/ia32/ia32_transform.c index 73c6c942c..07f29ff23 100644 --- a/ir/be/ia32/ia32_transform.c +++ b/ir/be/ia32/ia32_transform.c @@ -950,12 +950,11 @@ static ir_node *gen_shift_binop(ir_node *node, ir_node *op1, ir_node *op2, ir_graph *irg = current_ir_graph; ir_node *block = get_nodes_block(node); ir_node *new_block = be_transform_node(block); - ir_mode *mode = get_irn_mode(node); ir_node *new_op1; ir_node *new_op2; ir_node *new_node; - assert(! mode_is_float(mode)); + assert(! mode_is_float(get_irn_mode(node))); assert(flags & match_immediate); assert((flags & ~(match_mode_neutral | match_immediate)) == 0); @@ -2908,6 +2907,7 @@ static ir_node *create_I2I_Conv(ir_mode *src_mode, ir_mode *tgt_mode, ia32_address_mode_t am; ia32_address_t *addr = &am.addr; + (void) node; if (src_bits < tgt_bits) { smaller_mode = src_mode; smaller_bits = src_bits; diff --git a/ir/be/ppc32/ppc32_emitter.c b/ir/be/ppc32/ppc32_emitter.c index 1477df6cf..737298839 100644 --- a/ir/be/ppc32/ppc32_emitter.c +++ b/ir/be/ppc32/ppc32_emitter.c @@ -141,7 +141,7 @@ void ppc32_emit_dest_register(const ir_node *node, int pos) { } void ppc32_emit_rlwimi_helper(const ir_node *n) { - rlwimi_const_t *rlwimi_const = get_ppc32_rlwimi_const(n); + const rlwimi_const_t *rlwimi_const = get_ppc32_rlwimi_const(n); be_emit_irprintf("%i, %i, %i", rlwimi_const->shift, rlwimi_const->maskA, rlwimi_const->maskB); diff --git a/ir/be/ppc32/ppc32_new_nodes.c b/ir/be/ppc32/ppc32_new_nodes.c index 887ef4f5c..db8924565 100644 --- a/ir/be/ppc32/ppc32_new_nodes.c +++ b/ir/be/ppc32/ppc32_new_nodes.c @@ -237,20 +237,23 @@ static int ppc32_dump_node(ir_node *n, FILE *F, dump_reason_t reason) { * |___/ ***************************************************************************************************/ -/** - * Wraps get_irn_generic_attr() as it takes no const ir_node, so we need to do a cast. - * Firm was made by people hating const :-( - */ -ppc32_attr_t *get_ppc32_attr(const ir_node *node) { +ppc32_attr_t *get_ppc32_attr(ir_node *node) { assert(is_ppc32_irn(node) && "need ppc node to get attributes"); - return (ppc32_attr_t *)get_irn_generic_attr((ir_node *)node); + return (ppc32_attr_t *)get_irn_generic_attr(node); } +const ppc32_attr_t *get_ppc32_attr_const(const ir_node *node) { + assert(is_ppc32_irn(node) && "need ppc node to get attributes"); + return (const ppc32_attr_t *)get_irn_generic_attr_const(node); +} + + + /** * Returns the argument register requirements of a ppc node. */ const arch_register_req_t **get_ppc32_in_req_all(const ir_node *node) { - ppc32_attr_t *attr = get_ppc32_attr(node); + const ppc32_attr_t *attr = get_ppc32_attr_const(node); return attr->in_req; } @@ -258,7 +261,7 @@ const arch_register_req_t **get_ppc32_in_req_all(const ir_node *node) { * Returns the result register requirements of an ppc node. */ const arch_register_req_t **get_ppc32_out_req_all(const ir_node *node) { - ppc32_attr_t *attr = get_ppc32_attr(node); + const ppc32_attr_t *attr = get_ppc32_attr_const(node); return attr->out_req; } @@ -266,7 +269,7 @@ const arch_register_req_t **get_ppc32_out_req_all(const ir_node *node) { * Returns the argument register requirement at position pos of an ppc node. */ const arch_register_req_t *get_ppc32_in_req(const ir_node *node, int pos) { - ppc32_attr_t *attr = get_ppc32_attr(node); + const ppc32_attr_t *attr = get_ppc32_attr_const(node); return attr->in_req[pos]; } @@ -274,7 +277,7 @@ const arch_register_req_t *get_ppc32_in_req(const ir_node *node, int pos) { * Returns the result register requirement at position pos of an ppc node. */ const arch_register_req_t *get_ppc32_out_req(const ir_node *node, int pos) { - ppc32_attr_t *attr = get_ppc32_attr(node); + const ppc32_attr_t *attr = get_ppc32_attr_const(node); return attr->out_req[pos]; } @@ -298,14 +301,14 @@ void set_ppc32_req_in(ir_node *node, const arch_register_req_t *req, int pos) { * Returns the register flag of an ppc node. */ arch_irn_flags_t get_ppc32_flags(const ir_node *node) { - ppc32_attr_t *attr = get_ppc32_attr(node); + const ppc32_attr_t *attr = get_ppc32_attr_const(node); return attr->flags; } /** * Sets the register flag of an ppc node. */ -void set_ppc32_flags(const ir_node *node, arch_irn_flags_t flags) { +void set_ppc32_flags(ir_node *node, arch_irn_flags_t flags) { ppc32_attr_t *attr = get_ppc32_attr(node); attr->flags = flags; } @@ -314,7 +317,7 @@ void set_ppc32_flags(const ir_node *node, arch_irn_flags_t flags) { * Returns the result register slots of an ppc node. */ const arch_register_t **get_ppc32_slots(const ir_node *node) { - ppc32_attr_t *attr = get_ppc32_attr(node); + const ppc32_attr_t *attr = get_ppc32_attr_const(node); return attr->slots; } @@ -322,7 +325,7 @@ const arch_register_t **get_ppc32_slots(const ir_node *node) { * Returns the name of the OUT register at position pos. */ const char *get_ppc32_out_reg_name(const ir_node *node, int pos) { - ppc32_attr_t *attr = get_ppc32_attr(node); + const ppc32_attr_t *attr = get_ppc32_attr_const(node); assert(is_ppc32_irn(node) && "Not an ppc node."); assert(pos < ARR_LEN(attr->slots) && "Invalid OUT position."); @@ -335,7 +338,7 @@ const char *get_ppc32_out_reg_name(const ir_node *node, int pos) { * Returns the index of the OUT register at position pos within its register class. */ int get_ppc32_out_regnr(const ir_node *node, int pos) { - ppc32_attr_t *attr = get_ppc32_attr(node); + const ppc32_attr_t *attr = get_ppc32_attr_const(node); assert(is_ppc32_irn(node) && "Not an ppc node."); assert(pos < ARR_LEN(attr->slots) && "Invalid OUT position."); @@ -348,7 +351,7 @@ int get_ppc32_out_regnr(const ir_node *node, int pos) { * Returns the OUT register at position pos. */ const arch_register_t *get_ppc32_out_reg(const ir_node *node, int pos) { - ppc32_attr_t *attr = get_ppc32_attr(node); + const ppc32_attr_t *attr = get_ppc32_attr_const(node); assert(is_ppc32_irn(node) && "Not an ppc node."); assert(pos < ARR_LEN(attr->slots) && "Invalid OUT position."); @@ -361,7 +364,7 @@ const arch_register_t *get_ppc32_out_reg(const ir_node *node, int pos) { * Returns the number of results. */ int get_ppc32_n_res(const ir_node *node) { - ppc32_attr_t *attr = get_ppc32_attr(node); + const ppc32_attr_t *attr = get_ppc32_attr_const(node); return ARR_LEN(attr->slots); } @@ -378,14 +381,14 @@ int get_ppc32_n_res(const ir_node *node) { * Returns the type of the content (if any) */ ppc32_attr_content_type get_ppc32_type(const ir_node *node) { - ppc32_attr_t *attr = get_ppc32_attr(node); + const ppc32_attr_t *attr = get_ppc32_attr_const(node); return attr->content_type; } /** * Sets a tarval type content (also updating the content_type) */ -void set_ppc32_constant_tarval(const ir_node *node, tarval *const_tarval) { +void set_ppc32_constant_tarval(ir_node *node, tarval *const_tarval) { ppc32_attr_t *attr = get_ppc32_attr(node); attr->content_type = ppc32_ac_Const; attr->data.constant_tarval = const_tarval; @@ -395,14 +398,14 @@ void set_ppc32_constant_tarval(const ir_node *node, tarval *const_tarval) { * Returns a tarval type constant */ tarval *get_ppc32_constant_tarval(const ir_node *node) { - ppc32_attr_t *attr = get_ppc32_attr(node); + const ppc32_attr_t *attr = get_ppc32_attr_const(node); return attr->data.constant_tarval; } /** * Sets an ident type constant (also updating the content_type) */ -void set_ppc32_symconst_ident(const ir_node *node, ident *symconst_ident) { +void set_ppc32_symconst_ident(ir_node *node, ident *symconst_ident) { ppc32_attr_t *attr = get_ppc32_attr(node); attr->content_type = ppc32_ac_SymConst; attr->data.symconst_ident = symconst_ident; @@ -412,7 +415,7 @@ void set_ppc32_symconst_ident(const ir_node *node, ident *symconst_ident) { * Returns an ident type constant */ ident *get_ppc32_symconst_ident(const ir_node *node) { - ppc32_attr_t *attr = get_ppc32_attr(node); + const ppc32_attr_t *attr = get_ppc32_attr_const(node); return attr->data.symconst_ident; } @@ -420,7 +423,7 @@ ident *get_ppc32_symconst_ident(const ir_node *node) { /** * Sets an entity (also updating the content_type) */ -void set_ppc32_frame_entity(const ir_node *node, ir_entity *ent) { +void set_ppc32_frame_entity(ir_node *node, ir_entity *ent) { ppc32_attr_t *attr = get_ppc32_attr(node); attr->content_type = ppc32_ac_FrameEntity; attr->data.frame_entity = ent; @@ -430,14 +433,14 @@ void set_ppc32_frame_entity(const ir_node *node, ir_entity *ent) { * Returns an entity */ ir_entity *get_ppc32_frame_entity(const ir_node *node) { - ppc32_attr_t *attr = get_ppc32_attr(node); + const ppc32_attr_t *attr = get_ppc32_attr_const(node); return attr->data.frame_entity; } /** * Sets a Rlwimi const (also updating the content_type) */ -void set_ppc32_rlwimi_const(const ir_node *node, unsigned shift, unsigned maskA, unsigned maskB) { +void set_ppc32_rlwimi_const(ir_node *node, unsigned shift, unsigned maskA, unsigned maskB) { ppc32_attr_t *attr = get_ppc32_attr(node); attr->content_type = ppc32_ac_RlwimiConst; attr->data.rlwimi_const.shift = shift; @@ -448,15 +451,15 @@ void set_ppc32_rlwimi_const(const ir_node *node, unsigned shift, unsigned maskA, /** * Returns the rlwimi const structure */ -rlwimi_const_t *get_ppc32_rlwimi_const(const ir_node *node) { - ppc32_attr_t *attr = get_ppc32_attr(node); +const rlwimi_const_t *get_ppc32_rlwimi_const(const ir_node *node) { + const ppc32_attr_t *attr = get_ppc32_attr_const(node); return &attr->data.rlwimi_const; } /** * Sets a Proj number (also updating the content_type) */ -void set_ppc32_proj_nr(const ir_node *node, int proj_nr) { +void set_ppc32_proj_nr(ir_node *node, int proj_nr) { ppc32_attr_t *attr = get_ppc32_attr(node); attr->content_type = ppc32_ac_BranchProj; attr->data.proj_nr = proj_nr; @@ -466,14 +469,14 @@ void set_ppc32_proj_nr(const ir_node *node, int proj_nr) { * Returns the proj number */ int get_ppc32_proj_nr(const ir_node *node) { - ppc32_attr_t *attr = get_ppc32_attr(node); + const ppc32_attr_t *attr = get_ppc32_attr_const(node); return attr->data.proj_nr; } /** * Sets an offset for a memory access (also updating the content_type) */ -void set_ppc32_offset(const ir_node *node, int offset) { +void set_ppc32_offset(ir_node *node, int offset) { ppc32_attr_t *attr = get_ppc32_attr(node); attr->content_type = ppc32_ac_Offset; attr->data.offset = offset; @@ -483,14 +486,14 @@ void set_ppc32_offset(const ir_node *node, int offset) { * Returns the offset */ int get_ppc32_offset(const ir_node *node) { - ppc32_attr_t *attr = get_ppc32_attr(node); + const ppc32_attr_t *attr = get_ppc32_attr_const(node); return attr->data.offset; } /** * Sets the offset mode (ppc32_ao_None, ppc32_ao_Lo16, ppc32_ao_Hi16 or ppc32_ao_Ha16) */ -void set_ppc32_offset_mode(const ir_node *node, ppc32_attr_offset_mode mode) { +void set_ppc32_offset_mode(ir_node *node, ppc32_attr_offset_mode mode) { ppc32_attr_t *attr = get_ppc32_attr(node); attr->offset_mode = mode; } @@ -499,7 +502,7 @@ void set_ppc32_offset_mode(const ir_node *node, ppc32_attr_offset_mode mode) { * Returns the offset mode */ ppc32_attr_offset_mode get_ppc32_offset_mode(const ir_node *node) { - ppc32_attr_t *attr = get_ppc32_attr(node); + const ppc32_attr_t *attr = get_ppc32_attr_const(node); return attr->offset_mode; } diff --git a/ir/be/ppc32/ppc32_new_nodes.h b/ir/be/ppc32/ppc32_new_nodes.h index affbccc77..9f99231ff 100644 --- a/ir/be/ppc32/ppc32_new_nodes.h +++ b/ir/be/ppc32/ppc32_new_nodes.h @@ -42,7 +42,8 @@ /** * Returns the attributes of an ppc node. */ -ppc32_attr_t *get_ppc32_attr(const ir_node *node); +ppc32_attr_t *get_ppc32_attr(ir_node *node); +const ppc32_attr_t *get_ppc32_attr_const(const ir_node *node); /** * Returns the argument register requirements of an ppc node. @@ -82,7 +83,7 @@ arch_irn_flags_t get_ppc32_flags(const ir_node *node); /** * Sets the register flag of an ppc node. */ -void set_ppc32_flags(const ir_node *node, arch_irn_flags_t flags); +void set_ppc32_flags(ir_node *node, arch_irn_flags_t flags); /** * Returns the result register slots of an ppc node. @@ -111,25 +112,25 @@ int get_ppc32_n_res(const ir_node *node); ppc32_attr_content_type get_ppc32_type(const ir_node *node); -void set_ppc32_constant_tarval(const ir_node *node, tarval *const_tarval); +void set_ppc32_constant_tarval(ir_node *node, tarval *const_tarval); tarval *get_ppc32_constant_tarval(const ir_node *node); -void set_ppc32_symconst_ident(const ir_node *node, ident *symconst_ident); +void set_ppc32_symconst_ident(ir_node *node, ident *symconst_ident); ident *get_ppc32_symconst_ident(const ir_node *node); -void set_ppc32_frame_entity(const ir_node *node, ir_entity *ent); +void set_ppc32_frame_entity(ir_node *node, ir_entity *ent); ir_entity *get_ppc32_frame_entity(const ir_node *node); -void set_ppc32_rlwimi_const(const ir_node *node, unsigned shift, unsigned maskA, unsigned maskB); -rlwimi_const_t *get_ppc32_rlwimi_const(const ir_node *node); +void set_ppc32_rlwimi_const(ir_node *node, unsigned shift, unsigned maskA, unsigned maskB); +const rlwimi_const_t *get_ppc32_rlwimi_const(const ir_node *node); -void set_ppc32_proj_nr(const ir_node *node, int proj_nr); +void set_ppc32_proj_nr(ir_node *node, int proj_nr); int get_ppc32_proj_nr(const ir_node *node); -void set_ppc32_offset(const ir_node *node, int offset); +void set_ppc32_offset(ir_node *node, int offset); int get_ppc32_offset(const ir_node *node); -void set_ppc32_offset_mode(const ir_node *node, ppc32_attr_offset_mode mode); +void set_ppc32_offset_mode(ir_node *node, ppc32_attr_offset_mode mode); ppc32_attr_offset_mode get_ppc32_offset_mode(const ir_node *node); void ppc32_register_additional_opcodes(int opcode_num); diff --git a/ir/be/ppc32/ppc32_transform.c b/ir/be/ppc32/ppc32_transform.c index b60ee6d9d..93bd26be0 100644 --- a/ir/be/ppc32/ppc32_transform.c +++ b/ir/be/ppc32/ppc32_transform.c @@ -650,6 +650,7 @@ static ir_node *gen_Shrs(ppc32_transform_env_t *env) { tarval *tv_const = get_ppc32_constant_tarval(op2); int sh = get_tarval_long(tv_const); assert(0<=sh && sh<=31); + (void) sh; set_ppc32_constant_tarval(shift, tv_const); set_ppc32_offset_mode(shift, ppc32_ao_None); return shift; @@ -1377,6 +1378,7 @@ void ppc32_transform_node(ir_node *node, void *env) { ppc32_code_gen_t *cg = (ppc32_code_gen_t *)env; ir_op *op = get_irn_op(node); ir_node *asm_node = NULL; + (void) cg; if (op == op_Block) return; @@ -1679,6 +1681,7 @@ void ppc32_transform_const(ir_node *node, void *env) { ppc32_code_gen_t *cgenv = (ppc32_code_gen_t *)env; ir_node *asm_node = NULL; ppc32_transform_env_t tenv; + (void) cgenv; if (is_Block(node)) return; diff --git a/ir/common/debug.c b/ir/common/debug.c index b69293ff4..710b79671 100644 --- a/ir/common/debug.c +++ b/ir/common/debug.c @@ -192,6 +192,6 @@ void _firm_dbg_print(const firm_dbg_module_t *mod, unsigned mask, const char *fm #else /* DEBUG_libfirm */ /* some picky compiler don't allow empty files */ -static int dummy; +static int __attribute__((unused)) dummy; #endif /* DEBUG_libfirm */ diff --git a/ir/debug/debugger.c b/ir/debug/debugger.c index a25565db7..367972640 100644 --- a/ir/debug/debugger.c +++ b/ir/debug/debugger.c @@ -1334,7 +1334,7 @@ const char *gdb_out_edge_helper(const ir_node *node) { #else /* some picky compiler do not allow empty files */ -static int _firm_only_that_you_can_compile_with_NDEBUG_defined; +static int __attribute__((unused)) _firm_only_that_you_can_compile_with_NDEBUG_defined; #endif /* NDEBUG */ diff --git a/ir/ir/irdumptxt.c b/ir/ir/irdumptxt.c index 783b6245b..83b80e081 100644 --- a/ir/ir/irdumptxt.c +++ b/ir/ir/irdumptxt.c @@ -309,8 +309,7 @@ int dump_irnode_to_file(FILE *F, ir_node *n) { } } break; case iro_Const: { - ir_type *tp = get_Const_type(n); - assert(tp != firm_none_type); + assert(get_Const_type(n) != firm_none_type); fprintf(F, " Const of type %s \n", get_type_name_ex(get_Const_type(n), &bad)); } break; case iro_SymConst: { diff --git a/ir/ir/irgopt.c b/ir/ir/irgopt.c index 52be875a7..83c1312cc 100644 --- a/ir/ir/irgopt.c +++ b/ir/ir/irgopt.c @@ -312,6 +312,7 @@ static void copy_node(ir_node *n, void *env) { ir_node *nn, *block; int new_arity; ir_op *op = get_irn_op(n); + (void) env; /* The end node looses it's flexible in array. This doesn't matter, as dead node elimination builds End by hand, inlineing doesn't use @@ -1711,11 +1712,12 @@ void inline_leave_functions(int maxsize, int leavesize, int size, int ignore_run optimize_graph_df(irg); optimize_cf(irg); } - if (env->got_inline || (env->n_callers_orig != env->n_callers)) + if (env->got_inline || (env->n_callers_orig != env->n_callers)) { DB((dbg, SET_LEVEL_1, "Nodes:%3d ->%3d, calls:%3d ->%3d, callers:%3d ->%3d, -- %s\n", env->n_nodes_orig, env->n_nodes, env->n_call_nodes_orig, env->n_call_nodes, env->n_callers_orig, env->n_callers, get_entity_name(get_irg_entity(irg)))); + } } obstack_free(&obst, NULL); diff --git a/ir/ir/irnode.c b/ir/ir/irnode.c index 77aed07f8..40e73f2c5 100644 --- a/ir/ir/irnode.c +++ b/ir/ir/irnode.c @@ -1533,9 +1533,8 @@ set_Cast_type(ir_node *node, ir_type *to_tp) { int is_Cast_upcast(ir_node *node) { ir_type *totype = get_Cast_type(node); ir_type *fromtype = get_irn_typeinfo_type(get_Cast_op(node)); - ir_graph *myirg = get_irn_irg(node); - assert(get_irg_typeinfo_state(myirg) == ir_typeinfo_consistent); + assert(get_irg_typeinfo_state(get_irn_irg(node)) == ir_typeinfo_consistent); assert(fromtype); while (is_Pointer_type(totype) && is_Pointer_type(fromtype)) { @@ -2204,30 +2203,26 @@ void set_Mux_true(ir_node *node, ir_node *ir_true) { /* Psi support */ ir_node *get_Psi_cond(ir_node *node, int pos) { - int num_conds = get_Psi_n_conds(node); assert(node->op == op_Psi); - assert(pos < num_conds); + assert(pos < get_Psi_n_conds(node)); return get_irn_n(node, 2 * pos); } void set_Psi_cond(ir_node *node, int pos, ir_node *cond) { - int num_conds = get_Psi_n_conds(node); assert(node->op == op_Psi); - assert(pos < num_conds); + assert(pos < get_Psi_n_conds(node)); set_irn_n(node, 2 * pos, cond); } ir_node *get_Psi_val(ir_node *node, int pos) { - int num_vals = get_Psi_n_conds(node); assert(node->op == op_Psi); - assert(pos < num_vals); + assert(pos < get_Psi_n_conds(node)); return get_irn_n(node, 2 * pos + 1); } void set_Psi_val(ir_node *node, int pos, ir_node *val) { - int num_vals = get_Psi_n_conds(node); assert(node->op == op_Psi); - assert(pos < num_vals); + assert(pos < get_Psi_n_conds(node)); set_irn_n(node, 2 * pos + 1, val); } @@ -3095,5 +3090,5 @@ void dump_irn(ir_node *n) { } #else /* DEBUG_libfirm */ -void dump_irn(ir_node *n) {} +void dump_irn(ir_node *n) { (void) n; } #endif /* DEBUG_libfirm */ diff --git a/ir/ir/iropt.c b/ir/ir/iropt.c index 7a6321fb1..4fc0169aa 100644 --- a/ir/ir/iropt.c +++ b/ir/ir/iropt.c @@ -2937,7 +2937,8 @@ static ir_node *transform_bitwise_distributive(ir_node *n, ir_node *b_left = get_binop_left(b); ir_node *b_right = get_binop_right(b); ir_node *c = NULL; - ir_node *op1, *op2; + ir_node *op1 = NULL; + ir_node *op2 = NULL; if (is_op_commutative(op)) { if (a_left == b_left) { diff --git a/ir/ir/irvrfy.c b/ir/ir/irvrfy.c index 6042e31df..a2a4e153f 100644 --- a/ir/ir/irvrfy.c +++ b/ir/ir/irvrfy.c @@ -49,6 +49,8 @@ void vrfy_enable_entity_tests(int enable) { vrfy_entities = enable; } +#ifndef NDEBUG + /** * little helper for NULL modes */ @@ -273,6 +275,8 @@ static void show_phi_inputs(ir_node *phi, ir_node *block) { get_irn_node_nr(block), get_irn_arity(block)); } +#endif /* #ifndef NDEBUG */ + /** If the address is Sel or SymConst, return the entity. */ static ir_entity *get_ptr_entity(ir_node *ptr) { if (get_irn_op(ptr) == op_Sel) { diff --git a/ir/opt/gvn_pre.c b/ir/opt/gvn_pre.c index d1544855f..b59262f6c 100644 --- a/ir/opt/gvn_pre.c +++ b/ir/opt/gvn_pre.c @@ -446,10 +446,12 @@ static ir_node *translate(ir_node *node, ir_node *block, int pos, pre_env *env) node might depend on that. */ copy_node_attr(node, nn); res = node_add(env->trans_set, nn); - if (nn != res) + if (nn != res) { obstack_free(env->obst, nn); - else + } else { DB((dbg, LEVEL_2, "--> Translate %+F in <%+F,%d> into %+F\n", node, block, pos, res)); + } + return res; } return node; @@ -793,8 +795,9 @@ static void insert_nodes(ir_node *block, void *ctx) value_set_foreach(entry, idom_info->new_set) { updated |= value_add_or_replace(curr_info->avail_out, entry->node, entry->value); } - if (updated) + if (updated) { dump_value_set(curr_info->avail_out, "Updated [Avail_out]", block); + } if (arity <= 1) return; diff --git a/ir/tr/trvrfy.c b/ir/tr/trvrfy.c index 80836c993..81d4c03f5 100644 --- a/ir/tr/trvrfy.c +++ b/ir/tr/trvrfy.c @@ -34,7 +34,6 @@ #include "irprintf.h" #include "irgwalk.h" -static const char *firm_vrfy_failure_msg; #ifdef NDEBUG /* @@ -77,6 +76,10 @@ do { \ #endif /* NDEBUG */ +#ifndef NDEBUG + +static const char *firm_vrfy_failure_msg; + /** * Show diagnostic if an entity overwrites another one not * in direct superclasses. @@ -137,6 +140,17 @@ static void show_ent_overwrite_cnt(ir_entity *ent) { } } +/** + * Shows a wrong entity allocation + */ +static void show_ent_alloc_error(ir_entity *ent) { + ir_fprintf(stderr, "%+e owner %t has allocation %s\n", + ent, get_entity_type(ent), + get_allocation_name(get_entity_allocation(ent))); +} + +#endif /* #ifndef NDEBUG */ + /** * Check a class */ @@ -319,15 +333,6 @@ static int constants_on_wrong_irg(ir_entity *ent) { return 0; } -/** - * Shows a wrong entity allocation - */ -static void show_ent_alloc_error(ir_entity *ent) { - ir_fprintf(stderr, "%+e owner %t has allocation %s\n", - ent, get_entity_type(ent), - get_allocation_name(get_entity_allocation(ent))); -} - /* * Check an entity. Currently, we check only if initialized constants * are build on the const irg graph. diff --git a/ir/tv/fltcalc.c b/ir/tv/fltcalc.c index 431d573f1..9f30aefe0 100644 --- a/ir/tv/fltcalc.c +++ b/ir/tv/fltcalc.c @@ -1630,6 +1630,7 @@ fp_value *fc_int(const fp_value *a, fp_value *result) { fp_value *fc_rnd(const fp_value *a, fp_value *result) { if (result == NULL) result = calc_buffer; + (void) a; TRACEPRINTF(("%s ", fc_print(a, buffer, sizeof(buffer), FC_PACKED))); TRACEPRINTF(("rounded to integer ")); diff --git a/ir/tv/tv.c b/ir/tv/tv.c index 09c8de68f..1aa0deaea 100644 --- a/ir/tv/tv.c +++ b/ir/tv/tv.c @@ -884,9 +884,10 @@ tarval *tarval_convert_to(tarval *src, ir_mode *dst_mode) { assert(0); break; } - if (! fc_flt2int(res, sc_get_buffer(), dst_mode)) + buffer = alloca(sc_get_buffer_length()); + if (! fc_flt2int(res, buffer, dst_mode)) return tarval_bad; - return get_tarval(sc_get_buffer(), sc_get_buffer_length(), dst_mode); + return get_tarval(buffer, sc_get_buffer_length(), dst_mode); default: /* the rest can't be converted */ -- 2.20.1