summaryrefslogtreecommitdiff
path: root/gcc/ipa.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2011-05-03 17:22:58 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2011-05-03 17:22:58 +0000
commit19ad01f71bd1a53275a57ae41312131b4017d73b (patch)
tree29d6574c5d8892da7a62fdb54c7eabbacb56e4b1 /gcc/ipa.c
parentcc80225a88f5280f1d9984d2a798ff1b1ad56fc6 (diff)
downloadgcc-19ad01f71bd1a53275a57ae41312131b4017d73b.tar.gz
* cgraph.h (cgraph_node_set_def, varpool_node_set_def): Move out of GTY;
replace hash by pointer map. (cgraph_node_set_element_def, cgraph_node_set_element, const_cgraph_node_set_element, varpool_node_set_element_def, varpool_node_set_element, const_varpool_node_set_element): Remove. (free_cgraph_node_set, free_varpool_node_set): New function. (cgraph_node_set_size, varpool_node_set_size): Use vector size. * tree-emutls.c: Free varpool node set. * ipa-utils.c (cgraph_node_set_new, cgraph_node_set_add, cgraph_node_set_remove, cgraph_node_set_find, dump_cgraph_node_set, debug_cgraph_node_set, free_cgraph_node_set, varpool_node_set_new, varpool_node_set_add, varpool_node_set_remove, varpool_node_set_find, dump_varpool_node_set, free_varpool_node_set, debug_varpool_node_set): Move here from ipa.c; implement using pointer_map * ipa.c (cgraph_node_set_new, cgraph_node_set_add, cgraph_node_set_remove, cgraph_node_set_find, dump_cgraph_node_set, debug_cgraph_node_set, varpool_node_set_new, varpool_node_set_add, varpool_node_set_remove, varpool_node_set_find, dump_varpool_node_set, debug_varpool_node_set): Move to ipa-uitls.c. * lto/lto.c (ltrans_partition_def): Remove GTY annotations. (ltrans_partitions): Move to heap. (new_partition): Update. (free_ltrans_partitions): New function. (lto_wpa_write_files): Use it. * passes.c (ipa_write_summaries): Update. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@173334 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa.c')
-rw-r--r--gcc/ipa.c314
1 files changed, 0 insertions, 314 deletions
diff --git a/gcc/ipa.c b/gcc/ipa.c
index 606a9f374d1..8f1122b01f6 100644
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -1047,320 +1047,6 @@ struct ipa_opt_pass_d pass_ipa_whole_program_visibility =
NULL, /* variable_transform */
};
-/* Hash a cgraph node set element. */
-
-static hashval_t
-hash_cgraph_node_set_element (const void *p)
-{
- const_cgraph_node_set_element element = (const_cgraph_node_set_element) p;
- return htab_hash_pointer (element->node);
-}
-
-/* Compare two cgraph node set elements. */
-
-static int
-eq_cgraph_node_set_element (const void *p1, const void *p2)
-{
- const_cgraph_node_set_element e1 = (const_cgraph_node_set_element) p1;
- const_cgraph_node_set_element e2 = (const_cgraph_node_set_element) p2;
-
- return e1->node == e2->node;
-}
-
-/* Create a new cgraph node set. */
-
-cgraph_node_set
-cgraph_node_set_new (void)
-{
- cgraph_node_set new_node_set;
-
- new_node_set = ggc_alloc_cgraph_node_set_def ();
- new_node_set->hashtab = htab_create_ggc (10,
- hash_cgraph_node_set_element,
- eq_cgraph_node_set_element,
- NULL);
- new_node_set->nodes = NULL;
- return new_node_set;
-}
-
-/* Add cgraph_node NODE to cgraph_node_set SET. */
-
-void
-cgraph_node_set_add (cgraph_node_set set, struct cgraph_node *node)
-{
- void **slot;
- cgraph_node_set_element element;
- struct cgraph_node_set_element_def dummy;
-
- dummy.node = node;
- slot = htab_find_slot (set->hashtab, &dummy, INSERT);
-
- if (*slot != HTAB_EMPTY_ENTRY)
- {
- element = (cgraph_node_set_element) *slot;
- gcc_assert (node == element->node
- && (VEC_index (cgraph_node_ptr, set->nodes, element->index)
- == node));
- return;
- }
-
- /* Insert node into hash table. */
- element = ggc_alloc_cgraph_node_set_element_def ();
- element->node = node;
- element->index = VEC_length (cgraph_node_ptr, set->nodes);
- *slot = element;
-
- /* Insert into node vector. */
- VEC_safe_push (cgraph_node_ptr, gc, set->nodes, node);
-}
-
-/* Remove cgraph_node NODE from cgraph_node_set SET. */
-
-void
-cgraph_node_set_remove (cgraph_node_set set, struct cgraph_node *node)
-{
- void **slot, **last_slot;
- cgraph_node_set_element element, last_element;
- struct cgraph_node *last_node;
- struct cgraph_node_set_element_def dummy;
-
- dummy.node = node;
- slot = htab_find_slot (set->hashtab, &dummy, NO_INSERT);
- if (slot == NULL)
- return;
-
- element = (cgraph_node_set_element) *slot;
- gcc_assert (VEC_index (cgraph_node_ptr, set->nodes, element->index)
- == node);
-
- /* Remove from vector. We do this by swapping node with the last element
- of the vector. */
- last_node = VEC_pop (cgraph_node_ptr, set->nodes);
- if (last_node != node)
- {
- dummy.node = last_node;
- last_slot = htab_find_slot (set->hashtab, &dummy, NO_INSERT);
- last_element = (cgraph_node_set_element) *last_slot;
- gcc_assert (last_element);
-
- /* Move the last element to the original spot of NODE. */
- last_element->index = element->index;
- VEC_replace (cgraph_node_ptr, set->nodes, last_element->index,
- last_node);
- }
-
- /* Remove element from hash table. */
- htab_clear_slot (set->hashtab, slot);
- ggc_free (element);
-}
-
-/* Find NODE in SET and return an iterator to it if found. A null iterator
- is returned if NODE is not in SET. */
-
-cgraph_node_set_iterator
-cgraph_node_set_find (cgraph_node_set set, struct cgraph_node *node)
-{
- void **slot;
- struct cgraph_node_set_element_def dummy;
- cgraph_node_set_element element;
- cgraph_node_set_iterator csi;
-
- dummy.node = node;
- slot = htab_find_slot (set->hashtab, &dummy, NO_INSERT);
- if (slot == NULL)
- csi.index = (unsigned) ~0;
- else
- {
- element = (cgraph_node_set_element) *slot;
- gcc_assert (VEC_index (cgraph_node_ptr, set->nodes, element->index)
- == node);
- csi.index = element->index;
- }
- csi.set = set;
-
- return csi;
-}
-
-/* Dump content of SET to file F. */
-
-void
-dump_cgraph_node_set (FILE *f, cgraph_node_set set)
-{
- cgraph_node_set_iterator iter;
-
- for (iter = csi_start (set); !csi_end_p (iter); csi_next (&iter))
- {
- struct cgraph_node *node = csi_node (iter);
- fprintf (f, " %s/%i", cgraph_node_name (node), node->uid);
- }
- fprintf (f, "\n");
-}
-
-/* Dump content of SET to stderr. */
-
-DEBUG_FUNCTION void
-debug_cgraph_node_set (cgraph_node_set set)
-{
- dump_cgraph_node_set (stderr, set);
-}
-
-/* Hash a varpool node set element. */
-
-static hashval_t
-hash_varpool_node_set_element (const void *p)
-{
- const_varpool_node_set_element element = (const_varpool_node_set_element) p;
- return htab_hash_pointer (element->node);
-}
-
-/* Compare two varpool node set elements. */
-
-static int
-eq_varpool_node_set_element (const void *p1, const void *p2)
-{
- const_varpool_node_set_element e1 = (const_varpool_node_set_element) p1;
- const_varpool_node_set_element e2 = (const_varpool_node_set_element) p2;
-
- return e1->node == e2->node;
-}
-
-/* Create a new varpool node set. */
-
-varpool_node_set
-varpool_node_set_new (void)
-{
- varpool_node_set new_node_set;
-
- new_node_set = ggc_alloc_varpool_node_set_def ();
- new_node_set->hashtab = htab_create_ggc (10,
- hash_varpool_node_set_element,
- eq_varpool_node_set_element,
- NULL);
- new_node_set->nodes = NULL;
- return new_node_set;
-}
-
-/* Add varpool_node NODE to varpool_node_set SET. */
-
-void
-varpool_node_set_add (varpool_node_set set, struct varpool_node *node)
-{
- void **slot;
- varpool_node_set_element element;
- struct varpool_node_set_element_def dummy;
-
- dummy.node = node;
- slot = htab_find_slot (set->hashtab, &dummy, INSERT);
-
- if (*slot != HTAB_EMPTY_ENTRY)
- {
- element = (varpool_node_set_element) *slot;
- gcc_assert (node == element->node
- && (VEC_index (varpool_node_ptr, set->nodes, element->index)
- == node));
- return;
- }
-
- /* Insert node into hash table. */
- element = ggc_alloc_varpool_node_set_element_def ();
- element->node = node;
- element->index = VEC_length (varpool_node_ptr, set->nodes);
- *slot = element;
-
- /* Insert into node vector. */
- VEC_safe_push (varpool_node_ptr, gc, set->nodes, node);
-}
-
-/* Remove varpool_node NODE from varpool_node_set SET. */
-
-void
-varpool_node_set_remove (varpool_node_set set, struct varpool_node *node)
-{
- void **slot, **last_slot;
- varpool_node_set_element element, last_element;
- struct varpool_node *last_node;
- struct varpool_node_set_element_def dummy;
-
- dummy.node = node;
- slot = htab_find_slot (set->hashtab, &dummy, NO_INSERT);
- if (slot == NULL)
- return;
-
- element = (varpool_node_set_element) *slot;
- gcc_assert (VEC_index (varpool_node_ptr, set->nodes, element->index)
- == node);
-
- /* Remove from vector. We do this by swapping node with the last element
- of the vector. */
- last_node = VEC_pop (varpool_node_ptr, set->nodes);
- if (last_node != node)
- {
- dummy.node = last_node;
- last_slot = htab_find_slot (set->hashtab, &dummy, NO_INSERT);
- last_element = (varpool_node_set_element) *last_slot;
- gcc_assert (last_element);
-
- /* Move the last element to the original spot of NODE. */
- last_element->index = element->index;
- VEC_replace (varpool_node_ptr, set->nodes, last_element->index,
- last_node);
- }
-
- /* Remove element from hash table. */
- htab_clear_slot (set->hashtab, slot);
- ggc_free (element);
-}
-
-/* Find NODE in SET and return an iterator to it if found. A null iterator
- is returned if NODE is not in SET. */
-
-varpool_node_set_iterator
-varpool_node_set_find (varpool_node_set set, struct varpool_node *node)
-{
- void **slot;
- struct varpool_node_set_element_def dummy;
- varpool_node_set_element element;
- varpool_node_set_iterator vsi;
-
- dummy.node = node;
- slot = htab_find_slot (set->hashtab, &dummy, NO_INSERT);
- if (slot == NULL)
- vsi.index = (unsigned) ~0;
- else
- {
- element = (varpool_node_set_element) *slot;
- gcc_assert (VEC_index (varpool_node_ptr, set->nodes, element->index)
- == node);
- vsi.index = element->index;
- }
- vsi.set = set;
-
- return vsi;
-}
-
-/* Dump content of SET to file F. */
-
-void
-dump_varpool_node_set (FILE *f, varpool_node_set set)
-{
- varpool_node_set_iterator iter;
-
- for (iter = vsi_start (set); !vsi_end_p (iter); vsi_next (&iter))
- {
- struct varpool_node *node = vsi_node (iter);
- fprintf (f, " %s", varpool_node_name (node));
- }
- fprintf (f, "\n");
-}
-
-/* Dump content of SET to stderr. */
-
-DEBUG_FUNCTION void
-debug_varpool_node_set (varpool_node_set set)
-{
- dump_varpool_node_set (stderr, set);
-}
-
/* Simple ipa profile pass propagating frequencies across the callgraph. */