summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/gcse.c8
-rw-r--r--gcc/lcm.c21
-rw-r--r--gcc/sbitmap.c275
-rw-r--r--gcc/sbitmap.h23
5 files changed, 215 insertions, 123 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index eb7cdb86eaa..a7623708117 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,14 @@
+2002-04-09 Richard Henderson <rth@redhat.com>
+
+ * sbitmap.c (sbitmap_union_of_diff, sbitmap_a_and_b, sbitmap_a_xor_b,
+ sbitmap_a_or_b, sbitmap_a_or_b_and_c, sbitmap_a_and_b_or_c):
+ Do not return changed status.
+ (sbitmap_union_of_diff_cg, sbitmap_a_and_b_cg, sbitmap_a_xor_b_cg,
+ sbitmap_a_or_b_cg, sbitmap_a_or_b_and_c_cg, sbitmap_a_and_b_or_c_cg):
+ New functions that do return changed status.
+ * sbitmap.h: Update decls.
+ * gcse.c, lcm.c: Use _cg functions as needed.
+
Tue Apr 9 19:15:57 2002 J"orn Rennecke <joern.rennecke@superh.com>
* config.gcc (sh-*-elf*): Use sh/embed-elf.h instead of sh/elf.h.
diff --git a/gcc/gcse.c b/gcc/gcse.c
index cc3b2ec0179..7a49ffc8955 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -3023,8 +3023,8 @@ compute_rd ()
for (bb = 0; bb < n_basic_blocks; bb++)
{
sbitmap_union_of_preds (reaching_defs[bb], rd_out, bb);
- changed |= sbitmap_union_of_diff (rd_out[bb], rd_gen[bb],
- reaching_defs[bb], rd_kill[bb]);
+ changed |= sbitmap_union_of_diff_cg (rd_out[bb], rd_gen[bb],
+ reaching_defs[bb], rd_kill[bb]);
}
passes++;
}
@@ -5559,8 +5559,8 @@ compute_code_hoist_vbeinout ()
the convergence. */
for (bb = n_basic_blocks - 1; bb >= 0; bb--)
{
- changed |= sbitmap_a_or_b_and_c (hoist_vbein[bb], antloc[bb],
- hoist_vbeout[bb], transp[bb]);
+ changed |= sbitmap_a_or_b_and_c_cg (hoist_vbein[bb], antloc[bb],
+ hoist_vbeout[bb], transp[bb]);
if (bb != n_basic_blocks - 1)
sbitmap_intersection_of_succs (hoist_vbeout[bb], hoist_vbein, bb);
}
diff --git a/gcc/lcm.c b/gcc/lcm.c
index a7d1dac7b82..bc95aea8dd5 100644
--- a/gcc/lcm.c
+++ b/gcc/lcm.c
@@ -162,7 +162,8 @@ compute_antinout_edge (antloc, transp, antin, antout)
sbitmap_intersection_of_succs (antout[bb], antin, bb);
}
- if (sbitmap_a_or_b_and_c (antin[bb], antloc[bb], transp[bb], antout[bb]))
+ if (sbitmap_a_or_b_and_c_cg (antin[bb], antloc[bb],
+ transp[bb], antout[bb]))
/* If the in state of this block changed, then we need
to add the predecessors of this block to the worklist
if they are not already on the worklist. */
@@ -331,10 +332,10 @@ compute_laterin (edge_list, earliest, antloc, later, laterin)
/* Calculate LATER for all outgoing edges. */
for (e = b->succ; e != NULL; e = e->succ_next)
- if (sbitmap_union_of_diff (later[(size_t) e->aux],
- earliest[(size_t) e->aux],
- laterin[e->src->index],
- antloc[e->src->index])
+ if (sbitmap_union_of_diff_cg (later[(size_t) e->aux],
+ earliest[(size_t) e->aux],
+ laterin[e->src->index],
+ antloc[e->src->index])
/* If LATER for an outgoing edge was changed, then we need
to add the target of the outgoing edge to the worklist. */
&& e->dest != EXIT_BLOCK_PTR && e->dest->aux == 0)
@@ -552,7 +553,7 @@ compute_available (avloc, kill, avout, avin)
sbitmap_intersection_of_preds (avin[bb], avout, bb);
}
- if (sbitmap_union_of_diff (avout[bb], avloc[bb], avin[bb], kill[bb]))
+ if (sbitmap_union_of_diff_cg (avout[bb], avloc[bb], avin[bb], kill[bb]))
/* If the out state of this block changed, then we need
to add the successors of this block to the worklist
if they are not already on the worklist. */
@@ -678,10 +679,10 @@ compute_nearerout (edge_list, farthest, st_avloc, nearer, nearerout)
/* Calculate NEARER for all incoming edges. */
for (e = b->pred; e != NULL; e = e->pred_next)
- if (sbitmap_union_of_diff (nearer[(size_t) e->aux],
- farthest[(size_t) e->aux],
- nearerout[e->dest->index],
- st_avloc[e->dest->index])
+ if (sbitmap_union_of_diff_cg (nearer[(size_t) e->aux],
+ farthest[(size_t) e->aux],
+ nearerout[e->dest->index],
+ st_avloc[e->dest->index])
/* If NEARER for an incoming edge was changed, then we need
to add the source of the incoming edge to the worklist. */
&& e->src != ENTRY_BLOCK_PTR && e->src->aux == 0)
diff --git a/gcc/sbitmap.c b/gcc/sbitmap.c
index cd9deba0354..c101cb07441 100644
--- a/gcc/sbitmap.c
+++ b/gcc/sbitmap.c
@@ -106,6 +106,7 @@ sbitmap_equal (a, b)
{
return !memcmp (a->elms, b->elms, sizeof (SBITMAP_ELT_TYPE) * a->size);
}
+
/* Zero all elements in a bitmap. */
void
@@ -159,29 +160,41 @@ sbitmap_vector_ones (bmap, n_vecs)
/* Set DST to be A union (B - C).
DST = A | (B & ~C).
- Return non-zero if any change is made. */
+ Returns true if any change is made. */
-int
-sbitmap_union_of_diff (dst, a, b, c)
+bool
+sbitmap_union_of_diff_cg (dst, a, b, c)
sbitmap dst, a, b, c;
{
- unsigned int i;
- sbitmap_ptr dstp, ap, bp, cp;
- int changed = 0;
-
- for (dstp = dst->elms, ap = a->elms, bp = b->elms, cp = c->elms, i = 0;
- i < dst->size; i++, dstp++)
+ unsigned int i, n = dst->size;
+ sbitmap_ptr dstp = dst->elms;
+ sbitmap_ptr ap = a->elms;
+ sbitmap_ptr bp = b->elms;
+ sbitmap_ptr cp = c->elms;
+ SBITMAP_ELT_TYPE changed = 0;
+
+ for (i = 0; i < n; i++)
{
SBITMAP_ELT_TYPE tmp = *ap++ | (*bp++ & ~*cp++);
-
- if (*dstp != tmp)
- {
- changed = 1;
- *dstp = tmp;
- }
+ changed |= *dstp ^ tmp;
+ *dstp++ = tmp;
}
- return changed;
+ return changed != 0;
+}
+
+void
+sbitmap_union_of_diff (dst, a, b, c)
+ sbitmap dst, a, b, c;
+{
+ unsigned int i, n = dst->size;
+ sbitmap_ptr dstp = dst->elms;
+ sbitmap_ptr ap = a->elms;
+ sbitmap_ptr bp = b->elms;
+ sbitmap_ptr cp = c->elms;
+
+ for (i = 0; i < n; i++)
+ *dstp++ = *ap++ | (*bp++ & ~*cp++);
}
/* Set bitmap DST to the bitwise negation of the bitmap SRC. */
@@ -190,11 +203,12 @@ void
sbitmap_not (dst, src)
sbitmap dst, src;
{
- unsigned int i;
- sbitmap_ptr dstp, srcp;
+ unsigned int i, n = dst->size;
+ sbitmap_ptr dstp = dst->elms;
+ sbitmap_ptr srcp = src->elms;
- for (dstp = dst->elms, srcp = src->elms, i = 0; i < dst->size; i++)
- *dstp++ = ~(*srcp++);
+ for (i = 0; i < n; i++)
+ *dstp++ = ~*srcp++;
}
/* Set the bits in DST to be the difference between the bits
@@ -204,156 +218,213 @@ void
sbitmap_difference (dst, a, b)
sbitmap dst, a, b;
{
- unsigned int i;
- sbitmap_ptr dstp, ap, bp;
+ unsigned int i, n = dst->size;
+ sbitmap_ptr dstp = dst->elms;
+ sbitmap_ptr ap = a->elms;
+ sbitmap_ptr bp = b->elms;
- for (dstp = dst->elms, ap = a->elms, bp = b->elms, i = 0; i < dst->size; i++)
- *dstp++ = *ap++ & (~*bp++);
+ for (i = 0; i < n; i++)
+ *dstp++ = *ap++ & ~*bp++;
}
/* Set DST to be (A and B).
Return non-zero if any change is made. */
-int
-sbitmap_a_and_b (dst, a, b)
+bool
+sbitmap_a_and_b_cg (dst, a, b)
sbitmap dst, a, b;
{
- unsigned int i;
- sbitmap_ptr dstp, ap, bp;
- int changed = 0;
+ unsigned int i, n = dst->size;
+ sbitmap_ptr dstp = dst->elms;
+ sbitmap_ptr ap = a->elms;
+ sbitmap_ptr bp = b->elms;
+ SBITMAP_ELT_TYPE changed = 0;
- for (dstp = dst->elms, ap = a->elms, bp = b->elms, i = 0; i < dst->size;
- i++, dstp++)
+ for (i = 0; i < n; i++)
{
SBITMAP_ELT_TYPE tmp = *ap++ & *bp++;
-
- if (*dstp != tmp)
- {
- changed = 1;
- *dstp = tmp;
- }
+ changed = *dstp ^ tmp;
+ *dstp++ = tmp;
}
- return changed;
+ return changed != 0;
+}
+
+void
+sbitmap_a_and_b (dst, a, b)
+ sbitmap dst, a, b;
+{
+ unsigned int i, n = dst->size;
+ sbitmap_ptr dstp = dst->elms;
+ sbitmap_ptr ap = a->elms;
+ sbitmap_ptr bp = b->elms;
+
+ for (i = 0; i < n; i++)
+ *dstp++ = *ap++ & *bp++;
}
/* Set DST to be (A xor B)).
Return non-zero if any change is made. */
-int
-sbitmap_a_xor_b (dst, a, b)
+bool
+sbitmap_a_xor_b_cg (dst, a, b)
sbitmap dst, a, b;
{
- unsigned int i;
- sbitmap_ptr dstp, ap, bp;
- int changed = 0;
-
- for (dstp = dst->elms, ap = a->elms, bp = b->elms, i = 0; i < dst->size;
- i++, dstp++)
+ unsigned int i, n = dst->size;
+ sbitmap_ptr dstp = dst->elms;
+ sbitmap_ptr ap = a->elms;
+ sbitmap_ptr bp = b->elms;
+ SBITMAP_ELT_TYPE changed = 0;
+
+ for (i = 0; i < n; i++)
{
SBITMAP_ELT_TYPE tmp = *ap++ ^ *bp++;
-
- if (*dstp != tmp)
- {
- changed = 1;
- *dstp = tmp;
- }
+ changed = *dstp ^ tmp;
+ *dstp++ = tmp;
}
- return changed;
+
+ return changed != 0;
+}
+
+void
+sbitmap_a_xor_b (dst, a, b)
+ sbitmap dst, a, b;
+{
+ unsigned int i, n = dst->size;
+ sbitmap_ptr dstp = dst->elms;
+ sbitmap_ptr ap = a->elms;
+ sbitmap_ptr bp = b->elms;
+
+ for (i = 0; i < n; i++)
+ *dstp++ = *ap++ ^ *bp++;
}
/* Set DST to be (A or B)).
Return non-zero if any change is made. */
-int
-sbitmap_a_or_b (dst, a, b)
+bool
+sbitmap_a_or_b_cg (dst, a, b)
sbitmap dst, a, b;
{
- unsigned int i;
- sbitmap_ptr dstp, ap, bp;
- int changed = 0;
+ unsigned int i, n = dst->size;
+ sbitmap_ptr dstp = dst->elms;
+ sbitmap_ptr ap = a->elms;
+ sbitmap_ptr bp = b->elms;
+ SBITMAP_ELT_TYPE changed = 0;
- for (dstp = dst->elms, ap = a->elms, bp = b->elms, i = 0; i < dst->size;
- i++, dstp++)
+ for (i = 0; i < n; i++)
{
SBITMAP_ELT_TYPE tmp = *ap++ | *bp++;
-
- if (*dstp != tmp)
- {
- changed = 1;
- *dstp = tmp;
- }
+ changed = *dstp ^ tmp;
+ *dstp++ = tmp;
}
- return changed;
+ return changed != 0;
+}
+
+void
+sbitmap_a_or_b (dst, a, b)
+ sbitmap dst, a, b;
+{
+ unsigned int i, n = dst->size;
+ sbitmap_ptr dstp = dst->elms;
+ sbitmap_ptr ap = a->elms;
+ sbitmap_ptr bp = b->elms;
+
+ for (i = 0; i < n; i++)
+ *dstp++ = *ap++ | *bp++;
}
/* Return non-zero if A is a subset of B. */
-int
+bool
sbitmap_a_subset_b_p (a, b)
sbitmap a, b;
{
- unsigned int i;
+ unsigned int i, n = a->size;
sbitmap_ptr ap, bp;
- for (ap = a->elms, bp = b->elms, i = 0; i < a->size; i++, ap++, bp++)
+ for (ap = a->elms, bp = b->elms, i = 0; i < n; i++, ap++, bp++)
if ((*ap | *bp) != *bp)
- return 0;
+ return false;
- return 1;
+ return true;
}
/* Set DST to be (A or (B and C)).
Return non-zero if any change is made. */
-int
-sbitmap_a_or_b_and_c (dst, a, b, c)
+bool
+sbitmap_a_or_b_and_c_cg (dst, a, b, c)
sbitmap dst, a, b, c;
{
- unsigned int i;
- sbitmap_ptr dstp, ap, bp, cp;
- int changed = 0;
-
- for (dstp = dst->elms, ap = a->elms, bp = b->elms, cp = c->elms, i = 0;
- i < dst->size; i++, dstp++)
+ unsigned int i, n = dst->size;
+ sbitmap_ptr dstp = dst->elms;
+ sbitmap_ptr ap = a->elms;
+ sbitmap_ptr bp = b->elms;
+ sbitmap_ptr cp = c->elms;
+ SBITMAP_ELT_TYPE changed = 0;
+
+ for (i = 0; i < n; i++)
{
SBITMAP_ELT_TYPE tmp = *ap++ | (*bp++ & *cp++);
-
- if (*dstp != tmp)
- {
- changed = 1;
- *dstp = tmp;
- }
+ changed |= *dstp ^ tmp;
+ *dstp++ = tmp;
}
- return changed;
+ return changed != 0;
+}
+
+void
+sbitmap_a_or_b_and_c (dst, a, b, c)
+ sbitmap dst, a, b, c;
+{
+ unsigned int i, n = dst->size;
+ sbitmap_ptr dstp = dst->elms;
+ sbitmap_ptr ap = a->elms;
+ sbitmap_ptr bp = b->elms;
+ sbitmap_ptr cp = c->elms;
+
+ for (i = 0; i < n; i++)
+ *dstp++ = *ap++ | (*bp++ & *cp++);
}
/* Set DST to be (A and (B or C)).
Return non-zero if any change is made. */
-int
-sbitmap_a_and_b_or_c (dst, a, b, c)
+bool
+sbitmap_a_and_b_or_c_cg (dst, a, b, c)
sbitmap dst, a, b, c;
{
- unsigned int i;
- sbitmap_ptr dstp, ap, bp, cp;
- int changed = 0;
-
- for (dstp = dst->elms, ap = a->elms, bp = b->elms, cp = c->elms, i = 0;
- i < dst->size; i++, dstp++)
+ unsigned int i, n = dst->size;
+ sbitmap_ptr dstp = dst->elms;
+ sbitmap_ptr ap = a->elms;
+ sbitmap_ptr bp = b->elms;
+ sbitmap_ptr cp = c->elms;
+ SBITMAP_ELT_TYPE changed = 0;
+
+ for (i = 0; i < n; i++)
{
SBITMAP_ELT_TYPE tmp = *ap++ & (*bp++ | *cp++);
-
- if (*dstp != tmp)
- {
- changed = 1;
- *dstp = tmp;
- }
+ changed |= *dstp ^ tmp;
+ *dstp++ = tmp;
}
- return changed;
+ return changed != 0;
+}
+
+void
+sbitmap_a_and_b_or_c (dst, a, b, c)
+ sbitmap dst, a, b, c;
+{
+ unsigned int i, n = dst->size;
+ sbitmap_ptr dstp = dst->elms;
+ sbitmap_ptr ap = a->elms;
+ sbitmap_ptr bp = b->elms;
+ sbitmap_ptr cp = c->elms;
+
+ for (i = 0; i < n; i++)
+ *dstp++ = *ap++ & (*bp++ | *cp++);
}
#ifdef IN_GCC
diff --git a/gcc/sbitmap.h b/gcc/sbitmap.h
index 889680188b2..864ea094acb 100644
--- a/gcc/sbitmap.h
+++ b/gcc/sbitmap.h
@@ -103,18 +103,27 @@ extern void sbitmap_ones PARAMS ((sbitmap));
extern void sbitmap_vector_zero PARAMS ((sbitmap *, unsigned int));
extern void sbitmap_vector_ones PARAMS ((sbitmap *, unsigned int));
-extern int sbitmap_union_of_diff PARAMS ((sbitmap, sbitmap, sbitmap,
+extern void sbitmap_union_of_diff PARAMS ((sbitmap, sbitmap, sbitmap,
+ sbitmap));
+extern bool sbitmap_union_of_diff_cg PARAMS ((sbitmap, sbitmap, sbitmap,
sbitmap));
extern void sbitmap_difference PARAMS ((sbitmap, sbitmap, sbitmap));
extern void sbitmap_not PARAMS ((sbitmap, sbitmap));
-extern int sbitmap_a_or_b_and_c PARAMS ((sbitmap, sbitmap, sbitmap,
+extern void sbitmap_a_or_b_and_c PARAMS ((sbitmap, sbitmap, sbitmap,
+ sbitmap));
+extern bool sbitmap_a_or_b_and_c_cg PARAMS ((sbitmap, sbitmap, sbitmap,
+ sbitmap));
+extern void sbitmap_a_and_b_or_c PARAMS ((sbitmap, sbitmap, sbitmap,
sbitmap));
-extern int sbitmap_a_and_b_or_c PARAMS ((sbitmap, sbitmap, sbitmap,
+extern bool sbitmap_a_and_b_or_c_cg PARAMS ((sbitmap, sbitmap, sbitmap,
sbitmap));
-extern int sbitmap_a_and_b PARAMS ((sbitmap, sbitmap, sbitmap));
-extern int sbitmap_a_or_b PARAMS ((sbitmap, sbitmap, sbitmap));
-extern int sbitmap_a_xor_b PARAMS ((sbitmap, sbitmap, sbitmap));
-extern int sbitmap_a_subset_b_p PARAMS ((sbitmap, sbitmap));
+extern void sbitmap_a_and_b PARAMS ((sbitmap, sbitmap, sbitmap));
+extern bool sbitmap_a_and_b_cg PARAMS ((sbitmap, sbitmap, sbitmap));
+extern void sbitmap_a_or_b PARAMS ((sbitmap, sbitmap, sbitmap));
+extern bool sbitmap_a_or_b_cg PARAMS ((sbitmap, sbitmap, sbitmap));
+extern void sbitmap_a_xor_b PARAMS ((sbitmap, sbitmap, sbitmap));
+extern bool sbitmap_a_xor_b_cg PARAMS ((sbitmap, sbitmap, sbitmap));
+extern bool sbitmap_a_subset_b_p PARAMS ((sbitmap, sbitmap));
extern int sbitmap_first_set_bit PARAMS ((sbitmap));
extern int sbitmap_last_set_bit PARAMS ((sbitmap));