From 1b9805188655599d297e3fd36fe4d20017b33263 Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Tue, 13 Nov 2012 10:12:55 +0100 Subject: [PATCH] Let be_foreach_definition() declare the value variable. --- ir/be/bearch.h | 9 ++++----- ir/be/belive.c | 1 - ir/be/beprefalloc.c | 5 +---- ir/be/bespill.c | 2 +- ir/be/bespillbelady.c | 1 - ir/be/bespilldaemel.c | 5 ++--- 6 files changed, 8 insertions(+), 15 deletions(-) diff --git a/ir/be/bearch.h b/ir/be/bearch.h index 87f94aa33..bb8003732 100644 --- a/ir/be/bearch.h +++ b/ir/be/bearch.h @@ -609,16 +609,15 @@ static inline bool arch_irn_consider_in_reg_alloc( do { \ if (get_irn_mode(node) == mode_T) { \ foreach_out_edge(node, edge_) { \ - const arch_register_req_t *req_; \ - value = get_edge_src_irn(edge_); \ - req_ = arch_get_irn_register_req(value); \ + ir_node *const value = get_edge_src_irn(edge_); \ + arch_register_req_t const *const req_ = arch_get_irn_register_req(value); \ if (req_->cls != ccls) \ continue; \ code \ } \ } else { \ - const arch_register_req_t *req_ = arch_get_irn_register_req(node); \ - value = node; \ + arch_register_req_t const *const req_ = arch_get_irn_register_req(node); \ + ir_node *const value = node; \ if (req_->cls == ccls) { \ code \ } \ diff --git a/ir/be/belive.c b/ir/be/belive.c index 8ab7a8dc3..687788b7a 100644 --- a/ir/be/belive.c +++ b/ir/be/belive.c @@ -513,7 +513,6 @@ void be_liveness_transfer(const arch_register_class_t *cls, * function. */ assert(!is_Phi(node) && "liveness_transfer produces invalid results for phi nodes"); - ir_node *value; be_foreach_definition(node, cls, value, ir_nodeset_remove(nodeset, value); ); diff --git a/ir/be/beprefalloc.c b/ir/be/beprefalloc.c index 34564e176..6cb9a31af 100644 --- a/ir/be/beprefalloc.c +++ b/ir/be/beprefalloc.c @@ -306,7 +306,6 @@ static void analyze_block(ir_node *block, void *data) if (is_Phi(node)) break; - ir_node *value; be_foreach_definition(node, cls, value, check_defs(&live_nodes, weight, value); ); @@ -410,7 +409,6 @@ static void create_congruence_class(ir_node *block, void *data) /* check should be same constraints */ ir_node *last_phi = NULL; sched_foreach_reverse(block, node) { - ir_node *value; if (is_Phi(node)) { last_phi = node; break; @@ -1200,9 +1198,9 @@ static void enforce_constraints(ir_nodeset_t *live_nodes, ir_node *node, } /* is any of the live-throughs using a constrained output register? */ - ir_node *value; unsigned *live_through_regs = NULL; be_foreach_definition(node, cls, value, + (void)value; if (req_->width > 1) double_width = true; if (! (req_->type & arch_register_req_type_limited)) @@ -1696,7 +1694,6 @@ static void allocate_coalesce_block(ir_node *block, void *data) free_last_uses(&live_nodes, node); /* assign output registers */ - ir_node *value; be_foreach_definition_(node, cls, value, assign_reg(block, value, forbidden_regs); ); diff --git a/ir/be/bespill.c b/ir/be/bespill.c index 00e079898..f56b745dd 100644 --- a/ir/be/bespill.c +++ b/ir/be/bespill.c @@ -63,7 +63,6 @@ static void prepare_constr_insn(be_pre_spill_env_t *env, ir_node *node) unsigned *tmp = NULL; unsigned *def_constr = NULL; int arity = get_irn_arity(node); - ir_node *def; int i, i2; @@ -153,6 +152,7 @@ static void prepare_constr_insn(be_pre_spill_env_t *env, ir_node *node) /* collect all registers occurring in out constraints. */ be_foreach_definition(node, cls, def, + (void)def; if (! (req_->type & arch_register_req_type_limited)) continue; if (def_constr == NULL) { diff --git a/ir/be/bespillbelady.c b/ir/be/bespillbelady.c index f205aa5fb..658b34d23 100644 --- a/ir/be/bespillbelady.c +++ b/ir/be/bespillbelady.c @@ -805,7 +805,6 @@ static void process_block(ir_node *block) sched_foreach(block, irn) { int i, arity; - ir_node *value; assert(workset_get_length(ws) <= n_regs); /* Phis are no real instr (see insert_starters()) */ diff --git a/ir/be/bespilldaemel.c b/ir/be/bespilldaemel.c index e3bfdbd6f..f25977c9b 100644 --- a/ir/be/bespilldaemel.c +++ b/ir/be/bespilldaemel.c @@ -140,9 +140,9 @@ static unsigned get_value_width(const ir_node *node) */ static void do_spilling(ir_nodeset_t *live_nodes, ir_node *node) { - size_t values_defined = 0; - ir_node *value; + size_t values_defined = 0; be_foreach_definition(node, cls, value, + (void)value; assert(req_->width >= 1); values_defined += req_->width; ); @@ -228,7 +228,6 @@ static void remove_defs(ir_node *node, ir_nodeset_t *nodeset) /* You must break out of your loop when hitting the first phi function. */ assert(!is_Phi(node)); - ir_node *value; be_foreach_definition(node, cls, value, ir_nodeset_remove(nodeset, value); ); -- 2.20.1