This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Speed up bitmap iterators


This pair of patches improves bitmap iterators by
1) Making the iterator smaller
2) Making the source smaller (by about 60 lines)
3) Making the executable smaller (by about 25K, not much)
4) Making bootstrap faster (by about 1% on darwin, more on i686)

Unoptimizing compile times are similar, but when optimizing it does get
faster.

The first patch changes all ues of the iterator to have an unsigned type
as the bit number -- we pass its address around, and so must be consistent.
It contains no functional change. I felt it more consistent to go with
'unsigned' rather than 'int', attempting to change to 'int' started
touching more places.

The second patch changes the actual iterator.  You'll see I removed some
fields from the iterator, as they are unnecessary. The major change is
to do the search-for-next-bit in the continue-loop check, this avoids the
current code duplication which has that at both the initialization and
at the increment step. I.e. we go from

	for (init-to-start-bit, search-for-next-bit;
	     !end_p;
	     advance-one-bit, search-for-next-bit)
to
	for (init-to-start-bit;
	     search-for-next-bit;
	     advance-one-bit)

booted & tested on i686-pc-linux-gnu, ok?

nathan
--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

2004-10-31  Nathan Sidwell  <nathan@codesourcery.com>

	* bitmap.c (bitmap_print): Make bitno unsigned.
	* bt-load.c (clear_btr_from_live_range,
	btr_def_live_range): Likewise.
	* caller-save.c (save_call_clobbered_regs): Likewise.
	* cfganal.c (compute_dominance_frontiers_1): Likewise.
	* cfgcleanup.c (thread_jump): Likewise.
	* cfgrtl.c (safe_insert_insn_on_edge): Likewise.
	* conflict.c (conflict_graph_compute): Likewise.
	* ddg.c (add_deps_for_use): Likewise.
	* df.c (df_refs_update): Likewise.
	* except.c (remove_eh_handler): Likewise.
	* flow.c (verify_local_live_at_start, update_life_info,
	initialize_uninitialized_subregs, propagate_one_insn,
	free_propagate_block_info, propagate_block, find_use_as_address,
	reg_set_to_hard_reg_set): Likewise.
	* gcse.c (clear_modify_mem_tables): Likewise.
	* global.c (global_conflicts, build_insn_chain): Likewise.
	* ifcvt.c (dead_or_predicable): Likewise.
	* local-alloc.c (update_equiv_regs): Likewise.
	* loop.c (load_mems): Likewise.
	* ra-build.c (livethrough_conflicts_bb, conflicts_between_webs):
	Likewise.
	* ra-rewrite.c (reloads_to_loads, rewrite_program2, actual_spill):
	Likewise.
	* reload1.c (order_regs_for_reload, finish_spills): Likewise.
	* sched-deps.c (sched_analyze_insn, free_deps): Likewise.
	* sched-rgn.c (propagate_deps
	* tree-cfg.c (tree_purge_all_dead_eh_edges): Likewise.
	* tree-dfa.c (dump_dfa_stats
	tree-into-ssa.c (compute_global_livein, insert_phi_nodes,
	insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags):
	Likewise.
	* tree-outof-ssa.c (coalesce_ssa_name, coalesce_vars,
	free_temp_expr_table, find_replaceable_exprs): Likewise.
	* tree-sra.c (scan_function, scalarize_parms): Likewise.
	* tree-ssa-alias.c (init_alias_info,
	compute_points_to_and_addr_escape,
	compute_flow_sensitive_aliasing, maybe_create_global_var): Likewise.
	* tree-ssa-dce.c (mark_control_dependent_edges_necessary): Likewise.
	* tree-ssa-live.c (new_tree_live_info, live_worklist,
	calculate_live_on_entry, calculate_live_on_exit, compare_pairs,
	sort_coalesce_list, build_tree_conflict_graph, dump_live_info
	tree-ssa-loop-manip.c (add_exit_phis_var): Likewise.
	tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops,
	add_call_read_ops): Likewise.
	* tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Likewise.
	* tree-ssa-live.h (num_var_partitions): Return unsigned.

Index: bitmap.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/bitmap.c,v
retrieving revision 1.54
diff -c -3 -p -r1.54 bitmap.c
*** bitmap.c	29 Oct 2004 08:40:53 -0000	1.54
--- bitmap.c	30 Oct 2004 21:25:02 -0000
*************** void
*** 780,786 ****
  bitmap_print (FILE *file, bitmap head, const char *prefix, const char *suffix)
  {
    const char *comma = "";
!   int i;
    bitmap_iterator bi;
  
    fputs (prefix, file);
--- 780,786 ----
  bitmap_print (FILE *file, bitmap head, const char *prefix, const char *suffix)
  {
    const char *comma = "";
!   unsigned i;
    bitmap_iterator bi;
  
    fputs (prefix, file);
Index: bt-load.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/bt-load.c,v
retrieving revision 2.26
diff -c -3 -p -r2.26 bt-load.c
*** bt-load.c	28 Sep 2004 07:59:42 -0000	2.26
--- bt-load.c	30 Oct 2004 21:25:02 -0000
*************** block_at_edge_of_live_range_p (int bb, b
*** 821,827 ****
  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, bi)
--- 821,827 ----
  static void
  clear_btr_from_live_range (btr_def def)
  {
!   unsigned bb;
    bitmap_iterator bi;
  
    EXECUTE_IF_SET_IN_BITMAP (def->live_range, 0, bb, bi)
*************** clear_btr_from_live_range (btr_def def)
*** 845,851 ****
  static void
  add_btr_to_live_range (btr_def def)
  {
!   int bb;
    bitmap_iterator bi;
  
    EXECUTE_IF_SET_IN_BITMAP (def->live_range, 0, bb, bi)
--- 845,851 ----
  static void
  add_btr_to_live_range (btr_def def)
  {
!   unsigned bb;
    bitmap_iterator bi;
  
    EXECUTE_IF_SET_IN_BITMAP (def->live_range, 0, bb, bi)
*************** btr_def_live_range (btr_def def, HARD_RE
*** 975,985 ****
        def->live_range = BITMAP_XMALLOC ();
  
        bitmap_set_bit (def->live_range, def->bb->index);
!       if (flag_btr_bb_exclusive)
! 	COPY_HARD_REG_SET (*btrs_live_in_range, btrs_live[def->bb->index]);
!       else
! 	COPY_HARD_REG_SET (*btrs_live_in_range,
! 			   btrs_live_at_end[def->bb->index]);
  
        for (user = def->uses; user != NULL; user = user->next)
  	augment_live_range (def->live_range, btrs_live_in_range,
--- 975,983 ----
        def->live_range = BITMAP_XMALLOC ();
  
        bitmap_set_bit (def->live_range, def->bb->index);
!       COPY_HARD_REG_SET (*btrs_live_in_range,
! 			 (flag_btr_bb_exclusive
! 			  ? btrs_live : btrs_live_at_end)[def->bb->index]);
  
        for (user = def->uses; user != NULL; user = user->next)
  	augment_live_range (def->live_range, btrs_live_in_range,
*************** btr_def_live_range (btr_def def, HARD_RE
*** 991,1016 ****
  	 the set of target registers live over it, because migration
  	 of other PT instructions may have affected it.
        */
!       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, bi)
! 	    {
! 	      IOR_HARD_REG_SET (*btrs_live_in_range, btrs_live[bb]);
! 	    }
! 	}
!       else
! 	{
! 	  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 &&
--- 989,1004 ----
  	 the set of target registers live over it, because migration
  	 of other PT instructions may have affected it.
        */
!       unsigned bb;
!       unsigned def_bb = flag_btr_bb_exclusive ? -1 : def->bb->index;
        bitmap_iterator bi;
  
        CLEAR_HARD_REG_SET (*btrs_live_in_range);
!       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 &&
Index: caller-save.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/caller-save.c,v
retrieving revision 1.68
diff -c -3 -p -r1.68 caller-save.c
*** caller-save.c	18 Oct 2004 15:11:25 -0000	1.68
--- caller-save.c	30 Oct 2004 21:25:02 -0000
*************** save_call_clobbered_regs (void)
*** 408,414 ****
  
  	  if (code == CALL_INSN && ! find_reg_note (insn, REG_NORETURN, NULL))
  	    {
! 	      int regno;
  	      HARD_REG_SET hard_regs_to_save;
  	      reg_set_iterator rsi;
  
--- 408,414 ----
  
  	  if (code == CALL_INSN && ! find_reg_note (insn, REG_NORETURN, NULL))
  	    {
! 	      unsigned regno;
  	      HARD_REG_SET hard_regs_to_save;
  	      reg_set_iterator rsi;
  
Index: cfganal.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfganal.c,v
retrieving revision 1.51
diff -c -3 -p -r1.51 cfganal.c
*** cfganal.c	5 Oct 2004 22:55:58 -0000	1.51
--- cfganal.c	30 Oct 2004 21:25:02 -0000
*************** compute_dominance_frontiers_1 (bitmap *f
*** 970,976 ****
         c;
         c = next_dom_son (CDI_DOMINATORS, c))
      {
!       int x;
        bitmap_iterator bi;
  
        EXECUTE_IF_SET_IN_BITMAP (frontiers[c->index], 0, x, bi)
--- 970,976 ----
         c;
         c = next_dom_son (CDI_DOMINATORS, c))
      {
!       unsigned x;
        bitmap_iterator bi;
  
        EXECUTE_IF_SET_IN_BITMAP (frontiers[c->index], 0, x, bi)
Index: cfgcleanup.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgcleanup.c,v
retrieving revision 1.135
diff -c -3 -p -r1.135 cfgcleanup.c
*** cfgcleanup.c	25 Oct 2004 04:23:49 -0000	1.135
--- cfgcleanup.c	30 Oct 2004 21:25:02 -0000
*************** thread_jump (int mode, edge e, basic_blo
*** 279,285 ****
    rtx set1, set2, cond1, cond2, insn;
    enum rtx_code code1, code2, reversed_code2;
    bool reverse1 = false;
!   int i;
    regset nonequal;
    bool failed = false;
    reg_set_iterator rsi;
--- 279,285 ----
    rtx set1, set2, cond1, cond2, insn;
    enum rtx_code code1, code2, reversed_code2;
    bool reverse1 = false;
!   unsigned i;
    regset nonequal;
    bool failed = false;
    reg_set_iterator rsi;
*************** thread_jump (int mode, edge e, basic_blo
*** 348,354 ****
    cselib_init (false);
  
    /* First process all values computed in the source basic block.  */
!   for (insn = NEXT_INSN (BB_HEAD (e->src)); insn != NEXT_INSN (BB_END (e->src));
         insn = NEXT_INSN (insn))
      if (INSN_P (insn))
        cselib_process_insn (insn);
--- 348,355 ----
    cselib_init (false);
  
    /* First process all values computed in the source basic block.  */
!   for (insn = NEXT_INSN (BB_HEAD (e->src));
!        insn != NEXT_INSN (BB_END (e->src));
         insn = NEXT_INSN (insn))
      if (INSN_P (insn))
        cselib_process_insn (insn);
*************** thread_jump (int mode, edge e, basic_blo
*** 360,366 ****
       processing as if it were same basic block.
       Our goal is to prove that whole block is an NOOP.  */
  
!   for (insn = NEXT_INSN (BB_HEAD (b)); insn != NEXT_INSN (BB_END (b)) && !failed;
         insn = NEXT_INSN (insn))
      {
        if (INSN_P (insn))
--- 361,368 ----
       processing as if it were same basic block.
       Our goal is to prove that whole block is an NOOP.  */
  
!   for (insn = NEXT_INSN (BB_HEAD (b));
!        insn != NEXT_INSN (BB_END (b)) && !failed;
         insn = NEXT_INSN (insn))
      {
        if (INSN_P (insn))
*************** thread_jump (int mode, edge e, basic_blo
*** 369,375 ****
  
  	  if (GET_CODE (pat) == PARALLEL)
  	    {
! 	      for (i = 0; i < XVECLEN (pat, 0); i++)
  		failed |= mark_effect (XVECEXP (pat, 0, i), nonequal);
  	    }
  	  else
--- 371,377 ----
  
  	  if (GET_CODE (pat) == PARALLEL)
  	    {
! 	      for (i = 0; i < (unsigned)XVECLEN (pat, 0); i++)
  		failed |= mark_effect (XVECEXP (pat, 0, i), nonequal);
  	    }
  	  else
Index: cfgrtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgrtl.c,v
retrieving revision 1.142
diff -c -3 -p -r1.142 cfgrtl.c
*** cfgrtl.c	29 Oct 2004 08:40:53 -0000	1.142
--- cfgrtl.c	30 Oct 2004 21:25:02 -0000
*************** safe_insert_insn_on_edge (rtx insn, edge
*** 1463,1469 ****
    regset_head killed_head;
    regset killed = INITIALIZE_REG_SET (killed_head);
    rtx save_regs = NULL_RTX;
!   int regno, noccmode;
    enum machine_mode mode;
    reg_set_iterator rsi;
  
--- 1463,1470 ----
    regset_head killed_head;
    regset killed = INITIALIZE_REG_SET (killed_head);
    rtx save_regs = NULL_RTX;
!   unsigned regno;
!   int noccmode;
    enum machine_mode mode;
    reg_set_iterator rsi;
  
Index: conflict.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/conflict.c,v
retrieving revision 1.26
diff -c -3 -p -r1.26 conflict.c
*** conflict.c	18 Oct 2004 15:11:26 -0000	1.26
--- conflict.c	30 Oct 2004 21:25:02 -0000
*************** conflict_graph_compute (regset regs, par
*** 439,446 ****
        insn = BB_END (bb);
        for (insn = BB_END (bb); insn != head; insn = PREV_INSN (insn))
  	{
! 	  int born_reg;
! 	  int live_reg;
  	  rtx link;
  
  	  /* Are we interested in this insn? */
--- 439,446 ----
        insn = BB_END (bb);
        for (insn = BB_END (bb); insn != head; insn = PREV_INSN (insn))
  	{
! 	  unsigned born_reg;
! 	  unsigned live_reg;
  	  rtx link;
  
  	  /* Are we interested in this insn? */
Index: ddg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ddg.c,v
retrieving revision 1.9
diff -c -3 -p -r1.9 ddg.c
*** ddg.c	26 Sep 2004 19:53:10 -0000	1.9
--- ddg.c	30 Oct 2004 21:25:02 -0000
*************** add_deps_for_use (ddg_ptr g, struct df *
*** 311,317 ****
  static void
  build_inter_loop_deps (ddg_ptr g, struct df *df)
  {
!   int rd_num, u_num;
    struct bb_info *bb_info;
    bitmap_iterator bi;
  
--- 311,317 ----
  static void
  build_inter_loop_deps (ddg_ptr g, struct df *df)
  {
!   unsigned rd_num, u_num;
    struct bb_info *bb_info;
    bitmap_iterator bi;
  
Index: df.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/df.c,v
retrieving revision 1.74
diff -c -3 -p -r1.74 df.c
*** df.c	29 Oct 2004 08:40:54 -0000	1.74
--- df.c	30 Oct 2004 21:25:02 -0000
*************** static int
*** 2238,2244 ****
  df_refs_update (struct df *df, bitmap blocks)
  {
    basic_block bb;
!   int count = 0, bbno;
  
    df->n_regs = max_reg_num ();
    if (df->n_regs >= df->reg_size)
--- 2238,2244 ----
  df_refs_update (struct df *df, bitmap blocks)
  {
    basic_block bb;
!   unsigned count = 0, bbno;
  
    df->n_regs = max_reg_num ();
    if (df->n_regs >= df->reg_size)
Index: except.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/except.c,v
retrieving revision 1.290
diff -c -3 -p -r1.290 except.c
*** except.c	28 Sep 2004 07:59:46 -0000	1.290
--- except.c	30 Oct 2004 21:25:03 -0000
*************** remove_eh_handler (struct eh_region *reg
*** 2279,2285 ****
    cfun->eh->region_array[region->region_number] = outer;
    if (region->aka)
      {
!       int i;
        bitmap_iterator bi;
  
        EXECUTE_IF_SET_IN_BITMAP (region->aka, 0, i, bi)
--- 2279,2285 ----
    cfun->eh->region_array[region->region_number] = outer;
    if (region->aka)
      {
!       unsigned i;
        bitmap_iterator bi;
  
        EXECUTE_IF_SET_IN_BITMAP (region->aka, 0, i, bi)
Index: flow.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/flow.c,v
retrieving revision 1.602
diff -c -3 -p -r1.602 flow.c
*** flow.c	29 Oct 2004 08:40:54 -0000	1.602
--- flow.c	30 Oct 2004 21:25:03 -0000
*************** verify_local_live_at_start (regset new_l
*** 520,526 ****
      }
    else
      {
!       int i;
        reg_set_iterator rsi;
  
        /* Find the set of changed registers.  */
--- 520,526 ----
      }
    else
      {
!       unsigned i;
        reg_set_iterator rsi;
  
        /* Find the set of changed registers.  */
*************** update_life_info (sbitmap blocks, enum u
*** 570,576 ****
  {
    regset tmp;
    regset_head tmp_head;
!   int i;
    int stabilized_prop_flags = prop_flags;
    basic_block bb;
  
--- 570,576 ----
  {
    regset tmp;
    regset_head tmp_head;
!   unsigned i;
    int stabilized_prop_flags = prop_flags;
    basic_block bb;
  
*************** initialize_uninitialized_subregs (void)
*** 1358,1364 ****
  {
    rtx insn;
    edge e;
!   int reg, did_something = 0;
    find_regno_partial_param param;
    edge_iterator ei;
  
--- 1358,1364 ----
  {
    rtx insn;
    edge e;
!   unsigned reg, did_something = 0;
    find_regno_partial_param param;
    edge_iterator ei;
  
*************** propagate_one_insn (struct propagate_blo
*** 1523,1529 ****
    int insn_is_dead = 0;
    int libcall_is_dead = 0;
    rtx note;
!   int i;
  
    if (! INSN_P (insn))
      return prev;
--- 1523,1529 ----
    int insn_is_dead = 0;
    int libcall_is_dead = 0;
    rtx note;
!   unsigned i;
  
    if (! INSN_P (insn))
      return prev;
*************** free_propagate_block_info (struct propag
*** 1967,1973 ****
    if (pbi->flags & PROP_REG_INFO)
      {
        int num = pbi->insn_num;
!       int i;
        reg_set_iterator rsi;
  
        EXECUTE_IF_SET_IN_REG_SET (pbi->reg_live, 0, i, rsi)
--- 1967,1973 ----
    if (pbi->flags & PROP_REG_INFO)
      {
        int num = pbi->insn_num;
!       unsigned i;
        reg_set_iterator rsi;
  
        EXECUTE_IF_SET_IN_REG_SET (pbi->reg_live, 0, i, rsi)
*************** propagate_block (basic_block bb, regset 
*** 2012,2018 ****
  
    if (flags & PROP_REG_INFO)
      {
!       int i;
        reg_set_iterator rsi;
  
        /* Process the regs live at the end of the block.
--- 2012,2018 ----
  
    if (flags & PROP_REG_INFO)
      {
!       unsigned i;
        reg_set_iterator rsi;
  
        /* Process the regs live at the end of the block.
*************** find_use_as_address (rtx x, rtx reg, HOS
*** 4139,4145 ****
  void
  dump_regset (regset r, FILE *outf)
  {
!   int i;
    reg_set_iterator rsi;
  
    if (r == NULL)
--- 4139,4145 ----
  void
  dump_regset (regset r, FILE *outf)
  {
!   unsigned i;
    reg_set_iterator rsi;
  
    if (r == NULL)
*************** clear_log_links (sbitmap blocks)
*** 4328,4334 ****
  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, bi)
--- 4328,4334 ----
  void
  reg_set_to_hard_reg_set (HARD_REG_SET *to, bitmap from)
  {
!   unsigned i;
    bitmap_iterator bi;
  
    EXECUTE_IF_SET_IN_BITMAP (from, 0, i, bi)
Index: gcse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcse.c,v
retrieving revision 1.321
diff -c -3 -p -r1.321 gcse.c
*** gcse.c	30 Oct 2004 00:56:55 -0000	1.321
--- gcse.c	30 Oct 2004 21:25:03 -0000
*************** free_insn_expr_list_list (rtx *listp)
*** 2271,2277 ****
  static void
  clear_modify_mem_tables (void)
  {
!   int i;
    bitmap_iterator bi;
  
    EXECUTE_IF_SET_IN_BITMAP (modify_mem_list_set, 0, i, bi)
--- 2271,2277 ----
  static void
  clear_modify_mem_tables (void)
  {
!   unsigned i;
    bitmap_iterator bi;
  
    EXECUTE_IF_SET_IN_BITMAP (modify_mem_list_set, 0, i, bi)
Index: global.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/global.c,v
retrieving revision 1.112
diff -c -3 -p -r1.112 global.c
*** global.c	18 Oct 2004 15:11:28 -0000	1.112
--- global.c	30 Oct 2004 21:25:05 -0000
*************** allocno_compare (const void *v1p, const 
*** 669,675 ****
  static void
  global_conflicts (void)
  {
!   int i;
    basic_block b;
    rtx insn;
    int *block_start_allocnos;
--- 669,675 ----
  static void
  global_conflicts (void)
  {
!   unsigned i;
    basic_block b;
    rtx insn;
    int *block_start_allocnos;
*************** build_insn_chain (rtx first)
*** 1816,1822 ****
  
        if (first == BB_HEAD (b))
  	{
! 	  int i;
  	  bitmap_iterator bi;
  
  	  CLEAR_REG_SET (live_relevant_regs);
--- 1816,1822 ----
  
        if (first == BB_HEAD (b))
  	{
! 	  unsigned i;
  	  bitmap_iterator bi;
  
  	  CLEAR_REG_SET (live_relevant_regs);
Index: ifcvt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ifcvt.c,v
retrieving revision 1.168
diff -c -3 -p -r1.168 ifcvt.c
*** ifcvt.c	29 Oct 2004 08:40:58 -0000	1.168
--- ifcvt.c	30 Oct 2004 21:25:05 -0000
*************** dead_or_predicable (basic_block test_bb,
*** 3133,3139 ****
        regset_head merge_set_head, tmp_head, test_live_head, test_set_head;
        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.  */
--- 3133,3139 ----
        regset_head merge_set_head, tmp_head, test_live_head, test_set_head;
        regset merge_set, tmp, test_live, test_set;
        struct propagate_block_info *pbi;
!       unsigned i, fail = 0;
        bitmap_iterator bi;
  
        /* Check for no calls or trapping operations.  */
Index: local-alloc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/local-alloc.c,v
retrieving revision 1.140
diff -c -3 -p -r1.140 local-alloc.c
*** local-alloc.c	18 Oct 2004 15:11:29 -0000	1.140
--- local-alloc.c	30 Oct 2004 21:25:05 -0000
*************** update_equiv_regs (void)
*** 1118,1124 ****
    /* Clear all dead REGNOs from all basic block's live info.  */
    if (clear_regnos)
      {
!       int j;
        if (clear_regnos > 8)
  	{
  	  FOR_EACH_BB (bb)
--- 1118,1125 ----
    /* Clear all dead REGNOs from all basic block's live info.  */
    if (clear_regnos)
      {
!       unsigned j;
!       
        if (clear_regnos > 8)
  	{
  	  FOR_EACH_BB (bb)
Index: loop.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/loop.c,v
retrieving revision 1.514
diff -c -3 -p -r1.514 loop.c
*** loop.c	18 Oct 2004 15:11:29 -0000	1.514
--- loop.c	30 Oct 2004 21:25:06 -0000
*************** load_mems (const struct loop *loop)
*** 11240,11246 ****
  	  cselib_val *e = cselib_lookup (mem, VOIDmode, 0);
  	  rtx set;
  	  rtx best = mem;
! 	  int j;
  	  struct elt_loc_list *const_equiv = 0;
  	  reg_set_iterator rsi;
  
--- 11240,11246 ----
  	  cselib_val *e = cselib_lookup (mem, VOIDmode, 0);
  	  rtx set;
  	  rtx best = mem;
! 	  unsigned j;
  	  struct elt_loc_list *const_equiv = 0;
  	  reg_set_iterator rsi;
  
Index: ra-build.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ra-build.c,v
retrieving revision 1.36
diff -c -3 -p -r1.36 ra-build.c
*** ra-build.c	29 Oct 2004 08:40:59 -0000	1.36
--- ra-build.c	30 Oct 2004 21:25:06 -0000
*************** livethrough_conflicts_bb (basic_block bb
*** 1022,1028 ****
    struct ra_bb_info *info = (struct ra_bb_info *) bb->aux;
    rtx insn;
    bitmap all_defs;
!   int first, use_id;
    unsigned int deaths = 0;
    unsigned int contains_call = 0;
  
--- 1022,1029 ----
    struct ra_bb_info *info = (struct ra_bb_info *) bb->aux;
    rtx insn;
    bitmap all_defs;
!   int first;
!   unsigned use_id;
    unsigned int deaths = 0;
    unsigned int contains_call = 0;
  
*************** conflicts_between_webs (struct df *df)
*** 2193,2199 ****
        for (; cl; cl = cl->next)
          if (cl->conflicts)
  	  {
! 	    int j;
  	    struct web *web1 = find_subweb_2 (supweb1, cl->size_word);
  	    bitmap_iterator bi;
  
--- 2194,2200 ----
        for (; cl; cl = cl->next)
          if (cl->conflicts)
  	  {
! 	    unsigned j;
  	    struct web *web1 = find_subweb_2 (supweb1, cl->size_word);
  	    bitmap_iterator bi;
  
Index: ra-rewrite.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ra-rewrite.c,v
retrieving revision 1.29
diff -c -3 -p -r1.29 ra-rewrite.c
*** ra-rewrite.c	29 Oct 2004 08:41:00 -0000	1.29
--- ra-rewrite.c	30 Oct 2004 21:25:06 -0000
*************** reloads_to_loads (struct rewrite_info *r
*** 996,1002 ****
        struct web *web = ref2web[DF_REF_ID (refs[n])];
        struct web *supweb = find_web_for_subweb (web);
        int is_death;
!       int j;
        /* Only emit reloads when entering their interference
  	 region.  A use of a spilled web never opens an
  	 interference region, independent of it's color.  */
--- 996,1003 ----
        struct web *web = ref2web[DF_REF_ID (refs[n])];
        struct web *supweb = find_web_for_subweb (web);
        int is_death;
!       unsigned j;
!       
        /* Only emit reloads when entering their interference
  	 region.  A use of a spilled web never opens an
  	 interference region, independent of it's color.  */
*************** rewrite_program2 (bitmap new_deaths)
*** 1062,1068 ****
      {
        basic_block last_bb = NULL;
        rtx last_block_insn;
!       int i, j;
        bitmap_iterator bi;
  
        if (!INSN_P (insn))
--- 1063,1069 ----
      {
        basic_block last_bb = NULL;
        rtx last_block_insn;
!       unsigned i, j;
        bitmap_iterator bi;
  
        if (!INSN_P (insn))
*************** rewrite_program2 (bitmap new_deaths)
*** 1355,1361 ****
  	  CLEAR_HARD_REG_SET (cum_colors);
  	  FOR_EACH_EDGE (e, ei, bb->preds)
  	    {
! 	      int j;
  
  	      if (num >= 5)
  		break;
--- 1356,1362 ----
  	  CLEAR_HARD_REG_SET (cum_colors);
  	  FOR_EACH_EDGE (e, ei, bb->preds)
  	    {
! 	      unsigned j;
  
  	      if (num >= 5)
  		break;
*************** reset_changed_flag (void)
*** 1629,1635 ****
  void
  actual_spill (void)
  {
!   int i;
    bitmap_iterator bi;
    bitmap new_deaths = BITMAP_XMALLOC ();
  
--- 1630,1636 ----
  void
  actual_spill (void)
  {
!   unsigned i;
    bitmap_iterator bi;
    bitmap new_deaths = BITMAP_XMALLOC ();
  
Index: reload1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/reload1.c,v
retrieving revision 1.451
diff -c -3 -p -r1.451 reload1.c
*** reload1.c	18 Oct 2004 23:54:36 -0000	1.451
--- reload1.c	30 Oct 2004 21:25:07 -0000
*************** count_pseudo (int reg)
*** 1589,1595 ****
  static void
  order_regs_for_reload (struct insn_chain *chain)
  {
!   int i;
    HARD_REG_SET used_by_pseudos;
    HARD_REG_SET used_by_pseudos2;
    reg_set_iterator rsi;
--- 1589,1595 ----
  static void
  order_regs_for_reload (struct insn_chain *chain)
  {
!   unsigned i;
    HARD_REG_SET used_by_pseudos;
    HARD_REG_SET used_by_pseudos2;
    reg_set_iterator rsi;
*************** finish_spills (int global)
*** 3543,3549 ****
  {
    struct insn_chain *chain;
    int something_changed = 0;
!   int i;
    reg_set_iterator rsi;
  
    /* Build the spill_regs array for the function.  */
--- 3543,3549 ----
  {
    struct insn_chain *chain;
    int something_changed = 0;
!   unsigned i;
    reg_set_iterator rsi;
  
    /* Build the spill_regs array for the function.  */
*************** finish_spills (int global)
*** 3613,3619 ****
  	 and call retry_global_alloc.
  	 We change spill_pseudos here to only contain pseudos that did not
  	 get a new hard register.  */
!       for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++)
  	if (reg_old_renumber[i] != reg_renumber[i])
  	  {
  	    HARD_REG_SET forbidden;
--- 3613,3619 ----
  	 and call retry_global_alloc.
  	 We change spill_pseudos here to only contain pseudos that did not
  	 get a new hard register.  */
!       for (i = FIRST_PSEUDO_REGISTER; i < (unsigned)max_regno; i++)
  	if (reg_old_renumber[i] != reg_renumber[i])
  	  {
  	    HARD_REG_SET forbidden;
*************** finish_spills (int global)
*** 3661,3667 ****
      }
  
    /* Let alter_reg modify the reg rtx's for the modified pseudos.  */
!   for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++)
      {
        int regno = reg_renumber[i];
        if (reg_old_renumber[i] == regno)
--- 3661,3667 ----
      }
  
    /* Let alter_reg modify the reg rtx's for the modified pseudos.  */
!   for (i = FIRST_PSEUDO_REGISTER; i < (unsigned)max_regno; i++)
      {
        int regno = reg_renumber[i];
        if (reg_old_renumber[i] == regno)
Index: sched-deps.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/sched-deps.c,v
retrieving revision 1.81
diff -c -3 -p -r1.81 sched-deps.c
*** sched-deps.c	18 Oct 2004 15:11:30 -0000	1.81
--- sched-deps.c	30 Oct 2004 21:25:07 -0000
*************** sched_analyze_insn (struct deps *deps, r
*** 821,827 ****
  {
    RTX_CODE code = GET_CODE (x);
    rtx link;
!   int i;
    reg_set_iterator rsi;
  
    if (code == COND_EXEC)
--- 821,827 ----
  {
    RTX_CODE code = GET_CODE (x);
    rtx link;
!   unsigned i;
    reg_set_iterator rsi;
  
    if (code == COND_EXEC)
*************** sched_analyze_insn (struct deps *deps, r
*** 845,852 ****
      }
    else if (code == PARALLEL)
      {
!       int i;
!       for (i = XVECLEN (x, 0) - 1; i >= 0; i--)
  	{
  	  rtx sub = XVECEXP (x, 0, i);
  	  code = GET_CODE (sub);
--- 845,851 ----
      }
    else if (code == PARALLEL)
      {
!       for (i = XVECLEN (x, 0); i--;)
  	{
  	  rtx sub = XVECEXP (x, 0, i);
  	  code = GET_CODE (sub);
*************** sched_analyze_insn (struct deps *deps, r
*** 1006,1012 ****
  	    }
  	}
  
!       for (i = 0; i < deps->max_reg; i++)
  	{
  	  struct deps_reg *reg_last = &deps->reg_last[i];
  	  reg_last->sets = alloc_INSN_LIST (insn, reg_last->sets);
--- 1005,1011 ----
  	    }
  	}
  
!       for (i = 0; i < (unsigned)deps->max_reg; i++)
  	{
  	  struct deps_reg *reg_last = &deps->reg_last[i];
  	  reg_last->sets = alloc_INSN_LIST (insn, reg_last->sets);
*************** init_deps (struct deps *deps)
*** 1461,1467 ****
  void
  free_deps (struct deps *deps)
  {
!   int i;
    reg_set_iterator rsi;
  
    free_INSN_LIST_list (&deps->pending_read_insns);
--- 1460,1466 ----
  void
  free_deps (struct deps *deps)
  {
!   unsigned i;
    reg_set_iterator rsi;
  
    free_INSN_LIST_list (&deps->pending_read_insns);
Index: sched-rgn.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/sched-rgn.c,v
retrieving revision 1.85
diff -c -3 -p -r1.85 sched-rgn.c
*** sched-rgn.c	18 Oct 2004 15:11:30 -0000	1.85
--- sched-rgn.c	30 Oct 2004 21:25:07 -0000
*************** propagate_deps (int bb, struct deps *pre
*** 1986,1992 ****
    FOR_EACH_EDGE (e, ei, block->succs)
      {
        struct deps *succ_deps;
!       int reg;
        reg_set_iterator rsi;
  
        /* Only bbs "below" bb, in the same region, are interesting.  */
--- 1986,1992 ----
    FOR_EACH_EDGE (e, ei, block->succs)
      {
        struct deps *succ_deps;
!       unsigned reg;
        reg_set_iterator rsi;
  
        /* Only bbs "below" bb, in the same region, are interesting.  */
Index: tree-cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-cfg.c,v
retrieving revision 2.94
diff -c -3 -p -r2.94 tree-cfg.c
*** tree-cfg.c	28 Oct 2004 13:31:40 -0000	2.94
--- tree-cfg.c	30 Oct 2004 21:25:07 -0000
*************** bool
*** 5124,5130 ****
  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, bi)
--- 5124,5130 ----
  tree_purge_all_dead_eh_edges (bitmap blocks)
  {
    bool changed = false;
!   unsigned i;
    bitmap_iterator bi;
  
    EXECUTE_IF_SET_IN_BITMAP (blocks, 0, i, bi)
Index: tree-dfa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-dfa.c,v
retrieving revision 2.41
diff -c -3 -p -r2.41 tree-dfa.c
*** tree-dfa.c	27 Oct 2004 17:45:19 -0000	2.41
--- tree-dfa.c	30 Oct 2004 21:25:07 -0000
*************** dump_dfa_stats (FILE *file)
*** 688,694 ****
  
    size = num_referenced_vars * sizeof (tree);
    total += size;
!   fprintf (file, fmt_str_1, "Referenced variables", num_referenced_vars,
  	   SCALE (size), LABEL (size));
  
    size = dfa_stats.num_stmt_anns * sizeof (struct stmt_ann_d);
--- 688,694 ----
  
    size = num_referenced_vars * sizeof (tree);
    total += size;
!   fprintf (file, fmt_str_1, "Referenced variables", (unsigned long)num_referenced_vars,
  	   SCALE (size), LABEL (size));
  
    size = dfa_stats.num_stmt_anns * sizeof (struct stmt_ann_d);
Index: tree-into-ssa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-into-ssa.c,v
retrieving revision 2.28
diff -c -3 -p -r2.28 tree-into-ssa.c
*** tree-into-ssa.c	29 Oct 2004 08:41:00 -0000	2.28
--- tree-into-ssa.c	30 Oct 2004 21:25:07 -0000
*************** void
*** 230,236 ****
  compute_global_livein (bitmap livein, bitmap def_blocks)
  {
    basic_block bb, *worklist, *tos;
!   int i;
    bitmap_iterator bi;
  
    tos = worklist
--- 230,236 ----
  compute_global_livein (bitmap livein, bitmap def_blocks)
  {
    basic_block bb, *worklist, *tos;
!   unsigned i;
    bitmap_iterator bi;
  
    tos = worklist
*************** void insert_phi_nodes_1 (tree var, bitma
*** 603,609 ****
  static void
  insert_phi_nodes (bitmap *dfs, bitmap names_to_rename)
  {
!   size_t i;
    varray_type work_stack;
    bitmap_iterator bi;
  
--- 603,609 ----
  static void
  insert_phi_nodes (bitmap *dfs, bitmap names_to_rename)
  {
!   unsigned i;
    varray_type work_stack;
    bitmap_iterator bi;
  
*************** insert_phi_nodes_for (tree var, bitmap *
*** 1005,1011 ****
  {
    struct def_blocks_d *def_map;
    bitmap phi_insertion_points;
!   int bb_index;
    edge e;
    tree phi;
    basic_block bb;
--- 1005,1011 ----
  {
    struct def_blocks_d *def_map;
    bitmap phi_insertion_points;
!   unsigned bb_index;
    edge e;
    tree phi;
    basic_block bb;
*************** insert_phi_nodes_for (tree var, bitmap *
*** 1036,1042 ****
       We now always use fully pruned SSA form.  */
    while (VARRAY_ACTIVE_SIZE (*work_stack) > 0)
      {
!       int dfs_index;
        bitmap_iterator bi;
  
        bb = VARRAY_TOP_GENERIC_PTR_NOGC (*work_stack);
--- 1036,1042 ----
       We now always use fully pruned SSA form.  */
    while (VARRAY_ACTIVE_SIZE (*work_stack) > 0)
      {
!       unsigned dfs_index;
        bitmap_iterator bi;
  
        bb = VARRAY_TOP_GENERIC_PTR_NOGC (*work_stack);
*************** debug_def_blocks (void)
*** 1303,1326 ****
  static int
  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, bi)
!     {
!       fprintf (stderr, "%ld ", i);
!     }
!   fprintf (stderr, "}");
!   fprintf (stderr, ", LIVEIN_BLOCKS: { ");
!   EXECUTE_IF_SET_IN_BITMAP (db_p->livein_blocks, 0, i, bi)
!     {
!       fprintf (stderr, "%ld ", i);
!     }
!   fprintf (stderr, "}\n");
  
    return 1;
  }
--- 1303,1314 ----
  static int
  debug_def_blocks_r (void **slot, void *data ATTRIBUTE_UNUSED)
  {
    struct def_blocks_d *db_p = (struct def_blocks_d *) *slot;
    
    fprintf (stderr, "VAR: ");
    print_generic_expr (stderr, db_p->var, dump_flags);
!   bitmap_print (stderr, db_p->def_blocks, ", DEF_BLOCKS: { ", "}");
!   bitmap_print (stderr, db_p->livein_blocks, ", LIVEIN_BLOCKS: { ", "}\n");
  
    return 1;
  }
*************** get_def_blocks_for (tree var)
*** 1382,1388 ****
  static void
  invalidate_name_tags (bitmap vars_to_rename)
  {
!   size_t i;
    bool rename_name_tags_p;
    bitmap_iterator bi;
  
--- 1370,1376 ----
  static void
  invalidate_name_tags (bitmap vars_to_rename)
  {
!   unsigned i;
    bool rename_name_tags_p;
    bitmap_iterator bi;
  
Index: tree-outof-ssa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-outof-ssa.c,v
retrieving revision 2.27
diff -c -3 -p -r2.27 tree-outof-ssa.c
*** tree-outof-ssa.c	12 Oct 2004 20:51:50 -0000	2.27
--- tree-outof-ssa.c	30 Oct 2004 21:25:07 -0000
*************** coalesce_abnormal_edges (var_map map, co
*** 681,687 ****
  static tree_live_info_p
  coalesce_ssa_name (var_map map, int flags)
  {
!   int num, x, i;
    sbitmap live;
    tree var, phi;
    root_var_p rv;
--- 681,687 ----
  static tree_live_info_p
  coalesce_ssa_name (var_map map, int flags)
  {
!   unsigned num, x, i;
    sbitmap live;
    tree var, phi;
    root_var_p rv;
*************** coalesce_ssa_name (var_map map, int flag
*** 718,724 ****
  	      int p = var_to_partition (map, res);
  	      if (p == NO_PARTITION)
  		continue;
! 	      for (x = 0; x < PHI_NUM_ARGS (phi); x++)
  		{
  		  tree arg = PHI_ARG_DEF (phi, x);
  		  int p2;
--- 718,724 ----
  	      int p = var_to_partition (map, res);
  	      if (p == NO_PARTITION)
  		continue;
! 	      for (x = 0; x < (unsigned)PHI_NUM_ARGS (phi); x++)
  		{
  		  tree arg = PHI_ARG_DEF (phi, x);
  		  int p2;
*************** coalesce_vars (var_map map, tree_live_in
*** 1057,1063 ****
    basic_block bb;
    type_var_p tv;
    tree var;
!   int x, p, p2;
    coalesce_list_p cl;
    conflict_graph graph;
  
--- 1057,1063 ----
    basic_block bb;
    type_var_p tv;
    tree var;
!   unsigned x, p, p2;
    coalesce_list_p cl;
    conflict_graph graph;
  
*************** coalesce_vars (var_map map, tree_live_in
*** 1077,1102 ****
    FOR_EACH_BB (bb)
      {
        tree phi, arg;
!       int p;
        for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
  	{
  	  p = var_to_partition (map, PHI_RESULT (phi));
  
  	  /* Skip virtual PHI nodes.  */
! 	  if (p == NO_PARTITION)
  	    continue;
  
  	  make_live_on_entry (liveinfo, bb, p);
  
  	  /* Each argument is a potential copy operation. Add any arguments 
  	     which are not coalesced to the result to the coalesce list.  */
! 	  for (x = 0; x < PHI_NUM_ARGS (phi); x++)
  	    {
  	      arg = PHI_ARG_DEF (phi, x);
  	      if (!phi_ssa_name_p (arg))
  	        continue;
  	      p2 = var_to_partition (map, arg);
! 	      if (p2 == NO_PARTITION)
  		continue;
  	      if (p != p2)
  	        add_coalesce (cl, p, p2, 1);
--- 1077,1103 ----
    FOR_EACH_BB (bb)
      {
        tree phi, arg;
!       unsigned p;
!       
        for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
  	{
  	  p = var_to_partition (map, PHI_RESULT (phi));
  
  	  /* Skip virtual PHI nodes.  */
! 	  if (p == (unsigned)NO_PARTITION)
  	    continue;
  
  	  make_live_on_entry (liveinfo, bb, p);
  
  	  /* Each argument is a potential copy operation. Add any arguments 
  	     which are not coalesced to the result to the coalesce list.  */
! 	  for (x = 0; x < (unsigned)PHI_NUM_ARGS (phi); x++)
  	    {
  	      arg = PHI_ARG_DEF (phi, x);
  	      if (!phi_ssa_name_p (arg))
  	        continue;
  	      p2 = var_to_partition (map, arg);
! 	      if (p2 == (unsigned)NO_PARTITION)
  		continue;
  	      if (p != p2)
  	        add_coalesce (cl, p, p2, 1);
*************** free_temp_expr_table (temp_expr_table_p 
*** 1278,1284 ****
    tree *ret = NULL;
  
  #ifdef ENABLE_CHECKING
!   int x;
    for (x = 0; x <= num_var_partitions (t->map); x++)
      gcc_assert (!t->partition_dep_list[x]);
  #endif
--- 1279,1285 ----
    tree *ret = NULL;
  
  #ifdef ENABLE_CHECKING
!   unsigned x;
    for (x = 0; x <= num_var_partitions (t->map); x++)
      gcc_assert (!t->partition_dep_list[x]);
  #endif
*************** static tree *
*** 1695,1701 ****
  find_replaceable_exprs (var_map map)
  {
    basic_block bb;
!   int i;
    temp_expr_table_p table;
    tree *ret;
  
--- 1696,1702 ----
  find_replaceable_exprs (var_map map)
  {
    basic_block bb;
!   unsigned i;
    temp_expr_table_p table;
    tree *ret;
  
Index: tree-sra.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-sra.c,v
retrieving revision 2.40
diff -c -3 -p -r2.40 tree-sra.c
*** tree-sra.c	29 Oct 2004 08:41:02 -0000	2.40
--- tree-sra.c	30 Oct 2004 21:25:07 -0000
*************** scan_function (void)
*** 1018,1024 ****
  
    if (dump_file && (dump_flags & TDF_DETAILS))
      {
!       size_t i;
  
        fputs ("\nScan results:\n", dump_file);
        EXECUTE_IF_SET_IN_BITMAP (sra_candidates, 0, i, bi)
--- 1018,1024 ----
  
    if (dump_file && (dump_flags & TDF_DETAILS))
      {
!       unsigned i;
  
        fputs ("\nScan results:\n", dump_file);
        EXECUTE_IF_SET_IN_BITMAP (sra_candidates, 0, i, bi)
*************** static void
*** 1967,1973 ****
  scalarize_parms (void)
  {
    tree list = NULL;
!   size_t i;
    bitmap_iterator bi;
  
    EXECUTE_IF_SET_IN_BITMAP (needs_copy_in, 0, i, bi)
--- 1967,1973 ----
  scalarize_parms (void)
  {
    tree list = NULL;
!   unsigned i;
    bitmap_iterator bi;
  
    EXECUTE_IF_SET_IN_BITMAP (needs_copy_in, 0, i, bi)
Index: tree-ssa-alias.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-alias.c,v
retrieving revision 2.49
diff -c -3 -p -r2.49 tree-ssa-alias.c
*** tree-ssa-alias.c	29 Oct 2004 08:41:02 -0000	2.49
--- tree-ssa-alias.c	30 Oct 2004 21:25:07 -0000
*************** init_alias_info (void)
*** 379,385 ****
    /* If aliases have been computed before, clear existing information.  */
    if (aliases_computed_p)
      {
!       size_t i;
        bitmap_iterator bi;
  
        /* Clear the call-clobbered set.  We are going to re-discover
--- 379,385 ----
    /* If aliases have been computed before, clear existing information.  */
    if (aliases_computed_p)
      {
!       unsigned i;
        bitmap_iterator bi;
  
        /* Clear the call-clobbered set.  We are going to re-discover
*************** static void
*** 570,576 ****
  compute_points_to_and_addr_escape (struct alias_info *ai)
  {
    basic_block bb;
!   size_t i;
    tree op;
    ssa_op_iter iter;
  
--- 570,576 ----
  compute_points_to_and_addr_escape (struct alias_info *ai)
  {
    basic_block bb;
!   unsigned i;
    tree op;
    ssa_op_iter iter;
  
*************** compute_flow_sensitive_aliasing (struct 
*** 831,837 ****
  
    for (i = 0; i < VARRAY_ACTIVE_SIZE (ai->processed_ptrs); i++)
      {
!       size_t j;
        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));
--- 831,837 ----
  
    for (i = 0; i < VARRAY_ACTIVE_SIZE (ai->processed_ptrs); i++)
      {
!       unsigned j;
        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));
*************** setup_pointers_and_addressables (struct 
*** 1480,1486 ****
  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.  */
--- 1480,1486 ----
  static void
  maybe_create_global_var (struct alias_info *ai)
  {
!   unsigned i, n_clobbered;
    bitmap_iterator bi;
    
    /* No need to create it, if we have one already.  */
Index: tree-ssa-dce.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-dce.c,v
retrieving revision 2.25
diff -c -3 -p -r2.25 tree-ssa-dce.c
*** tree-ssa-dce.c	28 Oct 2004 02:56:50 -0000	2.25
--- tree-ssa-dce.c	30 Oct 2004 21:25:08 -0000
*************** find_obviously_necessary_stmts (struct e
*** 508,514 ****
  static void
  mark_control_dependent_edges_necessary (basic_block bb, struct edge_list *el)
  {
!   int edge_number;
  
    gcc_assert (bb != EXIT_BLOCK_PTR);
  
--- 508,514 ----
  static void
  mark_control_dependent_edges_necessary (basic_block bb, struct edge_list *el)
  {
!   unsigned edge_number;
  
    gcc_assert (bb != EXIT_BLOCK_PTR);
  
Index: tree-ssa-live.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-live.c,v
retrieving revision 2.23
diff -c -3 -p -r2.23 tree-ssa-live.c
*** tree-ssa-live.c	28 Sep 2004 18:14:33 -0000	2.23
--- tree-ssa-live.c	30 Oct 2004 21:25:08 -0000
*************** static tree_live_info_p
*** 433,439 ****
  new_tree_live_info (var_map map)
  {
    tree_live_info_p live;
!   int x;
  
    live = (tree_live_info_p) xmalloc (sizeof (struct tree_live_info_d));
    live->map = map;
--- 433,439 ----
  new_tree_live_info (var_map map)
  {
    tree_live_info_p live;
!   unsigned x;
  
    live = (tree_live_info_p) xmalloc (sizeof (struct tree_live_info_d));
    live->map = map;
*************** delete_tree_live_info (tree_live_info_p 
*** 483,489 ****
  static void
  live_worklist (tree_live_info_p live, varray_type stack, int i)
  {
!   int b;
    tree var;
    basic_block def_bb = NULL;
    edge e;
--- 483,489 ----
  static void
  live_worklist (tree_live_info_p live, varray_type stack, int i)
  {
!   unsigned b;
    tree var;
    basic_block def_bb = NULL;
    edge e;
*************** tree_live_info_p 
*** 557,563 ****
  calculate_live_on_entry (var_map map)
  {
    tree_live_info_p live;
!   int i;
    basic_block bb;
    bitmap saw_def;
    tree phi, var, stmt;
--- 557,563 ----
  calculate_live_on_entry (var_map map)
  {
    tree_live_info_p live;
!   unsigned i;
    basic_block bb;
    bitmap saw_def;
    tree phi, var, stmt;
*************** calculate_live_on_entry (var_map map)
*** 583,589 ****
  
        for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
  	{
! 	  for (i = 0; i < PHI_NUM_ARGS (phi); i++)
  	    {
  	      var = PHI_ARG_DEF (phi, i);
  	      if (!phi_ssa_name_p (var))
--- 583,589 ----
  
        for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
  	{
! 	  for (i = 0; i < (unsigned)PHI_NUM_ARGS (phi); i++)
  	    {
  	      var = PHI_ARG_DEF (phi, i);
  	      if (!phi_ssa_name_p (var))
*************** calculate_live_on_entry (var_map map)
*** 648,654 ****
        int entry_block = e->dest->index;
        if (e->dest == EXIT_BLOCK_PTR)
          continue;
!       for (i = 0; i < num_var_partitions (map); i++)
  	{
  	  basic_block tmp;
  	  tree d;
--- 648,654 ----
        int entry_block = e->dest->index;
        if (e->dest == EXIT_BLOCK_PTR)
          continue;
!       for (i = 0; i < (unsigned)num_var_partitions (map); i++)
  	{
  	  basic_block tmp;
  	  tree d;
*************** void
*** 732,738 ****
  calculate_live_on_exit (tree_live_info_p liveinfo)
  {
    unsigned b;
!   int i, x;
    bitmap *on_exit;
    basic_block bb;
    edge e;
--- 732,738 ----
  calculate_live_on_exit (tree_live_info_p liveinfo)
  {
    unsigned b;
!   unsigned i, x;
    bitmap *on_exit;
    basic_block bb;
    edge e;
*************** calculate_live_on_exit (tree_live_info_p
*** 741,754 ****
    var_map map = liveinfo->map;
  
    on_exit = (bitmap *)xmalloc (last_basic_block * sizeof (bitmap));
!   for (x = 0; x < last_basic_block; x++)
      on_exit[x] = BITMAP_XMALLOC ();
  
    /* Set all the live-on-exit bits for uses in PHIs.  */
    FOR_EACH_BB (bb)
      {
        for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
! 	for (i = 0; i < PHI_NUM_ARGS (phi); i++)
  	  { 
  	    t = PHI_ARG_DEF (phi, i);
  	    e = PHI_ARG_EDGE (phi, i);
--- 741,754 ----
    var_map map = liveinfo->map;
  
    on_exit = (bitmap *)xmalloc (last_basic_block * sizeof (bitmap));
!   for (x = 0; x < (unsigned)last_basic_block; x++)
      on_exit[x] = BITMAP_XMALLOC ();
  
    /* Set all the live-on-exit bits for uses in PHIs.  */
    FOR_EACH_BB (bb)
      {
        for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
! 	for (i = 0; i < (unsigned)PHI_NUM_ARGS (phi); i++)
  	  { 
  	    t = PHI_ARG_DEF (phi, i);
  	    e = PHI_ARG_EDGE (phi, i);
*************** int compare_pairs (const void *p1, const
*** 1168,1174 ****
  void
  sort_coalesce_list (coalesce_list_p cl)
  {
!   int x, num, count;
    partition_pair_p chain, p;
    partition_pair_p  *list;
  
--- 1168,1174 ----
  void
  sort_coalesce_list (coalesce_list_p cl)
  {
!   unsigned x, num, count;
    partition_pair_p chain, p;
    partition_pair_p  *list;
  
*************** build_tree_conflict_graph (tree_live_inf
*** 1296,1302 ****
    conflict_graph graph;
    var_map map;
    bitmap live;
!   int x, y, i;
    basic_block bb;
    varray_type partition_link, tpa_to_clear, tpa_nodes;
    unsigned l;
--- 1296,1302 ----
    conflict_graph graph;
    var_map map;
    bitmap live;
!   unsigned x, y, i;
    basic_block bb;
    varray_type partition_link, tpa_to_clear, tpa_nodes;
    unsigned l;
*************** build_tree_conflict_graph (tree_live_inf
*** 1421,1427 ****
        EXECUTE_IF_SET_IN_BITMAP (live, 0, x, bi)
          {
  	  i = tpa_find_tree (tpa, x);
! 	  if (i != TPA_NONE)
  	    {
  	      int start = VARRAY_INT (tpa_nodes, i);
  	      /* If start is 0, a new root reference list is being started.
--- 1421,1427 ----
        EXECUTE_IF_SET_IN_BITMAP (live, 0, x, bi)
          {
  	  i = tpa_find_tree (tpa, x);
! 	  if (i != (unsigned)TPA_NONE)
  	    {
  	      int start = VARRAY_INT (tpa_nodes, i);
  	      /* If start is 0, a new root reference list is being started.
*************** void
*** 1750,1756 ****
  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;
  
--- 1750,1756 ----
  dump_live_info (FILE *f, tree_live_info_p live, int flag)
  {
    basic_block bb;
!   unsigned i;
    var_map map = live->map;
    bitmap_iterator bi;
  
Index: tree-ssa-live.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-live.h,v
retrieving revision 2.7
diff -c -3 -p -r2.7 tree-ssa-live.h
*** tree-ssa-live.h	10 Sep 2004 15:09:39 -0000	2.7
--- tree-ssa-live.h	30 Oct 2004 21:25:08 -0000
*************** extern tree make_ssa_temp (tree);
*** 69,75 ****
  extern void register_ssa_partition_check (tree ssa_var);
  #endif
  
! static inline int num_var_partitions (var_map);
  static inline tree var_to_partition_to_var (var_map, tree);
  static inline tree partition_to_var (var_map, int);
  static inline int var_to_partition (var_map, tree);
--- 69,75 ----
  extern void register_ssa_partition_check (tree ssa_var);
  #endif
  
! static inline unsigned num_var_partitions (var_map);
  static inline tree var_to_partition_to_var (var_map, tree);
  static inline tree partition_to_var (var_map, int);
  static inline int var_to_partition (var_map, tree);
*************** extern var_map create_ssa_var_map (int);
*** 82,88 ****
  
  /* Number of partitions in MAP.  */
  
! static inline int 
  num_var_partitions (var_map map)
  {
    return map->num_partitions;
--- 82,88 ----
  
  /* Number of partitions in MAP.  */
  
! static inline unsigned
  num_var_partitions (var_map map)
  {
    return map->num_partitions;
Index: tree-ssa-loop-manip.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-loop-manip.c,v
retrieving revision 2.13
diff -c -3 -p -r2.13 tree-ssa-loop-manip.c
*** tree-ssa-loop-manip.c	28 Oct 2004 13:31:53 -0000	2.13
--- tree-ssa-loop-manip.c	30 Oct 2004 21:25:08 -0000
*************** static void
*** 152,158 ****
  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;
  
--- 152,158 ----
  add_exit_phis_var (tree var, bitmap livein, bitmap exits)
  {
    bitmap def;
!   unsigned index;
    basic_block def_bb = bb_for_stmt (SSA_NAME_DEF_STMT (var));
    bitmap_iterator bi;
  
Index: tree-ssa-operands.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-operands.c,v
retrieving revision 2.54
diff -c -3 -p -r2.54 tree-ssa-operands.c
*** tree-ssa-operands.c	30 Oct 2004 03:06:32 -0000	2.54
--- tree-ssa-operands.c	30 Oct 2004 21:25:08 -0000
*************** get_asm_expr_operands (tree stmt)
*** 1267,1273 ****
    for (link = ASM_CLOBBERS (stmt); link; link = TREE_CHAIN (link))
      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
--- 1267,1273 ----
    for (link = ASM_CLOBBERS (stmt); link; link = TREE_CHAIN (link))
      if (strcmp (TREE_STRING_POINTER (TREE_VALUE (link)), "memory") == 0)
        {
! 	unsigned i;
  	bitmap_iterator bi;
  
  	/* Clobber all call-clobbered variables (or .GLOBAL_VAR if we
*************** add_call_clobber_ops (tree stmt)
*** 1599,1605 ****
      add_stmt_operand (&global_var, stmt, opf_is_def);
    else
      {
!       size_t i;
        bitmap_iterator bi;
  
        EXECUTE_IF_SET_IN_BITMAP (call_clobbered_vars, 0, i, bi)
--- 1599,1605 ----
      add_stmt_operand (&global_var, stmt, opf_is_def);
    else
      {
!       unsigned i;
        bitmap_iterator bi;
  
        EXECUTE_IF_SET_IN_BITMAP (call_clobbered_vars, 0, i, bi)
*************** add_call_read_ops (tree stmt)
*** 1631,1637 ****
      add_stmt_operand (&global_var, stmt, opf_none);
    else
      {
!       size_t i;
        
        EXECUTE_IF_SET_IN_BITMAP (call_clobbered_vars, 0, i, bi)
  	{
--- 1631,1637 ----
      add_stmt_operand (&global_var, stmt, opf_none);
    else
      {
!       unsigned i;
        
        EXECUTE_IF_SET_IN_BITMAP (call_clobbered_vars, 0, i, bi)
  	{
Index: tree-ssa-pre.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-pre.c,v
retrieving revision 2.49
diff -c -3 -p -r2.49 tree-ssa-pre.c
*** tree-ssa-pre.c	29 Oct 2004 08:41:05 -0000	2.49
--- tree-ssa-pre.c	30 Oct 2004 21:25:08 -0000
*************** bitmap_print_value_set (FILE *outfile, b
*** 768,774 ****
    fprintf (outfile, "%s[%d] := { ", setname, blockindex);
    if (set)
      {
!       int i;
        bitmap_iterator bi;
  
        EXECUTE_IF_SET_IN_BITMAP (set->expressions, 0, i, bi)
--- 768,774 ----
    fprintf (outfile, "%s[%d] := { ", setname, blockindex);
    if (set)
      {
!       unsigned i;
        bitmap_iterator bi;
  
        EXECUTE_IF_SET_IN_BITMAP (set->expressions, 0, i, bi)
*************** bitmap_print_value_set (FILE *outfile, b
*** 778,784 ****
  	  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, ", ");
  	}
      }
--- 778,784 ----
  	  fprintf (outfile, " (");
  	  print_generic_expr (outfile, get_value_handle (ssa_name (i)), 0);
  	  fprintf (outfile, ") ");
! 	  if (bitmap_last_set_bit (set->expressions) != (int)i)
  	    fprintf (outfile, ", ");
  	}
      }
*************** insert_aux (basic_block block)
*** 1415,1421 ****
        dom = get_immediate_dominator (CDI_DOMINATORS, block);
        if (dom)
  	{
! 	  int i;
  	  bitmap_iterator bi;
  
  	  bitmap_set_t newset = NEW_SETS (dom);
--- 1415,1421 ----
        dom = get_immediate_dominator (CDI_DOMINATORS, block);
        if (dom)
  	{
! 	  unsigned i;
  	  bitmap_iterator bi;
  
  	  bitmap_set_t newset = NEW_SETS (dom);
2004-10-31  Nathan Sidwell  <nathan@codesourcery.com>

	* bitmap.h (bitmap_iterator): Remove word_bit and bit
	fields. Rename others.
	(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): Remove.
	(bmp_iter_set_init, bmp_iter_and_init, bmp_iter_and_compl_init,
	bmp_iter_next, bmp_iter_set, bmp_iter_and, bmp_iter_and_compl):
	New.
	(EXECUTE_IF_SET_IN_BITMAP, EXECUTE_IF_AND_IN_BITMAP,
	EXECUTE_IF_AND_COMPL_IN_BITMAP): Adjust.

Index: bitmap.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/bitmap.h,v
retrieving revision 1.39
diff -c -3 -p -r1.39 bitmap.h
*** bitmap.h	29 Oct 2004 08:40:53 -0000	1.39
--- bitmap.h	30 Oct 2004 21:25:02 -0000
*************** do {						\
*** 178,598 ****
  
  typedef struct
  {
!   /* Actual elements in the bitmaps.  */
!   bitmap_element *ptr1, *ptr2;
! 
!   /* 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_word;
!     }
!   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 referred 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_word;
!       else
!        bi->actual = bi->ptr1->bits[word_in_elt] >> bit_in_word;
      }
-   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_word;
!     }
!   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 */
--- 176,530 ----
  
  typedef struct
  {
!   /* Pointer to the current bitmap element.  */
!   bitmap_element *elt1;
!   
!   /* Pointer to 2nd bitmap element when two are involved.  */
!   bitmap_element *elt2;
! 
!   /* Word within the current element.  */
!   unsigned word_no;
!   
    /* 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 bits;
  } bitmap_iterator;
  
! /* Initialize a single bitmap iterator.  START_BIT is the first bit to
!    iterate from.  */
  
! static inline void
! bmp_iter_set_init (bitmap_iterator *bi, bitmap map,
! 		   unsigned start_bit, unsigned *bit_no)
! {
!   bi->elt1 = map->first;
!   bi->elt2 = NULL;
! 
!   /* Advance elt1 until it is not before the block containing start_bit.  */
!  advance:
!   if (!bi->elt1)
!     bi->elt1 = &bitmap_zero_bits;
!   else if (bi->elt1->indx < start_bit / BITMAP_ELEMENT_ALL_BITS)
!     {
!       bi->elt1 = bi->elt1->next;
!       goto advance;
!     }
! 
!   /* We might have gone past the start bit, so reinitialize it.  */
!   if (bi->elt1->indx != start_bit / BITMAP_ELEMENT_ALL_BITS)
!     start_bit = bi->elt1->indx * BITMAP_ELEMENT_ALL_BITS;
!   
!   /* Initialize for what is now start_bit.  */
!   bi->word_no = start_bit / BITMAP_WORD_BITS % BITMAP_ELEMENT_WORDS;
!   bi->bits = bi->elt1->bits[bi->word_no];
!   bi->bits >>= start_bit % BITMAP_WORD_BITS;
! 
!   /* If this word is zero, we must make sure we're not pointing at the
!      first bit, otherwise our incrementing to the next word boundary
!      will fail.  It won't matter if this increment moves us into the
!      next word.  */
!   start_bit += !bi->bits;
!   
!   *bit_no = start_bit;
! }
! 
! /* Initialize an iterator to iterate over the intersection of two
!    bitmaps.  START_BIT is the bit to commence from.  */
! 
! static inline void
! bmp_iter_and_init (bitmap_iterator *bi, bitmap map1, bitmap map2,
! 		   unsigned start_bit, unsigned *bit_no)
! {
!   bi->elt1 = map1->first;
!   bi->elt2 = map2->first;
! 
!   /* Advance elt1 until it is not before the block containing start_bit.  */
!  advance_elt1:
!   if (!bi->elt1)
!     bi->elt2 = NULL;
!   else if (bi->elt1->indx < start_bit / BITMAP_ELEMENT_ALL_BITS)
!     {
!       bi->elt1 = bi->elt1->next;
!       goto advance_elt1;
!     }
!   
!   /* Advance elt2 until it is not before elt1.  */
!  advance_elt2:
!   if (!bi->elt2)
!     bi->elt1 = bi->elt2 = &bitmap_zero_bits;
!   else if (bi->elt2->indx < bi->elt1->indx)
!     {
!       bi->elt2 = bi->elt2->next;
!       goto advance_elt2;
!     }
! 
!   /* If we're at the same index, then we have some intersecting bits.   */
!   if (bi->elt1->indx == bi->elt2->indx)
!     {
!       /* We might have advanced beyond the start_bit, so reinitialize
!      	 for that.  */
!       if (bi->elt1->indx != start_bit / BITMAP_ELEMENT_ALL_BITS)
! 	start_bit = bi->elt1->indx * BITMAP_ELEMENT_ALL_BITS;
!       
!       bi->word_no = start_bit / BITMAP_WORD_BITS % BITMAP_ELEMENT_WORDS;
!       bi->bits = bi->elt1->bits[bi->word_no] & bi->elt2->bits[bi->word_no];
!       bi->bits >>= start_bit % BITMAP_WORD_BITS;
      }
+   else
+     {
+       /* Otherwise we must immediately advance elt1, so initialize for
+ 	 that.  */
+       bi->word_no = BITMAP_ELEMENT_WORDS - 1;
+       bi->bits = 0;
+     }
+   
+   /* If this word is zero, we must make sure we're not pointing at the
+      first bit, otherwise our incrementing to the next word boundary
+      will fail.  It won't matter if this increment moves us into the
+      next word.  */
+   start_bit += !bi->bits;
+   
+   *bit_no = start_bit;
+ }
+ 
+ /* Initialize an iterator to iterate over the bits in MAP1 & ~MAP2.
+    */
+ 
+ static inline void
+ bmp_iter_and_compl_init (bitmap_iterator *bi, bitmap map1, bitmap map2,
+ 			 unsigned start_bit, unsigned *bit_no)
+ {
+   bi->elt1 = map1->first;
+   bi->elt2 = map2->first;
+ 
+   /* Advance elt1 until it is not before the block containing start_bit.  */
+  advance_elt1:
+   if (!bi->elt1)
+     bi->elt1 = &bitmap_zero_bits;
+   else if (bi->elt1->indx < start_bit / BITMAP_ELEMENT_ALL_BITS)
+     {
+       bi->elt1 = bi->elt1->next;
+       goto advance_elt1;
+     }
+ 
+   /* Advance elt2 until it is not before elt1.  */
+   while (bi->elt2 && bi->elt2->indx < bi->elt1->indx)
+     bi->elt2 = bi->elt2->next;
+ 
+   /* We might have advanced beyond the start_bit, so reinitialize for
+      that.  */
+   if (bi->elt1->indx != start_bit / BITMAP_ELEMENT_ALL_BITS)
+     start_bit = bi->elt1->indx * BITMAP_ELEMENT_ALL_BITS;
+   
+   bi->word_no = start_bit / BITMAP_WORD_BITS % BITMAP_ELEMENT_WORDS;
+   bi->bits = bi->elt1->bits[bi->word_no];
+   if (bi->elt2 && bi->elt1->indx == bi->elt2->indx)
+     bi->bits &= ~bi->elt2->bits[bi->word_no];
+   bi->bits >>= start_bit % BITMAP_WORD_BITS;
+   
+   /* If this word is zero, we must make sure we're not pointing at the
+      first bit, otherwise our incrementing to the next word boundary
+      will fail.  It won't matter if this increment moves us into the
+      next word.  */
+   start_bit += !bi->bits;
+   
+   *bit_no = start_bit;
+ }
+ 
+ /* Advance to the next bit in BI.  We don't advance to the next
+    non-zero bit yet.  */
+ 
+ static inline void
+ bmp_iter_next (bitmap_iterator *bi, unsigned *bit_no)
+ {
+   bi->bits >>= 1;
+   *bit_no += 1;
+ }
+ 
+ /* Advance to the next non-zero bit of a single bitmap, we will have
+    already advanced past the just iterated bit.  Return true if there
+    is a bit to iterate.  */
  
! static inline bool
! bmp_iter_set (bitmap_iterator *bi, unsigned *bit_no)
  {
!   /* If our current word is non-zero, it contains the bit we want.  */
!   if (bi->bits)
      {
!     next_bit:
!       while (!(bi->bits & 1))
  	{
! 	  bi->bits >>= 1;
! 	  *bit_no += 1;
  	}
!       return true;
      }
  
!   /* Round up to the word boundary.  We might have just iterated past
!      the end of the last word, hence the -1.  It is not possible for
!      bit_no to point at the beginning of the now last word.  */
!   *bit_no = ((*bit_no + BITMAP_WORD_BITS - 1)
! 	     / BITMAP_WORD_BITS * BITMAP_WORD_BITS);
!   
!   /* Find the next non-zero word in this elt.  */
!   while (++bi->word_no != BITMAP_ELEMENT_WORDS)
!     {
!     next_word:
!       bi->bits = bi->elt1->bits[bi->word_no];
!       if (bi->bits)
! 	goto next_bit;
!       *bit_no += BITMAP_WORD_BITS;
!     }
!   
!   /* Advance to the next element.  */
!   bi->elt1 = bi->elt1->next;
!   if (!bi->elt1)
!     return false;
!   *bit_no = bi->elt1->indx * BITMAP_ELEMENT_ALL_BITS;
!   bi->word_no = 0;
!   goto next_word;
! }
! 
! /* Advance to the next non-zero bit of an intersecting pair of
!    bitmaps.  We will have alreadt advanced past the just iterated bit.
!    Return true if there is a bit to iterate.  */
  
  static inline bool
! bmp_iter_and (bitmap_iterator *bi, unsigned *bit_no)
  {
!   /* If our current word is non-zero, it contains the bit we want.  */
!   if (bi->bits)
      {
!     next_bit:
!       while (!(bi->bits & 1))
  	{
! 	  bi->bits >>= 1;
! 	  *bit_no += 1;
  	}
!       return true;
      }
  
!   /* Round up to the word boundary.  We might have just iterated past
!      the end of the last word, hence the -1.  It is not possible for
!      bit_no to point at the beginning of the now last word.  */
!   *bit_no = ((*bit_no + BITMAP_WORD_BITS - 1)
! 	     / BITMAP_WORD_BITS * BITMAP_WORD_BITS);
!   
!   /* Find the next non-zero word in this elt.  */
!   while (++bi->word_no != BITMAP_ELEMENT_WORDS)
!     {
!     next_word:
!       bi->bits = bi->elt1->bits[bi->word_no] & bi->elt2->bits[bi->word_no];
!       if (bi->bits)
! 	goto next_bit;
!       *bit_no += BITMAP_WORD_BITS;
!     }
!   
!   /* Advance to the next identical element.  */
!   do
      {
!       /* Advance elt1 while it is less than elt2.  We always want to
! 	 advance one elt.  */
!       do
  	{
! 	  bi->elt1 = bi->elt1->next;
! 	  if (!bi->elt1)
! 	    return false;
  	}
!       while (bi->elt1->indx < bi->elt2->indx);
! 	
!       /* Advance elt2 to be no less than elt1.  */
!       while (bi->elt2->indx < bi->elt1->indx)
  	{
! 	  bi->elt2 = bi->elt2->next;
! 	  if (!bi->elt2)
! 	    return false;
  	}
  
      }
+   while (bi->elt1->indx != bi->elt2->indx);
+   
+   *bit_no = bi->elt1->indx * BITMAP_ELEMENT_ALL_BITS;
+   bi->word_no = 0;
+   goto next_word;
  }
  
! /* Advance to the next non-zero bit in the intersection of
!    complemented bitmaps.  We will have already advanced past the just
!    iterated bit.  */
  
! static inline bool
! bmp_iter_and_compl (bitmap_iterator *bi, unsigned *bit_no)
! {
!   /* If our current word is non-zero, it contains the bit we want.  */
!   if (bi->bits)
      {
!     next_bit:
!       while (!(bi->bits & 1))
  	{
! 	  bi->bits >>= 1;
! 	  *bit_no += 1;
  	}
!       return true;
      }
  
!   /* Round up to the word boundary.  We might have just iterated past
!      the end of the last word, hence the -1.  It is not possible for
!      bit_no to point at the beginning of the now last word.  */
!   *bit_no = ((*bit_no + BITMAP_WORD_BITS - 1)
! 	     / BITMAP_WORD_BITS * BITMAP_WORD_BITS);
!   
!   /* Find the next non-zero word in this elt.  */
!   while (++bi->word_no != BITMAP_ELEMENT_WORDS)
!     {
!     next_word:
!       bi->bits = bi->elt1->bits[bi->word_no];
!       if (bi->elt2 && bi->elt2->indx == bi->elt1->indx)
! 	bi->bits &= ~bi->elt2->bits[bi->word_no];
!       if (bi->bits)
! 	goto next_bit;
!       *bit_no += BITMAP_WORD_BITS;
!     }
!   
!   /* Advance to the next element of elt1.  */
!   bi->elt1 = bi->elt1->next;
!   if (!bi->elt1)
!     return false;
! 
!   /* Advance elt2 until it is no less than elt1.  */
!   while (bi->elt2 && bi->elt2->indx < bi->elt1->indx)
!     bi->elt2 = bi->elt2->next;
!   
!   *bit_no = bi->elt1->indx * BITMAP_ELEMENT_ALL_BITS;
!   bi->word_no = 0;
!   goto next_word;
  }
  
! /* Loop over all bits set 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 (bmp_iter_set_init (&(ITER), (BITMAP), (MIN), &(BITNUM));		\
!        bmp_iter_set (&(ITER), &(BITNUM));				\
!        bmp_iter_next (&(ITER), &(BITNUM)))
! 
! /* Loop over all the bits set in BITMAP1 & BITMAP2, starting with MIN
!    and setting BITNUM to the bit number.  ITER is a bitmap iterator.   */
! 
! #define EXECUTE_IF_AND_IN_BITMAP(BITMAP1, BITMAP2, MIN, BITNUM, ITER)	\
!   for (bmp_iter_and_init (&(ITER), (BITMAP1), (BITMAP2), (MIN), 	\
! 			  &(BITNUM));					\
!        bmp_iter_and (&(ITER), &(BITNUM));				\
!        bmp_iter_next (&(ITER), &(BITNUM)))
! 
! /* Loop over all the bits set in BITMAP1 & ~BITMAP2, starting with MIN
!    and setting BITNUM to the bit number.  ITER is a bitmap iterator.   */
! 
! #define EXECUTE_IF_AND_COMPL_IN_BITMAP(BITMAP1, BITMAP2, MIN, BITNUM, ITER) \
!   for (bmp_iter_and_compl_init (&(ITER), (BITMAP1), (BITMAP2), (MIN),	\
! 				&(BITNUM)); 				\
!        bmp_iter_and_compl (&(ITER), &(BITNUM));				\
!        bmp_iter_next (&(ITER), &(BITNUM)))
  
  #endif /* GCC_BITMAP_H */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]