aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-outof-ssa.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-outof-ssa.c')
-rw-r--r--gcc/tree-outof-ssa.c156
1 files changed, 7 insertions, 149 deletions
diff --git a/gcc/tree-outof-ssa.c b/gcc/tree-outof-ssa.c
index 705066a2805..1bd531a1b65 100644
--- a/gcc/tree-outof-ssa.c
+++ b/gcc/tree-outof-ssa.c
@@ -51,7 +51,6 @@ Boston, MA 02110-1301, USA. */
/* Flags to pass to remove_ssa_form. */
#define SSANORM_PERFORM_TER 0x1
-#define SSANORM_COMBINE_TEMPS 0x2
#define SSANORM_COALESCE_PARTITIONS 0x4
/* Used to hold all the components required to do SSA PHI elimination.
@@ -874,11 +873,8 @@ coalesce_ssa_name (var_map map, int flags)
SET_BIT (live, x);
}
- if ((flags & SSANORM_COMBINE_TEMPS) == 0)
- {
- delete_tree_live_info (liveinfo);
- liveinfo = NULL;
- }
+ delete_tree_live_info (liveinfo);
+ liveinfo = NULL;
/* Assign root variable as partition representative for each live on entry
partition. */
@@ -1126,121 +1122,6 @@ eliminate_virtual_phis (void)
}
-/* This routine will coalesce variables in MAP of the same type which do not
- interfere with each other. LIVEINFO is the live range info for variables
- of interest. This will both reduce the memory footprint of the stack, and
- allow us to coalesce together local copies of globals and scalarized
- component refs. */
-
-static void
-coalesce_vars (var_map map, tree_live_info_p liveinfo)
-{
- basic_block bb;
- type_var_p tv;
- tree var;
- unsigned x, p, p2;
- coalesce_list_p cl;
- conflict_graph graph;
-
- cl = create_coalesce_list (map);
-
- /* Merge all the live on entry vectors for coalesced partitions. */
- for (x = 0; x < num_var_partitions (map); x++)
- {
- var = partition_to_var (map, x);
- p = var_to_partition (map, var);
- if (p != x)
- live_merge_and_clear (liveinfo, p, x);
- }
-
- /* When PHI nodes are turned into copies, the result of each PHI node
- becomes live on entry to the block. Mark these now. */
- FOR_EACH_BB (bb)
- {
- tree phi, arg;
- unsigned p;
-
- for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
- {
- p = var_to_partition (map, PHI_RESULT (phi));
-
- /* Skip virtual PHI nodes. */
- if (p == (unsigned)NO_PARTITION)
- continue;
-
- make_live_on_entry (liveinfo, bb, p);
-
- /* Each argument is a potential copy operation. Add any arguments
- which are not coalesced to the result to the coalesce list. */
- for (x = 0; x < (unsigned)PHI_NUM_ARGS (phi); x++)
- {
- arg = PHI_ARG_DEF (phi, x);
- if (!phi_ssa_name_p (arg))
- continue;
- p2 = var_to_partition (map, arg);
- if (p2 == (unsigned)NO_PARTITION)
- continue;
- if (p != p2)
- {
- edge e = PHI_ARG_EDGE (phi, x);
-
- add_coalesce (cl, p, p2,
- coalesce_cost (EDGE_FREQUENCY (e),
- maybe_hot_bb_p (bb),
- EDGE_CRITICAL_P (e)));
- }
- }
- }
- }
-
-
- /* Re-calculate live on exit info. */
- calculate_live_on_exit (liveinfo);
-
- if (dump_file && (dump_flags & TDF_DETAILS))
- {
- fprintf (dump_file, "Live range info for variable memory coalescing.\n");
- dump_live_info (dump_file, liveinfo, LIVEDUMP_ALL);
-
- fprintf (dump_file, "Coalesce list from phi nodes:\n");
- dump_coalesce_list (dump_file, cl);
- }
-
-
- tv = type_var_init (map);
- if (dump_file)
- type_var_dump (dump_file, tv);
- type_var_compact (tv);
- if (dump_file)
- type_var_dump (dump_file, tv);
-
- graph = build_tree_conflict_graph (liveinfo, tv, cl);
-
- type_var_decompact (tv);
- if (dump_file && (dump_flags & TDF_DETAILS))
- {
- fprintf (dump_file, "type var list now looks like:n");
- type_var_dump (dump_file, tv);
-
- fprintf (dump_file, "Coalesce list after conflict graph build:\n");
- dump_coalesce_list (dump_file, cl);
- }
-
- sort_coalesce_list (cl);
- if (dump_file && (dump_flags & TDF_DETAILS))
- {
- fprintf (dump_file, "Coalesce list after sorting:\n");
- dump_coalesce_list (dump_file, cl);
- }
-
- coalesce_tpa_members (tv, graph, map, cl,
- ((dump_flags & TDF_DETAILS) ? dump_file : NULL));
-
- type_var_delete (tv);
- delete_coalesce_list (cl);
-}
-
-
/* Temporary Expression Replacement (TER)
Replace SSA version variables during out-of-ssa with their defining
@@ -1553,7 +1434,6 @@ check_replaceable (temp_expr_table_p tab, tree stmt)
{
tree var, def, basevar;
int version;
- var_map map = tab->map;
ssa_op_iter iter;
tree call_expr;
bitmap def_vars, use_vars;
@@ -1566,7 +1446,7 @@ check_replaceable (temp_expr_table_p tab, tree stmt)
if (!def)
return false;
- if (version_ref_count (map, def) != 1)
+ if (num_imm_uses (def) != 1)
return false;
/* There must be no V_MAY_DEFS or V_MUST_DEFS. */
@@ -2338,10 +2218,7 @@ remove_ssa_form (var_map map, int flags)
/* If we are not combining temps, don't calculate live ranges for variables
with only one SSA version. */
- if ((flags & SSANORM_COMBINE_TEMPS) == 0)
- compact_var_map (map, VARMAP_NO_SINGLE_DEFS);
- else
- compact_var_map (map, VARMAP_NORMAL);
+ compact_var_map (map, VARMAP_NO_SINGLE_DEFS);
if (dump_file && (dump_flags & TDF_DETAILS))
dump_var_map (dump_file, map);
@@ -2349,8 +2226,7 @@ remove_ssa_form (var_map map, int flags)
liveinfo = coalesce_ssa_name (map, flags);
/* Make sure even single occurrence variables are in the list now. */
- if ((flags & SSANORM_COMBINE_TEMPS) == 0)
- compact_var_map (map, VARMAP_NORMAL);
+ compact_var_map (map, VARMAP_NORMAL);
if (dump_file && (dump_flags & TDF_DETAILS))
{
@@ -2374,16 +2250,6 @@ remove_ssa_form (var_map map, int flags)
dump_var_map (dump_file, map);
}
- if ((flags & SSANORM_COMBINE_TEMPS) && liveinfo)
- {
- coalesce_vars (map, liveinfo);
- if (dump_file && (dump_flags & TDF_DETAILS))
- {
- fprintf (dump_file, "After variable memory coalescing:\n");
- dump_var_map (dump_file, map);
- }
- }
-
if (liveinfo)
delete_tree_live_info (liveinfo);
@@ -2449,8 +2315,7 @@ insert_backedge_copies (void)
need a copy statement. */
if ((e->flags & EDGE_DFS_BACK)
&& (TREE_CODE (arg) != SSA_NAME
- || (!flag_tree_combine_temps
- && SSA_NAME_VAR (arg) != result_var)))
+ || SSA_NAME_VAR (arg) != result_var))
{
tree stmt, name, last = NULL;
block_stmt_iterator bsi;
@@ -2505,7 +2370,6 @@ static unsigned int
rewrite_out_of_ssa (void)
{
var_map map;
- int var_flags = 0;
int ssa_flags = 0;
/* If elimination of a PHI requires inserting a copy on a backedge,
@@ -2524,14 +2388,8 @@ rewrite_out_of_ssa (void)
if (dump_file && (dump_flags & TDF_DETAILS))
dump_tree_cfg (dump_file, dump_flags & ~TDF_DETAILS);
- /* We cannot allow unssa to un-gimplify trees before we instrument them. */
- if (flag_tree_ter && !flag_mudflap)
- var_flags = SSA_VAR_MAP_REF_COUNT;
-
- map = create_ssa_var_map (var_flags);
+ map = create_ssa_var_map ();
- if (flag_tree_combine_temps)
- ssa_flags |= SSANORM_COMBINE_TEMPS;
if (flag_tree_ter && !flag_mudflap)
ssa_flags |= SSANORM_PERFORM_TER;