Let bitset_foreach() and bitset_foreach_clear() declare their iterator variables.
authorChristoph Mallon <christoph.mallon@gmx.de>
Fri, 13 Jul 2012 10:41:45 +0000 (12:41 +0200)
committerChristoph Mallon <christoph.mallon@gmx.de>
Fri, 13 Jul 2012 21:03:58 +0000 (23:03 +0200)
ir/adt/bitset.h
ir/ana/irlivechk.c
ir/be/bechordal.c
ir/be/bechordal_common.c
ir/be/becopyheur.c
ir/be/becopyheur2.c
ir/be/becopyheur4.c
ir/be/becopyopt.c
ir/ir/irargs.c
ir/ir/iredges.c

index 67518f8..59a6dbd 100644 (file)
@@ -225,12 +225,12 @@ static inline size_t bitset_next_set(const bitset_t *bs, size_t pos)
  * @param bitset The bitset.
  * @param elm A size_t variable.
  */
-#define bitset_foreach(bitset,elm) \
-       for(elm = bitset_next_set(bitset,0); elm != (size_t)-1; elm = bitset_next_set(bitset,elm+1))
+#define bitset_foreach(bitset, elm) \
+       for (size_t elm = 0; (elm = bitset_next_set((bitset), elm)) != (size_t)-1; ++elm)
 
 
-#define bitset_foreach_clear(bitset,elm) \
-       for(elm = bitset_next_clear(bitset,0); elm != (size_t) -1; elm = bitset_next_clear(bitset,elm+1))
+#define bitset_foreach_clear(bitset, elm) \
+       for (size_t elm = 0; (elm = bitset_next_clear((bitset), elm)) != (size_t)-1; ++elm)
 
 /**
  * Count the bits set.
index 3120e7c..a5aeba1 100644 (file)
@@ -166,8 +166,6 @@ static void compute_back_edge_chain(lv_chk_t *lv, const ir_node *bl)
        bitset_t *tmp = bitset_alloca(lv->n_blocks);
        bl_info_t *bi = get_block_info(lv, bl);
 
-       size_t elm;
-
        DBG((lv->dbg, LEVEL_2, "computing T_%d\n", bi->id));
 
        /* put all back edge sources reachable (reduced) from here in tmp */
@@ -202,7 +200,6 @@ static void compute_back_edge_chain(lv_chk_t *lv, const ir_node *bl)
 
 static inline void compute_back_edge_chains(lv_chk_t *lv)
 {
-       size_t elm;
        int i, n;
 
        DBG((lv->dbg, LEVEL_2, "back edge sources: %B\n", lv->back_edge_src));
index 1e34f0c..969de37 100644 (file)
@@ -176,7 +176,6 @@ static ir_node *handle_constraints(be_chordal_alloc_env_t *alloc_env,
        int *assignment;
        pmap *partners;
        int i, n_alloc;
-       size_t col;
        ir_node *perm = NULL;
        //int match_res, cost;
        be_chordal_env_t *env  = alloc_env->chordal_env;
@@ -360,7 +359,7 @@ static ir_node *handle_constraints(be_chordal_alloc_env_t *alloc_env,
                        DBG((dbg, LEVEL_2, "\tchecking reg of %+F: %s\n", proj, reg ? reg->name : "<none>"));
 
                        if (reg == NULL) {
-                               col = get_next_free_reg(alloc_env, bs);
+                               size_t const col = get_next_free_reg(alloc_env, bs);
                                reg = arch_register_for_index(env->cls, col);
                                bitset_set(bs, reg->index);
                                arch_set_irn_register(proj, reg);
index c6dce09..648df2d 100644 (file)
@@ -117,7 +117,6 @@ void create_borders(ir_node *block, void *env_ptr)
        be_lv_t          *lv   = be_get_irg_liveness(env->irg);
 
        int i, n;
-       size_t elm;
        unsigned step = 0;
        unsigned pressure = 0;
        struct list_head *head;
index c58aabe..00ae72b 100644 (file)
@@ -399,7 +399,6 @@ static inline void qnode_max_ind_set(qnode_t *qn, const unit_t *ou)
        ir_node **safe, **unsafe;
        int i, o, safe_count, safe_costs, unsafe_count, *unsafe_costs;
        bitset_t *curr, *best;
-       size_t pos;
        int next, curr_weight, best_weight = 0;
 
        /* assign the nodes into two groups.
index 8a01a12..81b7561 100644 (file)
@@ -337,7 +337,6 @@ static void determine_color_costs(co2_t *env, co2_irn_t *ci, col_cost_pair_t *co
        bitset_t *forb     = bitset_alloca(n_regs);
        affinity_node_t *a = ci->aff;
 
-       size_t elm;
        const ir_node *pos;
        neighbours_iter_t it;
        int i;
@@ -620,7 +619,6 @@ static void node_color_badness(co2_cloud_irn_t *ci, int *badness)
        be_ifg_t *ifg  = env->co->cenv->ifg;
        bitset_t *bs   = bitset_alloca(n_regs);
 
-       size_t elm;
        const ir_node *irn;
        neighbours_iter_t it;
 
index 74ce835..603a6db 100644 (file)
@@ -235,7 +235,6 @@ static void dbg_aff_chunk(const co_mst_env_t *env, const aff_chunk_t *c)
  */
 static void dbg_admissible_colors(const co_mst_env_t *env, const co_mst_irn_t *node)
 {
-       size_t idx;
        (void) env;
 
        if (bitset_popcount(node->adm_colors) < 1)
@@ -583,7 +582,6 @@ static void aff_chunk_assure_weight(co_mst_env_t *env, aff_chunk_t *c)
 
                        node->chunk = c;
                        if (node->constr_factor > REAL(0.0)) {
-                               size_t col;
                                bitset_foreach (node->adm_colors, col)
                                        c->color_affinity[col].cost += node->constr_factor;
                        }
index 65abc6b..b68740e 100644 (file)
@@ -331,7 +331,6 @@ 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;
-       size_t  pos;
        int curr_weight, best_weight = 0;
 
        /* assign the nodes into two groups.
index 08bf5a9..eb0ea21 100644 (file)
@@ -66,7 +66,6 @@ static int bitset_emit(lc_appendable_t *app,
 {
        int res = 2;
        bitset_t *b = (bitset_t*)arg->v_ptr;
-       size_t  p;
        char buf[32];
        const char *prefix = "";
 
index 74079d5..003609d 100644 (file)
@@ -795,7 +795,6 @@ static void verify_edge_counter(ir_node *irn, void *env)
        int                    list_cnt;
        int                    ref_cnt;
        int                    edge_cnt;
-       size_t                 idx;
        const struct list_head *head;
        const struct list_head *pos;
        ir_graph               *irg;