Add the * for the type in foreach_pset() automatically.
authorChristoph Mallon <christoph.mallon@gmx.de>
Fri, 13 Jul 2012 19:16:01 +0000 (21:16 +0200)
committerChristoph Mallon <christoph.mallon@gmx.de>
Fri, 13 Jul 2012 21:03:59 +0000 (23:03 +0200)
14 files changed:
include/libfirm/adt/pset.h
ir/adt/set.c
ir/ana/callgraph.c
ir/ana/cgana.c
ir/be/becopyilp2.c
ir/be/beifg.c
ir/common/irtools.c
ir/ir/irdump.c
ir/ir/iropt.c
ir/opt/proc_cloning.c
ir/stat/distrib.c
ir/stat/firmstat.c
ir/stat/pattern.c
ir/stat/stat_dmp.c

index 4a6d50c..3a3d69d 100644 (file)
@@ -215,7 +215,7 @@ FIRM_API void pset_break(pset *pset);
  * @param type   type of iterator variable
  * @param entry  the iterator
  */
-#define foreach_pset(pset, type, entry) for (type entry = (type)pset_first(pset); entry; entry = (type)pset_next(pset))
+#define foreach_pset(pset, type, entry) for (type *entry = (type*)pset_first(pset); entry; entry = (type*)pset_next(pset))
 
 /**
  * Inserts all elements of the pointer set src into
index 9833e63..8128d3b 100644 (file)
@@ -437,7 +437,7 @@ void *(pset_insert) (SET *se, const void *key, unsigned hash)
 
 void pset_insert_pset_ptr(pset *target, pset *src)
 {
-       foreach_pset(src, void*, elt) {
+       foreach_pset(src, void, elt) {
                pset_insert_ptr(target, elt);
        }
 }
index 029521b..4e1b7a4 100644 (file)
@@ -278,7 +278,7 @@ void compute_callgraph(void)
                irg->callees = NEW_ARR_F(cg_callee_entry *, count);
                irg->callee_isbe = NULL;
                j = 0;
-               foreach_pset(callee_set, cg_callee_entry*, callee) {
+               foreach_pset(callee_set, cg_callee_entry, callee) {
                        irg->callees[j++] = callee;
                }
                del_pset(callee_set);
@@ -289,7 +289,7 @@ void compute_callgraph(void)
                irg->callers = NEW_ARR_F(ir_graph *, count);
                irg->caller_isbe =  NULL;
                j = 0;
-               foreach_pset(caller_set, ir_graph*, c) {
+               foreach_pset(caller_set, ir_graph, c) {
                        irg->callers[j++] = c;
                }
                del_pset(caller_set);
index 553078f..a4052fa 100644 (file)
@@ -120,7 +120,7 @@ static ir_entity **get_impl_methods(ir_entity *method)
                arr = NULL;
        } else {
                arr = NEW_ARR_F(ir_entity *, size);
-               foreach_pset(set, ir_entity*, ent) {
+               foreach_pset(set, ir_entity, ent) {
                        arr[--size] = ent;
                }
        }
@@ -570,7 +570,7 @@ static size_t get_free_methods(ir_entity ***free_methods)
        length = pset_count(free_set);
        arr = XMALLOCN(ir_entity*, length);
        i = 0;
-       foreach_pset(free_set, ir_entity*, ent) {
+       foreach_pset(free_set, ir_entity, ent) {
                arr[i++] = ent;
        }
        del_pset(free_set);
@@ -717,7 +717,7 @@ static void callee_walker(ir_node *call, void *env)
                callee_ana_node(get_Call_ptr(call), methods);
                arr = NEW_ARR_F(ir_entity*, pset_count(methods));
                i = 0;
-               foreach_pset(methods, ir_entity*, ent) {
+               foreach_pset(methods, ir_entity, ent) {
                        arr[i] = ent;
                        /* we want the unknown_entity on the zero position for easy tests later */
                        if (is_unknown_entity(ent)) {
@@ -771,7 +771,7 @@ static void callee_ana(void)
 static void sel_methods_dispose(void)
 {
        assert(entities);
-       foreach_pset(entities, ir_entity*, ent) {
+       foreach_pset(entities, ir_entity, ent) {
                ir_entity **arr = (ir_entity**) get_entity_link(ent);
                if (arr != NULL) {
                        DEL_ARR_F(arr);
index 149fe24..504cf10 100644 (file)
@@ -348,7 +348,7 @@ static inline void remove_edge(set *edges, ir_node *n1, ir_node *n2, size_t *cou
        }
 }
 
-#define pset_foreach(pset, irn) foreach_pset((pset), ir_node*, (irn))
+#define pset_foreach(pset, irn) foreach_pset((pset), ir_node, (irn))
 
 /**
  * Search for an interference clique and an external node
index 04f01f4..857c20b 100644 (file)
@@ -246,7 +246,7 @@ static inline int get_next_clique(cliques_iter_t *it)
                                        int count = 0;
 
                                        /* fill the output buffer */
-                                       foreach_pset(it->living, ir_node*, irn) {
+                                       foreach_pset(it->living, ir_node, irn) {
                                                it->buf[count++] = irn;
                                        }
 
index 28ea1c8..5a10a8a 100644 (file)
@@ -211,7 +211,7 @@ void irn_rewire_inputs(ir_node *node)
 
 void firm_pset_dump(pset *set)
 {
-       foreach_pset(set, void*, obj) {
+       foreach_pset(set, void, obj) {
                ir_fprintf(stderr, "%+F\n", obj);
        }
 }
index b5b9a88..70a4214 100644 (file)
@@ -2294,20 +2294,20 @@ void dump_loop(FILE *F, ir_loop *l)
        collect_nodeloop_external_nodes(l, loopnodes, extnodes);
 
        /* build block lists */
-       foreach_pset(loopnodes, ir_node*, n) {
+       foreach_pset(loopnodes, ir_node, n) {
                set_irn_link(n, NULL);
        }
-       foreach_pset(extnodes, ir_node*, n) {
+       foreach_pset(extnodes, ir_node, n) {
                set_irn_link(n, NULL);
        }
-       foreach_pset(loopnodes, ir_node*, n) {
+       foreach_pset(loopnodes, ir_node, n) {
                if (!is_Block(n)) {
                        ir_node *const b = get_nodes_block(n);
                        set_irn_link(n, get_irn_link(b));
                        set_irn_link(b, n);
                }
        }
-       foreach_pset(extnodes, ir_node*, n) {
+       foreach_pset(extnodes, ir_node, n) {
                if (!is_Block(n)) {
                        ir_node *const b = get_nodes_block(n);
                        set_irn_link(n, get_irn_link(b));
@@ -2315,7 +2315,7 @@ void dump_loop(FILE *F, ir_loop *l)
                }
        }
 
-       foreach_pset(loopnodes, ir_node*, b) {
+       foreach_pset(loopnodes, ir_node, b) {
                if (is_Block(b)) {
                        fprintf(F, "graph: { title: ");
                        print_nodeid(F, b);
@@ -2342,7 +2342,7 @@ void dump_loop(FILE *F, ir_loop *l)
                        fprintf(F, "\n");
                }
        }
-       foreach_pset(extnodes, ir_node*, b) {
+       foreach_pset(extnodes, ir_node, b) {
                if (is_Block(b)) {
                        fprintf(F, "graph: { title: ");
                        print_nodeid(F, b);
index 9b9a344..0b3b658 100644 (file)
@@ -6622,7 +6622,7 @@ void visit_all_identities(ir_graph *irg, irg_walk_func visit, void *env)
        ir_graph *rem = current_ir_graph;
 
        current_ir_graph = irg;
-       foreach_pset(irg->value_table, ir_node*, node) {
+       foreach_pset(irg->value_table, ir_node, node) {
                visit(node, env);
        }
        current_ir_graph = rem;
index 8424a99..c4da9ad 100644 (file)
@@ -612,7 +612,7 @@ void proc_cloning(float threshold)
                /* We iterate the set and arrange the element of the set in a list.
                   The elements are arranged dependent of their value descending.*/
                if (hmap.map) {
-                       foreach_pset(hmap.map, entry_t*, entry) {
+                       foreach_pset(hmap.map, entry_t, entry) {
                                entry->weight = calculate_weight(entry);
 
                                /*
index 2fb4600..bd4299e 100644 (file)
@@ -188,7 +188,7 @@ int stat_get_count_distrib_tbl(distrib_tbl_t *tbl)
 {
        counter_t cnt = ZERO_CNT;
 
-       foreach_pset(tbl->hash_map, distrib_entry_t*, entry)
+       foreach_pset(tbl->hash_map, distrib_entry_t, entry)
                cnt_add(&cnt, &entry->cnt);
        return cnt_to_uint(&cnt);
 }
@@ -210,7 +210,7 @@ double stat_calc_mean_distrib_tbl(distrib_tbl_t *tbl)
                int max = INT_MIN;
                sum = 0.0;
 
-               foreach_pset(tbl->hash_map, distrib_entry_t*, entry) {
+               foreach_pset(tbl->hash_map, distrib_entry_t, entry) {
                        int value = PTR_TO_INT(entry->object);
 
                        if (value < min)
@@ -224,7 +224,7 @@ double stat_calc_mean_distrib_tbl(distrib_tbl_t *tbl)
        } else {
                sum = 0.0;
                count = 0;
-               foreach_pset(tbl->hash_map, distrib_entry_t*, entry) {
+               foreach_pset(tbl->hash_map, distrib_entry_t, entry) {
                        sum += cnt_to_dbl(&entry->cnt);
                        ++count;
                }
@@ -245,12 +245,12 @@ double stat_calc_avg_distrib_tbl(distrib_tbl_t *tbl)
                if (pset_count(tbl->hash_map) <= 0)
                        return 0.0;
 
-               foreach_pset(tbl->hash_map, distrib_entry_t*, entry) {
+               foreach_pset(tbl->hash_map, distrib_entry_t, entry) {
                        sum   += cnt_to_dbl(&entry->cnt) * PTR_TO_INT(entry->object);
                        count += cnt_to_uint(&entry->cnt);
                }
        } else {
-               foreach_pset(tbl->hash_map, distrib_entry_t*, entry) {
+               foreach_pset(tbl->hash_map, distrib_entry_t, entry) {
                        sum += cnt_to_dbl(&entry->cnt);
                        ++count;
                }
@@ -264,6 +264,6 @@ double stat_calc_avg_distrib_tbl(distrib_tbl_t *tbl)
  */
 void stat_iterate_distrib_tbl(const distrib_tbl_t *tbl, eval_distrib_entry_fun eval, void *env)
 {
-       foreach_pset(tbl->hash_map, distrib_entry_t*, entry)
+       foreach_pset(tbl->hash_map, distrib_entry_t, entry)
                eval(entry, env);
 }
index 7b2d1f1..e5dd51d 100644 (file)
@@ -1104,7 +1104,7 @@ static void update_graph_stat(graph_entry_t *global, graph_entry_t *graph)
        int i;
 
        /* clear first the alive counter in the graph */
-       foreach_pset(graph->opcode_hash, node_entry_t*, entry) {
+       foreach_pset(graph->opcode_hash, node_entry_t, entry) {
                cnt_clr(&entry->cnt_alive);
        }  /* foreach_pset */
 
@@ -1140,7 +1140,7 @@ static void update_graph_stat(graph_entry_t *global, graph_entry_t *graph)
                graph->is_chain_call = 0;
 
        /* assume we walk every graph only ONCE, we could sum here the global count */
-       foreach_pset(graph->opcode_hash, node_entry_t*, entry) {
+       foreach_pset(graph->opcode_hash, node_entry_t, entry) {
                node_entry_t *g_entry = opcode_get_entry(entry->op, global->opcode_hash);
 
                /* update the node counter */
@@ -1252,7 +1252,7 @@ static void stat_dump_registered(graph_entry_t *entry)
 
        for (dumper = status->dumper; dumper; dumper = dumper->next) {
                if (dumper->func_map) {
-                       foreach_pset(dumper->func_map, dump_graph_FUNC*, func)
+                       foreach_pset(dumper->func_map, dump_graph_FUNC, func)
                                func(dumper, entry);
                }  /* if */
        }  /* for */
@@ -2073,7 +2073,7 @@ void stat_dump_snapshot(const char *name, const char *phase)
                stat_dump_init(fname);
 
                /* calculate the graph statistics */
-               foreach_pset(status->irg_hash, graph_entry_t*, entry) {
+               foreach_pset(status->irg_hash, graph_entry_t, entry) {
                        if (entry->irg == NULL) {
                                /* special entry for the global count */
                                continue;
@@ -2092,7 +2092,7 @@ void stat_dump_snapshot(const char *name, const char *phase)
                }  /* while */
 
                /* dump per graph */
-               foreach_pset(status->irg_hash, graph_entry_t*, entry) {
+               foreach_pset(status->irg_hash, graph_entry_t, entry) {
                        if (entry->irg == NULL) {
                                /* special entry for the global count */
                                continue;
@@ -2128,7 +2128,7 @@ void stat_dump_snapshot(const char *name, const char *phase)
                stat_finish_pattern_history(fname);
 
                /* clear the global counters here */
-               foreach_pset(global->opcode_hash, node_entry_t*, entry) {
+               foreach_pset(global->opcode_hash, node_entry_t, entry) {
                        opcode_clear_entry(entry);
                }  /* for */
                /* clear all global counter */
index 1c48c15..c215556 100644 (file)
@@ -759,7 +759,7 @@ static void store_pattern(const char *fname)
        fwrite("FPS1", 4, 1, f);
        fwrite(&count, sizeof(count), 1, f);
 
-       foreach_pset(status->pattern_hash, pattern_entry_t*, entry) {
+       foreach_pset(status->pattern_hash, pattern_entry_t, entry) {
                fwrite(entry, offsetof(pattern_entry_t, buf) + entry->len, 1, f);
        }  /* for */
        fclose(f);
@@ -841,7 +841,7 @@ static void pattern_output(const char *fname)
 
        pattern_arr = XMALLOCN(pattern_entry_t*, count);
        i           = 0;
-       foreach_pset(status->pattern_hash, pattern_entry_t*, entry) {
+       foreach_pset(status->pattern_hash, pattern_entry_t, entry) {
                pattern_arr[i++] =  entry;
        }  /* for */
        assert(count == i);
index 148b87f..2176228 100644 (file)
@@ -204,7 +204,7 @@ static void simple_dump_opcode_hash(dumper_t *dmp, pset *set)
        cnt_clr(&f_normlized);
 
        fprintf(dmp->f, "%-16s %-8s %-8s %-8s %-8s\n", "Opcode", "alive", "created", "->Id", "normalized");
-       foreach_pset(set, node_entry_t*, entry) {
+       foreach_pset(set, node_entry_t, entry) {
                fprintf(dmp->f, "%-16s %8u %8u %8u %8u\n",
                        get_id_str(entry->op->name),
                        cnt_to_uint(&entry->cnt_alive),
@@ -248,7 +248,7 @@ static void simple_dump_opt_hash(dumper_t *dmp, pset *set, int index)
                fprintf(dmp->f, "\n%s:\n", name);
                fprintf(dmp->f, "%-16s %-8s\n", "Opcode", "deref");
 
-               foreach_pset(set, opt_entry_t*, entry) {
+               foreach_pset(set, opt_entry_t, entry) {
                        fprintf(dmp->f, "%-16s %8u\n",
                                get_id_str(entry->op->name), cnt_to_uint(&entry->count));
                }  /* foreach_pset */
@@ -269,15 +269,15 @@ static void simple_dump_be_block_reg_pressure(dumper_t *dmp, graph_entry_t *entr
        fprintf(dmp->f, "%12s", "Block Nr");
 
        /* print table head (register class names) */
-       foreach_pset(b_first->reg_pressure, reg_pressure_entry_t*, rp_entry)
+       foreach_pset(b_first->reg_pressure, reg_pressure_entry_t, rp_entry)
                fprintf(dmp->f, "%15s", rp_entry->class_name);
        fprintf(dmp->f, "\n");
 
        /* print the reg pressure for all blocks and register classes */
-       foreach_pset(entry->block_hash, be_block_entry_t*, b_entry) {
+       foreach_pset(entry->block_hash, be_block_entry_t, b_entry) {
                fprintf(dmp->f, "BLK   %6ld", b_entry->block_nr);
 
-               foreach_pset(b_entry->reg_pressure, reg_pressure_entry_t*, rp_entry)
+               foreach_pset(b_entry->reg_pressure, reg_pressure_entry_t, rp_entry)
                        fprintf(dmp->f, "%15d", rp_entry->pressure);
                fprintf(dmp->f, "\n");
        }  /* for */
@@ -302,7 +302,7 @@ static void simple_dump_be_block_sched_ready(dumper_t *dmp, graph_entry_t *entry
                fprintf(dmp->f, "%12s %12s %12s %12s %12s %12s %12s\n",
                        "Block Nr", "1 node", "2 nodes", "3 nodes", "4 nodes", "5 or more", "AVERAGE");
 
-               foreach_pset(entry->be_block_hash, be_block_entry_t*, b_entry) {
+               foreach_pset(entry->be_block_hash, be_block_entry_t, b_entry) {
                        /* this ensures that all keys from 1 to 5 are in the table */
                        for (i = 1; i < 6; ++i)
                                stat_insert_int_distrib_tbl(b_entry->sched_ready, i);
@@ -344,7 +344,7 @@ static void simple_dump_be_block_permstat_class(dumper_t *dmp, perm_class_entry_
                "# exchanges"
        );
 
-       foreach_pset(entry->perm_stat, perm_stat_entry_t*, ps_ent) {
+       foreach_pset(entry->perm_stat, perm_stat_entry_t, ps_ent) {
                fprintf(dmp->f, "%12d %12d %12d %12d %12d %12d\n",
                        ps_ent->size,
                        ps_ent->real_size,
@@ -400,11 +400,11 @@ static void simple_dump_be_block_permstat(dumper_t *dmp, graph_entry_t *entry)
 {
        if (pset_count(entry->be_block_hash) > 0) {
                fprintf(dmp->f, "\nPERMUTATION STATISTICS BEGIN:\n");
-               foreach_pset(entry->be_block_hash, be_block_entry_t*, b_entry) {
+               foreach_pset(entry->be_block_hash, be_block_entry_t, b_entry) {
                        fprintf(dmp->f, "BLOCK %ld:\n", b_entry->block_nr);
 
                        if (b_entry->perm_class_stat) {
-                               foreach_pset(b_entry->perm_class_stat, perm_class_entry_t*, pc_ent) {
+                               foreach_pset(b_entry->perm_class_stat, perm_class_entry_t, pc_ent) {
                                        fprintf(dmp->f, "register class %s:\n", pc_ent->class_name);
                                        simple_dump_be_block_permstat_class(dmp, pc_ent);
                                }  /* foreach_pset */
@@ -551,7 +551,7 @@ static void simple_dump_graph(dumper_t *dmp, graph_entry_t *entry)
 
                /* dump block info */
                fprintf(dmp->f, "\n%12s %12s %12s %12s %12s %12s %12s\n", "Block Nr", "Nodes", "intern E", "incoming E", "outgoing E", "Phi", "quot");
-               foreach_pset(entry->block_hash, block_entry_t*, b_entry) {
+               foreach_pset(entry->block_hash, block_entry_t, b_entry) {
                        fprintf(dmp->f, "BLK   %6ld %12u %12u %12u %12u %12u %4.8f %s\n",
                                b_entry->block_nr,
                                cnt_to_uint(&b_entry->cnt[bcnt_nodes]),
@@ -722,7 +722,7 @@ static void csv_count_nodes(dumper_t *dmp, graph_entry_t *graph, counter_t cnt[]
        for (i = 0; i < 4; ++i)
                cnt_clr(&cnt[i]);
 
-       foreach_pset(graph->opcode_hash, node_entry_t*, entry) {
+       foreach_pset(graph->opcode_hash, node_entry_t, entry) {
                if (entry->op == op_Phi) {
                        /* normal Phi */
                        cnt_add(&cnt[1], &entry->cnt_alive);