else if (add_graph_edge (graph, lhs, t))
flag |= bitmap_ior_into (sol, get_varinfo (t)->solution);
}
- else if (0 && dump_file && !(get_varinfo (j)->is_special_var))
- fprintf (dump_file, "Untypesafe usage in do_sd_constraint\n");
-
}
done:
}
}
}
- else if (0 && dump_file && !(get_varinfo (j)->is_special_var))
- fprintf (dump_file, "Untypesafe usage in do_ds_constraint\n");
}
}
}
-/* Return true if an access to [ACCESSPOS, ACCESSSIZE]
- overlaps with a field at [FIELDPOS, FIELDSIZE] */
-
-static bool
-offset_overlaps_with_access (const unsigned HOST_WIDE_INT fieldpos,
- const unsigned HOST_WIDE_INT fieldsize,
- const unsigned HOST_WIDE_INT accesspos,
- const unsigned HOST_WIDE_INT accesssize)
-{
- if (fieldpos == accesspos && fieldsize == accesssize)
- return true;
- if (accesspos >= fieldpos && accesspos < (fieldpos + fieldsize))
- return true;
- if (accesspos < fieldpos && (accesspos + accesssize > fieldpos))
- return true;
-
- return false;
-}
-
/* Given a COMPONENT_REF T, return the constraint_expr for it. */
static void
t = get_ref_base_and_extent (t, &bitpos, &bitsize, &bitmaxsize);
- /* String constants are readonly, so there is nothing to really do
- here. */
- if (TREE_CODE (t) == STRING_CST)
- return;
-
get_constraint_for (t, results);
result = VEC_last (ce_s, *results);
result->offset = bitpos;
varinfo_t curr;
for (curr = get_varinfo (result->var); curr; curr = curr->next)
{
- if (offset_overlaps_with_access (curr->offset, curr->size,
- result->offset, bitmaxsize))
+ if (ranges_overlap_p (curr->offset, curr->size,
+ result->offset, bitmaxsize))
{
result->var = curr->id;
break;
return;
}
+ /* String constants are read-only. */
+ if (TREE_CODE (t) == STRING_CST)
+ {
+ temp.var = readonly_id;
+ temp.type = SCALAR;
+ temp.offset = 0;
+ VEC_safe_push (ce_s, heap, *results, &temp);
+ return;
+ }
+
switch (TREE_CODE_CLASS (TREE_CODE (t)))
{
case tcc_expression:
{
case NOP_EXPR:
case CONVERT_EXPR:
- case NON_LVALUE_EXPR:
{
tree op = TREE_OPERAND (t, 0);
{
tree field;
int count = 0;
- int first_element = VEC_length (fieldoff_s, *fieldstack);
+ unsigned int first_element = VEC_length (fieldoff_s, *fieldstack);
+
+ /* If the vector of fields is growing too big, bail out early.
+ Callers check for VEC_length <= MAX_FIELDS_FOR_FIELD_SENSITIVE, make
+ sure this fails. */
+ if (first_element > MAX_FIELDS_FOR_FIELD_SENSITIVE)
+ return 0;
if (TREE_CODE (type) == COMPLEX_TYPE)
{
&& !notokay
&& !vi->is_unknown_size_var
&& var_can_have_subvars (decl)
+ && VEC_length (fieldoff_s, fieldstack) > 1
&& VEC_length (fieldoff_s, fieldstack) <= MAX_FIELDS_FOR_FIELD_SENSITIVE)
{
unsigned int newindex = VEC_length (varinfo_t, varmap);
static void
merge_smts_into (tree p, bitmap solution)
{
- unsigned int i;
- bitmap_iterator bi;
tree smt;
bitmap aliases;
tree var = p;
smt = var_ann (var)->symbol_mem_tag;
if (smt)
{
- alias_set_type smtset = get_alias_set (TREE_TYPE (smt));
-
- /* Need to set the SMT subsets first before this
- will work properly. */
+ /* The smt itself isn't included in its aliases. */
bitmap_set_bit (solution, DECL_UID (smt));
- EXECUTE_IF_SET_IN_BITMAP (used_smts, 0, i, bi)
- {
- tree newsmt = referenced_var (i);
- tree newsmttype = TREE_TYPE (newsmt);
-
- if (alias_set_subset_of (get_alias_set (newsmttype),
- smtset))
- bitmap_set_bit (solution, i);
- }
aliases = MTAG_ALIASES (smt);
if (aliases)
/* Instead of using pt_anything, we merge in the SMT aliases
for the underlying SMT. In addition, if they could have
- pointed to anything, they could point to global memory.
- But we cannot do that for ref-all pointers because these
- aliases have not been computed yet. */
+ pointed to anything, they could point to global memory. */
if (was_pt_anything)
{
- if (PTR_IS_REF_ALL (p))
- {
- pi->pt_anything = 1;
- return false;
- }
-
merge_smts_into (p, finished_solution);
pi->pt_global_mem = 1;
}
return 0;
}
-struct tree_opt_pass pass_ipa_pta =
+struct simple_ipa_opt_pass pass_ipa_pta =
{
+ {
+ SIMPLE_IPA_PASS,
"pta", /* name */
gate_ipa_pta, /* gate */
ipa_pta_execute, /* execute */
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
- TODO_update_ssa, /* todo_flags_finish */
- 0 /* letter */
+ TODO_update_ssa /* todo_flags_finish */
+ }
};
/* Initialize the heapvar for statement mapping. */