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]

Flatten bitmap head vector


Hi,
last vector of bitmaps that shows top in my profiles is compute_dominance_frontiers
one.  This patch flattens it to vector of bitmap heads.

Bootstrapped/regtested x86_64-linux, OK?

Honza

	* tree-into-ssa.c (insert_phi_nodes): Use bitmap heads
	for dominance frontiers.
	(rewrite_into_ssa): Update for bitmap heads in dominance
	frontiers.
	(insert_updated_phi_nodes_for): Likewise.
	(update_ssa): Likewise.
	* cfganal.c (compute_dominance_frontiers_1): Likewise.
	(compute_dominance_frontiers): Likewise.
	(compute_idf): Likewise.
	* df-problems.c (df_md_local_compute): Likewise.
Index: tree-into-ssa.c
===================================================================
--- tree-into-ssa.c	(revision 160312)
+++ tree-into-ssa.c	(working copy)
@@ -1143,7 +1143,7 @@ insert_phi_nodes_for (tree var, bitmap p
    the flowgraph.  */
 
 static void
-insert_phi_nodes (bitmap *dfs)
+insert_phi_nodes (bitmap_head *dfs)
 {
   referenced_var_iterator rvi;
   bitmap_iterator bi;
@@ -2349,7 +2349,7 @@ fini_ssa_renamer (void)
 static unsigned int
 rewrite_into_ssa (void)
 {
-  bitmap *dfs;
+  bitmap_head *dfs;
   basic_block bb;
 
   timevar_push (TV_TREE_SSA_OTHER);
@@ -2367,9 +2367,9 @@ rewrite_into_ssa (void)
   sbitmap_zero (interesting_blocks);
 
   /* Initialize dominance frontier.  */
-  dfs = XNEWVEC (bitmap, last_basic_block);
+  dfs = XNEWVEC (bitmap_head, last_basic_block);
   FOR_EACH_BB (bb)
-    dfs[bb->index] = BITMAP_ALLOC (NULL);
+    bitmap_initialize (&dfs[bb->index], &bitmap_default_obstack);
 
   /* 1- Compute dominance frontiers.  */
   calculate_dominance_info (CDI_DOMINATORS);
@@ -2386,7 +2386,7 @@ rewrite_into_ssa (void)
 
   /* Free allocated memory.  */
   FOR_EACH_BB (bb)
-    BITMAP_FREE (dfs[bb->index]);
+    bitmap_clear (&dfs[bb->index]);
   free (dfs);
 
   sbitmap_free (interesting_blocks);
@@ -3005,7 +3005,7 @@ release_ssa_name_after_update_ssa (tree 
      names is not pruned.  PHI nodes are inserted at every IDF block.  */
 
 static void
-insert_updated_phi_nodes_for (tree var, bitmap *dfs, bitmap blocks,
+insert_updated_phi_nodes_for (tree var, bitmap_head *dfs, bitmap blocks,
                               unsigned update_flags)
 {
   basic_block entry;
@@ -3332,13 +3332,13 @@ update_ssa (unsigned update_flags)
      and for symbols in SYMS_TO_RENAME.  */
   if (insert_phi_p)
     {
-      bitmap *dfs;
+      bitmap_head *dfs;
 
       /* If the caller requested PHI nodes to be added, compute
 	 dominance frontiers.  */
-      dfs = XNEWVEC (bitmap, last_basic_block);
+      dfs = XNEWVEC (bitmap_head, last_basic_block);
       FOR_EACH_BB (bb)
-	dfs[bb->index] = BITMAP_ALLOC (NULL);
+	bitmap_initialize (&dfs[bb->index], &bitmap_default_obstack);
       compute_dominance_frontiers (dfs);
 
       if (sbitmap_first_set_bit (old_ssa_names) >= 0)
@@ -3363,7 +3363,7 @@ update_ssa (unsigned update_flags)
 	                              update_flags);
 
       FOR_EACH_BB (bb)
-	BITMAP_FREE (dfs[bb->index]);
+	bitmap_clear (&dfs[bb->index]);
       free (dfs);
 
       /* Insertion of PHI nodes may have added blocks to the region.
Index: cfganal.c
===================================================================
--- cfganal.c	(revision 160312)
+++ cfganal.c	(working copy)
@@ -1256,7 +1256,7 @@ dfs_enumerate_from (basic_block bb, int 
 
 
 static void
-compute_dominance_frontiers_1 (bitmap *frontiers)
+compute_dominance_frontiers_1 (bitmap_head *frontiers)
 {
   edge p;
   edge_iterator ei;
@@ -1275,7 +1275,7 @@ compute_dominance_frontiers_1 (bitmap *f
 	      domsb = get_immediate_dominator (CDI_DOMINATORS, b);
 	      while (runner != domsb)
 		{
-		  if (!bitmap_set_bit (frontiers[runner->index],
+		  if (!bitmap_set_bit (&frontiers[runner->index],
 				       b->index))
 		    break;
 		  runner = get_immediate_dominator (CDI_DOMINATORS,
@@ -1288,7 +1288,7 @@ compute_dominance_frontiers_1 (bitmap *f
 
 
 void
-compute_dominance_frontiers (bitmap *frontiers)
+compute_dominance_frontiers (bitmap_head *frontiers)
 {
   timevar_push (TV_DOM_FRONTIERS);
 
@@ -1307,7 +1307,7 @@ compute_dominance_frontiers (bitmap *fro
    allocated for the return value.  */
 
 bitmap
-compute_idf (bitmap def_blocks, bitmap *dfs)
+compute_idf (bitmap def_blocks, bitmap_head *dfs)
 {
   bitmap_iterator bi;
   unsigned bb_index, i;
@@ -1340,7 +1340,7 @@ compute_idf (bitmap def_blocks, bitmap *
 	 we may pull a non-existing block from the work stack.  */
       gcc_assert (bb_index < (unsigned) last_basic_block);
 
-      EXECUTE_IF_AND_COMPL_IN_BITMAP (dfs[bb_index], phi_insertion_points,
+      EXECUTE_IF_AND_COMPL_IN_BITMAP (&dfs[bb_index], phi_insertion_points,
 	                              0, i, bi)
 	{
 	  /* Use a safe push because if there is a definition of VAR
Index: df-problems.c
===================================================================
--- df-problems.c	(revision 160315)
+++ df-problems.c	(working copy)
@@ -4390,7 +4390,7 @@ df_md_local_compute (bitmap all_blocks)
   unsigned int bb_index, df_bb_index;
   bitmap_iterator bi1, bi2;
   basic_block bb;
-  bitmap *frontiers;
+  bitmap_head *frontiers;
 
   bitmap_initialize (&seen_in_insn, &bitmap_default_obstack);
 
@@ -4401,9 +4401,9 @@ df_md_local_compute (bitmap all_blocks)
 
   bitmap_clear (&seen_in_insn);
 
-  frontiers = XNEWVEC (bitmap, last_basic_block);
+  frontiers = XNEWVEC (bitmap_head, last_basic_block);
   FOR_ALL_BB (bb)
-    frontiers[bb->index] = BITMAP_ALLOC (NULL);
+    bitmap_initialize (&frontiers[bb->index], &bitmap_default_obstack);
 
   compute_dominance_frontiers (frontiers);
 
@@ -4411,7 +4411,7 @@ df_md_local_compute (bitmap all_blocks)
   EXECUTE_IF_SET_IN_BITMAP (all_blocks, 0, bb_index, bi1)
     {
       bitmap kill = &df_md_get_bb_info (bb_index)->kill;
-      EXECUTE_IF_SET_IN_BITMAP (frontiers[bb_index], 0, df_bb_index, bi2)
+      EXECUTE_IF_SET_IN_BITMAP (&frontiers[bb_index], 0, df_bb_index, bi2)
 	{
 	  basic_block bb = BASIC_BLOCK (df_bb_index);
 	  if (bitmap_bit_p (all_blocks, df_bb_index))
@@ -4421,7 +4421,7 @@ df_md_local_compute (bitmap all_blocks)
     }
 
   FOR_ALL_BB (bb)
-    BITMAP_FREE (frontiers[bb->index]);
+    bitmap_clear (&frontiers[bb->index]);
   free (frontiers);
 }
 
Index: basic-block.h
===================================================================
--- basic-block.h	(revision 160312)
+++ basic-block.h	(working copy)
@@ -443,8 +443,8 @@ extern int pre_and_rev_post_order_comput
 extern int dfs_enumerate_from (basic_block, int,
 			       bool (*)(const_basic_block, const void *),
 			       basic_block *, int, const void *);
-extern void compute_dominance_frontiers (bitmap *);
-extern bitmap compute_idf (bitmap, bitmap *);
+extern void compute_dominance_frontiers (struct bitmap_head_def *);
+extern bitmap compute_idf (bitmap, struct bitmap_head_def *);
 extern void dump_bb_info (basic_block, bool, bool, int, const char *, FILE *);
 extern void dump_edge_info (FILE *, edge, int);
 extern void brief_dump_cfg (FILE *);


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