dump_subvars_for (FILE *file, tree var)
{
subvar_t sv = get_subvars_for_var (var);
+ tree subvar;
+ unsigned int i;
if (!sv)
return;
fprintf (file, "{ ");
- for (; sv; sv = sv->next)
+ for (i = 0; VEC_iterate (tree, sv, i, subvar); ++i)
{
- print_generic_expr (file, sv->var, dump_flags);
+ print_generic_expr (file, subvar, dump_flags);
+ fprintf (file, "@" HOST_WIDE_INT_PRINT_UNSIGNED, SFT_OFFSET (subvar));
+ if (SFT_BASE_FOR_COMPONENTS_P (subvar))
+ fprintf (file, "[B]");
fprintf (file, " ");
}
if (TREE_THIS_VOLATILE (var))
fprintf (file, ", is volatile");
- if (mem_sym_stats (cfun, var))
- {
- mem_sym_stats_t stats = mem_sym_stats (cfun, var);
- fprintf (file, ", direct reads: %ld", stats->num_direct_reads);
- fprintf (file, ", direct writes: %ld", stats->num_direct_writes);
- fprintf (file, ", indirect reads: %ld", stats->num_indirect_reads);
- fprintf (file, ", indirect writes: %ld", stats->num_indirect_writes);
- fprintf (file, ", read frequency: %ld", stats->frequency_reads);
- fprintf (file, ", write frequency: %ld", stats->frequency_writes);
- }
+ dump_mem_sym_stats_for_var (file, var);
if (is_call_clobbered (var))
{
fprintf (file, ", partition symbols: ");
dump_decl_set (file, MPT_SYMBOLS (var));
}
+
+ if (TREE_CODE (var) == STRUCT_FIELD_TAG)
+ {
+ fprintf (file, ", offset: " HOST_WIDE_INT_PRINT_UNSIGNED,
+ SFT_OFFSET (var));
+ fprintf (file, ", base for components: %s",
+ SFT_BASE_FOR_COMPONENTS_P (var) ? "NO" : "YES");
+ fprintf (file, ", partitionable: %s",
+ SFT_UNPARTITIONABLE_P (var) ? "NO" : "YES");
+ }
}
fprintf (file, "\n");
tree
referenced_var_lookup (unsigned int uid)
{
- tree h;
- struct tree_decl_minimal in;
- in.uid = uid;
- h = (tree) htab_find_with_hash (gimple_referenced_vars (cfun), &in, uid);
- gcc_assert (h || uid == 0);
- return h;
+ tree var;
+
+ gcc_assert (bitmap_bit_p (gimple_referenced_vars (cfun), uid));
+
+ /* For now also assert that the variable is really referenced.
+ Otherwise callers need to deal with the result from this function
+ being NULL. */
+ var = lookup_decl_from_uid (uid);
+ gcc_assert (var);
+ return var;
}
/* Check if TO is in the referenced_vars hash table and insert it if not.
bool
referenced_var_check_and_insert (tree to)
{
- tree h, *loc;
- struct tree_decl_minimal in;
unsigned int uid = DECL_UID (to);
- in.uid = uid;
- h = (tree) htab_find_with_hash (gimple_referenced_vars (cfun), &in, uid);
- if (h)
- {
- /* DECL_UID has already been entered in the table. Verify that it is
- the same entry as TO. See PR 27793. */
- gcc_assert (h == to);
- return false;
- }
+ if (bitmap_bit_p (gimple_referenced_vars (cfun), uid))
+ return false;
+
+ bitmap_set_bit (gimple_referenced_vars (cfun), uid);
- loc = (tree *) htab_find_slot_with_hash (gimple_referenced_vars (cfun),
- &in, uid, INSERT);
- *loc = to;
return true;
}
tree
gimple_default_def (struct function *fn, tree var)
{
- struct int_tree_map *h, in;
+ struct tree_decl_minimal ind;
+ struct tree_ssa_name in;
gcc_assert (SSA_VAR_P (var));
- in.uid = DECL_UID (var);
- h = (struct int_tree_map *) htab_find_with_hash (DEFAULT_DEFS (fn),
- &in,
- DECL_UID (var));
- if (h)
- return h->to;
- return NULL_TREE;
+ in.var = (tree)&ind;
+ ind.uid = DECL_UID (var);
+ return (tree) htab_find_with_hash (DEFAULT_DEFS (fn), &in, DECL_UID (var));
}
/* Insert the pair VAR's UID, DEF into the default_defs hashtable. */
void
set_default_def (tree var, tree def)
{
- struct int_tree_map in;
- struct int_tree_map *h;
+ struct tree_decl_minimal ind;
+ struct tree_ssa_name in;
void **loc;
gcc_assert (SSA_VAR_P (var));
- in.uid = DECL_UID (var);
- if (!def && gimple_default_def (cfun, var))
+ in.var = (tree)&ind;
+ ind.uid = DECL_UID (var);
+ if (!def)
{
loc = htab_find_slot_with_hash (DEFAULT_DEFS (cfun), &in,
DECL_UID (var), INSERT);
+ gcc_assert (*loc);
htab_remove_elt (DEFAULT_DEFS (cfun), *loc);
return;
}
- gcc_assert (!def || TREE_CODE (def) == SSA_NAME);
+ gcc_assert (TREE_CODE (def) == SSA_NAME && SSA_NAME_VAR (def) == var);
loc = htab_find_slot_with_hash (DEFAULT_DEFS (cfun), &in,
DECL_UID (var), INSERT);
/* Default definition might be changed by tail call optimization. */
- if (!*loc)
- {
- h = GGC_NEW (struct int_tree_map);
- h->uid = DECL_UID (var);
- h->to = def;
- *(struct int_tree_map **) loc = h;
- }
- else
- {
- h = (struct int_tree_map *) *loc;
- SSA_NAME_IS_DEFAULT_DEF (h->to) = false;
- h->to = def;
- }
+ if (*loc)
+ SSA_NAME_IS_DEFAULT_DEF (*(tree *) loc) = false;
+ *(tree *) loc = def;
/* Mark DEF as the default definition for VAR. */
SSA_NAME_IS_DEFAULT_DEF (def) = true;
remove_referenced_var (tree var)
{
var_ann_t v_ann;
- struct tree_decl_minimal in;
- void **loc;
unsigned int uid = DECL_UID (var);
+ subvar_t sv;
+
+ /* If we remove a var, we should also remove its subvars, as we kill
+ their parent var and its annotation. */
+ if (var_can_have_subvars (var)
+ && (sv = get_subvars_for_var (var)))
+ {
+ unsigned int i;
+ tree subvar;
+ for (i = 0; VEC_iterate (tree, sv, i, subvar); ++i)
+ remove_referenced_var (subvar);
+ }
clear_call_clobbered (var);
- v_ann = get_var_ann (var);
- ggc_free (v_ann);
+ if ((v_ann = var_ann (var)))
+ ggc_free (v_ann);
var->base.ann = NULL;
gcc_assert (DECL_P (var));
- in.uid = uid;
- loc = htab_find_slot_with_hash (gimple_referenced_vars (cfun), &in, uid,
- NO_INSERT);
- htab_clear_slot (gimple_referenced_vars (cfun), loc);
+ bitmap_clear_bit (gimple_referenced_vars (cfun), uid);
}
return exp;
}
+/* Returns true if STMT references an SSA_NAME that has
+ SSA_NAME_OCCURS_IN_ABNORMAL_PHI set, otherwise false. */
-/* Return memory reference statistics for variable VAR in function FN.
- This is computed by alias analysis, but it is not kept
- incrementally up-to-date. So, these stats are only accurate if
- pass_may_alias has been run recently. If no alias information
- exists, this function returns NULL. */
-
-mem_sym_stats_t
-mem_sym_stats (struct function *fn, tree var)
+bool
+stmt_references_abnormal_ssa_name (tree stmt)
{
- void **slot;
- struct pointer_map_t *stats_map = gimple_mem_ref_stats (fn)->mem_sym_stats;
-
- if (stats_map == NULL)
- return NULL;
+ ssa_op_iter oi;
+ use_operand_p use_p;
- slot = pointer_map_contains (stats_map, var);
- if (slot == NULL)
- return NULL;
+ FOR_EACH_SSA_USE_OPERAND (use_p, stmt, oi, SSA_OP_USE)
+ {
+ if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (USE_FROM_PTR (use_p)))
+ return true;
+ }
- return (mem_sym_stats_t) *slot;
+ return false;
}
+