+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,
/* 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)
{
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);
}
/* 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 */
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);
+ }
+ }
}
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
*/
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)
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);
- });
+ }
}
}
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
(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);
{
int index;
local_static_vars_info_t l;
+ bitmap_iterator bi;
+
node = order[i];
l = node->static_vars_info->local;
fprintf (cgraph_dump_file,
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));
+ }
}
}
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;
}
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));
+ }
}
}
{
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
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)
unsigned int uid = INSN_UID (insn);
unsigned int regno;
struct df_link *link;
+ bitmap_iterator bi;
if (! INSN_P (insn))
continue;
}
/* 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++;
+ }
}
}
}
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);
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)
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);
+ }
}
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);
}
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))
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))
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.
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);
unsigned aregs_needed;
unsigned depno;
struct invariant *dep;
+ bitmap_iterator bi;
*comp_cost = 0;
*regs_needed = 0;
(*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);
(*regs_needed) += aregs_needed;
(*comp_cost) += acomp_cost;
- });
+ }
}
/* Calculates gain for eliminating invariant INV. REGS_USED is the number
set_move_mark (unsigned invno)
{
struct invariant *inv = VARRAY_GENERIC_PTR_NOGC (invariants, invno);
+ bitmap_iterator bi;
if (inv->move)
return;
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. */
basic_block preheader = loop_preheader_edge (loop)->src;
rtx reg, set;
struct use *use;
+ bitmap_iterator bi;
if (inv->processed)
return;
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
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);
}
{
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);
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;
pass_cache[id2] = pass;
record_conflict (web1, web2);
}
- });
+ }
}
}
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));
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);
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)))
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));
if (aweb->type != SPILLED)
update_spill_colors (&(ri.colors_in_use), web, 1);
}
- });
+ }
bitmap_clear (ri.need_reload);
ri.num_reloads = 0;
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));
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);
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);
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);
bitmap_set_bit (ri.scratch, j);
ri.num_reloads--;
}
- });
+ }
bitmap_operation (ri.need_reload, ri.need_reload, ri.scratch,
BITMAP_AND_COMPL);
}
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;
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
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);
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.
actual_spill (void)
{
int i;
+ bitmap_iterator bi;
bitmap new_deaths = BITMAP_XMALLOC ();
+
reset_changed_flag ();
spill_coalprop ();
choose_spill_colors ();
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);
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),
*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
basic_block *doms;
htab_t ssa_name_map = NULL;
edge redirected;
+ bitmap_iterator bi;
if (!can_copy_bbs_p (region, n_region))
return false;
/* 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);
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
{
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;
}
{
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)
{
size_t i;
varray_type work_stack;
+ bitmap_iterator bi;
timevar_push (TV_TREE_INSERT_PHI_NODES);
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);
edge e;
tree phi;
basic_block bb;
+ bitmap_iterator bi;
def_map = find_def_blocks_for (var);
if (def_map == NULL)
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
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;
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. */
/* 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);
}
{
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;
{
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++)
sbitmap snames_to_rename;
tree name;
bitmap to_rename;
+ bitmap_iterator bi;
if (!any_marked_for_rewrite_p ())
return;
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;
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);
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);
static const struct sra_walk_fns fns = {
scan_use, scan_copy, scan_init, scan_ldst, true
};
+ bitmap_iterator bi;
sra_walk_function (&fns);
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);
}
}
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);
bitmap_set_bit (&done_head, i);
cleared_any = true;
}
- });
+ }
if (cleared_any)
{
{
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);
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);
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
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
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;
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)
{
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)
{
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. */
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
/* 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)
add_may_alias (var, global_var);
bitmap_set_bit (vars_to_rename, var_ann (var)->uid);
}
- });
+ }
}
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, "}");
}
}
/* 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);
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
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)
{
block_stmt_iterator bsi;
stmt_ann_t ann;
ssa_op_iter iter;
+ bitmap_iterator bi;
#ifdef ENABLE_CHECKING
int num;
#endif
}
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
/* 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;
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));
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)
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++)
basic_block bb;
int i;
var_map map = live->map;
+ bitmap_iterator bi;
if ((flag & LIVEDUMP_ENTRY) && live->livein)
{
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");
}
}
{
unsigned i;
struct loop *loop = data->current_loop;
+ bitmap_iterator bi;
if (!find_bivs (data))
return false;
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;
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)
fprintf (dump_file, " is invariant (%d)%s\n",
info->inv_id, info->has_nonlin_use ? "" : ", eliminable");
}
- });
+ }
fprintf (dump_file, "\n");
}
{
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. */
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)
{
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;
}
}
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);
- });
+ }
}
}
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):
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))
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;
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);
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++)
{
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);
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);
{
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
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;
&& !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. */
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;
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++)
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);
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.
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. */
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;
}
{
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
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);
else
add_stmt_operand (&var, stmt, opf_is_def);
}
- });
+ }
}
}
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
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);
- });
+ }
}
}
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");
}
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;