diff options
-rw-r--r-- | gcc/ChangeLog | 57 | ||||
-rw-r--r-- | gcc/basic-block.h | 30 | ||||
-rw-r--r-- | gcc/bitmap.c | 11 | ||||
-rw-r--r-- | gcc/bitmap.h | 605 | ||||
-rw-r--r-- | gcc/bt-load.c | 70 | ||||
-rw-r--r-- | gcc/cfganal.c | 5 | ||||
-rw-r--r-- | gcc/cgraphunit.c | 70 | ||||
-rw-r--r-- | gcc/ddg.c | 9 | ||||
-rw-r--r-- | gcc/df.c | 23 | ||||
-rw-r--r-- | gcc/except.c | 8 | ||||
-rw-r--r-- | gcc/flow.c | 14 | ||||
-rw-r--r-- | gcc/gcse.c | 14 | ||||
-rw-r--r-- | gcc/global.c | 16 | ||||
-rw-r--r-- | gcc/ifcvt.c | 20 | ||||
-rw-r--r-- | gcc/loop-invariant.c | 16 | ||||
-rw-r--r-- | gcc/ra-build.c | 33 | ||||
-rw-r--r-- | gcc/ra-rewrite.c | 52 | ||||
-rw-r--r-- | gcc/tree-cfg.c | 17 | ||||
-rw-r--r-- | gcc/tree-into-ssa.c | 84 | ||||
-rw-r--r-- | gcc/tree-outof-ssa.c | 6 | ||||
-rw-r--r-- | gcc/tree-sra.c | 15 | ||||
-rw-r--r-- | gcc/tree-ssa-alias.c | 64 | ||||
-rw-r--r-- | gcc/tree-ssa-dce.c | 9 | ||||
-rw-r--r-- | gcc/tree-ssa-dse.c | 6 | ||||
-rw-r--r-- | gcc/tree-ssa-live.c | 26 | ||||
-rw-r--r-- | gcc/tree-ssa-loop-ivopts.c | 76 | ||||
-rw-r--r-- | gcc/tree-ssa-loop-manip.c | 12 | ||||
-rw-r--r-- | gcc/tree-ssa-operands.c | 20 | ||||
-rw-r--r-- | gcc/tree-ssa-pre.c | 32 |
29 files changed, 946 insertions, 474 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4268e38..5bde111 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,60 @@ +2004-09-26 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz> + + * bitmap.h (EXECUTE_IF_SET_IN_BITMAP, EXECUTE_IF_AND_COMPL_IN_BITMAP, + EXECUTE_IF_AND_IN_BITMAP): Changed to iterator style. + (bitmap_iterator): New type. + (bmp_iter_common_next_1, bmp_iter_single_next_1, bmp_iter_single_init, + bmp_iter_end_p, bmp_iter_single_next, bmp_iter_and_not_next_1, + bmp_iter_and_not_init, bmp_iter_and_not_next, bmp_iter_and_next_1, + bmp_iter_and_init, bmp_iter_and_next): New functions. + * basic-block.h (EXECUTE_IF_SET_IN_REG_SET, + EXECUTE_IF_AND_COMPL_IN_REG_SET, EXECUTE_IF_AND_IN_REG_SET): Changed to + use iterator-style EXECUTE_IF_IN_BITMAP macros. + * bitmap.c (bitmap_print): Ditto. + * bt-load.c (clear_btr_from_live_range, add_btr_to_live_range, + btr_def_live_range): Ditto. + * cfganal.c (compute_dominance_frontiers_1) Ditto. + * cgraphunit.c (convert_UIDs_in_bitmap, cgraph_characterize_statics): + Ditto. + * ddg.c (build_inter_loop_deps): Ditto. + * df.c (FOR_EACH_BB_IN_BITMAP, df_bb_reg_info_compute, df_refs_update): + Ditto. + * except.c (remove_eh_handler): Ditto. + * flow.c (reg_set_to_hard_reg_set): Ditto. + * gcse.c (clear_modify_mem_tables): Ditto. + * global.c (build_insn_chain): Ditto. + * ifcvt.c (dead_or_predicable): Ditto. + * loop-invariant.c (get_inv_cost, set_move_mark, move_invariant_reg): + Ditto. + * ra-build.c (livethrough_conflicts_bb, conflicts_between_webs): Ditto. + * ra-rewrite.c (reloads_to_loads, rewrite_program2, + detect_web_parts_to_rebuild, delete_useless_defs, actual_spill): Ditto. + * tree-cfg.c (allocate_ssa_names, tree_duplicate_sese_region, + tree_purge_all_dead_eh_edges): Ditto. + * tree-into-ssa.c (compute_global_livein, insert_phi_nodes, + insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags, + rewrite_ssa_into_ssa): Ditto. + * tree-outof-ssa.c (find_replaceable_exprs): Ditto. + * tree-sra.c (scan_function, decide_instantiations, scalarize_parms): + Ditto. + * tree-ssa-alias.c (init_alias_info, compute_points_to_and_addr_escape, + compute_flow_sensitive_aliasing, maybe_create_global_var, + dump_points_to_info_for): Ditto. + * tree-ssa-dce.c (EXECUTE_IF_CONTROL_DEPENDENT): Ditto. + * tree-ssa-dse.c (dse_finalize_block): Ditto. + * tree-ssa-live.c (live_worklist, calculate_live_on_entry, + calculate_live_on_exit, build_tree_conflict_graph, dump_live_info): + Ditto. + * tree-ssa-loop-ivopts.c (find_induction_variables, + find_interesting_uses, add_old_ivs_candidates, alloc_use_cost_map, + determine_use_iv_costs, determine_set_costs, find_best_candidate, + set_cost_up_to, create_new_ivs, remove_unused_ivs, free_loop_data): + Ditto. + * tree-ssa-loop-manip.c (add_exit_phis_var, add_exit_phis): Ditto. + * tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops, + add_call_read_ops): Ditto. + * tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Ditto. + 2004-09-26 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> * pa.c (print_operand): Use non-trapping completers for UNLE, UNLT, diff --git a/gcc/basic-block.h b/gcc/basic-block.h index 21fd7bb..978f313 100644 --- a/gcc/basic-block.h +++ b/gcc/basic-block.h @@ -84,19 +84,43 @@ do { \ /* Loop over all registers in REGSET, starting with MIN, setting REGNUM to the register number and executing CODE for all registers that are set. */ #define EXECUTE_IF_SET_IN_REG_SET(REGSET, MIN, REGNUM, CODE) \ - EXECUTE_IF_SET_IN_BITMAP (REGSET, MIN, REGNUM, CODE) + do \ + { \ + bitmap_iterator bi; \ + \ + EXECUTE_IF_SET_IN_BITMAP (REGSET, MIN, REGNUM, bi) \ + { \ + CODE; \ + } \ + } while (0) /* Loop over all registers in REGSET1 and REGSET2, starting with MIN, setting REGNUM to the register number and executing CODE for all registers that are set in the first regset and not set in the second. */ #define EXECUTE_IF_AND_COMPL_IN_REG_SET(REGSET1, REGSET2, MIN, REGNUM, CODE) \ - EXECUTE_IF_AND_COMPL_IN_BITMAP (REGSET1, REGSET2, MIN, REGNUM, CODE) + do \ + { \ + bitmap_iterator bi; \ + \ + EXECUTE_IF_AND_COMPL_IN_BITMAP (REGSET1, REGSET2, MIN, REGNUM, bi) \ + { \ + CODE; \ + } \ + } while (0) /* Loop over all registers in REGSET1 and REGSET2, starting with MIN, setting REGNUM to the register number and executing CODE for all registers that are set in both regsets. */ #define EXECUTE_IF_AND_IN_REG_SET(REGSET1, REGSET2, MIN, REGNUM, CODE) \ - EXECUTE_IF_AND_IN_BITMAP (REGSET1, REGSET2, MIN, REGNUM, CODE) + do \ + { \ + bitmap_iterator bi; \ + \ + EXECUTE_IF_AND_IN_BITMAP (REGSET1, REGSET2, MIN, REGNUM, bi) \ + { \ + CODE; \ + } \ + } while (0) /* Allocate a register set with oballoc. */ #define OBSTACK_ALLOC_REG_SET(OBSTACK) BITMAP_OBSTACK_ALLOC (OBSTACK) diff --git a/gcc/bitmap.c b/gcc/bitmap.c index fada172..b678df9 100644 --- a/gcc/bitmap.c +++ b/gcc/bitmap.c @@ -779,13 +779,14 @@ bitmap_print (FILE *file, bitmap head, const char *prefix, const char *suffix) { const char *comma = ""; int i; + bitmap_iterator bi; fputs (prefix, file); - EXECUTE_IF_SET_IN_BITMAP (head, 0, i, - { - fprintf (file, "%s%d", comma, i); - comma = ", "; - }); + EXECUTE_IF_SET_IN_BITMAP (head, 0, i, bi) + { + fprintf (file, "%s%d", comma, i); + comma = ", "; + } fputs (suffix, file); } diff --git a/gcc/bitmap.h b/gcc/bitmap.h index 4191542..76cd473 100644 --- a/gcc/bitmap.h +++ b/gcc/bitmap.h @@ -162,194 +162,425 @@ do { \ /* Do any one-time initializations needed for bitmaps. */ #define BITMAP_INIT_ONCE() -/* Loop over all bits in BITMAP, starting with MIN, setting BITNUM to the - bit number and executing CODE for all bits that are set. */ - -#define EXECUTE_IF_SET_IN_BITMAP(BITMAP, MIN, BITNUM, CODE) \ -do { \ - bitmap_element *ptr_ = (BITMAP)->first; \ - unsigned int indx_ = (MIN) / BITMAP_ELEMENT_ALL_BITS; \ - unsigned bit_num_ = (MIN) % BITMAP_WORD_BITS; \ - unsigned word_num_ = (MIN) / BITMAP_WORD_BITS % BITMAP_ELEMENT_WORDS; \ - \ - \ - /* Find the block the minimum bit is in. */ \ - while (ptr_ != 0 && ptr_->indx < indx_) \ - ptr_ = ptr_->next; \ - \ - if (ptr_ != 0 && ptr_->indx != indx_) \ - { \ - bit_num_ = 0; \ - word_num_ = 0; \ - } \ - \ - for (; ptr_ != 0; ptr_ = ptr_->next) \ - { \ - for (; word_num_ < BITMAP_ELEMENT_WORDS; word_num_++) \ - { \ - BITMAP_WORD word_ = ptr_->bits[word_num_]; \ - \ - if (word_ != 0) \ - { \ - for (; bit_num_ < BITMAP_WORD_BITS; bit_num_++) \ - { \ - BITMAP_WORD mask_ = ((BITMAP_WORD) 1) << bit_num_; \ - \ - if ((word_ & mask_) != 0) \ - { \ - word_ &= ~ mask_; \ - (BITNUM) = (ptr_->indx * BITMAP_ELEMENT_ALL_BITS \ - + word_num_ * BITMAP_WORD_BITS \ - + bit_num_); \ - CODE; \ - \ - if (word_ == 0) \ - break; \ - } \ - } \ - } \ - \ - bit_num_ = 0; \ - } \ - \ - word_num_ = 0; \ - } \ -} while (0) +/* Iterator for bitmaps. */ -/* Loop over all bits in BITMAP1 and BITMAP2, starting with MIN, setting - BITNUM to the bit number and executing CODE for all bits that are set in - the first bitmap and not set in the second. */ - -#define EXECUTE_IF_AND_COMPL_IN_BITMAP(BITMAP1, BITMAP2, MIN, BITNUM, CODE) \ -do { \ - bitmap_element *ptr1_ = (BITMAP1)->first; \ - bitmap_element *ptr2_ = (BITMAP2)->first; \ - unsigned int indx_ = (MIN) / BITMAP_ELEMENT_ALL_BITS; \ - unsigned bit_num_ = (MIN) % BITMAP_WORD_BITS; \ - unsigned word_num_ = (MIN) / BITMAP_WORD_BITS % BITMAP_ELEMENT_WORDS; \ - \ - /* Find the block the minimum bit is in in the first bitmap. */ \ - while (ptr1_ != 0 && ptr1_->indx < indx_) \ - ptr1_ = ptr1_->next; \ - \ - if (ptr1_ != 0 && ptr1_->indx != indx_) \ - { \ - bit_num_ = 0; \ - word_num_ = 0; \ - } \ - \ - for (; ptr1_ != 0 ; ptr1_ = ptr1_->next) \ - { \ - /* Advance BITMAP2 to the equivalent link, using an all \ - zero element if an equivalent link doesn't exist. */ \ - bitmap_element *tmp2_; \ - \ - while (ptr2_ != 0 && ptr2_->indx < ptr1_->indx) \ - ptr2_ = ptr2_->next; \ - \ - tmp2_ = ((ptr2_ != 0 && ptr2_->indx == ptr1_->indx) \ - ? ptr2_ : &bitmap_zero_bits); \ - \ - for (; word_num_ < BITMAP_ELEMENT_WORDS; word_num_++) \ - { \ - BITMAP_WORD word_ = (ptr1_->bits[word_num_] \ - & ~ tmp2_->bits[word_num_]); \ - if (word_ != 0) \ - { \ - for (; bit_num_ < BITMAP_WORD_BITS; bit_num_++) \ - { \ - BITMAP_WORD mask_ = ((BITMAP_WORD) 1) << bit_num_; \ - \ - if ((word_ & mask_) != 0) \ - { \ - word_ &= ~ mask_; \ - (BITNUM) = (ptr1_->indx * BITMAP_ELEMENT_ALL_BITS \ - + word_num_ * BITMAP_WORD_BITS \ - + bit_num_); \ - \ - CODE; \ - if (word_ == 0) \ - break; \ - } \ - } \ - } \ - \ - bit_num_ = 0; \ - } \ - \ - word_num_ = 0; \ - } \ -} while (0) +typedef struct +{ + /* Actual elements in the bitmaps. */ + bitmap_element *ptr1, *ptr2; -/* Loop over all bits in BITMAP1 and BITMAP2, starting with MIN, setting - BITNUM to the bit number and executing CODE for all bits that are set in - the both bitmaps. */ - -#define EXECUTE_IF_AND_IN_BITMAP(BITMAP1, BITMAP2, MIN, BITNUM, CODE) \ -do { \ - bitmap_element *ptr1_ = (BITMAP1)->first; \ - bitmap_element *ptr2_ = (BITMAP2)->first; \ - unsigned int indx_ = (MIN) / BITMAP_ELEMENT_ALL_BITS; \ - unsigned bit_num_ = (MIN) % BITMAP_WORD_BITS; \ - unsigned word_num_ = (MIN) / BITMAP_WORD_BITS % BITMAP_ELEMENT_WORDS; \ - \ - /* Find the block the minimum bit is in in the first bitmap. */ \ - while (ptr1_ != 0 && ptr1_->indx < indx_) \ - ptr1_ = ptr1_->next; \ - \ - if (ptr1_ != 0 && ptr1_->indx != indx_) \ - { \ - bit_num_ = 0; \ - word_num_ = 0; \ - } \ - \ - for (; ptr1_ != 0 ; ptr1_ = ptr1_->next) \ - { \ - /* Advance BITMAP2 to the equivalent link. */ \ - while (ptr2_ != 0 && ptr2_->indx < ptr1_->indx) \ - ptr2_ = ptr2_->next; \ - \ - if (ptr2_ == 0) \ - { \ - /* If there are no more elements in BITMAP2, exit loop now. */ \ - ptr1_ = (bitmap_element *)0; \ - break; \ - } \ - else if (ptr2_->indx > ptr1_->indx) \ - { \ - bit_num_ = word_num_ = 0; \ - continue; \ - } \ - \ - for (; word_num_ < BITMAP_ELEMENT_WORDS; word_num_++) \ - { \ - BITMAP_WORD word_ = (ptr1_->bits[word_num_] \ - & ptr2_->bits[word_num_]); \ - if (word_ != 0) \ - { \ - for (; bit_num_ < BITMAP_WORD_BITS; bit_num_++) \ - { \ - BITMAP_WORD mask_ = ((BITMAP_WORD) 1) << bit_num_; \ - \ - if ((word_ & mask_) != 0) \ - { \ - word_ &= ~ mask_; \ - (BITNUM) = (ptr1_->indx * BITMAP_ELEMENT_ALL_BITS \ - + word_num_ * BITMAP_WORD_BITS \ - + bit_num_); \ - \ - CODE; \ - if (word_ == 0) \ - break; \ - } \ - } \ - } \ - \ - bit_num_ = 0; \ - } \ - \ - word_num_ = 0; \ - } \ -} while (0) + /* Position of an actual word in the elements. */ + unsigned word; + + /* Position of a bit corresponding to the start of word. */ + unsigned word_bit; + + /* Position of the actual bit. */ + unsigned bit; + + /* Contents of the actually processed word. When finding next bit + it is shifted right, so that the actual bit is always the least + significant bit of ACTUAL. */ + BITMAP_WORD actual; +} bitmap_iterator; + +/* Moves the iterator BI to the first set bit on or after the current + position in bitmap and returns the bit if available. The bit is + found in ACTUAL field only. */ + +static inline unsigned +bmp_iter_common_next_1 (bitmap_iterator *bi) +{ + while (!(bi->actual & 1)) + { + bi->actual >>= 1; + bi->bit++; + } + + return bi->bit; +} + +/* Moves the iterator BI to the first set bit on or after the current + position in bitmap and returns the bit if available. */ + +static inline unsigned +bmp_iter_single_next_1 (bitmap_iterator *bi) +{ + if (bi->actual) + return bmp_iter_common_next_1 (bi); + + bi->word++; + bi->word_bit += BITMAP_WORD_BITS; + + while (1) + { + for (; + bi->word < BITMAP_ELEMENT_WORDS; + bi->word++, bi->word_bit += BITMAP_WORD_BITS) + { + bi->actual = bi->ptr1->bits[bi->word]; + if (bi->actual) + { + bi->bit = bi->word_bit; + return bmp_iter_common_next_1 (bi); + } + } + + bi->ptr1 = bi->ptr1->next; + if (!bi->ptr1) + return 0; + + bi->word = 0; + bi->word_bit = bi->ptr1->indx * BITMAP_ELEMENT_ALL_BITS; + } +} + +/* Initializes a bitmap iterator BI for looping over bits of bitmap + BMP, starting with bit MIN. Returns the first bit of BMP greater + or equal to MIN if there is any. */ + +static inline unsigned +bmp_iter_single_init (bitmap_iterator *bi, bitmap bmp, unsigned min) +{ + unsigned indx = min / BITMAP_ELEMENT_ALL_BITS; + + for (bi->ptr1 = bmp->first; + bi->ptr1 && bi->ptr1->indx < indx; + bi->ptr1 = bi->ptr1->next) + continue; + + if (!bi->ptr1) + { + /* To avoid warnings. */ + bi->word = 0; + bi->bit = 0; + bi->word_bit = 0; + bi->actual = 0; + bi->ptr2 = NULL; + return 0; + } + + if (bi->ptr1->indx == indx) + { + unsigned bit_in_elt = min - BITMAP_ELEMENT_ALL_BITS * indx; + unsigned word_in_elt = bit_in_elt / BITMAP_WORD_BITS; + unsigned bit_in_word = bit_in_elt % BITMAP_WORD_BITS; + + bi->word = word_in_elt; + bi->word_bit = min - bit_in_word; + bi->bit = min; + bi->actual = bi->ptr1->bits[word_in_elt] >> bit_in_elt; + } + else + { + bi->word = 0; + bi->bit = bi->ptr1->indx * BITMAP_ELEMENT_ALL_BITS; + bi->word_bit = bi->bit; + bi->actual = bi->ptr1->bits[0]; + } + + return bmp_iter_single_next_1 (bi); +} + +/* Returns true if all elements of the bitmap refered to by iterator BI + were processed. */ + +static inline bool +bmp_iter_end_p (bitmap_iterator bi) +{ + return bi.ptr1 == NULL; +} + +/* Moves the iterator BI to the next bit of bitmap and returns the bit + if available. */ + +static inline unsigned +bmp_iter_single_next (bitmap_iterator *bi) +{ + bi->bit++; + bi->actual >>= 1; + return bmp_iter_single_next_1 (bi); +} + +/* Loop over all bits in BITMAP, starting with MIN and setting BITNUM to + the bit number. ITER is a bitmap iterator. */ + +#define EXECUTE_IF_SET_IN_BITMAP(BITMAP, MIN, BITNUM, ITER) \ + for ((BITNUM) = bmp_iter_single_init (&(ITER), (BITMAP), (MIN)); \ + !bmp_iter_end_p (ITER); \ + (BITNUM) = bmp_iter_single_next (&(ITER))) + +/* Moves the iterator BI to the first set bit on or after the current + position in difference of bitmaps and returns the bit if available. */ + +static inline unsigned +bmp_iter_and_not_next_1 (bitmap_iterator *bi) +{ + if (bi->actual) + return bmp_iter_common_next_1 (bi); + + bi->word++; + bi->word_bit += BITMAP_WORD_BITS; + + while (1) + { + bitmap_element *snd; + + if (bi->ptr2 && bi->ptr2->indx == bi->ptr1->indx) + snd = bi->ptr2; + else + snd = &bitmap_zero_bits; + + for (; + bi->word < BITMAP_ELEMENT_WORDS; + bi->word++, bi->word_bit += BITMAP_WORD_BITS) + { + bi->actual = (bi->ptr1->bits[bi->word] + & ~snd->bits[bi->word]); + if (bi->actual) + { + bi->bit = bi->word_bit; + return bmp_iter_common_next_1 (bi); + } + } + + bi->ptr1 = bi->ptr1->next; + if (!bi->ptr1) + return 0; + + while (bi->ptr2 + && bi->ptr2->indx < bi->ptr1->indx) + bi->ptr2 = bi->ptr2->next; + + bi->word = 0; + bi->word_bit = bi->ptr1->indx * BITMAP_ELEMENT_ALL_BITS; + } +} + +/* Initializes a bitmap iterator BI for looping over bits of bitmap + BMP1 &~ BMP2, starting with bit MIN. Returns the first bit of + BMP1 &~ BMP2 greater or equal to MIN if there is any. */ + +static inline unsigned +bmp_iter_and_not_init (bitmap_iterator *bi, bitmap bmp1, bitmap bmp2, + unsigned min) +{ + unsigned indx = min / BITMAP_ELEMENT_ALL_BITS; + + for (bi->ptr1 = bmp1->first; + bi->ptr1 && bi->ptr1->indx < indx; + bi->ptr1 = bi->ptr1->next) + continue; + + if (!bi->ptr1) + { + /* To avoid warnings. */ + bi->word = 0; + bi->bit = 0; + bi->word_bit = 0; + bi->actual = 0; + bi->ptr2 = NULL; + return 0; + } + + for (bi->ptr2 = bmp2->first; + bi->ptr2 && bi->ptr2->indx < bi->ptr1->indx; + bi->ptr2 = bi->ptr2->next) + continue; + + if (bi->ptr1->indx == indx) + { + unsigned bit_in_elt = min - BITMAP_ELEMENT_ALL_BITS * indx; + unsigned word_in_elt = bit_in_elt / BITMAP_WORD_BITS; + unsigned bit_in_word = bit_in_elt % BITMAP_WORD_BITS; + + bi->word = word_in_elt; + bi->word_bit = min - bit_in_word; + bi->bit = min; + + if (bi->ptr2 && bi->ptr2->indx == indx) + bi->actual = (bi->ptr1->bits[word_in_elt] + & ~bi->ptr2->bits[word_in_elt]) >> bit_in_elt; + else + bi->actual = bi->ptr1->bits[word_in_elt] >> bit_in_elt; + } + else + { + bi->word = 0; + bi->bit = bi->ptr1->indx * BITMAP_ELEMENT_ALL_BITS; + bi->word_bit = bi->bit; + + if (bi->ptr2 && bi->ptr2->indx == bi->ptr1->indx) + bi->actual = (bi->ptr1->bits[0] & ~bi->ptr2->bits[0]); + else + bi->actual = bi->ptr1->bits[0]; + } + + return bmp_iter_and_not_next_1 (bi); +} + +/* Moves the iterator BI to the next bit of difference of bitmaps and returns + the bit if available. */ + +static inline unsigned +bmp_iter_and_not_next (bitmap_iterator *bi) +{ + bi->bit++; + bi->actual >>= 1; + return bmp_iter_and_not_next_1 (bi); +} + +/* Loop over all bits in BMP1 and BMP2, starting with MIN, setting + BITNUM to the bit number for all bits that are set in the first bitmap + and not set in the second. ITER is a bitmap iterator. */ + +#define EXECUTE_IF_AND_COMPL_IN_BITMAP(BMP1, BMP2, MIN, BITNUM, ITER) \ + for ((BITNUM) = bmp_iter_and_not_init (&(ITER), (BMP1), (BMP2), (MIN)); \ + !bmp_iter_end_p (ITER); \ + (BITNUM) = bmp_iter_and_not_next (&(ITER))) + +/* Moves the iterator BI to the first set bit on or after the current + position in intersection of bitmaps and returns the bit if available. */ + +static inline unsigned +bmp_iter_and_next_1 (bitmap_iterator *bi) +{ + if (bi->actual) + return bmp_iter_common_next_1 (bi); + + bi->word++; + bi->word_bit += BITMAP_WORD_BITS; + + while (1) + { + for (; + bi->word < BITMAP_ELEMENT_WORDS; + bi->word++, bi->word_bit += BITMAP_WORD_BITS) + { + bi->actual = (bi->ptr1->bits[bi->word] + & bi->ptr2->bits[bi->word]); + if (bi->actual) + { + bi->bit = bi->word_bit; + return bmp_iter_common_next_1 (bi); + } + } + + do + { + bi->ptr1 = bi->ptr1->next; + if (!bi->ptr1) + return 0; + + while (bi->ptr2->indx < bi->ptr1->indx) + { + bi->ptr2 = bi->ptr2->next; + if (!bi->ptr2) + { + bi->ptr1 = NULL; + return 0; + } + } + } + while (bi->ptr1->indx != bi->ptr2->indx); + + bi->word = 0; + bi->word_bit = bi->ptr1->indx * BITMAP_ELEMENT_ALL_BITS; + } +} + +/* Initializes a bitmap iterator BI for looping over bits of bitmap + BMP1 & BMP2, starting with bit MIN. Returns the first bit of + BMP1 & BMP2 greater or equal to MIN if there is any. */ + +static inline unsigned +bmp_iter_and_init (bitmap_iterator *bi, bitmap bmp1, bitmap bmp2, + unsigned min) +{ + unsigned indx = min / BITMAP_ELEMENT_ALL_BITS; + + for (bi->ptr1 = bmp1->first; + bi->ptr1 && bi->ptr1->indx < indx; + bi->ptr1 = bi->ptr1->next) + continue; + + if (!bi->ptr1) + goto empty; + + bi->ptr2 = bmp2->first; + if (!bi->ptr2) + goto empty; + + while (1) + { + while (bi->ptr2->indx < bi->ptr1->indx) + { + bi->ptr2 = bi->ptr2->next; + if (!bi->ptr2) + goto empty; + } + + if (bi->ptr1->indx == bi->ptr2->indx) + break; + + bi->ptr1 = bi->ptr1->next; + if (!bi->ptr1) + goto empty; + } + + if (bi->ptr1->indx == indx) + { + unsigned bit_in_elt = min - BITMAP_ELEMENT_ALL_BITS * indx; + unsigned word_in_elt = bit_in_elt / BITMAP_WORD_BITS; + unsigned bit_in_word = bit_in_elt % BITMAP_WORD_BITS; + + bi->word = word_in_elt; + bi->word_bit = min - bit_in_word; + bi->bit = min; + + bi->actual = (bi->ptr1->bits[word_in_elt] + & bi->ptr2->bits[word_in_elt]) >> bit_in_elt; + } + else + { + bi->word = 0; + bi->bit = bi->ptr1->indx * BITMAP_ELEMENT_ALL_BITS; + bi->word_bit = bi->bit; + + bi->actual = (bi->ptr1->bits[0] & bi->ptr2->bits[0]); + } + + return bmp_iter_and_next_1 (bi); + +empty: + /* To avoid warnings. */ + bi->word = 0; + bi->bit = 0; + bi->word_bit = 0; + bi->actual = 0; + bi->ptr1 = NULL; + bi->ptr2 = NULL; + return 0; +} + +/* Moves the iterator BI to the next bit of intersection of bitmaps and returns + the bit if available. */ + +static inline unsigned +bmp_iter_and_next (bitmap_iterator *bi) +{ + bi->bit++; + bi->actual >>= 1; + return bmp_iter_and_next_1 (bi); +} + +/* Loop over all bits in BMP1 and BMP2, starting with MIN, setting + BITNUM to the bit number for all bits that are set in both bitmaps. + ITER is a bitmap iterator. */ + +#define EXECUTE_IF_AND_IN_BITMAP(BMP1, BMP2, MIN, BITNUM, ITER) \ + for ((BITNUM) = bmp_iter_and_init (&(ITER), (BMP1), (BMP2), (MIN)); \ + !bmp_iter_end_p (ITER); \ + (BITNUM) = bmp_iter_and_next (&(ITER))) #endif /* GCC_BITMAP_H */ diff --git a/gcc/bt-load.c b/gcc/bt-load.c index bbd6abd..ef4cf92 100644 --- a/gcc/bt-load.c +++ b/gcc/bt-load.c @@ -822,20 +822,20 @@ static void clear_btr_from_live_range (btr_def def) { int bb; + bitmap_iterator bi; - EXECUTE_IF_SET_IN_BITMAP - (def->live_range, 0, bb, - { - if ((!def->other_btr_uses_before_def - && !def->other_btr_uses_after_use) - || !block_at_edge_of_live_range_p (bb, def)) - { - CLEAR_HARD_REG_BIT (btrs_live[bb], def->btr); - CLEAR_HARD_REG_BIT (btrs_live_at_end[bb], def->btr); - if (dump_file) - dump_btrs_live (bb); - } - }); + EXECUTE_IF_SET_IN_BITMAP (def->live_range, 0, bb, bi) + { + if ((!def->other_btr_uses_before_def + && !def->other_btr_uses_after_use) + || !block_at_edge_of_live_range_p (bb, def)) + { + CLEAR_HARD_REG_BIT (btrs_live[bb], def->btr); + CLEAR_HARD_REG_BIT (btrs_live_at_end[bb], def->btr); + if (dump_file) + dump_btrs_live (bb); + } + } } @@ -846,14 +846,15 @@ static void add_btr_to_live_range (btr_def def) { int bb; - EXECUTE_IF_SET_IN_BITMAP - (def->live_range, 0, bb, - { - SET_HARD_REG_BIT (btrs_live[bb], def->btr); - SET_HARD_REG_BIT (btrs_live_at_end[bb], def->btr); - if (dump_file) - dump_btrs_live (bb); - }); + bitmap_iterator bi; + + EXECUTE_IF_SET_IN_BITMAP (def->live_range, 0, bb, bi) + { + SET_HARD_REG_BIT (btrs_live[bb], def->btr); + SET_HARD_REG_BIT (btrs_live_at_end[bb], def->btr); + if (dump_file) + dump_btrs_live (bb); + } } /* Update a live range to contain the basic block NEW_BLOCK, and all @@ -990,22 +991,25 @@ btr_def_live_range (btr_def def, HARD_REG_SET *btrs_live_in_range) */ int bb; int def_bb = def->bb->index; + bitmap_iterator bi; CLEAR_HARD_REG_SET (*btrs_live_in_range); if (flag_btr_bb_exclusive) - EXECUTE_IF_SET_IN_BITMAP - (def->live_range, 0, bb, - { - IOR_HARD_REG_SET (*btrs_live_in_range, btrs_live[bb]); - }); + { + EXECUTE_IF_SET_IN_BITMAP (def->live_range, 0, bb, bi) + { + IOR_HARD_REG_SET (*btrs_live_in_range, btrs_live[bb]); + } + } else - EXECUTE_IF_SET_IN_BITMAP - (def->live_range, 0, bb, - { - IOR_HARD_REG_SET (*btrs_live_in_range, - (def_bb == bb - ? btrs_live_at_end : btrs_live) [bb]); - }); + { + EXECUTE_IF_SET_IN_BITMAP (def->live_range, 0, bb, bi) + { + IOR_HARD_REG_SET (*btrs_live_in_range, + (def_bb == bb + ? btrs_live_at_end : btrs_live) [bb]); + } + } } if (!def->other_btr_uses_before_def && !def->other_btr_uses_after_use) diff --git a/gcc/cfganal.c b/gcc/cfganal.c index cec33ec..01f5f7d 100644 --- a/gcc/cfganal.c +++ b/gcc/cfganal.c @@ -1086,12 +1086,13 @@ compute_dominance_frontiers_1 (bitmap *frontiers, basic_block bb, sbitmap done) c = next_dom_son (CDI_DOMINATORS, c)) { int x; + bitmap_iterator bi; - EXECUTE_IF_SET_IN_BITMAP (frontiers[c->index], 0, x, + EXECUTE_IF_SET_IN_BITMAP (frontiers[c->index], 0, x, bi) { if (get_immediate_dominator (CDI_DOMINATORS, BASIC_BLOCK (x)) != bb) bitmap_set_bit (frontiers[bb->index], x); - }); + } } } diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index 7da6854..a5c42b4 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -352,18 +352,20 @@ static void convert_UIDs_in_bitmap (bitmap in_ann, bitmap in_decl) { int index; - EXECUTE_IF_SET_IN_BITMAP(in_decl, 0, index, - { - splay_tree_node n = - splay_tree_lookup (static_vars_to_consider_by_uid, index); - if (n != NULL) - { - tree t = (tree)n->value; - var_ann_t va = var_ann (t); - if (va) - bitmap_set_bit(in_ann, va->uid); - } - }); + bitmap_iterator bi; + + EXECUTE_IF_SET_IN_BITMAP(in_decl, 0, index, bi) + { + splay_tree_node n = + splay_tree_lookup (static_vars_to_consider_by_uid, index); + if (n != NULL) + { + tree t = (tree)n->value; + var_ann_t va = var_ann (t); + if (va) + bitmap_set_bit(in_ann, va->uid); + } + } } /* FIXME -- PROFILE-RESTRUCTURE: Delete all stmts initing *_decl_uid @@ -2456,8 +2458,12 @@ cgraph_characterize_statics (void) (i.e. have there address taken). */ { int index; - EXECUTE_IF_SET_IN_BITMAP (module_statics_escape, - 0, index, clear_static_vars_maps (index)); + bitmap_iterator bi; + + EXECUTE_IF_SET_IN_BITMAP (module_statics_escape, 0, index, bi) + { + clear_static_vars_maps (index); + } bitmap_operation (all_module_statics, all_module_statics, module_statics_escape, BITMAP_AND_COMPL); @@ -2484,6 +2490,8 @@ cgraph_characterize_statics (void) { int index; local_static_vars_info_t l; + bitmap_iterator bi; + node = order[i]; l = node->static_vars_info->local; fprintf (cgraph_dump_file, @@ -2491,14 +2499,18 @@ cgraph_characterize_statics (void) cgraph_node_name (node), node->uid); fprintf (cgraph_dump_file, "\n locals read: "); EXECUTE_IF_SET_IN_BITMAP (l->statics_read_by_decl_uid, - 0, index, - fprintf (cgraph_dump_file, "%s ", - cgraph_get_static_name_by_uid (index))); + 0, index, bi) + { + fprintf (cgraph_dump_file, "%s ", + cgraph_get_static_name_by_uid (index)); + } fprintf (cgraph_dump_file, "\n locals written: "); EXECUTE_IF_SET_IN_BITMAP (l->statics_written_by_decl_uid, - 0, index, - fprintf(cgraph_dump_file, "%s ", - cgraph_get_static_name_by_uid (index))); + 0, index, bi) + { + fprintf(cgraph_dump_file, "%s ", + cgraph_get_static_name_by_uid (index)); + } } } @@ -2597,6 +2609,8 @@ cgraph_characterize_statics (void) static_vars_info_t node_info; global_static_vars_info_t node_g; int index; + bitmap_iterator bi; + node = order[i]; node_info = node->static_vars_info; node_g = node_info->global; @@ -2612,14 +2626,18 @@ cgraph_characterize_statics (void) } fprintf (cgraph_dump_file, "\n globals read: "); EXECUTE_IF_SET_IN_BITMAP (node_g->statics_read_by_decl_uid, - 0, index, - fprintf (cgraph_dump_file, "%s ", - cgraph_get_static_name_by_uid (index))); + 0, index, bi) + { + fprintf (cgraph_dump_file, "%s ", + cgraph_get_static_name_by_uid (index)); + } fprintf (cgraph_dump_file, "\n globals written: "); EXECUTE_IF_SET_IN_BITMAP (node_g->statics_written_by_decl_uid, - 0, index, - fprintf (cgraph_dump_file, "%s ", - cgraph_get_static_name_by_uid (index))); + 0, index, bi) + { + fprintf (cgraph_dump_file, "%s ", + cgraph_get_static_name_by_uid (index)); + } } } @@ -313,28 +313,29 @@ build_inter_loop_deps (ddg_ptr g, struct df *df) { int rd_num, u_num; struct bb_info *bb_info; + bitmap_iterator bi; bb_info = DF_BB_INFO (df, g->bb); /* Find inter-loop output and true deps by connecting downward exposed defs to the first def of the BB and to upwards exposed uses. */ - EXECUTE_IF_SET_IN_BITMAP (bb_info->rd_gen, 0, rd_num, + EXECUTE_IF_SET_IN_BITMAP (bb_info->rd_gen, 0, rd_num, bi) { struct ref *rd = df->defs[rd_num]; add_deps_for_def (g, df, rd); - }); + } /* Find inter-loop anti deps. We are interested in uses of the block that appear below all defs; this implies that these uses are killed. */ - EXECUTE_IF_SET_IN_BITMAP (bb_info->ru_kill, 0, u_num, + EXECUTE_IF_SET_IN_BITMAP (bb_info->ru_kill, 0, u_num, bi) { struct ref *use = df->uses[u_num]; /* We are interested in uses of this BB. */ if (BLOCK_FOR_INSN (use->insn) == g->bb) add_deps_for_use (g, df,use); - }); + } } /* Given two nodes, analyze their RTL insns and add inter-loop mem deps @@ -192,8 +192,12 @@ and again mark them read/write. do \ { \ unsigned int node_; \ - EXECUTE_IF_SET_IN_BITMAP (BITMAP, MIN, node_, \ - {(BB) = BASIC_BLOCK (node_); CODE;}); \ + bitmap_iterator bi; \ + EXECUTE_IF_SET_IN_BITMAP (BITMAP, MIN, node_, bi) \ + { \ + (BB) = BASIC_BLOCK (node_); \ + CODE; \ + } \ } \ while (0) @@ -1829,6 +1833,7 @@ df_bb_reg_info_compute (struct df *df, basic_block bb, bitmap live) unsigned int uid = INSN_UID (insn); unsigned int regno; struct df_link *link; + bitmap_iterator bi; if (! INSN_P (insn)) continue; @@ -1854,10 +1859,10 @@ df_bb_reg_info_compute (struct df *df, basic_block bb, bitmap live) } /* Increment lifetimes of all live registers. */ - EXECUTE_IF_SET_IN_BITMAP (live, 0, regno, - { - reg_info[regno].lifetime++; - }); + EXECUTE_IF_SET_IN_BITMAP (live, 0, regno, bi) + { + reg_info[regno].lifetime++; + } } } @@ -2251,10 +2256,12 @@ df_refs_update (struct df *df, bitmap blocks) } else { - EXECUTE_IF_AND_IN_BITMAP (df->bbs_modified, blocks, 0, bbno, + bitmap_iterator bi; + + EXECUTE_IF_AND_IN_BITMAP (df->bbs_modified, blocks, 0, bbno, bi) { count += df_bb_refs_update (df, BASIC_BLOCK (bbno)); - }); + } } df_refs_process (df); diff --git a/gcc/except.c b/gcc/except.c index 259a3c7..6b3a1e2 100644 --- a/gcc/except.c +++ b/gcc/except.c @@ -2274,8 +2274,12 @@ remove_eh_handler (struct eh_region *region) if (region->aka) { int i; - EXECUTE_IF_SET_IN_BITMAP (region->aka, 0, i, - { cfun->eh->region_array[i] = outer; }); + bitmap_iterator bi; + + EXECUTE_IF_SET_IN_BITMAP (region->aka, 0, i, bi) + { + cfun->eh->region_array[i] = outer; + } } if (outer) @@ -4320,12 +4320,12 @@ void reg_set_to_hard_reg_set (HARD_REG_SET *to, bitmap from) { int i; + bitmap_iterator bi; - EXECUTE_IF_SET_IN_BITMAP - (from, 0, i, - { - if (i >= FIRST_PSEUDO_REGISTER) - return; - SET_HARD_REG_BIT (*to, i); - }); + EXECUTE_IF_SET_IN_BITMAP (from, 0, i, bi) + { + if (i >= FIRST_PSEUDO_REGISTER) + return; + SET_HARD_REG_BIT (*to, i); + } } @@ -2272,14 +2272,18 @@ static void clear_modify_mem_tables (void) { int i; + bitmap_iterator bi; - EXECUTE_IF_SET_IN_BITMAP - (modify_mem_list_set, 0, i, free_INSN_LIST_list (modify_mem_list + i)); + EXECUTE_IF_SET_IN_BITMAP (modify_mem_list_set, 0, i, bi) + { + free_INSN_LIST_list (modify_mem_list + i); + } bitmap_clear (modify_mem_list_set); - EXECUTE_IF_SET_IN_BITMAP - (canon_modify_mem_list_set, 0, i, - free_insn_expr_list_list (canon_modify_mem_list + i)); + EXECUTE_IF_SET_IN_BITMAP (canon_modify_mem_list_set, 0, i, bi) + { + free_insn_expr_list_list (canon_modify_mem_list + i); + } bitmap_clear (canon_modify_mem_list_set); } diff --git a/gcc/global.c b/gcc/global.c index 223a468..4398e30 100644 --- a/gcc/global.c +++ b/gcc/global.c @@ -1816,17 +1816,17 @@ build_insn_chain (rtx first) if (first == BB_HEAD (b)) { int i; + bitmap_iterator bi; CLEAR_REG_SET (live_relevant_regs); - EXECUTE_IF_SET_IN_BITMAP - (b->global_live_at_start, 0, i, - { - if (i < FIRST_PSEUDO_REGISTER - ? ! TEST_HARD_REG_BIT (eliminable_regset, i) - : reg_renumber[i] >= 0) - SET_REGNO_REG_SET (live_relevant_regs, i); - }); + EXECUTE_IF_SET_IN_BITMAP (b->global_live_at_start, 0, i, bi) + { + if (i < FIRST_PSEUDO_REGISTER + ? ! TEST_HARD_REG_BIT (eliminable_regset, i) + : reg_renumber[i] >= 0) + SET_REGNO_REG_SET (live_relevant_regs, i); + } } if (!NOTE_P (first) && !BARRIER_P (first)) diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c index 5963158..c7c0531 100644 --- a/gcc/ifcvt.c +++ b/gcc/ifcvt.c @@ -3140,6 +3140,7 @@ dead_or_predicable (basic_block test_bb, basic_block merge_bb, regset merge_set, tmp, test_live, test_set; struct propagate_block_info *pbi; int i, fail = 0; + bitmap_iterator bi; /* Check for no calls or trapping operations. */ for (insn = head; ; insn = NEXT_INSN (insn)) @@ -3191,14 +3192,13 @@ dead_or_predicable (basic_block test_bb, basic_block merge_bb, hard registers before reload. */ if (SMALL_REGISTER_CLASSES && ! reload_completed) { - EXECUTE_IF_SET_IN_BITMAP - (merge_set, 0, i, - { - if (i < FIRST_PSEUDO_REGISTER - && ! fixed_regs[i] - && ! global_regs[i]) + EXECUTE_IF_SET_IN_BITMAP (merge_set, 0, i, bi) + { + if (i < FIRST_PSEUDO_REGISTER + && ! fixed_regs[i] + && ! global_regs[i]) fail = 1; - }); + } } /* For TEST, we're interested in a range of insns, not a whole block. @@ -3225,11 +3225,13 @@ dead_or_predicable (basic_block test_bb, basic_block merge_bb, bitmap_operation (tmp, test_set, test_live, BITMAP_IOR); bitmap_operation (tmp, tmp, merge_set, BITMAP_AND); - EXECUTE_IF_SET_IN_BITMAP(tmp, 0, i, fail = 1); + if (bitmap_first_set_bit (tmp) >= 0) + fail = 1; bitmap_operation (tmp, test_set, merge_bb->global_live_at_start, BITMAP_AND); - EXECUTE_IF_SET_IN_BITMAP(tmp, 0, i, fail = 1); + if (bitmap_first_set_bit (tmp) >= 0) + fail = 1; FREE_REG_SET (tmp); FREE_REG_SET (merge_set); diff --git a/gcc/loop-invariant.c b/gcc/loop-invariant.c index 36d5118..e0824e0 100644 --- a/gcc/loop-invariant.c +++ b/gcc/loop-invariant.c @@ -599,6 +599,7 @@ get_inv_cost (struct invariant *inv, int *comp_cost, unsigned *regs_needed) unsigned aregs_needed; unsigned depno; struct invariant *dep; + bitmap_iterator bi; *comp_cost = 0; *regs_needed = 0; @@ -610,7 +611,7 @@ get_inv_cost (struct invariant *inv, int *comp_cost, unsigned *regs_needed) (*regs_needed)++; (*comp_cost) += inv->cost; - EXECUTE_IF_SET_IN_BITMAP (inv->depends_on, 0, depno, + EXECUTE_IF_SET_IN_BITMAP (inv->depends_on, 0, depno, bi) { dep = VARRAY_GENERIC_PTR_NOGC (invariants, depno); @@ -631,7 +632,7 @@ get_inv_cost (struct invariant *inv, int *comp_cost, unsigned *regs_needed) (*regs_needed) += aregs_needed; (*comp_cost) += acomp_cost; - }); + } } /* Calculates gain for eliminating invariant INV. REGS_USED is the number @@ -696,6 +697,7 @@ static void set_move_mark (unsigned invno) { struct invariant *inv = VARRAY_GENERIC_PTR_NOGC (invariants, invno); + bitmap_iterator bi; if (inv->move) return; @@ -704,7 +706,10 @@ set_move_mark (unsigned invno) if (dump_file) fprintf (dump_file, "Decided to move invariant %d\n", invno); - EXECUTE_IF_SET_IN_BITMAP (inv->depends_on, 0, invno, set_move_mark (invno)); + EXECUTE_IF_SET_IN_BITMAP (inv->depends_on, 0, invno, bi) + { + set_move_mark (invno); + } } /* Determines which invariants to move. DF is the dataflow object. */ @@ -761,6 +766,7 @@ move_invariant_reg (struct loop *loop, unsigned invno, struct df *df) basic_block preheader = loop_preheader_edge (loop)->src; rtx reg, set; struct use *use; + bitmap_iterator bi; if (inv->processed) return; @@ -768,10 +774,10 @@ move_invariant_reg (struct loop *loop, unsigned invno, struct df *df) if (inv->depends_on) { - EXECUTE_IF_SET_IN_BITMAP (inv->depends_on, 0, i, + EXECUTE_IF_SET_IN_BITMAP (inv->depends_on, 0, i, bi) { move_invariant_reg (loop, i, df); - }); + } } /* Move the set out of the loop. If the set is always executed (we could diff --git a/gcc/ra-build.c b/gcc/ra-build.c index 130b376..69f6aaa 100644 --- a/gcc/ra-build.c +++ b/gcc/ra-build.c @@ -1056,17 +1056,21 @@ livethrough_conflicts_bb (basic_block bb) if (deaths > 0 || contains_call || bitmap_first_set_bit (all_defs) >= 0) - EXECUTE_IF_SET_IN_BITMAP (info->live_throughout, first, use_id, - { - struct web_part *wp = &web_parts[df->def_id + use_id]; - unsigned int bl = rtx_to_bits (DF_REF_REG (wp->ref)); - bitmap conflicts; - wp = find_web_part (wp); - wp->spanned_deaths += deaths; - wp->crosses_call |= contains_call; - conflicts = get_sub_conflicts (wp, bl); - bitmap_operation (conflicts, conflicts, all_defs, BITMAP_IOR); - }); + { + bitmap_iterator bi; + + EXECUTE_IF_SET_IN_BITMAP (info->live_throughout, first, use_id, bi) + { + struct web_part *wp = &web_parts[df->def_id + use_id]; + unsigned int bl = rtx_to_bits (DF_REF_REG (wp->ref)); + bitmap conflicts; + wp = find_web_part (wp); + wp->spanned_deaths += deaths; + wp->crosses_call |= contains_call; + conflicts = get_sub_conflicts (wp, bl); + bitmap_operation (conflicts, conflicts, all_defs, BITMAP_IOR); + } + } BITMAP_XFREE (all_defs); } @@ -2191,6 +2195,8 @@ conflicts_between_webs (struct df *df) { int j; struct web *web1 = find_subweb_2 (supweb1, cl->size_word); + bitmap_iterator bi; + if (have_ignored) bitmap_operation (cl->conflicts, cl->conflicts, ignore_defs, BITMAP_AND_COMPL); @@ -2205,8 +2211,7 @@ conflicts_between_webs (struct df *df) pass++; /* Note, that there are only defs in the conflicts bitset. */ - EXECUTE_IF_SET_IN_BITMAP ( - cl->conflicts, 0, j, + EXECUTE_IF_SET_IN_BITMAP (cl->conflicts, 0, j, bi) { struct web *web2 = def2web[j]; unsigned int id2 = web2->id; @@ -2215,7 +2220,7 @@ conflicts_between_webs (struct df *df) pass_cache[id2] = pass; record_conflict (web1, web2); } - }); + } } } diff --git a/gcc/ra-rewrite.c b/gcc/ra-rewrite.c index adc3983..23c26ba 100644 --- a/gcc/ra-rewrite.c +++ b/gcc/ra-rewrite.c @@ -1013,8 +1013,10 @@ reloads_to_loads (struct rewrite_info *ri, struct ref **refs, if (is_death) { int old_num_r = num_reloads; + bitmap_iterator bi; + bitmap_clear (ri->scratch); - EXECUTE_IF_SET_IN_BITMAP (ri->need_reload, 0, j, + EXECUTE_IF_SET_IN_BITMAP (ri->need_reload, 0, j, bi) { struct web *web2 = ID2WEB (j); struct web *aweb2 = alias (find_web_for_subweb (web2)); @@ -1030,7 +1032,7 @@ reloads_to_loads (struct rewrite_info *ri, struct ref **refs, bitmap_set_bit (ri->scratch, j); num_reloads--; } - }); + } if (num_reloads != old_num_r) bitmap_operation (ri->need_reload, ri->need_reload, ri->scratch, BITMAP_AND_COMPL); @@ -1062,6 +1064,8 @@ rewrite_program2 (bitmap new_deaths) basic_block last_bb = NULL; rtx last_block_insn; int i, j; + bitmap_iterator bi; + if (!INSN_P (insn)) insn = prev_real_insn (insn); while (insn && !(bb = BLOCK_FOR_INSN (insn))) @@ -1073,7 +1077,7 @@ rewrite_program2 (bitmap new_deaths) sbitmap_zero (ri.live); CLEAR_HARD_REG_SET (ri.colors_in_use); - EXECUTE_IF_SET_IN_BITMAP (live_at_end[i - 2], 0, j, + EXECUTE_IF_SET_IN_BITMAP (live_at_end[i - 2], 0, j, bi) { struct web *web = use2web[j]; struct web *aweb = alias (find_web_for_subweb (web)); @@ -1090,7 +1094,7 @@ rewrite_program2 (bitmap new_deaths) if (aweb->type != SPILLED) update_spill_colors (&(ri.colors_in_use), web, 1); } - }); + } bitmap_clear (ri.need_reload); ri.num_reloads = 0; @@ -1130,7 +1134,9 @@ rewrite_program2 (bitmap new_deaths) if (INSN_P (insn) && BLOCK_FOR_INSN (insn) != last_bb) { int index = BLOCK_FOR_INSN (insn)->index + 2; - EXECUTE_IF_SET_IN_BITMAP (live_at_end[index - 2], 0, j, + bitmap_iterator bi; + + EXECUTE_IF_SET_IN_BITMAP (live_at_end[index - 2], 0, j, bi) { struct web *web = use2web[j]; struct web *aweb = alias (find_web_for_subweb (web)); @@ -1139,9 +1145,9 @@ rewrite_program2 (bitmap new_deaths) SET_BIT (ri.live, web->id); update_spill_colors (&(ri.colors_in_use), web, 1); } - }); + } bitmap_clear (ri.scratch); - EXECUTE_IF_SET_IN_BITMAP (ri.need_reload, 0, j, + EXECUTE_IF_SET_IN_BITMAP (ri.need_reload, 0, j, bi) { struct web *web2 = ID2WEB (j); struct web *supweb2 = find_web_for_subweb (web2); @@ -1156,7 +1162,7 @@ rewrite_program2 (bitmap new_deaths) bitmap_set_bit (ri.scratch, j); ri.num_reloads--; } - }); + } bitmap_operation (ri.need_reload, ri.need_reload, ri.scratch, BITMAP_AND_COMPL); last_bb = BLOCK_FOR_INSN (insn); @@ -1344,26 +1350,28 @@ rewrite_program2 (bitmap new_deaths) int in_ir = 0; edge e; int num = 0; + bitmap_iterator bi; + HARD_REG_SET cum_colors, colors; CLEAR_HARD_REG_SET (cum_colors); for (e = bb->pred; e && num < 5; e = e->pred_next, num++) { int j; CLEAR_HARD_REG_SET (colors); - EXECUTE_IF_SET_IN_BITMAP (live_at_end[e->src->index], 0, j, + EXECUTE_IF_SET_IN_BITMAP (live_at_end[e->src->index], 0, j, bi) { struct web *web = use2web[j]; struct web *aweb = alias (find_web_for_subweb (web)); if (aweb->type != SPILLED) update_spill_colors (&colors, web, 1); - }); + } IOR_HARD_REG_SET (cum_colors, colors); } if (num == 5) in_ir = 1; bitmap_clear (ri.scratch); - EXECUTE_IF_SET_IN_BITMAP (ri.need_reload, 0, j, + EXECUTE_IF_SET_IN_BITMAP (ri.need_reload, 0, j, bi) { struct web *web2 = ID2WEB (j); struct web *supweb2 = find_web_for_subweb (web2); @@ -1384,7 +1392,7 @@ rewrite_program2 (bitmap new_deaths) bitmap_set_bit (ri.scratch, j); ri.num_reloads--; } - }); + } bitmap_operation (ri.need_reload, ri.need_reload, ri.scratch, BITMAP_AND_COMPL); } @@ -1458,6 +1466,8 @@ detect_web_parts_to_rebuild (void) struct web *web = DLIST_WEB (d); struct conflict_link *wl; unsigned int j; + bitmap_iterator bi; + /* This check is only needed for coalesced nodes, but hey. */ if (alias (web)->type != SPILLED) continue; @@ -1494,14 +1504,14 @@ detect_web_parts_to_rebuild (void) SET_BIT (already_webs, wl->t->id); mark_refs_for_checking (wl->t, uses_as_bitmap); } - EXECUTE_IF_SET_IN_BITMAP (web->useless_conflicts, 0, j, + EXECUTE_IF_SET_IN_BITMAP (web->useless_conflicts, 0, j, bi) { struct web *web2 = ID2WEB (j); if (TEST_BIT (already_webs, web2->id)) continue; SET_BIT (already_webs, web2->id); mark_refs_for_checking (web2, uses_as_bitmap); - }); + } } /* We also recheck unconditionally all uses of any hardregs. This means @@ -1550,10 +1560,12 @@ static void delete_useless_defs (void) { unsigned int i; + bitmap_iterator bi; + /* If the insn only sets the def without any sideeffect (besides clobbers or uses), we can delete it. single_set() also tests for INSN_P(insn). */ - EXECUTE_IF_SET_IN_BITMAP (useless_defs, 0, i, + EXECUTE_IF_SET_IN_BITMAP (useless_defs, 0, i, bi) { rtx insn = DF_REF_INSN (df->defs[i]); rtx set = single_set (insn); @@ -1566,7 +1578,7 @@ delete_useless_defs (void) NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED; df_insn_modify (df, BLOCK_FOR_INSN (insn), insn); } - }); + } } /* Look for spilled webs, on whose behalf no insns were emitted. @@ -1617,7 +1629,9 @@ void actual_spill (void) { int i; + bitmap_iterator bi; bitmap new_deaths = BITMAP_XMALLOC (); + reset_changed_flag (); spill_coalprop (); choose_spill_colors (); @@ -1633,8 +1647,10 @@ actual_spill (void) insns_with_deaths = sbitmap_alloc (get_max_uid ()); death_insns_max_uid = get_max_uid (); sbitmap_zero (insns_with_deaths); - EXECUTE_IF_SET_IN_BITMAP (new_deaths, 0, i, - { SET_BIT (insns_with_deaths, i);}); + EXECUTE_IF_SET_IN_BITMAP (new_deaths, 0, i, bi) + { + SET_BIT (insns_with_deaths, i); + } detect_non_changed_webs (); detect_web_parts_to_rebuild (); BITMAP_XFREE (new_deaths); diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 51c4bed..6f5284e 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -4386,11 +4386,12 @@ allocate_ssa_names (bitmap definitions, htab_t *map) struct ssa_name_map_entry *entry; PTR *slot; unsigned ver; + bitmap_iterator bi; if (!*map) *map = htab_create (10, ssa_name_map_entry_hash, ssa_name_map_entry_eq, free); - EXECUTE_IF_SET_IN_BITMAP (definitions, 0, ver, + EXECUTE_IF_SET_IN_BITMAP (definitions, 0, ver, bi) { name = ssa_name (ver); slot = htab_find_slot_with_hash (*map, name, SSA_NAME_VERSION (name), @@ -4404,7 +4405,7 @@ allocate_ssa_names (bitmap definitions, htab_t *map) *slot = entry; } entry->to_name = duplicate_ssa_name (name, SSA_NAME_DEF_STMT (name)); - }); + } } /* Rewrite the definition DEF in statement STMT to new ssa name as specified @@ -4555,6 +4556,7 @@ tree_duplicate_sese_region (edge entry, edge exit, basic_block *doms; htab_t ssa_name_map = NULL; edge redirected; + bitmap_iterator bi; if (!can_copy_bbs_p (region, n_region)) return false; @@ -4639,7 +4641,7 @@ tree_duplicate_sese_region (edge entry, edge exit, /* Add phi nodes for definitions at exit. TODO -- once we have immediate uses, it should be possible to emit phi nodes just for definitions that are used outside region. */ - EXECUTE_IF_SET_IN_BITMAP (definitions, 0, ver, + EXECUTE_IF_SET_IN_BITMAP (definitions, 0, ver, bi) { tree name = ssa_name (ver); @@ -4648,7 +4650,7 @@ tree_duplicate_sese_region (edge entry, edge exit, add_phi_arg (&phi, name, exit_copy); SSA_NAME_DEF_STMT (name) = phi; - }); + } /* And create new definitions inside region and its copy. TODO -- once we have immediate uses, it might be better to leave definitions in region @@ -5070,9 +5072,12 @@ tree_purge_all_dead_eh_edges (bitmap blocks) { bool changed = false; size_t i; + bitmap_iterator bi; - EXECUTE_IF_SET_IN_BITMAP (blocks, 0, i, - { changed |= tree_purge_dead_eh_edges (BASIC_BLOCK (i)); }); + EXECUTE_IF_SET_IN_BITMAP (blocks, 0, i, bi) + { + changed |= tree_purge_dead_eh_edges (BASIC_BLOCK (i)); + } return changed; } diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c index e71eb47..696bdfd 100644 --- a/gcc/tree-into-ssa.c +++ b/gcc/tree-into-ssa.c @@ -231,14 +231,15 @@ compute_global_livein (bitmap livein, bitmap def_blocks) { basic_block bb, *worklist, *tos; int i; + bitmap_iterator bi; tos = worklist = (basic_block *) xmalloc (sizeof (basic_block) * (n_basic_blocks + 1)); - EXECUTE_IF_SET_IN_BITMAP (livein, 0, i, + EXECUTE_IF_SET_IN_BITMAP (livein, 0, i, bi) { - *tos++ = BASIC_BLOCK (i); - }); + *tos++ = BASIC_BLOCK (i); + } /* Iterate until the worklist is empty. */ while (tos != worklist) @@ -602,6 +603,7 @@ insert_phi_nodes (bitmap *dfs, bitmap names_to_rename) { size_t i; varray_type work_stack; + bitmap_iterator bi; timevar_push (TV_TREE_INSERT_PHI_NODES); @@ -615,15 +617,17 @@ insert_phi_nodes (bitmap *dfs, bitmap names_to_rename) each definition block. */ if (names_to_rename) { - EXECUTE_IF_SET_IN_BITMAP (names_to_rename, 0, i, + EXECUTE_IF_SET_IN_BITMAP (names_to_rename, 0, i, bi) { if (ssa_name (i)) insert_phi_nodes_1 (ssa_name (i), dfs, &work_stack); - }); + } } else if (vars_to_rename) - EXECUTE_IF_SET_IN_BITMAP (vars_to_rename, 0, i, - insert_phi_nodes_1 (referenced_var (i), dfs, &work_stack)); + EXECUTE_IF_SET_IN_BITMAP (vars_to_rename, 0, i, bi) + { + insert_phi_nodes_1 (referenced_var (i), dfs, &work_stack); + } else for (i = 0; i < num_referenced_vars; i++) insert_phi_nodes_1 (referenced_var (i), dfs, &work_stack); @@ -964,6 +968,7 @@ insert_phi_nodes_for (tree var, bitmap *dfs, varray_type *work_stack) edge e; tree phi; basic_block bb; + bitmap_iterator bi; def_map = find_def_blocks_for (var); if (def_map == NULL) @@ -971,10 +976,10 @@ insert_phi_nodes_for (tree var, bitmap *dfs, varray_type *work_stack) phi_insertion_points = BITMAP_XMALLOC (); - EXECUTE_IF_SET_IN_BITMAP (def_map->def_blocks, 0, bb_index, + EXECUTE_IF_SET_IN_BITMAP (def_map->def_blocks, 0, bb_index, bi) { VARRAY_PUSH_GENERIC_PTR_NOGC (*work_stack, BASIC_BLOCK (bb_index)); - }); + } /* Pop a block off the worklist, add every block that appears in the original block's dfs that we have not already processed to @@ -991,6 +996,7 @@ insert_phi_nodes_for (tree var, bitmap *dfs, varray_type *work_stack) while (VARRAY_ACTIVE_SIZE (*work_stack) > 0) { int dfs_index; + bitmap_iterator bi; bb = VARRAY_TOP_GENERIC_PTR_NOGC (*work_stack); bb_index = bb->index; @@ -999,13 +1005,13 @@ insert_phi_nodes_for (tree var, bitmap *dfs, varray_type *work_stack) EXECUTE_IF_AND_COMPL_IN_BITMAP (dfs[bb_index], phi_insertion_points, - 0, dfs_index, + 0, dfs_index, bi) { basic_block bb = BASIC_BLOCK (dfs_index); VARRAY_PUSH_GENERIC_PTR_NOGC (*work_stack, bb); bitmap_set_bit (phi_insertion_points, dfs_index); - }); + } } /* Remove the blocks where we already have the phis. */ @@ -1018,21 +1024,19 @@ insert_phi_nodes_for (tree var, bitmap *dfs, varray_type *work_stack) /* And insert the PHI nodes. */ EXECUTE_IF_AND_IN_BITMAP (phi_insertion_points, def_map->livein_blocks, - 0, bb_index, - do - { - bb = BASIC_BLOCK (bb_index); + 0, bb_index, bi) + { + bb = BASIC_BLOCK (bb_index); - phi = create_phi_node (var, bb); + phi = create_phi_node (var, bb); - /* If we are rewriting ssa names, add also the phi arguments. */ - if (TREE_CODE (var) == SSA_NAME) - { - for (e = bb->pred; e; e = e->pred_next) - add_phi_arg (&phi, var, e); - } - } - while (0)); + /* If we are rewriting ssa names, add also the phi arguments. */ + if (TREE_CODE (var) == SSA_NAME) + { + for (e = bb->pred; e; e = e->pred_next) + add_phi_arg (&phi, var, e); + } + } BITMAP_XFREE (phi_insertion_points); } @@ -1260,16 +1264,21 @@ debug_def_blocks_r (void **slot, void *data ATTRIBUTE_UNUSED) { unsigned long i; struct def_blocks_d *db_p = (struct def_blocks_d *) *slot; + bitmap_iterator bi; fprintf (stderr, "VAR: "); print_generic_expr (stderr, db_p->var, dump_flags); fprintf (stderr, ", DEF_BLOCKS: { "); - EXECUTE_IF_SET_IN_BITMAP (db_p->def_blocks, 0, i, - fprintf (stderr, "%ld ", i)); + EXECUTE_IF_SET_IN_BITMAP (db_p->def_blocks, 0, i, bi) + { + fprintf (stderr, "%ld ", i); + } fprintf (stderr, "}"); fprintf (stderr, ", LIVEIN_BLOCKS: { "); - EXECUTE_IF_SET_IN_BITMAP (db_p->livein_blocks, 0, i, - fprintf (stderr, "%ld ", i)); + EXECUTE_IF_SET_IN_BITMAP (db_p->livein_blocks, 0, i, bi) + { + fprintf (stderr, "%ld ", i); + } fprintf (stderr, "}\n"); return 1; @@ -1334,14 +1343,17 @@ invalidate_name_tags (bitmap vars_to_rename) { size_t i; bool rename_name_tags_p; + bitmap_iterator bi; rename_name_tags_p = false; - EXECUTE_IF_SET_IN_BITMAP (vars_to_rename, 0, i, + EXECUTE_IF_SET_IN_BITMAP (vars_to_rename, 0, i, bi) + { if (POINTER_TYPE_P (TREE_TYPE (referenced_var (i)))) { rename_name_tags_p = true; break; - }); + } + } if (rename_name_tags_p) for (i = 0; i < num_referenced_vars; i++) @@ -1550,6 +1562,7 @@ rewrite_ssa_into_ssa (void) sbitmap snames_to_rename; tree name; bitmap to_rename; + bitmap_iterator bi; if (!any_marked_for_rewrite_p ()) return; @@ -1598,8 +1611,10 @@ rewrite_ssa_into_ssa (void) snames_to_rename = sbitmap_alloc (num_ssa_names); sbitmap_zero (snames_to_rename); - EXECUTE_IF_SET_IN_BITMAP (to_rename, 0, i, - SET_BIT (snames_to_rename, i)); + EXECUTE_IF_SET_IN_BITMAP (to_rename, 0, i, bi) + { + SET_BIT (snames_to_rename, i); + } mark_def_sites_global_data.kills = sbitmap_alloc (num_ssa_names); mark_def_sites_global_data.names_to_rename = snames_to_rename; @@ -1657,7 +1672,10 @@ rewrite_ssa_into_ssa (void) unmark_all_for_rewrite (); - EXECUTE_IF_SET_IN_BITMAP (to_rename, 0, i, release_ssa_name (ssa_name (i))); + EXECUTE_IF_SET_IN_BITMAP (to_rename, 0, i, bi) + { + release_ssa_name (ssa_name (i)); + } sbitmap_free (snames_to_rename); diff --git a/gcc/tree-outof-ssa.c b/gcc/tree-outof-ssa.c index 185e39b..e23f0a1 100644 --- a/gcc/tree-outof-ssa.c +++ b/gcc/tree-outof-ssa.c @@ -1706,11 +1706,13 @@ find_replaceable_exprs (var_map map) table = new_temp_expr_table (map); FOR_EACH_BB (bb) { + bitmap_iterator bi; + find_replaceable_in_bb (table, bb); - EXECUTE_IF_SET_IN_BITMAP ((table->partition_in_use), 0, i, + EXECUTE_IF_SET_IN_BITMAP ((table->partition_in_use), 0, i, bi) { kill_expr (table, i, false); - }); + } } ret = free_temp_expr_table (table); diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 9c1a497..53c125c 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -1011,6 +1011,7 @@ scan_function (void) static const struct sra_walk_fns fns = { scan_use, scan_copy, scan_init, scan_ldst, true }; + bitmap_iterator bi; sra_walk_function (&fns); @@ -1019,13 +1020,13 @@ scan_function (void) size_t i; fputs ("\nScan results:\n", dump_file); - EXECUTE_IF_SET_IN_BITMAP (sra_candidates, 0, i, + EXECUTE_IF_SET_IN_BITMAP (sra_candidates, 0, i, bi) { tree var = referenced_var (i); struct sra_elt *elt = lookup_element (NULL, var, NULL, NO_INSERT); if (elt) scan_dump (elt); - }); + } fputc ('\n', dump_file); } } @@ -1351,13 +1352,14 @@ decide_instantiations (void) unsigned int i; bool cleared_any; struct bitmap_head_def done_head; + bitmap_iterator bi; /* We cannot clear bits from a bitmap we're iterating over, so save up all the bits to clear until the end. */ bitmap_initialize (&done_head, 1); cleared_any = false; - EXECUTE_IF_SET_IN_BITMAP (sra_candidates, 0, i, + EXECUTE_IF_SET_IN_BITMAP (sra_candidates, 0, i, bi) { tree var = referenced_var (i); struct sra_elt *elt = lookup_element (NULL, var, NULL, NO_INSERT); @@ -1372,7 +1374,7 @@ decide_instantiations (void) bitmap_set_bit (&done_head, i); cleared_any = true; } - }); + } if (cleared_any) { @@ -1957,13 +1959,14 @@ scalarize_parms (void) { tree list = NULL; size_t i; + bitmap_iterator bi; - EXECUTE_IF_SET_IN_BITMAP (needs_copy_in, 0, i, + EXECUTE_IF_SET_IN_BITMAP (needs_copy_in, 0, i, bi) { tree var = referenced_var (i); struct sra_elt *elt = lookup_element (NULL, var, NULL, NO_INSERT); generate_copy_inout (elt, true, var, &list); - }); + } if (list) insert_edge_copies (list, ENTRY_BLOCK_PTR); diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index b0cdddc..883c53d 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -382,10 +382,11 @@ init_alias_info (void) if (aliases_computed_p) { size_t i; + bitmap_iterator bi; /* Clear the call-clobbered set. We are going to re-discover call-clobbered variables. */ - EXECUTE_IF_SET_IN_BITMAP (call_clobbered_vars, 0, i, + EXECUTE_IF_SET_IN_BITMAP (call_clobbered_vars, 0, i, bi) { tree var = referenced_var (i); @@ -394,7 +395,7 @@ init_alias_info (void) code, so we can't remove them from CALL_CLOBBERED_VARS. */ if (!is_call_clobbered (var)) bitmap_clear_bit (call_clobbered_vars, var_ann (var)->uid); - }); + } /* Similarly, clear the set of addressable variables. In this case, we can just clear the set because addressability is @@ -589,6 +590,7 @@ compute_points_to_and_addr_escape (struct alias_info *ai) bitmap addr_taken; tree stmt = bsi_stmt (si); bool stmt_escapes_p = is_escape_site (stmt, &ai->num_calls_found); + bitmap_iterator bi; /* Mark all the variables whose address are taken by the statement. Note that this will miss all the addresses taken @@ -597,13 +599,13 @@ compute_points_to_and_addr_escape (struct alias_info *ai) get_stmt_operands (stmt); addr_taken = addresses_taken (stmt); if (addr_taken) - EXECUTE_IF_SET_IN_BITMAP (addr_taken, 0, i, - { - tree var = referenced_var (i); - bitmap_set_bit (ai->addresses_needed, var_ann (var)->uid); - if (stmt_escapes_p) - mark_call_clobbered (var); - }); + EXECUTE_IF_SET_IN_BITMAP (addr_taken, 0, i, bi) + { + tree var = referenced_var (i); + bitmap_set_bit (ai->addresses_needed, var_ann (var)->uid); + if (stmt_escapes_p) + mark_call_clobbered (var); + } if (stmt_escapes_p) block_ann->has_escape_site = 1; @@ -618,11 +620,11 @@ compute_points_to_and_addr_escape (struct alias_info *ai) if (addr_taken && TREE_CODE (stmt) == MODIFY_EXPR && !POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (stmt, 0)))) - EXECUTE_IF_SET_IN_BITMAP (addr_taken, 0, i, - { - tree var = referenced_var (i); - mark_call_clobbered (var); - }); + EXECUTE_IF_SET_IN_BITMAP (addr_taken, 0, i, bi) + { + tree var = referenced_var (i); + mark_call_clobbered (var); + } FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_USE) { @@ -835,6 +837,7 @@ compute_flow_sensitive_aliasing (struct alias_info *ai) tree ptr = VARRAY_TREE (ai->processed_ptrs, i); struct ptr_info_def *pi = SSA_NAME_PTR_INFO (ptr); var_ann_t v_ann = var_ann (SSA_NAME_VAR (ptr)); + bitmap_iterator bi; if (pi->value_escapes_p || pi->pt_anything) { @@ -847,16 +850,20 @@ compute_flow_sensitive_aliasing (struct alias_info *ai) mark_call_clobbered (v_ann->type_mem_tag); if (pi->pt_vars) - EXECUTE_IF_SET_IN_BITMAP (pi->pt_vars, 0, j, - mark_call_clobbered (referenced_var (j))); + EXECUTE_IF_SET_IN_BITMAP (pi->pt_vars, 0, j, bi) + { + mark_call_clobbered (referenced_var (j)); + } } /* Set up aliasing information for PTR's name memory tag (if it has one). Note that only pointers that have been dereferenced will have a name memory tag. */ if (pi->name_mem_tag && pi->pt_vars) - EXECUTE_IF_SET_IN_BITMAP (pi->pt_vars, 0, j, - add_may_alias (pi->name_mem_tag, referenced_var (j))); + EXECUTE_IF_SET_IN_BITMAP (pi->pt_vars, 0, j, bi) + { + add_may_alias (pi->name_mem_tag, referenced_var (j)); + } /* If the name tag is call clobbered, so is the type tag associated with the base VAR_DECL. */ @@ -1476,13 +1483,17 @@ static void maybe_create_global_var (struct alias_info *ai) { size_t i, n_clobbered; + bitmap_iterator bi; /* No need to create it, if we have one already. */ if (global_var == NULL_TREE) { /* Count all the call-clobbered variables. */ n_clobbered = 0; - EXECUTE_IF_SET_IN_BITMAP (call_clobbered_vars, 0, i, n_clobbered++); + EXECUTE_IF_SET_IN_BITMAP (call_clobbered_vars, 0, i, bi) + { + n_clobbered++; + } /* Create .GLOBAL_VAR if we have too many call-clobbered variables. We also create .GLOBAL_VAR when there no @@ -1510,7 +1521,7 @@ maybe_create_global_var (struct alias_info *ai) /* If the function has calls to clobbering functions and .GLOBAL_VAR has been created, make it an alias for all call-clobbered variables. */ if (global_var) - EXECUTE_IF_SET_IN_BITMAP (call_clobbered_vars, 0, i, + EXECUTE_IF_SET_IN_BITMAP (call_clobbered_vars, 0, i, bi) { tree var = referenced_var (i); if (var != global_var) @@ -1518,7 +1529,7 @@ maybe_create_global_var (struct alias_info *ai) add_may_alias (var, global_var); bitmap_set_bit (vars_to_rename, var_ann (var)->uid); } - }); + } } @@ -2315,13 +2326,14 @@ dump_points_to_info_for (FILE *file, tree ptr) if (pi->pt_vars) { unsigned ix; + bitmap_iterator bi; fprintf (file, ", points-to vars: { "); - EXECUTE_IF_SET_IN_BITMAP (pi->pt_vars, 0, ix, - { - print_generic_expr (file, referenced_var (ix), dump_flags); - fprintf (file, " "); - }); + EXECUTE_IF_SET_IN_BITMAP (pi->pt_vars, 0, ix, bi) + { + print_generic_expr (file, referenced_var (ix), dump_flags); + fprintf (file, " "); + } fprintf (file, "}"); } } diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c index 937a301..dfa719a 100644 --- a/gcc/tree-ssa-dce.c +++ b/gcc/tree-ssa-dce.c @@ -95,7 +95,14 @@ bitmap *control_dependence_map; /* Execute CODE for each edge (given number EDGE_NUMBER within the CODE) for which the block with index N is control dependent. */ #define EXECUTE_IF_CONTROL_DEPENDENT(N, EDGE_NUMBER, CODE) \ - EXECUTE_IF_SET_IN_BITMAP (control_dependence_map[N], 0, EDGE_NUMBER, CODE) + { \ + bitmap_iterator bi; \ + \ + EXECUTE_IF_SET_IN_BITMAP (control_dependence_map[N], 0, EDGE_NUMBER, bi) \ + { \ + CODE; \ + } \ + } /* Local function prototypes. */ static inline void set_control_dependence_map_bit (basic_block, int); diff --git a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c index 23487f2..93ceaeb 100644 --- a/gcc/tree-ssa-dse.c +++ b/gcc/tree-ssa-dse.c @@ -368,10 +368,14 @@ dse_finalize_block (struct dom_walk_data *walk_data, struct dse_global_data *dse_gd = walk_data->global_data; bitmap stores = dse_gd->stores; unsigned int i; + bitmap_iterator bi; /* Unwind the stores noted in this basic block. */ if (bd->stores) - EXECUTE_IF_SET_IN_BITMAP (bd->stores, 0, i, bitmap_clear_bit (stores, i);); + EXECUTE_IF_SET_IN_BITMAP (bd->stores, 0, i, bi) + { + bitmap_clear_bit (stores, i); + } } static void diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c index 507f378..41b970f 100644 --- a/gcc/tree-ssa-live.c +++ b/gcc/tree-ssa-live.c @@ -488,15 +488,16 @@ live_worklist (tree_live_info_p live, varray_type stack, int i) basic_block def_bb = NULL; edge e; var_map map = live->map; + bitmap_iterator bi; var = partition_to_var (map, i); if (SSA_NAME_DEF_STMT (var)) def_bb = bb_for_stmt (SSA_NAME_DEF_STMT (var)); - EXECUTE_IF_SET_IN_BITMAP (live->livein[i], 0, b, + EXECUTE_IF_SET_IN_BITMAP (live->livein[i], 0, b, bi) { VARRAY_PUSH_INT (stack, b); - }); + } while (VARRAY_ACTIVE_SIZE (stack) > 0) { @@ -565,6 +566,7 @@ calculate_live_on_entry (var_map map) block_stmt_iterator bsi; stmt_ann_t ann; ssa_op_iter iter; + bitmap_iterator bi; #ifdef ENABLE_CHECKING int num; #endif @@ -628,10 +630,10 @@ calculate_live_on_entry (var_map map) } VARRAY_INT_INIT (stack, last_basic_block, "stack"); - EXECUTE_IF_SET_IN_BITMAP (live->global, 0, i, + EXECUTE_IF_SET_IN_BITMAP (live->global, 0, i, bi) { live_worklist (live, stack, i); - }); + } #ifdef ENABLE_CHECKING /* Check for live on entry partitions and report those with a DEF in @@ -758,13 +760,15 @@ calculate_live_on_exit (tree_live_info_p liveinfo) /* Set live on exit for all predecessors of live on entry's. */ for (i = 0; i < num_var_partitions (map); i++) { + bitmap_iterator bi; + on_entry = live_entry_blocks (liveinfo, i); - EXECUTE_IF_SET_IN_BITMAP (on_entry, 0, b, + EXECUTE_IF_SET_IN_BITMAP (on_entry, 0, b, bi) { for (e = BASIC_BLOCK(b)->pred; e; e = e->pred_next) if (e->src != ENTRY_BLOCK_PTR) bitmap_set_bit (on_exit[e->src->index], i); - }); + } } liveinfo->liveout = on_exit; @@ -1295,6 +1299,7 @@ build_tree_conflict_graph (tree_live_info_p liveinfo, tpa_p tpa, varray_type partition_link, tpa_to_clear, tpa_nodes; unsigned l; ssa_op_iter iter; + bitmap_iterator bi; map = live_var_map (liveinfo); graph = conflict_graph_new (num_var_partitions (map)); @@ -1411,7 +1416,7 @@ build_tree_conflict_graph (tree_live_info_p liveinfo, tpa_p tpa, tpa_clear contains all the tpa_roots processed, and these are the only entries which need to be zero'd out for a clean restart. */ - EXECUTE_IF_SET_IN_BITMAP (live, 0, x, + EXECUTE_IF_SET_IN_BITMAP (live, 0, x, bi) { i = tpa_find_tree (tpa, x); if (i != TPA_NONE) @@ -1428,7 +1433,7 @@ build_tree_conflict_graph (tree_live_info_p liveinfo, tpa_p tpa, VARRAY_INT (tpa_nodes, i) = x + 1; VARRAY_INT (partition_link, x + 1) = start; } - }); + } /* Now clear the used tpa root references. */ for (l = 0; l < VARRAY_ACTIVE_SIZE (tpa_to_clear); l++) @@ -1745,6 +1750,7 @@ dump_live_info (FILE *f, tree_live_info_p live, int flag) basic_block bb; int i; var_map map = live->map; + bitmap_iterator bi; if ((flag & LIVEDUMP_ENTRY) && live->livein) { @@ -1768,11 +1774,11 @@ dump_live_info (FILE *f, tree_live_info_p live, int flag) FOR_EACH_BB (bb) { fprintf (f, "\nLive on exit from BB%d : ", bb->index); - EXECUTE_IF_SET_IN_BITMAP (live->liveout[bb->index], 0, i, + EXECUTE_IF_SET_IN_BITMAP (live->liveout[bb->index], 0, i, bi) { print_generic_expr (f, partition_to_var (map, i), TDF_SLIM); fprintf (f, " "); - }); + } fprintf (f, "\n"); } } diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index d0b468f..e33d572 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -944,6 +944,7 @@ find_induction_variables (struct ivopts_data *data) { unsigned i; struct loop *loop = data->current_loop; + bitmap_iterator bi; if (!find_bivs (data)) return false; @@ -975,11 +976,11 @@ find_induction_variables (struct ivopts_data *data) fprintf (dump_file, "Induction variables:\n\n"); - EXECUTE_IF_SET_IN_BITMAP (data->relevant, 0, i, + EXECUTE_IF_SET_IN_BITMAP (data->relevant, 0, i, bi) { if (ver_info (data, i)->iv) dump_iv (dump_file, ver_info (data, i)->iv); - }); + } } return true; @@ -1524,9 +1525,11 @@ find_interesting_uses (struct ivopts_data *data) if (dump_file && (dump_flags & TDF_DETAILS)) { + bitmap_iterator bi; + fprintf (dump_file, "\n"); - EXECUTE_IF_SET_IN_BITMAP (data->relevant, 0, i, + EXECUTE_IF_SET_IN_BITMAP (data->relevant, 0, i, bi) { info = ver_info (data, i); if (info->inv_id) @@ -1536,7 +1539,7 @@ find_interesting_uses (struct ivopts_data *data) fprintf (dump_file, " is invariant (%d)%s\n", info->inv_id, info->has_nonlin_use ? "" : ", eliminable"); } - }); + } fprintf (dump_file, "\n"); } @@ -1718,13 +1721,14 @@ add_old_ivs_candidates (struct ivopts_data *data) { unsigned i; struct iv *iv; + bitmap_iterator bi; - EXECUTE_IF_SET_IN_BITMAP (data->relevant, 0, i, + EXECUTE_IF_SET_IN_BITMAP (data->relevant, 0, i, bi) { iv = ver_info (data, i)->iv; if (iv && iv->biv_p && !zero_p (iv->step)) add_old_iv_candidates (data, iv); - }); + } } /* Adds candidates based on the value of the induction variable IV and USE. */ @@ -1896,6 +1900,7 @@ alloc_use_cost_map (struct ivopts_data *data) for (i = 0; i < n_iv_uses (data); i++) { struct iv_use *use = iv_use (data, i); + bitmap_iterator bi; if (data->consider_all_candidates) { @@ -1905,7 +1910,10 @@ alloc_use_cost_map (struct ivopts_data *data) else { size = n_imp; - EXECUTE_IF_SET_IN_BITMAP (use->related_cands, 0, j, size++); + EXECUTE_IF_SET_IN_BITMAP (use->related_cands, 0, j, bi) + { + size++; + } use->n_map_members = 0; } @@ -3204,12 +3212,14 @@ determine_use_iv_costs (struct ivopts_data *data) } else { - EXECUTE_IF_SET_IN_BITMAP (use->related_cands, 0, j, + bitmap_iterator bi; + + EXECUTE_IF_SET_IN_BITMAP (use->related_cands, 0, j, bi) { cand = iv_cand (data, j); if (!cand->important) determine_use_iv_cost (data, use, cand); - }); + } } } @@ -3331,6 +3341,7 @@ determine_set_costs (struct ivopts_data *data) unsigned j, n; tree phi, op; struct loop *loop = data->current_loop; + bitmap_iterator bi; /* We use the following model (definitely improvable, especially the cost function -- TODO): @@ -3375,13 +3386,13 @@ determine_set_costs (struct ivopts_data *data) n++; } - EXECUTE_IF_SET_IN_BITMAP (data->relevant, 0, j, + EXECUTE_IF_SET_IN_BITMAP (data->relevant, 0, j, bi) { struct version_info *info = ver_info (data, j); if (info->inv_id && info->has_nonlin_use) n++; - }); + } loop_data (loop)->regs_used = n; if (dump_file && (dump_flags & TDF_DETAILS)) @@ -3412,6 +3423,7 @@ find_best_candidate (struct ivopts_data *data, unsigned best_cost = INFTY, cost; struct iv_cand *cnd = NULL, *acnd; bitmap depends_on = NULL, asol; + bitmap_iterator bi, bi1; if (data->consider_all_candidates) asol = sol; @@ -3421,34 +3433,37 @@ find_best_candidate (struct ivopts_data *data, bitmap_a_and_b (asol, sol, use->related_cands); } - EXECUTE_IF_SET_IN_BITMAP (asol, 0, c, + EXECUTE_IF_SET_IN_BITMAP (asol, 0, c, bi) { acnd = iv_cand (data, c); cost = get_use_iv_cost (data, use, acnd, &depends_on); if (cost == INFTY) - goto next_cand; + continue; if (cost > best_cost) - goto next_cand; + continue; if (cost == best_cost) { /* Prefer the cheaper iv. */ if (acnd->cost >= cnd->cost) - goto next_cand; + continue; } if (depends_on) { - EXECUTE_IF_AND_COMPL_IN_BITMAP (depends_on, inv, 0, d, - goto next_cand); + EXECUTE_IF_AND_COMPL_IN_BITMAP (depends_on, inv, 0, d, bi1) + { + goto next_cand; + } if (used_inv) bitmap_a_or_b (used_inv, used_inv, depends_on); } cnd = acnd; best_cost = cost; + next_cand: ; - }); + } if (cnd && used_ivs) bitmap_set_bit (used_ivs, cnd->id); @@ -3475,6 +3490,7 @@ set_cost_up_to (struct ivopts_data *data, bitmap sol, bitmap inv, struct iv_use *use; struct iv_cand *cand; bitmap used_ivs = BITMAP_XMALLOC (), used_inv = BITMAP_XMALLOC (); + bitmap_iterator bi; for (i = 0; i < max_use; i++) { @@ -3490,7 +3506,7 @@ set_cost_up_to (struct ivopts_data *data, bitmap sol, bitmap inv, cost += acost; } - EXECUTE_IF_SET_IN_BITMAP (used_ivs, 0, i, + EXECUTE_IF_SET_IN_BITMAP (used_ivs, 0, i, bi) { cand = iv_cand (data, i); @@ -3499,8 +3515,11 @@ set_cost_up_to (struct ivopts_data *data, bitmap sol, bitmap inv, size++; cost += cand->cost; - }); - EXECUTE_IF_SET_IN_BITMAP (used_inv, 0, i, size++); + } + EXECUTE_IF_SET_IN_BITMAP (used_inv, 0, i, bi) + { + size++; + } cost += ivopts_global_cost_for_size (data, size); bitmap_copy (sol, used_ivs); @@ -3774,12 +3793,13 @@ create_new_ivs (struct ivopts_data *data, bitmap set) { unsigned i; struct iv_cand *cand; + bitmap_iterator bi; - EXECUTE_IF_SET_IN_BITMAP (set, 0, i, + EXECUTE_IF_SET_IN_BITMAP (set, 0, i, bi) { cand = iv_cand (data, i); create_new_iv (data, cand); - }); + } } /* Removes statement STMT (real or a phi node). If INCLUDING_DEFINED_NAME @@ -4270,8 +4290,9 @@ static void remove_unused_ivs (struct ivopts_data *data) { unsigned j; + bitmap_iterator bi; - EXECUTE_IF_SET_IN_BITMAP (data->relevant, 0, j, + EXECUTE_IF_SET_IN_BITMAP (data->relevant, 0, j, bi) { struct version_info *info; @@ -4282,7 +4303,7 @@ remove_unused_ivs (struct ivopts_data *data) && !info->iv->have_use_for && !info->preserve_biv) remove_statement (SSA_NAME_DEF_STMT (info->iv->ssa_name), true); - }); + } } /* Frees data allocated by the optimization of a single loop. */ @@ -4291,8 +4312,9 @@ static void free_loop_data (struct ivopts_data *data) { unsigned i, j; + bitmap_iterator bi; - EXECUTE_IF_SET_IN_BITMAP (data->relevant, 0, i, + EXECUTE_IF_SET_IN_BITMAP (data->relevant, 0, i, bi) { struct version_info *info; @@ -4303,7 +4325,7 @@ free_loop_data (struct ivopts_data *data) info->has_nonlin_use = false; info->preserve_biv = false; info->inv_id = 0; - }); + } bitmap_clear (data->relevant); for (i = 0; i < n_iv_uses (data); i++) diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c index a06b352..7857258 100644 --- a/gcc/tree-ssa-loop-manip.c +++ b/gcc/tree-ssa-loop-manip.c @@ -153,6 +153,7 @@ add_exit_phis_var (tree var, bitmap livein, bitmap exits) bitmap def; int index; basic_block def_bb = bb_for_stmt (SSA_NAME_DEF_STMT (var)); + bitmap_iterator bi; bitmap_clear_bit (livein, def_bb->index); @@ -161,8 +162,10 @@ add_exit_phis_var (tree var, bitmap livein, bitmap exits) compute_global_livein (livein, def); BITMAP_XFREE (def); - EXECUTE_IF_AND_IN_BITMAP (exits, livein, 0, index, - add_exit_phis_edge (BASIC_BLOCK (index), var)); + EXECUTE_IF_AND_IN_BITMAP (exits, livein, 0, index, bi) + { + add_exit_phis_edge (BASIC_BLOCK (index), var); + } } /* Add exit phis for the names marked in NAMES_TO_RENAME. @@ -173,11 +176,12 @@ static void add_exit_phis (bitmap names_to_rename, bitmap *use_blocks, bitmap loop_exits) { unsigned i; + bitmap_iterator bi; - EXECUTE_IF_SET_IN_BITMAP (names_to_rename, 0, i, + EXECUTE_IF_SET_IN_BITMAP (names_to_rename, 0, i, bi) { add_exit_phis_var (ssa_name (i), use_blocks[i], loop_exits); - }); + } } /* Returns a bitmap of all loop exit edge targets. */ diff --git a/gcc/tree-ssa-operands.c b/gcc/tree-ssa-operands.c index 55e6f8a..2506761 100644 --- a/gcc/tree-ssa-operands.c +++ b/gcc/tree-ssa-operands.c @@ -1264,24 +1264,25 @@ get_asm_expr_operands (tree stmt) if (strcmp (TREE_STRING_POINTER (TREE_VALUE (link)), "memory") == 0) { size_t i; + bitmap_iterator bi; /* Clobber all call-clobbered variables (or .GLOBAL_VAR if we decided to group them). */ if (global_var) add_stmt_operand (&global_var, stmt, opf_is_def); else - EXECUTE_IF_SET_IN_BITMAP (call_clobbered_vars, 0, i, + EXECUTE_IF_SET_IN_BITMAP (call_clobbered_vars, 0, i, bi) { tree var = referenced_var (i); add_stmt_operand (&var, stmt, opf_is_def); - }); + } /* Now clobber all addressables. */ - EXECUTE_IF_SET_IN_BITMAP (addressable_vars, 0, i, + EXECUTE_IF_SET_IN_BITMAP (addressable_vars, 0, i, bi) { tree var = referenced_var (i); add_stmt_operand (&var, stmt, opf_is_def); - }); + } break; } @@ -1597,6 +1598,7 @@ add_call_clobber_ops (tree stmt, tree callee) { size_t i; bitmap not_read_b = NULL, not_written_b = NULL; + bitmap_iterator bi; /* Get info for module level statics. There is a bit set for each static if the call being processed does not read or @@ -1609,7 +1611,7 @@ add_call_clobber_ops (tree stmt, tree callee) not_written_b = get_global_statics_not_written (callee); } - EXECUTE_IF_SET_IN_BITMAP (call_clobbered_vars, 0, i, + EXECUTE_IF_SET_IN_BITMAP (call_clobbered_vars, 0, i, bi) { tree var = referenced_var (i); @@ -1648,7 +1650,7 @@ add_call_clobber_ops (tree stmt, tree callee) else add_stmt_operand (&var, stmt, opf_is_def); } - }); + } } } @@ -1659,6 +1661,8 @@ add_call_clobber_ops (tree stmt, tree callee) static void add_call_read_ops (tree stmt, tree callee) { + bitmap_iterator bi; + /* Otherwise, if the function is not pure, it may reference memory. Add a VUSE for .GLOBAL_VAR if it has been created. Otherwise, add a VUSE for each call-clobbered variable. See add_referenced_var for the @@ -1671,14 +1675,14 @@ add_call_read_ops (tree stmt, tree callee) bitmap not_read_b = callee ? get_global_statics_not_read (callee) : NULL; - EXECUTE_IF_SET_IN_BITMAP (call_clobbered_vars, 0, i, + EXECUTE_IF_SET_IN_BITMAP (call_clobbered_vars, 0, i, bi) { tree var = referenced_var (i); bool not_read = not_read_b ? bitmap_bit_p(not_read_b, i) : false; if (!not_read) add_stmt_operand (&var, stmt, opf_none); - }); + } } } diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index 7d218a8..92932b6 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -769,16 +769,18 @@ bitmap_print_value_set (FILE *outfile, bitmap_set_t set, if (set) { int i; - EXECUTE_IF_SET_IN_BITMAP (set->expressions, 0, i, - { - print_generic_expr (outfile, ssa_name (i), 0); + bitmap_iterator bi; + + EXECUTE_IF_SET_IN_BITMAP (set->expressions, 0, i, bi) + { + print_generic_expr (outfile, ssa_name (i), 0); - fprintf (outfile, " ("); - print_generic_expr (outfile, get_value_handle (ssa_name (i)), 0); - fprintf (outfile, ") "); - if (bitmap_last_set_bit (set->expressions) != i) - fprintf (outfile, ", "); - }); + fprintf (outfile, " ("); + print_generic_expr (outfile, get_value_handle (ssa_name (i)), 0); + fprintf (outfile, ") "); + if (bitmap_last_set_bit (set->expressions) != i) + fprintf (outfile, ", "); + } } fprintf (outfile, " }\n"); } @@ -1416,12 +1418,14 @@ insert_aux (basic_block block) if (dom) { int i; + bitmap_iterator bi; + bitmap_set_t newset = NEW_SETS (dom); - EXECUTE_IF_SET_IN_BITMAP (newset->expressions, 0, i, - { - bitmap_insert_into_set (NEW_SETS (block), ssa_name (i)); - bitmap_value_replace_in_set (AVAIL_OUT (block), ssa_name (i)); - }); + EXECUTE_IF_SET_IN_BITMAP (newset->expressions, 0, i, bi) + { + bitmap_insert_into_set (NEW_SETS (block), ssa_name (i)); + bitmap_value_replace_in_set (AVAIL_OUT (block), ssa_name (i)); + } if (block->pred->pred_next) { value_set_node_t node; |