Commit 8a5ac708 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

Let foreach_set() declare the iterator variable.

parent 7458c2ad
......@@ -201,7 +201,7 @@ FIRM_API void set_break(set *set);
* @param type type of iterator variable
* @param entry the iterator
*/
#define foreach_set(set, type, entry) for (entry = set_first(type, set); entry; entry = set_next(type, set))
#define foreach_set(set, type, entry) for (type *entry = set_first(type, set); entry; entry = set_next(type, set))
/** @cond PRIVATE */
......
......@@ -113,7 +113,6 @@ static void dfs_perform(dfs_t *dfs, void *n, void *anc, int level)
static void classify_edges(dfs_t *dfs)
{
dfs_edge_t *edge;
stat_ev_cnt_decl(anc);
stat_ev_cnt_decl(back);
stat_ev_cnt_decl(fwd);
......@@ -160,7 +159,6 @@ dfs_edge_kind_t dfs_get_edge_kind(const dfs_t *dfs, const void *a, const void *b
dfs_t *dfs_new(const absgraph_t *graph_impl, void *graph_self)
{
dfs_t *res = XMALLOC(dfs_t);
dfs_node_t *node;
res->graph_impl = graph_impl;
res->graph = graph_self;
......@@ -176,7 +174,7 @@ dfs_t *dfs_new(const absgraph_t *graph_impl, void *graph_self)
dfs_perform(res, graph_impl->get_root(graph_self), NULL, 0);
/* make sure the end node (which might not be accessible) has a number */
node = get_node(res, graph_impl->get_end(graph_self));
dfs_node_t *const node = get_node(res, graph_impl->get_end(graph_self));
if (!node->visited) {
node->visited = 1;
node->node = graph_impl->get_end(graph_self);
......@@ -250,8 +248,6 @@ static int node_level_cmp(const void *a, const void *b)
void dfs_dump(const dfs_t *dfs, FILE *file)
{
dfs_node_t **nodes = XMALLOCN(dfs_node_t*, dfs->pre_num);
dfs_node_t *node;
dfs_edge_t *edge;
int i, n = 0;
ir_fprintf(file, "digraph G {\nranksep=0.5\n");
......@@ -274,7 +270,7 @@ void dfs_dump(const dfs_t *dfs, FILE *file)
}
for (i = 0; i < n; ++i) {
node = nodes[i];
dfs_node_t *const node = nodes[i];
ir_fprintf(file, "\tn%d [label=\"%d\"]\n", node->pre_num, get_Block_dom_tree_pre_num((ir_node*) node->node));
#if 0
ir_fprintf(file, "\tn%d [shape=box,label=\"%+F\\l%d %d/%d %d\"];\n",
......
......@@ -953,8 +953,6 @@ void arm_gen_routine(ir_graph *irg)
/* emit SymConst values */
if (set_count(sym_or_tv) > 0) {
sym_or_tv_t *entry;
be_emit_cstring("\t.align 2\n");
foreach_set(sym_or_tv, sym_or_tv_t, entry) {
......
......@@ -608,7 +608,6 @@ static void ou_optimize(unit_t *ou)
/* apply the best found qnode */
if (curr->mis_size >= 2) {
node_stat_t *ns;
int root_col = qnode_get_new_color(curr, ou->nodes[0]);
DBG((dbg, LEVEL_1, "\t Best color: %d Costs: %d << %d << %d\n", curr->color, ou->min_nodes_costs, ou->all_nodes_costs - curr->mis_costs, ou->all_nodes_costs));
/* globally pin root and all args which have the same color */
......
......@@ -1036,7 +1036,6 @@ static void writeback_colors(co2_t *env)
static void process(co2_t *env)
{
affinity_node_t *a;
co2_cloud_t *pos;
co2_cloud_t **clouds;
int n_clouds;
......
......@@ -357,8 +357,6 @@ static inline void remove_edge(set *edges, ir_node *n1, ir_node *n2, size_t *cou
*/
static void build_clique_star_cstr(ilp_env_t *ienv)
{
affinity_node_t *aff;
/* for each node with affinity edges */
co_gs_foreach_aff_node(ienv->co, aff) {
struct obstack ob;
......@@ -540,8 +538,6 @@ end:
*/
static void build_path_cstr(ilp_env_t *ienv)
{
affinity_node_t *aff_info;
/* for each node with affinity edges */
co_gs_foreach_aff_node(ienv->co, aff_info) {
pdeq *path = new_pdeq();
......
......@@ -727,7 +727,6 @@ int co_get_lower_bound(const copy_opt_t *co)
void co_complete_stats(const copy_opt_t *co, co_complete_stats_t *stat)
{
bitset_t *seen = bitset_malloc(get_irg_last_idx(co->irg));
affinity_node_t *an;
memset(stat, 0, sizeof(stat[0]));
......
......@@ -84,7 +84,6 @@ void be_dump_ifg(FILE *F, ir_graph *irg, const be_ifg_t *ifg)
static void dump_affinity_edges(FILE *F, const copy_opt_t *co,
bool dump_costs, bool dump_colors)
{
affinity_node_t *a;
co_gs_foreach_aff_node(co, a) {
neighb_t *n;
......
......@@ -640,8 +640,6 @@ static ir_node *get_end_of_block_insertion_point(ir_node* block)
static void create_memperms(be_fec_env_t *env)
{
memperm_t *memperm;
foreach_set(env->memperms, memperm_t, memperm) {
ir_node **nodes = ALLOCAN(ir_node*, memperm->entrycount);
memperm_entry_t *entry;
......
......@@ -875,10 +875,9 @@ void make_spill_locations_dominate_irn(spill_env_t *env, ir_node *irn)
void be_insert_spills_reloads(spill_env_t *env)
{
const ir_exec_freq *exec_freq = env->exec_freq;
size_t n_mem_phis = ARR_LEN(env->mem_phis);
spill_info_t *si;
size_t i;
const ir_exec_freq *exec_freq = env->exec_freq;
size_t n_mem_phis = ARR_LEN(env->mem_phis);
size_t i;
be_timer_push(T_RA_SPILL_APPLY);
......
......@@ -113,7 +113,6 @@ static void insert_all_perms_walker(ir_node *bl, void *data)
/* Look at all predecessors of the phi block */
for (i = 0, n = get_irn_arity(bl); i < n; ++i) {
ir_node *phi, *perm, *insert_after, **in;
perm_proj_t *pp;
set *arg_set = new_set(cmp_perm_proj, chordal_env->cls->n_regs);
ir_node *pred_bl = get_Block_cfgpred_block(bl, i);
int n_projs = 0;
......@@ -130,7 +129,7 @@ static void insert_all_perms_walker(ir_node *bl, void *data)
hash = hash_irn(arg);
templ.arg = arg;
pp = set_find(perm_proj_t, arg_set, &templ, sizeof(templ), hash);
perm_proj_t *const pp = set_find(perm_proj_t, arg_set, &templ, sizeof(templ), hash);
/*
* If a proj_perm_t entry has not been made in the argument set,
......@@ -188,7 +187,7 @@ static void insert_all_perms_walker(ir_node *bl, void *data)
perm_proj_t templ;
templ.arg = get_irn_n(phi, i);
pp = set_find(perm_proj_t, arg_set, &templ, sizeof(templ), hash_irn(templ.arg));
perm_proj_t *const pp = set_find(perm_proj_t, arg_set, &templ, sizeof(templ), hash_irn(templ.arg));
/* If not found, it was an interfering argument */
if (pp) {
......
......@@ -516,7 +516,6 @@ static void check_spillslot_interference(be_verify_spillslots_env_t *env)
{
int spillcount = set_count(env->spills);
spill_t **spills = ALLOCAN(spill_t*, spillcount);
spill_t *spill;
int i;
i = 0;
......
......@@ -680,7 +680,7 @@ void scalar_replacement_opt(ir_graph *irg)
{
unsigned nvals;
int i;
scalars_t key, *value;
scalars_t key;
ir_node *irg_frame;
ir_mode **modes;
set *set_ent;
......
......@@ -396,7 +396,6 @@ void compute_inh_transitive_closure(void)
void free_inh_transitive_closure(void)
{
if (tr_inh_trans_set) {
tr_inh_trans_tp *elt;
foreach_set(tr_inh_trans_set, tr_inh_trans_tp, elt) {
del_pset(elt->directions[d_up]);
del_pset(elt->directions[d_down]);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment