From b451899be294500fe974c6e97febc59cabdda114 Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Fri, 13 Jul 2012 21:16:01 +0200 Subject: [PATCH] Add the * for the type in foreach_pset() automatically. --- include/libfirm/adt/pset.h | 2 +- ir/adt/set.c | 2 +- ir/ana/callgraph.c | 4 ++-- ir/ana/cgana.c | 8 ++++---- ir/be/becopyilp2.c | 2 +- ir/be/beifg.c | 2 +- ir/common/irtools.c | 2 +- ir/ir/irdump.c | 12 ++++++------ ir/ir/iropt.c | 2 +- ir/opt/proc_cloning.c | 2 +- ir/stat/distrib.c | 12 ++++++------ ir/stat/firmstat.c | 12 ++++++------ ir/stat/pattern.c | 4 ++-- ir/stat/stat_dmp.c | 22 +++++++++++----------- 14 files changed, 44 insertions(+), 44 deletions(-) diff --git a/include/libfirm/adt/pset.h b/include/libfirm/adt/pset.h index 4a6d50c28..3a3d69dca 100644 --- a/include/libfirm/adt/pset.h +++ b/include/libfirm/adt/pset.h @@ -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 diff --git a/ir/adt/set.c b/ir/adt/set.c index 9833e6380..8128d3ba8 100644 --- a/ir/adt/set.c +++ b/ir/adt/set.c @@ -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); } } diff --git a/ir/ana/callgraph.c b/ir/ana/callgraph.c index 029521b8b..4e1b7a46a 100644 --- a/ir/ana/callgraph.c +++ b/ir/ana/callgraph.c @@ -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); diff --git a/ir/ana/cgana.c b/ir/ana/cgana.c index 553078f3e..a4052fade 100644 --- a/ir/ana/cgana.c +++ b/ir/ana/cgana.c @@ -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); diff --git a/ir/be/becopyilp2.c b/ir/be/becopyilp2.c index 149fe24dd..504cf1091 100644 --- a/ir/be/becopyilp2.c +++ b/ir/be/becopyilp2.c @@ -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 diff --git a/ir/be/beifg.c b/ir/be/beifg.c index 04f01f45f..857c20bed 100644 --- a/ir/be/beifg.c +++ b/ir/be/beifg.c @@ -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; } diff --git a/ir/common/irtools.c b/ir/common/irtools.c index 28ea1c88d..5a10a8aab 100644 --- a/ir/common/irtools.c +++ b/ir/common/irtools.c @@ -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); } } diff --git a/ir/ir/irdump.c b/ir/ir/irdump.c index b5b9a88d6..70a4214fb 100644 --- a/ir/ir/irdump.c +++ b/ir/ir/irdump.c @@ -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); diff --git a/ir/ir/iropt.c b/ir/ir/iropt.c index 9b9a3447a..0b3b65875 100644 --- a/ir/ir/iropt.c +++ b/ir/ir/iropt.c @@ -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; diff --git a/ir/opt/proc_cloning.c b/ir/opt/proc_cloning.c index 8424a99fd..c4da9ad83 100644 --- a/ir/opt/proc_cloning.c +++ b/ir/opt/proc_cloning.c @@ -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); /* diff --git a/ir/stat/distrib.c b/ir/stat/distrib.c index 2fb4600a5..bd4299eb1 100644 --- a/ir/stat/distrib.c +++ b/ir/stat/distrib.c @@ -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); } diff --git a/ir/stat/firmstat.c b/ir/stat/firmstat.c index 7b2d1f183..e5dd51d76 100644 --- a/ir/stat/firmstat.c +++ b/ir/stat/firmstat.c @@ -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 */ diff --git a/ir/stat/pattern.c b/ir/stat/pattern.c index 1c48c15d7..c21555679 100644 --- a/ir/stat/pattern.c +++ b/ir/stat/pattern.c @@ -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); diff --git a/ir/stat/stat_dmp.c b/ir/stat/stat_dmp.c index 148b87fe9..2176228b2 100644 --- a/ir/stat/stat_dmp.c +++ b/ir/stat/stat_dmp.c @@ -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); -- 2.20.1