Commit b47374fa by Richard Henderson Committed by Richard Henderson

sbitmap.c (sbitmap_union_of_diff, [...]): Do not return changed status.

        * 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.

From-SVN: r52094
parent 1951818c
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> 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. * config.gcc (sh-*-elf*): Use sh/embed-elf.h instead of sh/elf.h.
......
...@@ -3023,8 +3023,8 @@ compute_rd () ...@@ -3023,8 +3023,8 @@ compute_rd ()
for (bb = 0; bb < n_basic_blocks; bb++) for (bb = 0; bb < n_basic_blocks; bb++)
{ {
sbitmap_union_of_preds (reaching_defs[bb], rd_out, bb); sbitmap_union_of_preds (reaching_defs[bb], rd_out, bb);
changed |= sbitmap_union_of_diff (rd_out[bb], rd_gen[bb], changed |= sbitmap_union_of_diff_cg (rd_out[bb], rd_gen[bb],
reaching_defs[bb], rd_kill[bb]); reaching_defs[bb], rd_kill[bb]);
} }
passes++; passes++;
} }
...@@ -5559,8 +5559,8 @@ compute_code_hoist_vbeinout () ...@@ -5559,8 +5559,8 @@ compute_code_hoist_vbeinout ()
the convergence. */ the convergence. */
for (bb = n_basic_blocks - 1; bb >= 0; bb--) for (bb = n_basic_blocks - 1; bb >= 0; bb--)
{ {
changed |= sbitmap_a_or_b_and_c (hoist_vbein[bb], antloc[bb], changed |= sbitmap_a_or_b_and_c_cg (hoist_vbein[bb], antloc[bb],
hoist_vbeout[bb], transp[bb]); hoist_vbeout[bb], transp[bb]);
if (bb != n_basic_blocks - 1) if (bb != n_basic_blocks - 1)
sbitmap_intersection_of_succs (hoist_vbeout[bb], hoist_vbein, bb); sbitmap_intersection_of_succs (hoist_vbeout[bb], hoist_vbein, bb);
} }
......
...@@ -162,7 +162,8 @@ compute_antinout_edge (antloc, transp, antin, antout) ...@@ -162,7 +162,8 @@ compute_antinout_edge (antloc, transp, antin, antout)
sbitmap_intersection_of_succs (antout[bb], antin, bb); 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 /* If the in state of this block changed, then we need
to add the predecessors of this block to the worklist to add the predecessors of this block to the worklist
if they are not already on the worklist. */ if they are not already on the worklist. */
...@@ -331,10 +332,10 @@ compute_laterin (edge_list, earliest, antloc, later, laterin) ...@@ -331,10 +332,10 @@ compute_laterin (edge_list, earliest, antloc, later, laterin)
/* Calculate LATER for all outgoing edges. */ /* Calculate LATER for all outgoing edges. */
for (e = b->succ; e != NULL; e = e->succ_next) for (e = b->succ; e != NULL; e = e->succ_next)
if (sbitmap_union_of_diff (later[(size_t) e->aux], if (sbitmap_union_of_diff_cg (later[(size_t) e->aux],
earliest[(size_t) e->aux], earliest[(size_t) e->aux],
laterin[e->src->index], laterin[e->src->index],
antloc[e->src->index]) antloc[e->src->index])
/* If LATER for an outgoing edge was changed, then we need /* If LATER for an outgoing edge was changed, then we need
to add the target of the outgoing edge to the worklist. */ to add the target of the outgoing edge to the worklist. */
&& e->dest != EXIT_BLOCK_PTR && e->dest->aux == 0) && e->dest != EXIT_BLOCK_PTR && e->dest->aux == 0)
...@@ -552,7 +553,7 @@ compute_available (avloc, kill, avout, avin) ...@@ -552,7 +553,7 @@ compute_available (avloc, kill, avout, avin)
sbitmap_intersection_of_preds (avin[bb], avout, bb); 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 /* If the out state of this block changed, then we need
to add the successors of this block to the worklist to add the successors of this block to the worklist
if they are not already on the worklist. */ if they are not already on the worklist. */
...@@ -678,10 +679,10 @@ compute_nearerout (edge_list, farthest, st_avloc, nearer, nearerout) ...@@ -678,10 +679,10 @@ compute_nearerout (edge_list, farthest, st_avloc, nearer, nearerout)
/* Calculate NEARER for all incoming edges. */ /* Calculate NEARER for all incoming edges. */
for (e = b->pred; e != NULL; e = e->pred_next) for (e = b->pred; e != NULL; e = e->pred_next)
if (sbitmap_union_of_diff (nearer[(size_t) e->aux], if (sbitmap_union_of_diff_cg (nearer[(size_t) e->aux],
farthest[(size_t) e->aux], farthest[(size_t) e->aux],
nearerout[e->dest->index], nearerout[e->dest->index],
st_avloc[e->dest->index]) st_avloc[e->dest->index])
/* If NEARER for an incoming edge was changed, then we need /* If NEARER for an incoming edge was changed, then we need
to add the source of the incoming edge to the worklist. */ to add the source of the incoming edge to the worklist. */
&& e->src != ENTRY_BLOCK_PTR && e->src->aux == 0) && e->src != ENTRY_BLOCK_PTR && e->src->aux == 0)
......
...@@ -106,6 +106,7 @@ sbitmap_equal (a, b) ...@@ -106,6 +106,7 @@ sbitmap_equal (a, b)
{ {
return !memcmp (a->elms, b->elms, sizeof (SBITMAP_ELT_TYPE) * a->size); return !memcmp (a->elms, b->elms, sizeof (SBITMAP_ELT_TYPE) * a->size);
} }
/* Zero all elements in a bitmap. */ /* Zero all elements in a bitmap. */
void void
...@@ -159,29 +160,41 @@ sbitmap_vector_ones (bmap, n_vecs) ...@@ -159,29 +160,41 @@ sbitmap_vector_ones (bmap, n_vecs)
/* Set DST to be A union (B - C). /* Set DST to be A union (B - C).
DST = A | (B & ~C). DST = A | (B & ~C).
Return non-zero if any change is made. */ Returns true if any change is made. */
int bool
sbitmap_union_of_diff (dst, a, b, c) sbitmap_union_of_diff_cg (dst, a, b, c)
sbitmap dst, a, b, c; sbitmap dst, a, b, c;
{ {
unsigned int i; unsigned int i, n = dst->size;
sbitmap_ptr dstp, ap, bp, cp; sbitmap_ptr dstp = dst->elms;
int changed = 0; sbitmap_ptr ap = a->elms;
sbitmap_ptr bp = b->elms;
for (dstp = dst->elms, ap = a->elms, bp = b->elms, cp = c->elms, i = 0; sbitmap_ptr cp = c->elms;
i < dst->size; i++, dstp++) SBITMAP_ELT_TYPE changed = 0;
for (i = 0; i < n; i++)
{ {
SBITMAP_ELT_TYPE tmp = *ap++ | (*bp++ & ~*cp++); SBITMAP_ELT_TYPE tmp = *ap++ | (*bp++ & ~*cp++);
changed |= *dstp ^ tmp;
if (*dstp != tmp) *dstp++ = tmp;
{
changed = 1;
*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. */ /* Set bitmap DST to the bitwise negation of the bitmap SRC. */
...@@ -190,11 +203,12 @@ void ...@@ -190,11 +203,12 @@ void
sbitmap_not (dst, src) sbitmap_not (dst, src)
sbitmap dst, src; sbitmap dst, src;
{ {
unsigned int i; unsigned int i, n = dst->size;
sbitmap_ptr dstp, srcp; sbitmap_ptr dstp = dst->elms;
sbitmap_ptr srcp = src->elms;
for (dstp = dst->elms, srcp = src->elms, i = 0; i < dst->size; i++) for (i = 0; i < n; i++)
*dstp++ = ~(*srcp++); *dstp++ = ~*srcp++;
} }
/* Set the bits in DST to be the difference between the bits /* Set the bits in DST to be the difference between the bits
...@@ -204,156 +218,213 @@ void ...@@ -204,156 +218,213 @@ void
sbitmap_difference (dst, a, b) sbitmap_difference (dst, a, b)
sbitmap dst, a, b; sbitmap dst, a, b;
{ {
unsigned int i; unsigned int i, n = dst->size;
sbitmap_ptr dstp, ap, bp; 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++) for (i = 0; i < n; i++)
*dstp++ = *ap++ & (~*bp++); *dstp++ = *ap++ & ~*bp++;
} }
/* Set DST to be (A and B). /* Set DST to be (A and B).
Return non-zero if any change is made. */ Return non-zero if any change is made. */
int bool
sbitmap_a_and_b (dst, a, b) sbitmap_a_and_b_cg (dst, a, b)
sbitmap dst, a, b; sbitmap dst, a, b;
{ {
unsigned int i; unsigned int i, n = dst->size;
sbitmap_ptr dstp, ap, bp; sbitmap_ptr dstp = dst->elms;
int changed = 0; 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; for (i = 0; i < n; i++)
i++, dstp++)
{ {
SBITMAP_ELT_TYPE tmp = *ap++ & *bp++; SBITMAP_ELT_TYPE tmp = *ap++ & *bp++;
changed = *dstp ^ tmp;
if (*dstp != tmp) *dstp++ = tmp;
{
changed = 1;
*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)). /* Set DST to be (A xor B)).
Return non-zero if any change is made. */ Return non-zero if any change is made. */
int bool
sbitmap_a_xor_b (dst, a, b) sbitmap_a_xor_b_cg (dst, a, b)
sbitmap dst, a, b; sbitmap dst, a, b;
{ {
unsigned int i; unsigned int i, n = dst->size;
sbitmap_ptr dstp, ap, bp; sbitmap_ptr dstp = dst->elms;
int changed = 0; 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; SBITMAP_ELT_TYPE changed = 0;
i++, dstp++)
for (i = 0; i < n; i++)
{ {
SBITMAP_ELT_TYPE tmp = *ap++ ^ *bp++; SBITMAP_ELT_TYPE tmp = *ap++ ^ *bp++;
changed = *dstp ^ tmp;
if (*dstp != tmp) *dstp++ = tmp;
{
changed = 1;
*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)). /* Set DST to be (A or B)).
Return non-zero if any change is made. */ Return non-zero if any change is made. */
int bool
sbitmap_a_or_b (dst, a, b) sbitmap_a_or_b_cg (dst, a, b)
sbitmap dst, a, b; sbitmap dst, a, b;
{ {
unsigned int i; unsigned int i, n = dst->size;
sbitmap_ptr dstp, ap, bp; sbitmap_ptr dstp = dst->elms;
int changed = 0; 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; for (i = 0; i < n; i++)
i++, dstp++)
{ {
SBITMAP_ELT_TYPE tmp = *ap++ | *bp++; SBITMAP_ELT_TYPE tmp = *ap++ | *bp++;
changed = *dstp ^ tmp;
if (*dstp != tmp) *dstp++ = tmp;
{
changed = 1;
*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. */ /* Return non-zero if A is a subset of B. */
int bool
sbitmap_a_subset_b_p (a, b) sbitmap_a_subset_b_p (a, b)
sbitmap a, b; sbitmap a, b;
{ {
unsigned int i; unsigned int i, n = a->size;
sbitmap_ptr ap, bp; 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) if ((*ap | *bp) != *bp)
return 0; return false;
return 1; return true;
} }
/* Set DST to be (A or (B and C)). /* Set DST to be (A or (B and C)).
Return non-zero if any change is made. */ Return non-zero if any change is made. */
int bool
sbitmap_a_or_b_and_c (dst, a, b, c) sbitmap_a_or_b_and_c_cg (dst, a, b, c)
sbitmap dst, a, b, c; sbitmap dst, a, b, c;
{ {
unsigned int i; unsigned int i, n = dst->size;
sbitmap_ptr dstp, ap, bp, cp; sbitmap_ptr dstp = dst->elms;
int changed = 0; sbitmap_ptr ap = a->elms;
sbitmap_ptr bp = b->elms;
for (dstp = dst->elms, ap = a->elms, bp = b->elms, cp = c->elms, i = 0; sbitmap_ptr cp = c->elms;
i < dst->size; i++, dstp++) SBITMAP_ELT_TYPE changed = 0;
for (i = 0; i < n; i++)
{ {
SBITMAP_ELT_TYPE tmp = *ap++ | (*bp++ & *cp++); SBITMAP_ELT_TYPE tmp = *ap++ | (*bp++ & *cp++);
changed |= *dstp ^ tmp;
if (*dstp != tmp) *dstp++ = tmp;
{
changed = 1;
*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)). /* Set DST to be (A and (B or C)).
Return non-zero if any change is made. */ Return non-zero if any change is made. */
int bool
sbitmap_a_and_b_or_c (dst, a, b, c) sbitmap_a_and_b_or_c_cg (dst, a, b, c)
sbitmap dst, a, b, c; sbitmap dst, a, b, c;
{ {
unsigned int i; unsigned int i, n = dst->size;
sbitmap_ptr dstp, ap, bp, cp; sbitmap_ptr dstp = dst->elms;
int changed = 0; sbitmap_ptr ap = a->elms;
sbitmap_ptr bp = b->elms;
for (dstp = dst->elms, ap = a->elms, bp = b->elms, cp = c->elms, i = 0; sbitmap_ptr cp = c->elms;
i < dst->size; i++, dstp++) SBITMAP_ELT_TYPE changed = 0;
for (i = 0; i < n; i++)
{ {
SBITMAP_ELT_TYPE tmp = *ap++ & (*bp++ | *cp++); SBITMAP_ELT_TYPE tmp = *ap++ & (*bp++ | *cp++);
changed |= *dstp ^ tmp;
if (*dstp != tmp) *dstp++ = tmp;
{
changed = 1;
*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 #ifdef IN_GCC
......
...@@ -103,18 +103,27 @@ extern void sbitmap_ones PARAMS ((sbitmap)); ...@@ -103,18 +103,27 @@ extern void sbitmap_ones PARAMS ((sbitmap));
extern void sbitmap_vector_zero PARAMS ((sbitmap *, unsigned int)); extern void sbitmap_vector_zero PARAMS ((sbitmap *, unsigned int));
extern void sbitmap_vector_ones 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)); sbitmap));
extern void sbitmap_difference PARAMS ((sbitmap, sbitmap, sbitmap)); extern void sbitmap_difference PARAMS ((sbitmap, sbitmap, sbitmap));
extern void sbitmap_not PARAMS ((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)); 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)); sbitmap));
extern int sbitmap_a_and_b PARAMS ((sbitmap, sbitmap, sbitmap)); extern void sbitmap_a_and_b PARAMS ((sbitmap, sbitmap, sbitmap));
extern int sbitmap_a_or_b PARAMS ((sbitmap, sbitmap, sbitmap)); extern bool sbitmap_a_and_b_cg PARAMS ((sbitmap, sbitmap, sbitmap));
extern int sbitmap_a_xor_b PARAMS ((sbitmap, sbitmap, sbitmap)); extern void sbitmap_a_or_b PARAMS ((sbitmap, sbitmap, sbitmap));
extern int sbitmap_a_subset_b_p PARAMS ((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_first_set_bit PARAMS ((sbitmap));
extern int sbitmap_last_set_bit PARAMS ((sbitmap)); extern int sbitmap_last_set_bit PARAMS ((sbitmap));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment