m_varpool_node_hooks (NULL)
{
m_items.create (0);
- m_classes_vec.create (0);
bitmap_obstack_initialize (&m_bmstack);
}
for (unsigned int i = 0; i < m_items.length (); i++)
delete m_items[i];
- unsigned int l;
- congruence_class_group *it;
- FOR_EACH_VEC_ELT (m_classes_vec, l, it)
+
+ for (hash_table<congruence_class_hash>::iterator it = m_classes.begin ();
+ it != m_classes.end (); ++it)
{
- for (unsigned int i = 0; i < it->classes.length (); i++)
- delete it->classes[i];
+ for (unsigned int i = 0; i < (*it)->classes.length (); i++)
+ delete (*it)->classes[i];
- it->classes.release ();
- free (it);
+ (*it)->classes.release ();
+ free (*it);
}
m_items.release ();
- m_classes_vec.release ();
bitmap_obstack_release (&m_bmstack);
}
else
{
item->classes.create (1);
- m_classes_vec.safe_push (item);
*slot = item;
}
void
sem_item_optimizer::subdivide_classes_by_equality (bool in_wpa)
{
- unsigned int l;
- congruence_class_group *it;
- FOR_EACH_VEC_ELT (m_classes_vec, l, it)
+ for (hash_table <congruence_class_hash>::iterator it = m_classes.begin ();
+ it != m_classes.end (); ++it)
{
- unsigned int class_count = it->classes.length ();
+ unsigned int class_count = (*it)->classes.length ();
for (unsigned i = 0; i < class_count; i++)
{
- congruence_class *c = it->classes[i];
+ congruence_class *c = (*it)->classes[i];
if (c->members.length() > 1)
{
sem_item *first = c->members[0];
new_vector.safe_push (first);
- unsigned class_split_first = it->classes.length ();
+ unsigned class_split_first = (*it)->classes.length ();
for (unsigned j = 1; j < c->members.length (); j++)
{
bool integrated = false;
for (unsigned k = class_split_first;
- k < it->classes.length (); k++)
+ k < (*it)->classes.length (); k++)
{
- sem_item *x = it->classes[k]->members[0];
+ sem_item *x = (*it)->classes[k]->members[0];
bool equals
= in_wpa ? x->equals_wpa (item, m_symtab_node_map)
: x->equals (item, m_symtab_node_map);
if (equals)
{
integrated = true;
- add_item_to_class (it->classes[k], item);
+ add_item_to_class ((*it)->classes[k], item);
break;
}
m_classes_count++;
add_item_to_class (c, item);
- it->classes.safe_push (c);
+ (*it)->classes.safe_push (c);
}
}
}
unsigned newly_created_classes = 0;
- unsigned int l;
- congruence_class_group *it;
- FOR_EACH_VEC_ELT (m_classes_vec, l, it)
+ for (hash_table <congruence_class_hash>::iterator it = m_classes.begin ();
+ it != m_classes.end (); ++it)
{
- unsigned int class_count = it->classes.length ();
+ unsigned int class_count = (*it)->classes.length ();
auto_vec<congruence_class *> new_classes;
for (unsigned i = 0; i < class_count; i++)
{
- congruence_class *c = it->classes[i];
+ congruence_class *c = (*it)->classes[i];
if (c->members.length() > 1)
{
if (first_class)
{
- it->classes[i] = new_cls;
+ (*it)->classes[i] = new_cls;
first_class = false;
}
else
}
for (unsigned i = 0; i < new_classes.length (); i++)
- it->classes.safe_push (new_classes[i]);
+ (*it)->classes.safe_push (new_classes[i]);
}
return newly_created_classes;
void
sem_item_optimizer::verify_classes (void)
{
- unsigned int l;
- congruence_class_group *it;
- FOR_EACH_VEC_ELT (m_classes_vec, l, it)
+ for (hash_table<congruence_class_hash>::iterator it = m_classes.begin ();
+ it != m_classes.end (); ++it)
{
- for (unsigned int i = 0; i < it->classes.length (); i++)
+ for (unsigned int i = 0; i < (*it)->classes.length (); i++)
{
- congruence_class *cls = it->classes[i];
+ congruence_class *cls = (*it)->classes[i];
gcc_assert (cls);
gcc_assert (cls->members.length () > 0);
void
sem_item_optimizer::process_cong_reduction (void)
{
- unsigned int l;
- congruence_class_group *it;
- FOR_EACH_VEC_ELT (m_classes_vec, l, it)
- for (unsigned i = 0; i < it->classes.length (); i++)
- if (it->classes[i]->is_class_used ())
- worklist_push (it->classes[i]);
+ for (hash_table<congruence_class_hash>::iterator it = m_classes.begin ();
+ it != m_classes.end (); ++it)
+ for (unsigned i = 0; i < (*it)->classes.length (); i++)
+ if ((*it)->classes[i]->is_class_used ())
+ worklist_push ((*it)->classes[i]);
if (dump_file)
fprintf (dump_file, "Worklist has been filled with: %lu\n",
unsigned int max_index = 0;
unsigned int* histogram = XCNEWVEC (unsigned int, m_items.length () + 1);
- unsigned int l;
- congruence_class_group *it;
- FOR_EACH_VEC_ELT (m_classes_vec, l, it)
- for (unsigned i = 0; i < it->classes.length (); i++)
+ for (hash_table<congruence_class_hash>::iterator it = m_classes.begin ();
+ it != m_classes.end (); ++it)
+ for (unsigned i = 0; i < (*it)->classes.length (); i++)
{
- unsigned int c = it->classes[i]->members.length ();
+ unsigned int c = (*it)->classes[i]->members.length ();
histogram[c]++;
if (c > max_index)
fprintf (dump_file, "\n\n");
-
if (dump_flags & TDF_DETAILS)
- FOR_EACH_VEC_ELT (m_classes_vec, l, it)
+ for (hash_table<congruence_class_hash>::iterator it = m_classes.begin ();
+ it != m_classes.end (); ++it)
{
fprintf (dump_file, " group: with %u classes:\n",
- it->classes.length ());
+ (*it)->classes.length ());
- for (unsigned i = 0; i < it->classes.length (); i++)
+ for (unsigned i = 0; i < (*it)->classes.length (); i++)
{
- it->classes[i]->dump (dump_file, 4);
+ (*it)->classes[i]->dump (dump_file, 4);
- if (i < it->classes.length () - 1)
+ if (i < (*it)->classes.length () - 1)
fprintf (dump_file, " ");
}
}
bool merged_p = false;
- unsigned int l;
- congruence_class_group *it;
- FOR_EACH_VEC_ELT (m_classes_vec, l, it)
- for (unsigned int i = 0; i < it->classes.length (); i++)
+ for (hash_table<congruence_class_hash>::iterator it = m_classes.begin ();
+ it != m_classes.end (); ++it)
+ for (unsigned int i = 0; i < (*it)->classes.length (); i++)
{
- congruence_class *c = it->classes[i];
+ congruence_class *c = (*it)->classes[i];
if (c->members.length () > 1)
{
non_singular_classes_count++;
item_count ? 100.0f * equal_items / item_count : 0.0f);
}
- FOR_EACH_VEC_ELT (m_classes_vec, l, it)
- for (unsigned int i = 0; i < it->classes.length (); i++)
+ for (hash_table<congruence_class_hash>::iterator it = m_classes.begin ();
+ it != m_classes.end (); ++it)
+ for (unsigned int i = 0; i < (*it)->classes.length (); i++)
{
- congruence_class *c = it->classes[i];
+ congruence_class *c = (*it)->classes[i];
if (c->members.length () == 1)
continue;