-typedef struct tree_partition_associator_d
-{
- VEC(tree,heap) *trees;
- VEC(int,heap) *first_partition;
- int *next_partition;
- int *partition_to_tree_map;
- int num_trees;
- int uncompressed_num;
- var_map map;
-} *tpa_p;
-
-/* Value returned when there are no more partitions associated with a tree. */
-#define TPA_NONE -1
-
-static inline tree tpa_tree (tpa_p, int);
-static inline int tpa_first_partition (tpa_p, int);
-static inline int tpa_next_partition (tpa_p, int);
-static inline int tpa_num_trees (tpa_p);
-static inline int tpa_find_tree (tpa_p, int);
-static inline void tpa_decompact (tpa_p);
-extern void tpa_delete (tpa_p);
-extern void tpa_dump (FILE *, tpa_p);
-extern void tpa_remove_partition (tpa_p, int, int);
-extern int tpa_compact (tpa_p);
-
-
-/* Return the number of distinct tree nodes in TPA. */
-
-static inline int
-tpa_num_trees (tpa_p tpa)
-{
- return tpa->num_trees;
-}
-
-
-/* Return the tree node for index I in TPA. */
-
-static inline tree
-tpa_tree (tpa_p tpa, int i)
-{
- return VEC_index (tree, tpa->trees, i);
-}
-
-
-/* Return the first partition associated with tree list I in TPA. */
-
-static inline int
-tpa_first_partition (tpa_p tpa, int i)
-{
- return VEC_index (int, tpa->first_partition, i);
-}
-
-
-/* Return the next partition after partition I in TPA's list. */
-
-static inline int
-tpa_next_partition (tpa_p tpa, int i)
-{
- return tpa->next_partition[i];
-}
-
-
-/* Return the tree index from TPA whose list contains partition I.
- TPA_NONE is returned if I is not associated with any list. */
-
-static inline int
-tpa_find_tree (tpa_p tpa, int i)
-{
- int index;
-
- index = tpa->partition_to_tree_map[i];
- /* When compressed, any index higher than the number of tree elements is
- a compressed element, so return TPA_NONE. */
- if (index != TPA_NONE && index >= tpa_num_trees (tpa))
- {
- gcc_assert (tpa->uncompressed_num != -1);
- index = TPA_NONE;
- }
-
- return index;
-}
-
-
-/* This function removes any compaction which was performed on TPA. */
-
-static inline void
-tpa_decompact(tpa_p tpa)
-{
- gcc_assert (tpa->uncompressed_num != -1);
- tpa->num_trees = tpa->uncompressed_num;
-}
-
-
-/* Once a var_map has been created and compressed, a complementary root_var
- object can be built. This creates a list of all the root variables from
- which ssa version names are derived. Each root variable has a list of
- which partitions are versions of that root.
-
- This is implemented using the tree_partition_associator.
-
- The tree vector is used to represent the root variable.
- The list of partitions represent SSA versions of the root variable. */
-
-typedef tpa_p root_var_p;
-
-static inline tree root_var (root_var_p, int);
-static inline int root_var_first_partition (root_var_p, int);
-static inline int root_var_next_partition (root_var_p, int);
-static inline int root_var_num (root_var_p);
-static inline void root_var_dump (FILE *, root_var_p);
-static inline void root_var_remove_partition (root_var_p, int, int);
-static inline void root_var_delete (root_var_p);
-static inline int root_var_find (root_var_p, int);
-static inline int root_var_compact (root_var_p);
-static inline void root_var_decompact (tpa_p);
-
-extern root_var_p root_var_init (var_map);
-
-/* Value returned when there are no more partitions associated with a root
- variable. */
-#define ROOT_VAR_NONE TPA_NONE
-
-
-/* Return the number of distinct root variables in RV. */
-
-static inline int
-root_var_num (root_var_p rv)
-{
- return tpa_num_trees (rv);
-}
-
-
-/* Return root variable I from RV. */
-
-static inline tree
-root_var (root_var_p rv, int i)
-{
- return tpa_tree (rv, i);
-}
-
-
-/* Return the first partition in RV belonging to root variable list I. */
-
-static inline int
-root_var_first_partition (root_var_p rv, int i)
-{
- return tpa_first_partition (rv, i);
-}
-
-
-/* Return the next partition after partition I in a root list from RV. */
-
-static inline int
-root_var_next_partition (root_var_p rv, int i)
-{
- return tpa_next_partition (rv, i);
-}
-
-
-/* Send debug info for root_var list RV to file F. */
-
-static inline void
-root_var_dump (FILE *f, root_var_p rv)
-{
- fprintf (f, "\nRoot Var dump\n");
- tpa_dump (f, rv);
- fprintf (f, "\n");
-}
-
-
-/* Destroy root_var object RV. */
-
-static inline void
-root_var_delete (root_var_p rv)
-{
- tpa_delete (rv);
-}
-
-
-/* Remove partition PARTITION_INDEX from root_var list ROOT_INDEX in RV. */
-
-static inline void
-root_var_remove_partition (root_var_p rv, int root_index, int partition_index)
-{
- tpa_remove_partition (rv, root_index, partition_index);
-}
-
-
-/* Return the root_var list index for partition I in RV. */
-
-static inline int
-root_var_find (root_var_p rv, int i)
-{
- return tpa_find_tree (rv, i);
-}
-
-
-/* Hide single element lists in RV. */
-
-static inline int
-root_var_compact (root_var_p rv)
-{
- return tpa_compact (rv);
-}
-
-
-/* Expose the single element lists in RV. */
-
-static inline void
-root_var_decompact (root_var_p rv)
-{
- tpa_decompact (rv);
-}
-
-
-/* This set of routines implements a coalesce_list. This is an object which
- is used to track pairs of partitions which are desirable to coalesce
- together at some point. Costs are associated with each pair, and when
- all desired information has been collected, the object can be used to
- order the pairs for processing. */
-
-/* This structure defines a pair entry. */
-
-typedef struct partition_pair
-{
- int first_partition;
- int second_partition;
- int cost;
-} * partition_pair_p;
-
-extern unsigned int partition_pair_map_hash (const void *);
-extern int partition_pair_map_eq (const void *, const void *);
-
-/* This structure maintains the list of coalesce pairs. */
-
-typedef struct coalesce_list_d
-{
- var_map map;
- htab_t list;
- partition_pair_p *sorted;
- int num_sorted;
- bool add_mode;
-} *coalesce_list_p;
-
-extern coalesce_list_p create_coalesce_list (var_map);
-extern void add_coalesce (coalesce_list_p, int, int, int);
-extern int coalesce_cost (int, bool, bool);
-extern void sort_coalesce_list (coalesce_list_p);
-extern void dump_coalesce_list (FILE *, coalesce_list_p);
-extern void delete_coalesce_list (coalesce_list_p);
-
-#define NO_BEST_COALESCE -1
-
-extern conflict_graph build_tree_conflict_graph (tree_live_info_p, tpa_p,
- coalesce_list_p);
-extern void coalesce_tpa_members (tpa_p tpa, conflict_graph graph, var_map map,
- coalesce_list_p cl, FILE *);