static temp_expr_table_p new_temp_expr_table (var_map map) { temp_expr_table_p t; unsigned x; t = XNEW (struct temp_expr_table_d); t->map = map; t->partition_dependencies = XCNEWVEC (bitmap, num_ssa_names + 1); t->expr_decl_uids = XCNEWVEC (bitmap, num_ssa_names + 1); t->kill_list = XCNEWVEC (bitmap, num_var_partitions (map) + 1); t->partition_in_use = BITMAP_ALLOC (NULL); t->virtual_partition = num_var_partitions (map); t->new_replaceable_dependencies = BITMAP_ALLOC (NULL); t->replaceable_expressions = NULL; t->num_in_part = XCNEWVEC (int, num_var_partitions (map)); for (x = 1; x < num_ssa_names; x++) { int p; tree name = ssa_name (x); if (!name) continue; p = var_to_partition (map, name); if (p != NO_PARTITION) t->num_in_part[p]++; } return t; }
FOR_EACH_SSA_NAME (x, name, cfun) { int p; p = var_to_partition (map, name); if (p != NO_PARTITION) t->num_in_part[p]++; }
static void eliminate_build (elim_graph g) { tree Ti; int p0, pi; gimple_stmt_iterator gsi; clear_elim_graph (g); for (gsi = gsi_start_phis (g->e->dest); !gsi_end_p (gsi); gsi_next (&gsi)) { gimple phi = gsi_stmt (gsi); source_location locus; p0 = var_to_partition (g->map, gimple_phi_result (phi)); /* Ignore results which are not in partitions. */ if (p0 == NO_PARTITION) continue; Ti = PHI_ARG_DEF (phi, g->e->dest_idx); locus = gimple_phi_arg_location_from_edge (phi, g->e); /* If this argument is a constant, or a SSA_NAME which is being left in SSA form, just queue a copy to be emitted on this edge. */ if (!phi_ssa_name_p (Ti) || (TREE_CODE (Ti) == SSA_NAME && var_to_partition (g->map, Ti) == NO_PARTITION)) { /* Save constant copies until all other copies have been emitted on this edge. */ VEC_safe_push (int, heap, g->const_dests, p0); VEC_safe_push (tree, heap, g->const_copies, Ti); VEC_safe_push (source_location, heap, g->copy_locus, locus); } else {
static void add_dependence (temp_expr_table_p tab, int version, tree var) { int i; bitmap_iterator bi; unsigned x; i = SSA_NAME_VERSION (var); if (version_to_be_replaced_p (tab, i)) { if (!bitmap_empty_p (tab->new_replaceable_dependencies)) { /* Version will now be killed by a write to any partition the substituted expression would have been killed by. */ EXECUTE_IF_SET_IN_BITMAP (tab->new_replaceable_dependencies, 0, x, bi) add_to_partition_kill_list (tab, x, version); /* Rather than set partition_dependencies and in_use lists bit by bit, simply OR in the new_replaceable_dependencies bits. */ if (!tab->partition_dependencies[version]) tab->partition_dependencies[version] = BITMAP_ALLOC (NULL); bitmap_ior_into (tab->partition_dependencies[version], tab->new_replaceable_dependencies); bitmap_ior_into (tab->partition_in_use, tab->new_replaceable_dependencies); /* It is only necessary to add these once. */ bitmap_clear (tab->new_replaceable_dependencies); } } else { i = var_to_partition (tab->map, var); #ifdef ENABLE_CHECKING gcc_assert (i != NO_PARTITION); gcc_assert (tab->num_in_part[i] != 0); #endif /* Only dependencies on ssa_names which are coalesced with something need to be tracked. Partitions with containing only a single SSA_NAME *cannot* have their value changed. */ if (tab->num_in_part[i] > 1) { add_to_partition_kill_list (tab, i, version); make_dependent_on_partition (tab, version, i); } } }
/* If this argument is a constant, or a SSA_NAME which is being left in SSA form, just queue a copy to be emitted on this edge. */ if (!phi_ssa_name_p (Ti) || (TREE_CODE (Ti) == SSA_NAME && var_to_partition (g->map, Ti) == NO_PARTITION)) { /* Save constant copies until all other copies have been emitted on this edge. */ VEC_safe_push (int, heap, g->const_dests, p0); VEC_safe_push (tree, heap, g->const_copies, Ti); VEC_safe_push (source_location, heap, g->copy_locus, locus); } else { pi = var_to_partition (g->map, Ti); if (p0 != pi) { eliminate_name (g, p0); eliminate_name (g, pi); elim_graph_add_edge (g, p0, pi, locus); } } } } /* Push successors of T onto the elimination stack for G. */ static void elim_forward (elim_graph g, int T)