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]

[patch] sbitmap.h: Use the iterator style in EXECUTE_IF_SET_IN_SBITMAP.


Hi,

Attached is a patch to use the iterator style in EXECUTE_IF_SET_IN_SBITMAP.

The non-iterator style EXECUTE_IF_SET_IN_SBITMAP has long been a source of headache for debugging.

The patch changes the macro to use the iterator style.

The only caveat is that the macro is now picky about the type of a variable used to store the bit index. It takes nothing but unsigned int because new inline function sbitmap_iter_cond takes a pointer to unsinged int. As far as this argument is concerned, gcc gives a warning for anything but a pointer to unsigned int. On x86_64, it doesn't even like size_t. This strictness forces us to change the types of several variables to unsigned int.

Tested on x86_64-pc-linux-gnu. OK to apply?

p.s.
If you like, I could first submit a patch to change the types of several variables to unsigned int.


Kazu Hirata
2005-06-05  Kazu Hirata  <kazu@codesourcery.com>

	* sbitmap.h (sbitmap_iterator, sbitmap_iter_init,
	sbitmap_iter_cond, sbitmap_iter_next): New.
	* bt-load.c, cfganal.c, combine.c, ddg.c, flow.c,
	modulo-sched.c, sbitmap.c, sched-rgn.c, tree-into-ssa.c,
	tree-outof-ssa.c, tree-ssa-alias.c, tree-ssa-live.c: Update
	uses of EXECUTE_IF_SET_IN_SBITMAP to the new style.

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

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