static VEC(constraint_t,heap) *constraints;
static alloc_pool constraint_pool;
-
-DEF_VEC_I(int);
-DEF_VEC_ALLOC_I(int, heap);
-
/* The constraint graph is represented as an array of bitmaps
containing successor nodes. */
static unsigned int changed_count;
static sbitmap changed;
-DEF_VEC_I(unsigned);
-DEF_VEC_ALLOC_I(unsigned,heap);
-
-
/* Strongly Connected Component visitation info. */
struct scc_info
vi->size = fo->size;
vi->offset = fo->offset;
vi->may_have_pointers = fo->may_have_pointers;
+ if (vi->is_global_var
+ && (!flag_whole_program || !in_ipa_mode)
+ && vi->may_have_pointers)
+ {
+ if (fo->only_restrict_pointers)
+ make_constraint_from_restrict (vi, "GLOBAL_RESTRICT");
+ }
for (i = VEC_length (fieldoff_s, fieldstack) - 1;
i >= 1 && VEC_iterate (fieldoff_s, fieldstack, i, fo);
i--)
newvi->fullsize = vi->fullsize;
newvi->may_have_pointers = fo->may_have_pointers;
insert_into_field_list (vi, newvi);
- if (newvi->is_global_var
- && (!flag_whole_program || !in_ipa_mode)
+ if ((newvi->is_global_var || TREE_CODE (decl) == PARM_DECL)
&& newvi->may_have_pointers)
{
if (fo->only_restrict_pointers)
make_constraint_from_restrict (newvi, "GLOBAL_RESTRICT");
- make_copy_constraint (newvi, nonlocal_id);
+ if (newvi->is_global_var && !in_ipa_mode)
+ make_copy_constraint (newvi, nonlocal_id);
}
stats.total_vars++;
if (!could_have_pointers (t))
continue;
- /* If flag_argument_noalias is set, then function pointer
- arguments are guaranteed not to point to each other. In that
- case, create an artificial variable PARM_NOALIAS and the
- constraint ARG = &PARM_NOALIAS. */
- if (POINTER_TYPE_P (TREE_TYPE (t)) && flag_argument_noalias > 0)
+ /* For restrict qualified pointers to objects passed by
+ reference build a real representative for the pointed-to object. */
+ if (DECL_BY_REFERENCE (t)
+ && POINTER_TYPE_P (TREE_TYPE (t))
+ && TYPE_RESTRICT (TREE_TYPE (t)))
{
+ struct constraint_expr lhsc, rhsc;
varinfo_t vi;
- var_ann_t ann;
-
- vi = make_constraint_from_heapvar (get_vi_for_tree (t),
- "PARM_NOALIAS");
- ann = get_var_ann (vi->decl);
- if (flag_argument_noalias == 1)
- {
- ann->noalias_state = NO_ALIAS;
- make_copy_constraint (vi, nonlocal_id);
- }
- else if (flag_argument_noalias == 2)
- {
- ann->noalias_state = NO_ALIAS_GLOBAL;
- make_constraint_from (vi, vi->id);
- }
- else if (flag_argument_noalias == 3)
+ tree heapvar = heapvar_lookup (t, 0);
+ if (heapvar == NULL_TREE)
{
- ann->noalias_state = NO_ALIAS_ANYTHING;
- make_constraint_from (vi, vi->id);
+ var_ann_t ann;
+ heapvar = create_tmp_var_raw (TREE_TYPE (TREE_TYPE (t)),
+ "PARM_NOALIAS");
+ DECL_EXTERNAL (heapvar) = 1;
+ heapvar_insert (t, 0, heapvar);
+ ann = get_var_ann (heapvar);
+ ann->is_heapvar = 1;
}
- else
- gcc_unreachable ();
+ if (gimple_referenced_vars (cfun))
+ add_referenced_var (heapvar);
+ lhsc.var = get_vi_for_tree (t)->id;
+ lhsc.type = SCALAR;
+ lhsc.offset = 0;
+ rhsc.var = (vi = get_vi_for_tree (heapvar))->id;
+ rhsc.type = ADDRESSOF;
+ rhsc.offset = 0;
+ process_constraint (new_constraint (lhsc, rhsc));
+ vi->is_restrict_var = 1;
+ continue;
}
- else
- {
- varinfo_t arg_vi = get_vi_for_tree (t);
- for (p = arg_vi; p; p = p->next)
- make_constraint_from (p, nonlocal_id);
- }
+ for (p = get_vi_for_tree (t); p; p = p->next)
+ if (p->may_have_pointers)
+ make_constraint_from (p, nonlocal_id);
if (POINTER_TYPE_P (TREE_TYPE (t))
&& TYPE_RESTRICT (TREE_TYPE (t)))
make_constraint_from_restrict (get_vi_for_tree (t), "PARM_RESTRICT");