diff options
author | kazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-06-07 14:30:25 +0000 |
---|---|---|
committer | kazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-06-07 14:30:25 +0000 |
commit | 3e790786cfb2c88061ebc1faad8273489bf3c388 (patch) | |
tree | 562f4507f40d0b9cd1ffaff1ad4960266f21f391 | |
parent | aed164c3b749041e52ddb15d0114078e9dbeb7ae (diff) | |
download | gcc-3e790786cfb2c88061ebc1faad8273489bf3c388.tar.gz |
* sbitmap.h (sbitmap_iterator, sbitmap_iter_init,
sbitmap_iter_cond, sbitmap_iter_next): New.
* bt-load.c, cfganal.c, combine.c, ddg.c, flow.c,
modulo-sched.c, sbitmap.c, sched-rgn.c, tree-into-ssa.c,
tree-outof-ssa.c, tree-ssa-alias.c, tree-ssa-live.c: Update
uses of EXECUTE_IF_SET_IN_SBITMAP to the new style.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@100709 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/bt-load.c | 7 | ||||
-rw-r--r-- | gcc/cfganal.c | 6 | ||||
-rw-r--r-- | gcc/combine.c | 6 | ||||
-rw-r--r-- | gcc/ddg.c | 43 | ||||
-rw-r--r-- | gcc/flow.c | 44 | ||||
-rw-r--r-- | gcc/modulo-sched.c | 28 | ||||
-rw-r--r-- | gcc/sbitmap.c | 4 | ||||
-rw-r--r-- | gcc/sbitmap.h | 110 | ||||
-rw-r--r-- | gcc/sched-rgn.c | 13 | ||||
-rw-r--r-- | gcc/tree-into-ssa.c | 40 | ||||
-rw-r--r-- | gcc/tree-outof-ssa.c | 5 | ||||
-rw-r--r-- | gcc/tree-ssa-alias.c | 14 | ||||
-rw-r--r-- | gcc/tree-ssa-live.c | 15 |
14 files changed, 225 insertions, 119 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b4fff9ae7ee..9e99ca669b7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2005-06-07 Kazu Hirata <kazu@codesourcery.com> + + * sbitmap.h (sbitmap_iterator, sbitmap_iter_init, + sbitmap_iter_cond, sbitmap_iter_next): New. + * bt-load.c, cfganal.c, combine.c, ddg.c, flow.c, + modulo-sched.c, sbitmap.c, sched-rgn.c, tree-into-ssa.c, + tree-outof-ssa.c, tree-ssa-alias.c, tree-ssa-live.c: Update + uses of EXECUTE_IF_SET_IN_SBITMAP to the new style. + 2005-06-07 Zdenek Dvorak <dvorakz@suse.cz> * tree-ssa-address.c: New file. diff --git a/gcc/bt-load.c b/gcc/bt-load.c index 47ac16a82fb..d58dab7a1f0 100644 --- a/gcc/bt-load.c +++ b/gcc/bt-load.c @@ -699,7 +699,8 @@ link_btr_uses (btr_def *def_array, btr_user *use_array, sbitmap *bb_out, { /* Find all the reaching defs for this use. */ sbitmap reaching_defs_of_reg = sbitmap_alloc(max_uid); - int uid; + unsigned int uid; + sbitmap_iterator sbi; if (user->use) sbitmap_a_and_b ( @@ -720,7 +721,7 @@ link_btr_uses (btr_def *def_array, btr_user *use_array, sbitmap *bb_out, reaching_defs, btr_defset[reg - first_btr]); } - EXECUTE_IF_SET_IN_SBITMAP (reaching_defs_of_reg, 0, uid, + EXECUTE_IF_SET_IN_SBITMAP (reaching_defs_of_reg, 0, uid, sbi) { btr_def def = def_array[uid]; @@ -752,7 +753,7 @@ link_btr_uses (btr_def *def_array, btr_user *use_array, sbitmap *bb_out, def->other_btr_uses_after_use = 1; user->next = def->uses; def->uses = user; - }); + } sbitmap_free (reaching_defs_of_reg); } diff --git a/gcc/cfganal.c b/gcc/cfganal.c index 6c707729b70..0db040fe8ec 100644 --- a/gcc/cfganal.c +++ b/gcc/cfganal.c @@ -521,13 +521,15 @@ find_edge_index (struct edge_list *edge_list, basic_block pred, basic_block succ void flow_nodes_print (const char *str, const sbitmap nodes, FILE *file) { - int node; + unsigned int node; + sbitmap_iterator sbi; if (! nodes) return; fprintf (file, "%s { ", str); - EXECUTE_IF_SET_IN_SBITMAP (nodes, 0, node, {fprintf (file, "%d ", node);}); + EXECUTE_IF_SET_IN_SBITMAP (nodes, 0, node, sbi) + fprintf (file, "%d ", node); fputs ("}\n", file); } diff --git a/gcc/combine.c b/gcc/combine.c index 7cecc3d0102..2f0b787ee57 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -639,7 +639,9 @@ combine_instructions (rtx f, unsigned int nregs) rtx prev; #endif int i; + unsigned int j; rtx links, nextlinks; + sbitmap_iterator sbi; int new_direct_jump_p = 0; @@ -884,8 +886,8 @@ combine_instructions (rtx f, unsigned int nregs) } clear_bb_flags (); - EXECUTE_IF_SET_IN_SBITMAP (refresh_blocks, 0, i, - BASIC_BLOCK (i)->flags |= BB_DIRTY); + EXECUTE_IF_SET_IN_SBITMAP (refresh_blocks, 0, j, sbi) + BASIC_BLOCK (j)->flags |= BB_DIRTY; new_direct_jump_p |= purge_all_dead_edges (); delete_noop_moves (); diff --git a/gcc/ddg.c b/gcc/ddg.c index cbdb18e72bc..5d32b89c143 100644 --- a/gcc/ddg.c +++ b/gcc/ddg.c @@ -692,7 +692,8 @@ static ddg_scc_ptr create_scc (ddg_ptr g, sbitmap nodes) { ddg_scc_ptr scc; - int u; + unsigned int u; + sbitmap_iterator sbi; scc = (ddg_scc_ptr) xmalloc (sizeof (struct ddg_scc)); scc->backarcs = NULL; @@ -701,7 +702,7 @@ create_scc (ddg_ptr g, sbitmap nodes) sbitmap_copy (scc->nodes, nodes); /* Mark the backarcs that belong to this SCC. */ - EXECUTE_IF_SET_IN_SBITMAP (nodes, 0, u, + EXECUTE_IF_SET_IN_SBITMAP (nodes, 0, u, sbi) { ddg_edge_ptr e; ddg_node_ptr n = &g->nodes[u]; @@ -713,7 +714,7 @@ create_scc (ddg_ptr g, sbitmap nodes) if (e->distance > 0) add_backarc_to_scc (scc, e); } - }); + } set_recurrence_length (scc, g); return scc; @@ -782,13 +783,14 @@ get_node_of_insn (ddg_ptr g, rtx insn) void find_successors (sbitmap succ, ddg_ptr g, sbitmap ops) { - int i; + unsigned int i; + sbitmap_iterator sbi; - EXECUTE_IF_SET_IN_SBITMAP (ops, 0, i, + EXECUTE_IF_SET_IN_SBITMAP (ops, 0, i, sbi) { const sbitmap node_succ = NODE_SUCCESSORS (&g->nodes[i]); sbitmap_a_or_b (succ, succ, node_succ); - }); + }; /* We want those that are not in ops. */ sbitmap_difference (succ, succ, ops); @@ -800,13 +802,14 @@ find_successors (sbitmap succ, ddg_ptr g, sbitmap ops) void find_predecessors (sbitmap preds, ddg_ptr g, sbitmap ops) { - int i; + unsigned int i; + sbitmap_iterator sbi; - EXECUTE_IF_SET_IN_SBITMAP (ops, 0, i, + EXECUTE_IF_SET_IN_SBITMAP (ops, 0, i, sbi) { const sbitmap node_preds = NODE_PREDECESSORS (&g->nodes[i]); sbitmap_a_or_b (preds, preds, node_preds); - }); + }; /* We want those that are not in ops. */ sbitmap_difference (preds, preds, ops); @@ -901,8 +904,11 @@ int find_nodes_on_paths (sbitmap result, ddg_ptr g, sbitmap from, sbitmap to) { int answer; - int change, u; + int change; + unsigned int u; int num_nodes = g->num_nodes; + sbitmap_iterator sbi; + sbitmap workset = sbitmap_alloc (num_nodes); sbitmap reachable_from = sbitmap_alloc (num_nodes); sbitmap reach_to = sbitmap_alloc (num_nodes); @@ -917,7 +923,7 @@ find_nodes_on_paths (sbitmap result, ddg_ptr g, sbitmap from, sbitmap to) change = 0; sbitmap_copy (workset, tmp); sbitmap_zero (tmp); - EXECUTE_IF_SET_IN_SBITMAP (workset, 0, u, + EXECUTE_IF_SET_IN_SBITMAP (workset, 0, u, sbi) { ddg_edge_ptr e; ddg_node_ptr u_node = &g->nodes[u]; @@ -934,7 +940,7 @@ find_nodes_on_paths (sbitmap result, ddg_ptr g, sbitmap from, sbitmap to) change = 1; } } - }); + } } sbitmap_copy (reach_to, to); @@ -946,7 +952,7 @@ find_nodes_on_paths (sbitmap result, ddg_ptr g, sbitmap from, sbitmap to) change = 0; sbitmap_copy (workset, tmp); sbitmap_zero (tmp); - EXECUTE_IF_SET_IN_SBITMAP (workset, 0, u, + EXECUTE_IF_SET_IN_SBITMAP (workset, 0, u, sbi) { ddg_edge_ptr e; ddg_node_ptr u_node = &g->nodes[u]; @@ -963,7 +969,7 @@ find_nodes_on_paths (sbitmap result, ddg_ptr g, sbitmap from, sbitmap to) change = 1; } } - }); + } } answer = sbitmap_a_and_b_cg (result, reachable_from, reach_to); @@ -1008,7 +1014,8 @@ update_dist_to_successors (ddg_node_ptr u_node, sbitmap nodes, sbitmap tmp) int longest_simple_path (struct ddg * g, int src, int dest, sbitmap nodes) { - int i, u; + int i; + unsigned int u; int change = 1; int result; int num_nodes = g->num_nodes; @@ -1027,15 +1034,17 @@ longest_simple_path (struct ddg * g, int src, int dest, sbitmap nodes) while (change) { + sbitmap_iterator sbi; + change = 0; sbitmap_copy (workset, tmp); sbitmap_zero (tmp); - EXECUTE_IF_SET_IN_SBITMAP (workset, 0, u, + EXECUTE_IF_SET_IN_SBITMAP (workset, 0, u, sbi) { ddg_node_ptr u_node = &g->nodes[u]; change |= update_dist_to_successors (u_node, nodes, tmp); - }); + } } result = g->nodes[dest].aux.count; sbitmap_free (workset); diff --git a/gcc/flow.c b/gcc/flow.c index 9eae74b4ad0..b73ac4d09bc 100644 --- a/gcc/flow.c +++ b/gcc/flow.c @@ -653,7 +653,9 @@ update_life_info (sbitmap blocks, enum update_life_extent extent, if (blocks) { - EXECUTE_IF_SET_IN_SBITMAP (blocks, 0, i, + sbitmap_iterator sbi; + + EXECUTE_IF_SET_IN_SBITMAP (blocks, 0, i, sbi) { bb = BASIC_BLOCK (i); @@ -662,7 +664,7 @@ update_life_info (sbitmap blocks, enum update_life_extent extent, if (extent == UPDATE_LIFE_LOCAL) verify_local_live_at_start (tmp, bb); - }); + }; } else { @@ -1032,7 +1034,7 @@ calculate_global_regs_live (sbitmap blocks_in, sbitmap blocks_out, int flags) In other words, regs that are set only as part of a COND_EXEC. */ regset *cond_local_sets; - int i; + unsigned int i; /* Some passes used to forget clear aux field of basic block causing sick behavior here. */ @@ -1406,12 +1408,14 @@ calculate_global_regs_live (sbitmap blocks_in, sbitmap blocks_out, int flags) if (blocks_out) { - EXECUTE_IF_SET_IN_SBITMAP (blocks_out, 0, i, + sbitmap_iterator sbi; + + EXECUTE_IF_SET_IN_SBITMAP (blocks_out, 0, i, sbi) { basic_block bb = BASIC_BLOCK (i); FREE_REG_SET (local_sets[bb->index - (INVALID_BLOCK + 1)]); FREE_REG_SET (cond_local_sets[bb->index - (INVALID_BLOCK + 1)]); - }); + }; } else { @@ -4355,7 +4359,7 @@ int count_or_remove_death_notes (sbitmap blocks, int kill) { int count = 0; - int i; + unsigned int i; basic_block bb; /* This used to be a loop over all the blocks with a membership test @@ -4367,10 +4371,12 @@ count_or_remove_death_notes (sbitmap blocks, int kill) than an sbitmap. */ if (blocks) { - EXECUTE_IF_SET_IN_SBITMAP (blocks, 0, i, + sbitmap_iterator sbi; + + EXECUTE_IF_SET_IN_SBITMAP (blocks, 0, i, sbi) { count += count_or_remove_death_notes_bb (BASIC_BLOCK (i), kill); - }); + }; } else { @@ -4450,7 +4456,6 @@ static void clear_log_links (sbitmap blocks) { rtx insn; - int i; if (!blocks) { @@ -4459,15 +4464,20 @@ clear_log_links (sbitmap blocks) free_INSN_LIST_list (&LOG_LINKS (insn)); } else - EXECUTE_IF_SET_IN_SBITMAP (blocks, 0, i, - { - basic_block bb = BASIC_BLOCK (i); + { + unsigned int i; + sbitmap_iterator sbi; - for (insn = BB_HEAD (bb); insn != NEXT_INSN (BB_END (bb)); - insn = NEXT_INSN (insn)) - if (INSN_P (insn)) - free_INSN_LIST_list (&LOG_LINKS (insn)); - }); + EXECUTE_IF_SET_IN_SBITMAP (blocks, 0, i, sbi) + { + basic_block bb = BASIC_BLOCK (i); + + for (insn = BB_HEAD (bb); insn != NEXT_INSN (BB_END (bb)); + insn = NEXT_INSN (insn)) + if (INSN_P (insn)) + free_INSN_LIST_list (&LOG_LINKS (insn)); + } + } } /* Given a register bitmap, turn on the bits in a HARD_REG_SET that diff --git a/gcc/modulo-sched.c b/gcc/modulo-sched.c index 082b059bc22..39549b93cb0 100644 --- a/gcc/modulo-sched.c +++ b/gcc/modulo-sched.c @@ -499,9 +499,10 @@ generate_reg_moves (partial_schedule_ptr ps) for (i_reg_move = 0; i_reg_move < nreg_moves; i_reg_move++) { - int i_use; + unsigned int i_use; rtx new_reg = gen_reg_rtx (GET_MODE (prev_reg)); rtx reg_move = gen_move_insn (new_reg, prev_reg); + sbitmap_iterator sbi; add_insn_before (reg_move, last_reg_move); last_reg_move = reg_move; @@ -509,7 +510,7 @@ generate_reg_moves (partial_schedule_ptr ps) if (!SCHED_FIRST_REG_MOVE (u)) SCHED_FIRST_REG_MOVE (u) = reg_move; - EXECUTE_IF_SET_IN_SBITMAP (uses_of_defs[i_reg_move], 0, i_use, + EXECUTE_IF_SET_IN_SBITMAP (uses_of_defs[i_reg_move], 0, i_use, sbi) { struct undo_replace_buff_elem *rep; @@ -528,7 +529,7 @@ generate_reg_moves (partial_schedule_ptr ps) } replace_rtx (g->nodes[i_use].insn, old_reg, new_reg); - }); + } prev_reg = new_reg; } @@ -1842,11 +1843,12 @@ calculate_order_params (ddg_ptr g, int mii ATTRIBUTE_UNUSED) static int find_max_asap (ddg_ptr g, sbitmap nodes) { - int u; + unsigned int u; int max_asap = -1; int result = -1; + sbitmap_iterator sbi; - EXECUTE_IF_SET_IN_SBITMAP (nodes, 0, u, + EXECUTE_IF_SET_IN_SBITMAP (nodes, 0, u, sbi) { ddg_node_ptr u_node = &g->nodes[u]; @@ -1855,19 +1857,20 @@ find_max_asap (ddg_ptr g, sbitmap nodes) max_asap = ASAP (u_node); result = u; } - }); + } return result; } static int find_max_hv_min_mob (ddg_ptr g, sbitmap nodes) { - int u; + unsigned int u; int max_hv = -1; int min_mob = INT_MAX; int result = -1; + sbitmap_iterator sbi; - EXECUTE_IF_SET_IN_SBITMAP (nodes, 0, u, + EXECUTE_IF_SET_IN_SBITMAP (nodes, 0, u, sbi) { ddg_node_ptr u_node = &g->nodes[u]; @@ -1883,19 +1886,20 @@ find_max_hv_min_mob (ddg_ptr g, sbitmap nodes) min_mob = MOB (u_node); result = u; } - }); + } return result; } static int find_max_dv_min_mob (ddg_ptr g, sbitmap nodes) { - int u; + unsigned int u; int max_dv = -1; int min_mob = INT_MAX; int result = -1; + sbitmap_iterator sbi; - EXECUTE_IF_SET_IN_SBITMAP (nodes, 0, u, + EXECUTE_IF_SET_IN_SBITMAP (nodes, 0, u, sbi) { ddg_node_ptr u_node = &g->nodes[u]; @@ -1911,7 +1915,7 @@ find_max_dv_min_mob (ddg_ptr g, sbitmap nodes) min_mob = MOB (u_node); result = u; } - }); + } return result; } diff --git a/gcc/sbitmap.c b/gcc/sbitmap.c index 7c912a922af..cbc5775dbb6 100644 --- a/gcc/sbitmap.c +++ b/gcc/sbitmap.c @@ -691,8 +691,10 @@ int sbitmap_first_set_bit (sbitmap bmap) { unsigned int n; + sbitmap_iterator sbi; - EXECUTE_IF_SET_IN_SBITMAP (bmap, 0, n, { return n; }); + EXECUTE_IF_SET_IN_SBITMAP (bmap, 0, n, sbi) + return n; return -1; } diff --git a/gcc/sbitmap.h b/gcc/sbitmap.h index edaa0580ebf..fe23cbf91fa 100644 --- a/gcc/sbitmap.h +++ b/gcc/sbitmap.h @@ -55,36 +55,86 @@ typedef SBITMAP_ELT_TYPE *sbitmap_ptr; ((BITMAP)->elms [(BITNO) / SBITMAP_ELT_BITS] \ &= ~((SBITMAP_ELT_TYPE) 1 << (BITNO) % SBITMAP_ELT_BITS)) -/* Loop over all elements of SBITSET, starting with MIN. */ -#define EXECUTE_IF_SET_IN_SBITMAP(SBITMAP, MIN, N, CODE) \ -do { \ - unsigned int word_num_ = (MIN) / (unsigned int) SBITMAP_ELT_BITS; \ - unsigned int bit_num_ = (MIN) % (unsigned int) SBITMAP_ELT_BITS; \ - unsigned int size_ = (SBITMAP)->size; \ - SBITMAP_ELT_TYPE *ptr_ = (SBITMAP)->elms; \ - SBITMAP_ELT_TYPE word_; \ - \ - if (word_num_ < size_) \ - { \ - word_ = ptr_[word_num_] >> bit_num_; \ - \ - while (1) \ - { \ - for (; word_ != 0; word_ >>= 1, bit_num_++) \ - { \ - if ((word_ & 1) != 0) \ - { \ - (N) = word_num_ * SBITMAP_ELT_BITS + bit_num_; \ - CODE; \ - } \ - } \ - word_num_++; \ - if (word_num_ >= size_) \ - break; \ - bit_num_ = 0, word_ = ptr_[word_num_]; \ - } \ - } \ -} while (0) +/* The iterator for sbitmap. */ +typedef struct { + /* The pointer to the first word of the bitmap. */ + SBITMAP_ELT_TYPE *ptr; + + /* The size of the bitmap. */ + unsigned int size; + + /* The current word index. */ + unsigned int word_num; + + /* The current bit index. */ + unsigned int bit_num; + + /* The words currently visited. */ + SBITMAP_ELT_TYPE word; +} sbitmap_iterator; + +/* Initialize the iterator I with sbitmap BMP and the initial index + MIN. */ + +static inline void +sbitmap_iter_init (sbitmap_iterator *i, sbitmap bmp, unsigned int min) +{ + i->word_num = min / (unsigned int) SBITMAP_ELT_BITS; + i->bit_num = min % (unsigned int) SBITMAP_ELT_BITS; + i->size = bmp->size; + i->ptr = bmp->elms; + + if (i->word_num >= i->size) + i->word = 0; + else + i->word = i->ptr[i->word_num] >> i->bit_num; +} + +/* Return true if we have more bits to visit, in which case *N is set + to the index of the bit to be visited. Otherwise, return + false. */ + +static inline bool +sbitmap_iter_cond (sbitmap_iterator *i, unsigned int *n) +{ + /* Skip words that are zeros. */ + for (; i->word == 0; i->word = i->ptr[i->word_num]) + { + i->word_num++; + + /* If we have reached the end, break. */ + if (i->word_num >= i->size) + return false; + + i->bit_num = i->word_num * SBITMAP_ELT_BITS; + } + + /* Skip bits that are zero. */ + for (; (i->word & 1) == 0; i->word >>= 1) + i->bit_num++; + + *n = i->bit_num; + + return true; +} + +/* Advance to the next bit. */ + +static inline void +sbitmap_iter_next (sbitmap_iterator *i) +{ + i->word >>= 1; + i->bit_num++; +} + +/* Loop over all elements of SBITMAP, starting with MIN. In each + iteration, N is set to the index of the bit being visited. ITER is + an instance of sbitmap_iterator used to iterate the bitmap. */ + +#define EXECUTE_IF_SET_IN_SBITMAP(SBITMAP, MIN, N, ITER) \ + for (sbitmap_iter_init (&(ITER), (SBITMAP), (MIN)); \ + sbitmap_iter_cond (&(ITER), &(N)); \ + sbitmap_iter_next (&(ITER))) #define EXECUTE_IF_SET_IN_SBITMAP_REV(SBITMAP, N, CODE) \ do { \ diff --git a/gcc/sched-rgn.c b/gcc/sched-rgn.c index 7c6afbe3581..4196e6d7e93 100644 --- a/gcc/sched-rgn.c +++ b/gcc/sched-rgn.c @@ -351,7 +351,8 @@ is_cfg_nonregular (void) static void extract_edgelst (sbitmap set, edgelst *el) { - int i; + unsigned int i; + sbitmap_iterator sbi; /* edgelst table space is reused in each call to extract_edgelst. */ edgelst_last = 0; @@ -360,11 +361,11 @@ extract_edgelst (sbitmap set, edgelst *el) el->nr_members = 0; /* Iterate over each word in the bitset. */ - EXECUTE_IF_SET_IN_SBITMAP (set, 0, i, - { - edgelst_table[edgelst_last++] = rgn_edges[i]; - el->nr_members++; - }); + EXECUTE_IF_SET_IN_SBITMAP (set, 0, i, sbi) + { + edgelst_table[edgelst_last++] = rgn_edges[i]; + el->nr_members++; + } } /* Functions for the construction of regions. */ diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c index 7a50f73f259..1daea76b02c 100644 --- a/gcc/tree-into-ssa.c +++ b/gcc/tree-into-ssa.c @@ -2033,6 +2033,7 @@ prepare_names_to_update (bitmap blocks, bool insert_phi_p) { unsigned i; bitmap_iterator bi; + sbitmap_iterator sbi; /* If a name N from NEW_SSA_NAMES is also marked to be released, remove it from NEW_SSA_NAMES so that we don't try to visit its @@ -2046,17 +2047,17 @@ prepare_names_to_update (bitmap blocks, bool insert_phi_p) /* First process names in NEW_SSA_NAMES. Otherwise, uses of old names may be considered to be live-in on blocks that contain definitions for their replacements. */ - EXECUTE_IF_SET_IN_SBITMAP (new_ssa_names, 0, i, - prepare_def_site_for (ssa_name (i), blocks, insert_phi_p)); + EXECUTE_IF_SET_IN_SBITMAP (new_ssa_names, 0, i, sbi) + prepare_def_site_for (ssa_name (i), blocks, insert_phi_p); /* If an old name is in NAMES_TO_RELEASE, we cannot remove it from OLD_SSA_NAMES, but we have to ignore its definition site. */ - EXECUTE_IF_SET_IN_SBITMAP (old_ssa_names, 0, i, + EXECUTE_IF_SET_IN_SBITMAP (old_ssa_names, 0, i, sbi) { if (names_to_release == NULL || !bitmap_bit_p (names_to_release, i)) prepare_def_site_for (ssa_name (i), blocks, insert_phi_p); prepare_use_sites_for (ssa_name (i), blocks, insert_phi_p); - }); + } } @@ -2105,12 +2106,14 @@ dump_update_ssa (FILE *file) if (new_ssa_names && sbitmap_first_set_bit (new_ssa_names) >= 0) { + sbitmap_iterator sbi; + fprintf (file, "\nSSA replacement table\n"); fprintf (file, "N_i -> { O_1 ... O_j } means that N_i replaces " "O_1, ..., O_j\n\n"); - EXECUTE_IF_SET_IN_SBITMAP (new_ssa_names, 0, i, - dump_names_replaced_by (file, ssa_name (i))); + EXECUTE_IF_SET_IN_SBITMAP (new_ssa_names, 0, i, sbi) + dump_names_replaced_by (file, ssa_name (i)); fprintf (file, "\n"); fprintf (file, "Number of virtual NEW -> OLD mappings: %7u\n", @@ -2346,10 +2349,11 @@ ssa_names_to_replace (void) { unsigned i; bitmap ret; + sbitmap_iterator sbi; ret = BITMAP_ALLOC (NULL); - EXECUTE_IF_SET_IN_SBITMAP (old_ssa_names, 0, i, - bitmap_set_bit (ret, i)); + EXECUTE_IF_SET_IN_SBITMAP (old_ssa_names, 0, i, sbi) + bitmap_set_bit (ret, i); return ret; } @@ -2516,6 +2520,7 @@ static void switch_virtuals_to_full_rewrite (void) { unsigned i; + sbitmap_iterator sbi; if (dump_file) { @@ -2531,13 +2536,13 @@ switch_virtuals_to_full_rewrite (void) /* Remove all virtual names from NEW_SSA_NAMES and OLD_SSA_NAMES. Note that it is not really necessary to remove the mappings from REPL_TBL, that would only waste time. */ - EXECUTE_IF_SET_IN_SBITMAP (new_ssa_names, 0, i, + EXECUTE_IF_SET_IN_SBITMAP (new_ssa_names, 0, i, sbi) if (!is_gimple_reg (ssa_name (i))) - RESET_BIT (new_ssa_names, i)); + RESET_BIT (new_ssa_names, i); - EXECUTE_IF_SET_IN_SBITMAP (old_ssa_names, 0, i, + EXECUTE_IF_SET_IN_SBITMAP (old_ssa_names, 0, i, sbi) if (!is_gimple_reg (ssa_name (i))) - RESET_BIT (old_ssa_names, i)); + RESET_BIT (old_ssa_names, i); bitmap_ior_into (syms_to_rename, update_ssa_stats.virtual_symbols); } @@ -2616,6 +2621,7 @@ update_ssa (unsigned update_flags) unsigned i; sbitmap tmp; bool insert_phi_p; + sbitmap_iterator sbi; if (!need_ssa_update_p ()) return; @@ -2746,6 +2752,8 @@ update_ssa (unsigned update_flags) if (sbitmap_first_set_bit (old_ssa_names) >= 0) { + sbitmap_iterator sbi; + /* insert_update_phi_nodes_for will call add_new_name_mapping when inserting new PHI nodes, so the set OLD_SSA_NAMES will grow while we are traversing it (but it will not @@ -2753,9 +2761,9 @@ update_ssa (unsigned update_flags) for traversal. */ sbitmap tmp = sbitmap_alloc (old_ssa_names->n_bits); sbitmap_copy (tmp, old_ssa_names); - EXECUTE_IF_SET_IN_SBITMAP (tmp, 0, i, + EXECUTE_IF_SET_IN_SBITMAP (tmp, 0, i, sbi) insert_updated_phi_nodes_for (ssa_name (i), dfs, blocks, - update_flags)); + update_flags); sbitmap_free (tmp); } @@ -2776,8 +2784,8 @@ update_ssa (unsigned update_flags) /* Reset the current definition for name and symbol before renaming the sub-graph. */ - EXECUTE_IF_SET_IN_SBITMAP (old_ssa_names, 0, i, - set_current_def (ssa_name (i), NULL_TREE)); + EXECUTE_IF_SET_IN_SBITMAP (old_ssa_names, 0, i, sbi) + set_current_def (ssa_name (i), NULL_TREE); EXECUTE_IF_SET_IN_BITMAP (syms_to_rename, 0, i, bi) set_current_def (referenced_var (i), NULL_TREE); diff --git a/gcc/tree-outof-ssa.c b/gcc/tree-outof-ssa.c index a32ecf68341..a7b4f3f26a7 100644 --- a/gcc/tree-outof-ssa.c +++ b/gcc/tree-outof-ssa.c @@ -695,6 +695,7 @@ coalesce_ssa_name (var_map map, int flags) conflict_graph graph; basic_block bb; coalesce_list_p cl = NULL; + sbitmap_iterator sbi; if (num_var_partitions (map) <= 1) return NULL; @@ -797,7 +798,7 @@ coalesce_ssa_name (var_map map, int flags) /* Assign root variable as partition representative for each live on entry partition. */ - EXECUTE_IF_SET_IN_SBITMAP (live, 0, x, + EXECUTE_IF_SET_IN_SBITMAP (live, 0, x, sbi) { var = root_var (rv, root_var_find (rv, x)); ann = var_ann (var); @@ -817,7 +818,7 @@ coalesce_ssa_name (var_map map, int flags) change_partition_var (map, var, x); } - }); + } sbitmap_free (live); diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index f8b992accd6..ab23cd0bab8 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -1073,12 +1073,13 @@ compute_flow_insensitive_aliasing (struct alias_info *ai) if (sbitmap_first_set_bit (may_aliases2) >= 0) { - size_t k; + unsigned int k; + sbitmap_iterator sbi; /* Add all the aliases for TAG2 into TAG1's alias set. FIXME, update grouping heuristic counters. */ - EXECUTE_IF_SET_IN_SBITMAP (may_aliases2, 0, k, - add_may_alias (tag1, referenced_var (k))); + EXECUTE_IF_SET_IN_SBITMAP (may_aliases2, 0, k, sbi) + add_may_alias (tag1, referenced_var (k)); sbitmap_a_or_b (may_aliases1, may_aliases1, may_aliases2); } else @@ -1133,11 +1134,12 @@ total_alias_vops_cmp (const void *p, const void *q) static void group_aliases_into (tree tag, sbitmap tag_aliases, struct alias_info *ai) { - size_t i; + unsigned int i; var_ann_t tag_ann = var_ann (tag); size_t num_tag_refs = VARRAY_UINT (ai->num_references, tag_ann->uid); + sbitmap_iterator sbi; - EXECUTE_IF_SET_IN_SBITMAP (tag_aliases, 0, i, + EXECUTE_IF_SET_IN_SBITMAP (tag_aliases, 0, i, sbi) { tree var = referenced_var (i); var_ann_t ann = var_ann (var); @@ -1157,7 +1159,7 @@ group_aliases_into (tree tag, sbitmap tag_aliases, struct alias_info *ai) itself won't be removed. We will merely replace them with references to TAG. */ ai->total_alias_vops -= num_tag_refs; - }); + } /* We have reduced the number of virtual operands that TAG makes on behalf of all the variables formerly aliased with it. However, diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c index 886a9eba0ab..8f7bf77cda0 100644 --- a/gcc/tree-ssa-live.c +++ b/gcc/tree-ssa-live.c @@ -185,7 +185,8 @@ void compact_var_map (var_map map, int flags) { sbitmap used; - int x, limit, count, tmp, root, root_i; + int tmp, root, root_i; + unsigned int x, limit, count; tree var; root_var_p rv = NULL; @@ -238,10 +239,12 @@ compact_var_map (var_map map, int flags) /* Build a compacted partitioning. */ if (count != limit) { + sbitmap_iterator sbi; + map->compact_to_partition = (int *)xmalloc (count * sizeof (int)); count = 0; /* SSA renaming begins at 1, so skip 0 when compacting. */ - EXECUTE_IF_SET_IN_SBITMAP (used, 1, x, + EXECUTE_IF_SET_IN_SBITMAP (used, 1, x, sbi) { map->partition_to_compact[x] = count; map->compact_to_partition[count] = x; @@ -249,7 +252,7 @@ compact_var_map (var_map map, int flags) if (TREE_CODE (var) != SSA_NAME) change_partition_var (map, var, count); count++; - }); + } } else { @@ -408,9 +411,11 @@ create_ssa_var_map (int flags) sbitmap_a_and_b (both, used_in_real_ops, used_in_virtual_ops); if (sbitmap_first_set_bit (both) >= 0) { - EXECUTE_IF_SET_IN_SBITMAP (both, 0, i, + sbitmap_iterator sbi; + + EXECUTE_IF_SET_IN_SBITMAP (both, 0, i, sbi) fprintf (stderr, "Variable %s used in real and virtual operands\n", - get_name (referenced_var (i)))); + get_name (referenced_var (i))); internal_error ("SSA corruption"); } |