/* Used for per-solver-iteration bitmaps. */
static bitmap_obstack iteration_obstack;
-static unsigned int create_variable_info_for (tree, const char *);
+static unsigned int create_variable_info_for (tree, const char *, bool);
typedef struct constraint_graph *constraint_graph_t;
static void unify_nodes (constraint_graph_t, unsigned int, unsigned int, bool);
to the vector of variable info structures. */
static varinfo_t
-new_var_info (tree t, const char *name)
+new_var_info (tree t, const char *name, bool add_id)
{
unsigned index = varmap.length ();
varinfo_t ret = variable_info_pool.allocate ();
+ if (dump_file && add_id)
+ {
+ char *tempname = xasprintf ("%s(%d)", name, index);
+ name = ggc_strdup (tempname);
+ free (tempname);
+ }
+
ret->id = index;
ret->name = name;
ret->decl = t;
if (existed)
return *slot_p;
- vi = new_var_info (NULL_TREE, "CALLUSED");
+ vi = new_var_info (NULL_TREE, "CALLUSED", true);
vi->offset = 0;
vi->size = 1;
vi->fullsize = 2;
vi->is_full_var = true;
- vi2 = new_var_info (NULL_TREE, "CALLCLOBBERED");
+ vi2 = new_var_info (NULL_TREE, "CALLCLOBBERED", true);
vi2->offset = 1;
vi2->size = 1;
vi2->fullsize = 2;
{
varinfo_t *slot = vi_for_tree->get (t);
if (slot == NULL)
- return get_varinfo (create_variable_info_for (t, alias_get_name (t)));
+ {
+ unsigned int id = create_variable_info_for (t, alias_get_name (t), false);
+ return get_varinfo (id);
+ }
return *slot;
}
/* Get a scalar constraint expression for a new temporary variable. */
static struct constraint_expr
-new_scalar_tmp_constraint_exp (const char *name)
+new_scalar_tmp_constraint_exp (const char *name, bool add_id)
{
struct constraint_expr tmp;
varinfo_t vi;
- vi = new_var_info (NULL_TREE, name);
+ vi = new_var_info (NULL_TREE, name, add_id);
vi->offset = 0;
vi->size = -1;
vi->fullsize = -1;
{
/* Split into tmp = *rhs, *lhs = tmp */
struct constraint_expr tmplhs;
- tmplhs = new_scalar_tmp_constraint_exp ("doubledereftmp");
+ tmplhs = new_scalar_tmp_constraint_exp ("doubledereftmp", true);
process_constraint (new_constraint (tmplhs, rhs));
process_constraint (new_constraint (lhs, tmplhs));
}
{
/* Split into tmp = &rhs, *lhs = tmp */
struct constraint_expr tmplhs;
- tmplhs = new_scalar_tmp_constraint_exp ("derefaddrtmp");
+ tmplhs = new_scalar_tmp_constraint_exp ("derefaddrtmp", true);
process_constraint (new_constraint (tmplhs, rhs));
process_constraint (new_constraint (lhs, tmplhs));
}
else if (c->type == DEREF)
{
struct constraint_expr tmplhs;
- tmplhs = new_scalar_tmp_constraint_exp ("dereftmp");
+ tmplhs = new_scalar_tmp_constraint_exp ("dereftmp", true);
process_constraint (new_constraint (tmplhs, *c));
c->var = tmplhs.var;
}
else
{
struct constraint_expr tmp;
- tmp = new_scalar_tmp_constraint_exp ("allalltmp");
+ tmp = new_scalar_tmp_constraint_exp ("allalltmp", true);
FOR_EACH_VEC_ELT (rhsc, i, rhsp)
process_constraint (new_constraint (tmp, *rhsp));
FOR_EACH_VEC_ELT (lhsc, i, lhsp)
Return the created variable. */
static varinfo_t
-make_heapvar (const char *name)
+make_heapvar (const char *name, bool add_id)
{
varinfo_t vi;
tree heapvar;
heapvar = build_fake_var_decl (ptr_type_node);
DECL_EXTERNAL (heapvar) = 1;
- vi = new_var_info (heapvar, name);
+ vi = new_var_info (heapvar, name, add_id);
vi->is_artificial_var = true;
vi->is_heap_var = true;
vi->is_unknown_size_var = true;
for tracking restrict pointers. */
static varinfo_t
-make_constraint_from_restrict (varinfo_t lhs, const char *name)
+make_constraint_from_restrict (varinfo_t lhs, const char *name, bool add_id)
{
- varinfo_t vi = make_heapvar (name);
+ varinfo_t vi = make_heapvar (name, add_id);
vi->is_restrict_var = 1;
vi->is_global_var = 1;
vi->may_have_pointers = 1;
point to global memory. */
static varinfo_t
-make_constraint_from_global_restrict (varinfo_t lhs, const char *name)
+make_constraint_from_global_restrict (varinfo_t lhs, const char *name,
+ bool add_id)
{
- varinfo_t vi = make_constraint_from_restrict (lhs, name);
+ varinfo_t vi = make_constraint_from_restrict (lhs, name, add_id);
make_copy_constraint (vi, nonlocal_id);
return vi;
}
varinfo_t uses = get_call_use_vi (stmt);
if (!(flags & EAF_DIRECT))
{
- varinfo_t tem = new_var_info (NULL_TREE, "callarg");
+ varinfo_t tem = new_var_info (NULL_TREE, "callarg", true);
make_constraint_to (tem->id, arg);
make_transitive_closure_constraints (tem);
make_copy_constraint (uses, tem->id);
struct constraint_expr lhs, rhs;
varinfo_t uses = get_call_use_vi (stmt);
varinfo_t clobbers = get_call_clobber_vi (stmt);
- varinfo_t tem = new_var_info (NULL_TREE, "callarg");
+ varinfo_t tem = new_var_info (NULL_TREE, "callarg", true);
make_constraint_to (tem->id, arg);
if (!(flags & EAF_DIRECT))
make_transitive_closure_constraints (tem);
varinfo_t vi;
struct constraint_expr tmpc;
rhsc.create (0);
- vi = make_heapvar ("HEAP");
+ vi = make_heapvar ("HEAP", true);
/* We are marking allocated storage local, we deal with it becoming
global by escaping and setting of vars_contains_escaped_heap. */
DECL_EXTERNAL (vi->decl) = 0;
tree ptrptr = gimple_call_arg (t, 0);
get_constraint_for (ptrptr, &lhsc);
do_deref (&lhsc);
- varinfo_t vi = make_heapvar ("HEAP");
+ varinfo_t vi = make_heapvar ("HEAP", true);
/* We are marking allocated storage local, we deal with it becoming
global by escaping and setting of vars_contains_escaped_heap. */
DECL_EXTERNAL (vi->decl) = 0;
of the variable we've created for the function. */
static varinfo_t
-create_function_info_for (tree decl, const char *name)
+create_function_info_for (tree decl, const char *name, bool add_id)
{
struct function *fn = DECL_STRUCT_FUNCTION (decl);
varinfo_t vi, prev_vi;
/* Create the variable info. */
- vi = new_var_info (decl, name);
+ vi = new_var_info (decl, name, add_id);
vi->offset = 0;
vi->size = 1;
vi->fullsize = fi_parm_base + num_args;
newname = ggc_strdup (tempname);
free (tempname);
- clobbervi = new_var_info (NULL, newname);
+ clobbervi = new_var_info (NULL, newname, false);
clobbervi->offset = fi_clobbers;
clobbervi->size = 1;
clobbervi->fullsize = vi->fullsize;
newname = ggc_strdup (tempname);
free (tempname);
- usevi = new_var_info (NULL, newname);
+ usevi = new_var_info (NULL, newname, false);
usevi->offset = fi_uses;
usevi->size = 1;
usevi->fullsize = vi->fullsize;
newname = ggc_strdup (tempname);
free (tempname);
- chainvi = new_var_info (fn->static_chain_decl, newname);
+ chainvi = new_var_info (fn->static_chain_decl, newname, false);
chainvi->offset = fi_static_chain;
chainvi->size = 1;
chainvi->fullsize = vi->fullsize;
newname = ggc_strdup (tempname);
free (tempname);
- resultvi = new_var_info (resultdecl, newname);
+ resultvi = new_var_info (resultdecl, newname, false);
resultvi->offset = fi_result;
resultvi->size = 1;
resultvi->fullsize = vi->fullsize;
newname = ggc_strdup (tempname);
free (tempname);
- argvi = new_var_info (argdecl, newname);
+ argvi = new_var_info (argdecl, newname, false);
argvi->offset = fi_parm_base + i;
argvi->size = 1;
argvi->is_full_var = true;
/* We need sth that can be pointed to for va_start. */
decl = build_fake_var_decl (ptr_type_node);
- argvi = new_var_info (decl, newname);
+ argvi = new_var_info (decl, newname, false);
argvi->offset = fi_parm_base + num_args;
argvi->size = ~0;
argvi->is_full_var = true;
of DECL. */
static varinfo_t
-create_variable_info_for_1 (tree decl, const char *name)
+create_variable_info_for_1 (tree decl, const char *name, bool add_id)
{
varinfo_t vi, newvi;
tree decl_type = TREE_TYPE (decl);
if (!declsize
|| !tree_fits_uhwi_p (declsize))
{
- vi = new_var_info (decl, name);
+ vi = new_var_info (decl, name, add_id);
vi->offset = 0;
vi->size = ~0;
vi->fullsize = ~0;
if (fieldstack.length () == 0
|| fieldstack.length () > MAX_FIELDS_FOR_FIELD_SENSITIVE)
{
- vi = new_var_info (decl, name);
+ vi = new_var_info (decl, name, add_id);
vi->offset = 0;
vi->may_have_pointers = true;
vi->fullsize = tree_to_uhwi (declsize);
return vi;
}
- vi = new_var_info (decl, name);
+ vi = new_var_info (decl, name, add_id);
vi->fullsize = tree_to_uhwi (declsize);
if (fieldstack.length () == 1)
vi->is_full_var = true;
newvi->only_restrict_pointers = fo->only_restrict_pointers;
if (i + 1 < fieldstack.length ())
{
- varinfo_t tem = new_var_info (decl, name);
+ varinfo_t tem = new_var_info (decl, name, false);
newvi->next = tem->id;
tem->head = vi->id;
}
}
static unsigned int
-create_variable_info_for (tree decl, const char *name)
+create_variable_info_for (tree decl, const char *name, bool add_id)
{
- varinfo_t vi = create_variable_info_for_1 (decl, name);
+ varinfo_t vi = create_variable_info_for_1 (decl, name, add_id);
unsigned int id = vi->id;
insert_vi_for_tree (decl, vi);
|| vi->only_restrict_pointers)
{
varinfo_t rvi
- = make_constraint_from_global_restrict (vi, "GLOBAL_RESTRICT");
+ = make_constraint_from_global_restrict (vi, "GLOBAL_RESTRICT",
+ true);
/* ??? For now exclude reads from globals as restrict sources
if those are not (indirectly) from incoming parameters. */
rvi->is_restrict_var = false;
if (vi->may_have_pointers)
{
if (vi->only_restrict_pointers)
- make_constraint_from_global_restrict (vi, "GLOBAL_RESTRICT");
+ make_constraint_from_global_restrict (vi, "GLOBAL_RESTRICT", true);
else
make_copy_constraint (vi, nonlocal_id);
}
varinfo_t p = lookup_vi_for_tree (t);
if (p == NULL)
{
- p = create_variable_info_for_1 (t, alias_get_name (t));
+ p = create_variable_info_for_1 (t, alias_get_name (t), false);
insert_vi_for_tree (t, p);
}
varinfo_t vi;
tree heapvar = build_fake_var_decl (TREE_TYPE (TREE_TYPE (t)));
DECL_EXTERNAL (heapvar) = 1;
- vi = create_variable_info_for_1 (heapvar, "PARM_NOALIAS");
+ vi = create_variable_info_for_1 (heapvar, "PARM_NOALIAS", true);
vi->is_restrict_var = 1;
insert_vi_for_tree (heapvar, vi);
make_constraint_from (p, vi->id);
}
if (restrict_pointer_p)
- make_constraint_from_global_restrict (p, "PARM_RESTRICT");
+ make_constraint_from_global_restrict (p, "PARM_RESTRICT", true);
else
{
for (; p; p = vi_next (p))
{
if (p->only_restrict_pointers)
- make_constraint_from_global_restrict (p, "PARM_RESTRICT");
+ make_constraint_from_global_restrict (p, "PARM_RESTRICT", true);
else if (p->may_have_pointers)
make_constraint_from (p, nonlocal_id);
}
/* Create the NULL variable, used to represent that a variable points
to NULL. */
- var_nothing = new_var_info (NULL_TREE, "NULL");
+ var_nothing = new_var_info (NULL_TREE, "NULL", false);
gcc_assert (var_nothing->id == nothing_id);
var_nothing->is_artificial_var = 1;
var_nothing->offset = 0;
/* Create the ANYTHING variable, used to represent that a variable
points to some unknown piece of memory. */
- var_anything = new_var_info (NULL_TREE, "ANYTHING");
+ var_anything = new_var_info (NULL_TREE, "ANYTHING", false);
gcc_assert (var_anything->id == anything_id);
var_anything->is_artificial_var = 1;
var_anything->size = ~0;
/* Create the STRING variable, used to represent that a variable
points to a string literal. String literals don't contain
pointers so STRING doesn't point to anything. */
- var_string = new_var_info (NULL_TREE, "STRING");
+ var_string = new_var_info (NULL_TREE, "STRING", false);
gcc_assert (var_string->id == string_id);
var_string->is_artificial_var = 1;
var_string->offset = 0;
/* Create the ESCAPED variable, used to represent the set of escaped
memory. */
- var_escaped = new_var_info (NULL_TREE, "ESCAPED");
+ var_escaped = new_var_info (NULL_TREE, "ESCAPED", false);
gcc_assert (var_escaped->id == escaped_id);
var_escaped->is_artificial_var = 1;
var_escaped->offset = 0;
/* Create the NONLOCAL variable, used to represent the set of nonlocal
memory. */
- var_nonlocal = new_var_info (NULL_TREE, "NONLOCAL");
+ var_nonlocal = new_var_info (NULL_TREE, "NONLOCAL", false);
gcc_assert (var_nonlocal->id == nonlocal_id);
var_nonlocal->is_artificial_var = 1;
var_nonlocal->offset = 0;
/* Create the STOREDANYTHING variable, used to represent the set of
variables stored to *ANYTHING. */
- var_storedanything = new_var_info (NULL_TREE, "STOREDANYTHING");
+ var_storedanything = new_var_info (NULL_TREE, "STOREDANYTHING", false);
gcc_assert (var_storedanything->id == storedanything_id);
var_storedanything->is_artificial_var = 1;
var_storedanything->offset = 0;
/* Create the INTEGER variable, used to represent that a variable points
to what an INTEGER "points to". */
- var_integer = new_var_info (NULL_TREE, "INTEGER");
+ var_integer = new_var_info (NULL_TREE, "INTEGER", false);
gcc_assert (var_integer->id == integer_id);
var_integer->is_artificial_var = 1;
var_integer->size = ~0;
gcc_assert (!node->clone_of);
vi = create_function_info_for (node->decl,
- alias_get_name (node->decl));
+ alias_get_name (node->decl), false);
node->call_for_symbol_thunks_and_aliases
(associate_varinfo_to_alias, vi, true);
}