+2004-11-30 Jeff Law <law@redhat.com>
+
+ * sbitmap.c (sbitmap_any_common_bits): New function.
+ * sbitmap.h (sbitmap_any_common_bits): Prototype.
+ * modulo-sched.c (sms_schedule_by_order): Use sbitmap_any_common_bits
+ No longer allocate/free "psp", "pss" sbitmaps.
+ * tree-ssa-alias.c (compute_flow_insensitive_aliasing): Similarly for
+ the "res" sbitmap.
+ (group_aliases): Similarly.
+
2004-11-30 Nathan Sidwell <nathan@codesourcery.com>
* tree-vectorizer.c (vect_analyze_data_refs): Reformat and avoid
ddg_edge_ptr e;
int start, end, step; /* Place together into one struct? */
sbitmap sched_nodes = sbitmap_alloc (num_nodes);
- sbitmap psp = sbitmap_alloc (num_nodes);
- sbitmap pss = sbitmap_alloc (num_nodes);
sbitmap must_precede = sbitmap_alloc (num_nodes);
sbitmap must_follow = sbitmap_alloc (num_nodes);
continue;
/* 1. compute sched window for u (start, end, step). */
- sbitmap_zero (psp);
- sbitmap_zero (pss);
- psp_not_empty = sbitmap_a_and_b_cg (psp, u_node_preds, sched_nodes);
- pss_not_empty = sbitmap_a_and_b_cg (pss, u_node_succs, sched_nodes);
+ psp_not_empty = sbitmap_any_common_bits (u_node_preds, sched_nodes);
+ pss_not_empty = sbitmap_any_common_bits (u_node_succs, sched_nodes);
if (psp_not_empty && !pss_not_empty)
{
} /* While try_again_with_larger_ii. */
sbitmap_free (sched_nodes);
- sbitmap_free (psp);
- sbitmap_free (pss);
if (ii >= maxii)
{
*dstp++ = *ap++;
}
+/* Return true if there are any bits set in A are also set in B.
+ Return false otherwise. */
+
+bool
+sbitmap_any_common_bits (sbitmap a, sbitmap b)
+{
+ sbitmap_ptr ap = a->elms;
+ sbitmap_ptr bp = b->elms;
+ unsigned int i, n;
+
+ n = MIN (a->size, b->size);
+ for (i = 0; i < n; i++)
+ if ((*ap++ & *bp++) != 0)
+ return true;
+
+ return false;
+}
+
/* Set DST to be (A and B).
Return nonzero if any change is made. */
extern bool sbitmap_a_or_b_and_c_cg (sbitmap, sbitmap, sbitmap, sbitmap);
extern void sbitmap_a_and_b_or_c (sbitmap, sbitmap, sbitmap, sbitmap);
extern bool sbitmap_a_and_b_or_c_cg (sbitmap, sbitmap, sbitmap, sbitmap);
+extern bool sbitmap_any_common_bits (sbitmap, sbitmap);
extern void sbitmap_a_and_b (sbitmap, sbitmap, sbitmap);
extern bool sbitmap_a_and_b_cg (sbitmap, sbitmap, sbitmap);
extern void sbitmap_a_or_b (sbitmap, sbitmap, sbitmap);
compute_flow_insensitive_aliasing (struct alias_info *ai)
{
size_t i;
- sbitmap res;
/* Initialize counter for the total number of virtual operands that
aliasing will introduce. When AI->TOTAL_ALIAS_VOPS goes beyond the
To avoid this problem, we do a final traversal of AI->POINTERS
looking for pairs of pointers that have no aliased symbols in
common and yet have conflicting alias set numbers. */
- res = sbitmap_alloc (num_referenced_vars);
-
for (i = 0; i < ai->num_pointers; i++)
{
size_t j;
/* The two pointers may alias each other. If they already have
symbols in common, do nothing. */
- sbitmap_a_and_b (res, may_aliases1, may_aliases2);
- if (sbitmap_first_set_bit (res) >= 0)
+ if (sbitmap_any_common_bits (may_aliases1, may_aliases2))
continue;
if (sbitmap_first_set_bit (may_aliases2) >= 0)
}
}
- sbitmap_free (res);
-
if (dump_file)
fprintf (dump_file, "%s: Total number of aliased vops: %ld\n",
get_name (current_function_decl),
group_aliases (struct alias_info *ai)
{
size_t i;
- sbitmap res;
/* Sort the POINTERS array in descending order of contributed
virtual operands. */
qsort (ai->pointers, ai->num_pointers, sizeof (struct alias_map_d *),
total_alias_vops_cmp);
- res = sbitmap_alloc (num_referenced_vars);
-
/* For every pointer in AI->POINTERS, reverse the roles of its tag
and the tag's may-aliases set. */
for (i = 0; i < ai->num_pointers; i++)
{
sbitmap tag2_aliases = ai->pointers[j]->may_aliases;
- sbitmap_a_and_b (res, tag1_aliases, tag2_aliases);
- if (sbitmap_first_set_bit (res) >= 0)
+ if (sbitmap_any_common_bits (tag1_aliases, tag2_aliases))
{
tree tag2 = var_ann (ai->pointers[j]->var)->type_mem_tag;
}
}
- sbitmap_free (res);
-
if (dump_file)
fprintf (dump_file,
"%s: Total number of aliased vops after grouping: %ld%s\n",