diff options
author | Andrew Macleod <amacleod@redhat.com> | 2006-08-30 13:26:08 +0000 |
---|---|---|
committer | Andrew Macleod <amacleod@redhat.com> | 2006-08-30 13:26:08 +0000 |
commit | 3208c74bac9b699754eea8a62eb7b7e5018c991a (patch) | |
tree | 5af125458ab36c3c3529e6a4ec81e2300a05f1e9 /gcc/tree-outof-ssa.c | |
parent | 968e99129d32e13d489e2c0ad50a4cd665691824 (diff) |
change compaction routines to partition view, dont add coalesces when bulding the conflict graph, and don';t use rootvars in compaction.
2006-08-30 Andrew MacLeod <amacleod@redhat.com>
* tree-ssa-live.c (compact_var_map): Remove.
(partition_view_init): New. Routine to ready a var_map for any type
of compacted view.
(partition_view_fini): New. Perform compaction based on a bitmap of
desired elements in a var_map.
(partition_view_normal): New. Perform what use to be var_map_compact
with VARMAP_NORMAL as a parameter.
(partition_view_no_single_version): New. Perform what use to be
var_map_compact with VARMAP_NO_SINGLE_DEFS.
(build_tree_conflict_graph): Don't modify the coalesce list, and remove
the coalesce list from the parameter list.
* tree-ssa-live.h (VARMAP_NORMAL, VARMAP_NO_SINGLE_DEFS): Remove.
* tree-outof-ssa.c (coalesce_result_decls_and_copies): Renamed from
coalesce_result_decls and add coalesces taht use to be added in
build_tree_conflict_graph.
(coalesce_ssa_name): Reorder function calls slightly, use new partition
view routines.
(remove_ssa_form): Move initial compaction to coalesce_ssa_name.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/out-of-ssa-the-sequel@116585 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-outof-ssa.c')
-rw-r--r-- | gcc/tree-outof-ssa.c | 71 |
1 files changed, 42 insertions, 29 deletions
diff --git a/gcc/tree-outof-ssa.c b/gcc/tree-outof-ssa.c index 3030ffb605c..9b182dc568e 100644 --- a/gcc/tree-outof-ssa.c +++ b/gcc/tree-outof-ssa.c @@ -718,10 +718,11 @@ coalesce_phi_operands (var_map map, coalesce_list_p cl) /* Coalesce all the result decls together. */ static void -coalesce_result_decls (var_map map, coalesce_list_p cl) +coalesce_result_decls_and_copies (var_map map, coalesce_list_p cl) { unsigned int i, x; tree var = NULL; + tree stmt; for (i = x = 0; x < num_var_partitions (map); x++) { @@ -739,6 +740,22 @@ coalesce_result_decls (var_map map, coalesce_list_p cl) maybe_hot_bb_p (EXIT_BLOCK_PTR), false)); } + else + /* Add coalesces between copies seen in the IL as well. */ + if ((stmt = SSA_NAME_DEF_STMT (p)) != NULL_TREE) + { + if (TREE_CODE (stmt) == MODIFY_EXPR + && TREE_CODE (TREE_OPERAND (stmt, 1)) == SSA_NAME) + { + int p = var_to_partition (map, TREE_OPERAND (stmt, 1)); + basic_block bb = bb_for_stmt (stmt); + if (p != NO_PARTITION) + add_coalesce (cl, x, p, + coalesce_cost (bb->frequency, + maybe_hot_bb_p (bb), + false)); + } + } } } @@ -819,39 +836,42 @@ coalesce_ssa_name (var_map map, int flags) coalesce_list_p cl = NULL; sbitmap_iterator sbi; + /* Don't calculate live ranges for variables with only one SSA version. */ + partition_view_no_single_version (map); + if (num_var_partitions (map) <= 1) return NULL; + cl = create_coalesce_list (map); + + coalesce_phi_operands (map, cl); + coalesce_result_decls_and_copies (map, cl); + coalesce_asm_operands (map, cl); + + if (dump_file && (dump_flags & TDF_DETAILS)) + dump_var_map (dump_file, map); + liveinfo = calculate_live_ranges (map); rv = root_var_init (map); /* Remove single element variable from the list. */ root_var_compact (rv); - cl = create_coalesce_list (map); - - coalesce_phi_operands (map, cl); - coalesce_result_decls (map, cl); - coalesce_asm_operands (map, cl); - /* Build a conflict graph. */ - graph = build_tree_conflict_graph (liveinfo, rv, cl); + graph = build_tree_conflict_graph (liveinfo, rv); - if (cl) + if (dump_file && (dump_flags & TDF_DETAILS)) { - if (dump_file && (dump_flags & TDF_DETAILS)) - { - fprintf (dump_file, "Before sorting:\n"); - dump_coalesce_list (dump_file, cl); - } + fprintf (dump_file, "Before sorting:\n"); + dump_coalesce_list (dump_file, cl); + } - sort_coalesce_list (cl); + sort_coalesce_list (cl); - if (dump_file && (dump_flags & TDF_DETAILS)) - { - fprintf (dump_file, "\nAfter sorting:\n"); - dump_coalesce_list (dump_file, cl); - } + if (dump_file && (dump_flags & TDF_DETAILS)) + { + fprintf (dump_file, "\nAfter sorting:\n"); + dump_coalesce_list (dump_file, cl); } /* Put the single element variables back in. */ @@ -2127,17 +2147,10 @@ remove_ssa_form (var_map map, int flags) tree phi, next; tree *values = NULL; - /* If we are not combining temps, don't calculate live ranges for variables - with only one SSA version. */ - compact_var_map (map, VARMAP_NO_SINGLE_DEFS); - - if (dump_file && (dump_flags & TDF_DETAILS)) - dump_var_map (dump_file, map); - liveinfo = coalesce_ssa_name (map, flags); - /* Make sure even single occurrence variables are in the list now. */ - compact_var_map (map, VARMAP_NORMAL); + /* Make sure all variables are in the list. */ + partition_view_normal (map); if (dump_file && (dump_flags & TDF_DETAILS)) { |