]> gcc.gnu.org Git - gcc.git/commitdiff
sbitmap.h (struct int_list): Remove.
authorSteven Bosscher <steven@gcc.gnu.org>
Mon, 23 Jul 2012 14:28:29 +0000 (14:28 +0000)
committerSteven Bosscher <steven@gcc.gnu.org>
Mon, 23 Jul 2012 14:28:29 +0000 (14:28 +0000)
* sbitmap.h (struct int_list): Remove.
(sbitmap_intersect_of_predsucc, sbitmap_union_of_predsucc):
Remove prototypes of non-existing function.
(sbitmap_intersect_of_predecessors, sbitmap_intersect_of_successors,
sbitmap_union_of_predecessors, sbitmap_union_of_successors): Remove
unused defines.
(sbitmap_intersection_of_succs, sbitmap_intersection_of_preds,
sbitmap_union_of_succs, sbitmap_union_of_preds): Move prototypes to...
* basic-block.h: ... here.
* sbitmap.c: Do not include basic-block.h.
(sbitmap_intersection_of_succs, sbitmap_intersection_of_preds,
sbitmap_union_of_succs, sbitmap_union_of_preds): Move functions to...
* cfganal.c: ... here.
* bt-load.c (compute_out, link_btr_uses): Update for above changes.
* gcse.c (compute_code_hoist_vbeinout): Likewise.
* lcm.c (compute_antinout_edge, compute_available): Likewise.
* Makefile.in: Fix sbitmap.o dependencies.

From-SVN: r189785

gcc/ChangeLog
gcc/Makefile.in
gcc/basic-block.h
gcc/bt-load.c
gcc/cfganal.c
gcc/gcse.c
gcc/lcm.c
gcc/sbitmap.c
gcc/sbitmap.h

index 4ffeb4ef7261fbdc8325164575b9c1b579779124..6ab125ca83aebd2651492334542389a593ec0cfe 100644 (file)
@@ -1,3 +1,23 @@
+2012-07-22  Steven Bosscher  <steven@gcc.gnu.org>
+
+       * sbitmap.h (struct int_list): Remove.
+       (sbitmap_intersect_of_predsucc, sbitmap_union_of_predsucc):
+       Remove prototypes of non-existing function.
+       (sbitmap_intersect_of_predecessors, sbitmap_intersect_of_successors,
+       sbitmap_union_of_predecessors, sbitmap_union_of_successors): Remove
+       unused defines.
+       (sbitmap_intersection_of_succs, sbitmap_intersection_of_preds,
+       sbitmap_union_of_succs, sbitmap_union_of_preds): Move prototypes to...
+       * basic-block.h: ... here.
+       * sbitmap.c: Do not include basic-block.h.
+       (sbitmap_intersection_of_succs, sbitmap_intersection_of_preds,
+       sbitmap_union_of_succs, sbitmap_union_of_preds): Move functions to...
+       * cfganal.c: ... here.
+       * bt-load.c (compute_out, link_btr_uses): Update for above changes.
+       * gcse.c (compute_code_hoist_vbeinout): Likewise.
+       * lcm.c (compute_antinout_edge, compute_available): Likewise.
+       * Makefile.in: Fix sbitmap.o dependencies.
+
 2012-07-23  Jan-Benedict Glaw  <jbglaw@lug-owl.de>
            Nick Clifton  <nickc@redhat.com>
 
index d48c696e83117aa380a38118c0b60037e1aad49b..c688fa5880539ddf7e9cd9caedad0fc99d09f34d 100644 (file)
@@ -1842,7 +1842,7 @@ graph.o: graph.c $(SYSTEM_H) coretypes.h $(TM_H) toplev.h $(DIAGNOSTIC_CORE_H) $
     $(RTL_H) $(FUNCTION_H) hard-reg-set.h $(BASIC_BLOCK_H) graph.h $(OBSTACK_H) \
     $(CONFIG_H) $(EMIT_RTL_H)
 
-sbitmap.o: sbitmap.c sbitmap.h $(CONFIG_H) $(SYSTEM_H) coretypes.h $(BASIC_BLOCK_H)
+sbitmap.o: sbitmap.c sbitmap.h $(CONFIG_H) $(SYSTEM_H) coretypes.h
 ebitmap.o: ebitmap.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(EBITMAP_H)
 sparseset.o: sparseset.c $(SYSTEM_H) sparseset.h $(CONFIG_H)
 
index 24f178f3e75234c4d78346e642a772f72284e5ef..15d34e0e1ac8be1b651dc77bb5edb37c029d089b 100644 (file)
@@ -674,6 +674,12 @@ ei_cond (edge_iterator ei, edge *p)
 #define CLEANUP_CFGLAYOUT      32      /* Do cleanup in cfglayout mode.  */
 #define CLEANUP_CFG_CHANGED    64      /* The caller changed the CFG.  */
 
+/* In cfganal.c */
+extern void sbitmap_intersection_of_succs (sbitmap, sbitmap *, basic_block);
+extern void sbitmap_intersection_of_preds (sbitmap, sbitmap *, basic_block);
+extern void sbitmap_union_of_succs (sbitmap, sbitmap *, basic_block);
+extern void sbitmap_union_of_preds (sbitmap, sbitmap *, basic_block);
+
 /* In lcm.c */
 extern struct edge_list *pre_edge_lcm (int, sbitmap *, sbitmap *,
                                       sbitmap *, sbitmap *, sbitmap **,
index 7ec4454746dc948918ce45ad479b4bcfab338acd..2cab03cc86e44258e3a3bc307f315deda4f3125f 100644 (file)
@@ -650,7 +650,7 @@ compute_out (sbitmap *bb_out, sbitmap *bb_gen, sbitmap *bb_kill, int max_uid)
       changed = 0;
       for (i = NUM_FIXED_BLOCKS; i < last_basic_block; i++)
        {
-         sbitmap_union_of_preds (bb_in, bb_out, i);
+         sbitmap_union_of_preds (bb_in, bb_out, BASIC_BLOCK (i));
          changed |= sbitmap_union_of_diff_cg (bb_out[i], bb_gen[i],
                                               bb_in, bb_kill[i]);
        }
@@ -673,7 +673,7 @@ link_btr_uses (btr_def *def_array, btr_user *use_array, sbitmap *bb_out,
       rtx insn;
       rtx last;
 
-      sbitmap_union_of_preds (reaching_defs, bb_out, i);
+      sbitmap_union_of_preds (reaching_defs, bb_out, BASIC_BLOCK (i));
       for (insn = BB_HEAD (bb), last = NEXT_INSN (BB_END (bb));
           insn != last;
           insn = NEXT_INSN (insn))
index c906e17e358dd6672c99dff3427c3266581a4229..692be3808b81762f8c8c0a34289beb2b7138422b 100644 (file)
@@ -1182,4 +1182,177 @@ compute_idf (bitmap def_blocks, bitmap_head *dfs)
   return phi_insertion_points;
 }
 
+/* Intersection and union of preds/succs for sbitmap based data flow
+   solvers.  All four functions defined below take the same arguments:
+   B is the basic block to perform the operation for.  DST is the
+   target sbitmap, i.e. the result.  SRC is an sbitmap vector of size
+   last_basic_block so that it can be indexed with basic block indices.
+   DST may be (but does not have to be) SRC[B->index].  */
 
+/* Set the bitmap DST to the intersection of SRC of successors of
+   basic block B.  */
+
+void
+sbitmap_intersection_of_succs (sbitmap dst, sbitmap *src,
+                              basic_block b)
+{
+  unsigned int set_size = dst->size;
+  edge e;
+  unsigned ix;
+
+  gcc_assert (!dst->popcount);
+
+  for (e = NULL, ix = 0; ix < EDGE_COUNT (b->succs); ix++)
+    {
+      e = EDGE_SUCC (b, ix);
+      if (e->dest == EXIT_BLOCK_PTR)
+       continue;
+
+      sbitmap_copy (dst, src[e->dest->index]);
+      break;
+    }
+
+  if (e == 0)
+    sbitmap_ones (dst);
+  else
+    for (++ix; ix < EDGE_COUNT (b->succs); ix++)
+      {
+       unsigned int i;
+       SBITMAP_ELT_TYPE *p, *r;
+
+       e = EDGE_SUCC (b, ix);
+       if (e->dest == EXIT_BLOCK_PTR)
+         continue;
+
+       p = src[e->dest->index]->elms;
+       r = dst->elms;
+       for (i = 0; i < set_size; i++)
+         *r++ &= *p++;
+      }
+}
+
+/* Set the bitmap DST to the intersection of SRC of predecessors of
+   basic block B.  */
+
+void
+sbitmap_intersection_of_preds (sbitmap dst, sbitmap *src,
+                              basic_block b)
+{
+  unsigned int set_size = dst->size;
+  edge e;
+  unsigned ix;
+
+  gcc_assert (!dst->popcount);
+
+  for (e = NULL, ix = 0; ix < EDGE_COUNT (b->preds); ix++)
+    {
+      e = EDGE_PRED (b, ix);
+      if (e->src == ENTRY_BLOCK_PTR)
+       continue;
+
+      sbitmap_copy (dst, src[e->src->index]);
+      break;
+    }
+
+  if (e == 0)
+    sbitmap_ones (dst);
+  else
+    for (++ix; ix < EDGE_COUNT (b->preds); ix++)
+      {
+       unsigned int i;
+       SBITMAP_ELT_TYPE *p, *r;
+
+       e = EDGE_PRED (b, ix);
+       if (e->src == ENTRY_BLOCK_PTR)
+         continue;
+
+       p = src[e->src->index]->elms;
+       r = dst->elms;
+       for (i = 0; i < set_size; i++)
+         *r++ &= *p++;
+      }
+}
+
+/* Set the bitmap DST to the union of SRC of successors of
+   basic block B.  */
+
+void
+sbitmap_union_of_succs (sbitmap dst, sbitmap *src,
+                       basic_block b)
+{
+  unsigned int set_size = dst->size;
+  edge e;
+  unsigned ix;
+
+  gcc_assert (!dst->popcount);
+
+  for (ix = 0; ix < EDGE_COUNT (b->succs); ix++)
+    {
+      e = EDGE_SUCC (b, ix);
+      if (e->dest == EXIT_BLOCK_PTR)
+       continue;
+
+      sbitmap_copy (dst, src[e->dest->index]);
+      break;
+    }
+
+  if (ix == EDGE_COUNT (b->succs))
+    sbitmap_zero (dst);
+  else
+    for (ix++; ix < EDGE_COUNT (b->succs); ix++)
+      {
+       unsigned int i;
+       SBITMAP_ELT_TYPE *p, *r;
+
+       e = EDGE_SUCC (b, ix);
+       if (e->dest == EXIT_BLOCK_PTR)
+         continue;
+
+       p = src[e->dest->index]->elms;
+       r = dst->elms;
+       for (i = 0; i < set_size; i++)
+         *r++ |= *p++;
+      }
+}
+
+/* Set the bitmap DST to the union of SRC of predecessors of
+   basic block B.  */
+
+void
+sbitmap_union_of_preds (sbitmap dst, sbitmap *src,
+                       basic_block b)
+{
+  unsigned int set_size = dst->size;
+  edge e;
+  unsigned ix;
+
+  gcc_assert (!dst->popcount);
+
+  for (ix = 0; ix < EDGE_COUNT (b->preds); ix++)
+    {
+      e = EDGE_PRED (b, ix);
+      if (e->src== ENTRY_BLOCK_PTR)
+       continue;
+
+      sbitmap_copy (dst, src[e->src->index]);
+      break;
+    }
+
+  if (ix == EDGE_COUNT (b->preds))
+    sbitmap_zero (dst);
+  else
+    for (ix++; ix < EDGE_COUNT (b->preds); ix++)
+      {
+       unsigned int i;
+       SBITMAP_ELT_TYPE *p, *r;
+
+       e = EDGE_PRED (b, ix);
+       if (e->src == ENTRY_BLOCK_PTR)
+         continue;
+
+       p = src[e->src->index]->elms;
+       r = dst->elms;
+       for (i = 0; i < set_size; i++)
+         *r++ |= *p++;
+      }
+}
index fd5a89763a6d6559345f81dadf632350125a5529..f7c42d200926798182427ec745b902cb8334c48a 100644 (file)
@@ -2790,7 +2790,7 @@ compute_code_hoist_vbeinout (void)
          if (bb->next_bb != EXIT_BLOCK_PTR)
            {
              sbitmap_intersection_of_succs (hoist_vbeout[bb->index],
-                                            hoist_vbein, bb->index);
+                                            hoist_vbein, bb);
 
              /* Include expressions in VBEout that are calculated
                 in BB and available at its end.  */
index 236dbf351c3b2abf8f2425b930ff7527fe2b83f5..fec2ba45d306779427d6ebeb4334013a01e37125 100644 (file)
--- a/gcc/lcm.c
+++ b/gcc/lcm.c
@@ -145,7 +145,7 @@ compute_antinout_edge (sbitmap *antloc, sbitmap *transp, sbitmap *antin,
          /* Clear the aux field of this block so that it can be added to
             the worklist again if necessary.  */
          bb->aux = NULL;
-         sbitmap_intersection_of_succs (antout[bb->index], antin, bb->index);
+         sbitmap_intersection_of_succs (antout[bb->index], antin, bb);
        }
 
       if (sbitmap_a_or_b_and_c_cg (antin[bb->index], antloc[bb->index],
@@ -526,7 +526,7 @@ compute_available (sbitmap *avloc, sbitmap *kill, sbitmap *avout,
          /* Clear the aux field of this block so that it can be added to
             the worklist again if necessary.  */
          bb->aux = NULL;
-         sbitmap_intersection_of_preds (avin[bb->index], avout, bb->index);
+         sbitmap_intersection_of_preds (avin[bb->index], avout, bb);
        }
 
       if (sbitmap_union_of_diff_cg (avout[bb->index], avloc[bb->index],
index 23d459ec30935300c0926c0593dfa8adf4ae4f10..d606736c4c7d283ee52cdaa42fc390d2b45fe887 100644 (file)
@@ -23,15 +23,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "coretypes.h"
 #include "sbitmap.h"
 
-#ifdef IN_GCC
-/* FIXME: sbitmap is just a data structure, but we define dataflow functions
-   here also.  This is conditional on IN_GCC (see second #ifdef IN_GCC
-   further down).
-   For now, also only conditionally include basic-block.h, but we should
-   find a better place for the dataflow functions.  Perhaps cfganal.c?  */
-#include "basic-block.h"
-#endif
-
 #if GCC_VERSION >= 3400
 #  if HOST_BITS_PER_WIDEST_FAST_INT == HOST_BITS_PER_LONG
 #    define do_popcount(x) __builtin_popcountl(x)
@@ -744,184 +735,6 @@ sbitmap_a_and_b_or_c (sbitmap dst, const_sbitmap a, const_sbitmap b, const_sbitm
     *dstp++ = *ap++ & (*bp++ | *cp++);
 }
 
-#ifdef IN_GCC
-/* FIXME: depends on basic-block.h, see comment at start of this file.
-
-   Ironically, the comments before the functions below suggest they do
-   dataflow using the "new flow graph structures", but that's the *old*
-   new data structures.  The functions receive basic block numbers and
-   use BASIC_BLOCK(idx) to get the basic block.  They should receive
-   the basic block directly,  *sigh*.  */
-
-/* Set the bitmap DST to the intersection of SRC of successors of
-   block number BB, using the new flow graph structures.  */
-
-void
-sbitmap_intersection_of_succs (sbitmap dst, sbitmap *src, int bb)
-{
-  basic_block b = BASIC_BLOCK (bb);
-  unsigned int set_size = dst->size;
-  edge e;
-  unsigned ix;
-
-  gcc_assert (!dst->popcount);
-
-  for (e = NULL, ix = 0; ix < EDGE_COUNT (b->succs); ix++)
-    {
-      e = EDGE_SUCC (b, ix);
-      if (e->dest == EXIT_BLOCK_PTR)
-       continue;
-
-      sbitmap_copy (dst, src[e->dest->index]);
-      break;
-    }
-
-  if (e == 0)
-    sbitmap_ones (dst);
-  else
-    for (++ix; ix < EDGE_COUNT (b->succs); ix++)
-      {
-       unsigned int i;
-       sbitmap_ptr p, r;
-
-       e = EDGE_SUCC (b, ix);
-       if (e->dest == EXIT_BLOCK_PTR)
-         continue;
-
-       p = src[e->dest->index]->elms;
-       r = dst->elms;
-       for (i = 0; i < set_size; i++)
-         *r++ &= *p++;
-      }
-}
-
-/* Set the bitmap DST to the intersection of SRC of predecessors of
-   block number BB, using the new flow graph structures.  */
-
-void
-sbitmap_intersection_of_preds (sbitmap dst, sbitmap *src, int bb)
-{
-  basic_block b = BASIC_BLOCK (bb);
-  unsigned int set_size = dst->size;
-  edge e;
-  unsigned ix;
-
-  gcc_assert (!dst->popcount);
-
-  for (e = NULL, ix = 0; ix < EDGE_COUNT (b->preds); ix++)
-    {
-      e = EDGE_PRED (b, ix);
-      if (e->src == ENTRY_BLOCK_PTR)
-       continue;
-
-      sbitmap_copy (dst, src[e->src->index]);
-      break;
-    }
-
-  if (e == 0)
-    sbitmap_ones (dst);
-  else
-    for (++ix; ix < EDGE_COUNT (b->preds); ix++)
-      {
-       unsigned int i;
-       sbitmap_ptr p, r;
-
-       e = EDGE_PRED (b, ix);
-       if (e->src == ENTRY_BLOCK_PTR)
-         continue;
-
-       p = src[e->src->index]->elms;
-       r = dst->elms;
-       for (i = 0; i < set_size; i++)
-         *r++ &= *p++;
-      }
-}
-
-/* Set the bitmap DST to the union of SRC of successors of
-   block number BB, using the new flow graph structures.  */
-
-void
-sbitmap_union_of_succs (sbitmap dst, sbitmap *src, int bb)
-{
-  basic_block b = BASIC_BLOCK (bb);
-  unsigned int set_size = dst->size;
-  edge e;
-  unsigned ix;
-
-  gcc_assert (!dst->popcount);
-
-  for (ix = 0; ix < EDGE_COUNT (b->succs); ix++)
-    {
-      e = EDGE_SUCC (b, ix);
-      if (e->dest == EXIT_BLOCK_PTR)
-       continue;
-
-      sbitmap_copy (dst, src[e->dest->index]);
-      break;
-    }
-
-  if (ix == EDGE_COUNT (b->succs))
-    sbitmap_zero (dst);
-  else
-    for (ix++; ix < EDGE_COUNT (b->succs); ix++)
-      {
-       unsigned int i;
-       sbitmap_ptr p, r;
-
-       e = EDGE_SUCC (b, ix);
-       if (e->dest == EXIT_BLOCK_PTR)
-         continue;
-
-       p = src[e->dest->index]->elms;
-       r = dst->elms;
-       for (i = 0; i < set_size; i++)
-         *r++ |= *p++;
-      }
-}
-
-/* Set the bitmap DST to the union of SRC of predecessors of
-   block number BB, using the new flow graph structures.  */
-
-void
-sbitmap_union_of_preds (sbitmap dst, sbitmap *src, int bb)
-{
-  basic_block b = BASIC_BLOCK (bb);
-  unsigned int set_size = dst->size;
-  edge e;
-  unsigned ix;
-
-  gcc_assert (!dst->popcount);
-
-  for (ix = 0; ix < EDGE_COUNT (b->preds); ix++)
-    {
-      e = EDGE_PRED (b, ix);
-      if (e->src== ENTRY_BLOCK_PTR)
-       continue;
-
-      sbitmap_copy (dst, src[e->src->index]);
-      break;
-    }
-
-  if (ix == EDGE_COUNT (b->preds))
-    sbitmap_zero (dst);
-  else
-    for (ix++; ix < EDGE_COUNT (b->preds); ix++)
-      {
-       unsigned int i;
-       sbitmap_ptr p, r;
-
-       e = EDGE_PRED (b, ix);
-       if (e->src == ENTRY_BLOCK_PTR)
-         continue;
-
-       p = src[e->src->index]->elms;
-       r = dst->elms;
-       for (i = 0; i < set_size; i++)
-         *r++ |= *p++;
-      }
-}
-#endif
-
 /* Return number of first bit set in the bitmap, -1 if none.  */
 
 int
@@ -1021,13 +834,13 @@ void
 dump_sbitmap_vector (FILE *file, const char *title, const char *subtitle,
                     sbitmap *bmaps, int n_maps)
 {
-  int bb;
+  int i;
 
   fprintf (file, "%s\n", title);
-  for (bb = 0; bb < n_maps; bb++)
+  for (i = 0; i < n_maps; i++)
     {
-      fprintf (file, "%s %d\n", subtitle, bb);
-      dump_sbitmap (file, bmaps[bb]);
+      fprintf (file, "%s %d\n", subtitle, i);
+      dump_sbitmap (file, bmaps[i]);
     }
 
   fprintf (file, "\n");
index f78e0bf286691aaef94901265d5325482825c08c..9bd4ccdcde06b844b3d97a84145bde881d161dd9 100644 (file)
@@ -201,8 +201,6 @@ do {                                                                        \
 #define sbitmap_free(MAP)              (free((MAP)->popcount), free((MAP)))
 #define sbitmap_vector_free(VEC)       free(VEC)
 
-struct int_list;
-
 extern void dump_sbitmap (FILE *, const_sbitmap);
 extern void dump_sbitmap_file (FILE *, const_sbitmap);
 extern void dump_sbitmap_vector (FILE *, const char *, const char *, sbitmap *,
@@ -241,26 +239,8 @@ extern bool sbitmap_a_subset_b_p (const_sbitmap, const_sbitmap);
 extern int sbitmap_first_set_bit (const_sbitmap);
 extern int sbitmap_last_set_bit (const_sbitmap);
 
-extern void sbitmap_intersect_of_predsucc (sbitmap, sbitmap *, int,
-                                          struct int_list **);
-#define sbitmap_intersect_of_predecessors  sbitmap_intersect_of_predsucc
-#define sbitmap_intersect_of_successors    sbitmap_intersect_of_predsucc
-
-extern void sbitmap_union_of_predsucc (sbitmap, sbitmap *, int,
-                                      struct int_list **);
-#define sbitmap_union_of_predecessors  sbitmap_union_of_predsucc
-#define sbitmap_union_of_successors    sbitmap_union_of_predsucc
-
-/* Intersection and Union of preds/succs using the new flow graph
-   structure instead of the pred/succ arrays.  */
-
-extern void sbitmap_intersection_of_succs (sbitmap, sbitmap *, int);
-extern void sbitmap_intersection_of_preds (sbitmap, sbitmap *, int);
-extern void sbitmap_union_of_succs (sbitmap, sbitmap *, int);
-extern void sbitmap_union_of_preds (sbitmap, sbitmap *, int);
-
 extern void debug_sbitmap (const_sbitmap);
 extern sbitmap sbitmap_realloc (sbitmap, unsigned int);
-extern unsigned long sbitmap_popcount(const_sbitmap, unsigned long);
+extern unsigned long sbitmap_popcount (const_sbitmap, unsigned long);
 extern void sbitmap_verify_popcount (const_sbitmap);
 #endif /* ! GCC_SBITMAP_H */
This page took 0.113001 seconds and 5 git commands to generate.