aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-structalias.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2014-08-15 12:54:28 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2014-08-15 12:54:28 +0000
commitebd7d91067c230ca812f6d5a3b6c2b2302aaf9a5 (patch)
tree5212ba0bf347b9753f11947f4c212315e8a458dd /gcc/tree-ssa-structalias.c
parent275be1dac2866fa0e50a73ad36bdc45760796d63 (diff)
downloadgcc-ebd7d91067c230ca812f6d5a3b6c2b2302aaf9a5.zip
gcc-ebd7d91067c230ca812f6d5a3b6c2b2302aaf9a5.tar.gz
gcc-ebd7d91067c230ca812f6d5a3b6c2b2302aaf9a5.tar.bz2
tree-ssa-structalias.c (readonly_id): Rename to string_id.
2014-08-15 Richard Biener <rguenther@suse.de> * tree-ssa-structalias.c (readonly_id): Rename to string_id. (get_constraint_for_ssa_var): Remove dead code. (get_constraint_for_1): Adjust. (find_what_var_points_to): Likewise. (init_base_vars): Likewise. STRING_CSTs do not contain pointers. From-SVN: r214020
Diffstat (limited to 'gcc/tree-ssa-structalias.c')
-rw-r--r--gcc/tree-ssa-structalias.c53
1 files changed, 18 insertions, 35 deletions
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index 3f18d82..efcec2e 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -344,7 +344,7 @@ vi_next (varinfo_t vi)
/* Static IDs for the special variables. Variable ID zero is unused
and used as terminator for the sub-variable chain. */
-enum { nothing_id = 1, anything_id = 2, readonly_id = 3,
+enum { nothing_id = 1, anything_id = 2, string_id = 3,
escaped_id = 4, nonlocal_id = 5,
storedanything_id = 6, integer_id = 7 };
@@ -2938,14 +2938,6 @@ get_constraint_for_ssa_var (tree t, vec<ce_s> *results, bool address_p)
cexpr.var = vi->id;
cexpr.type = SCALAR;
cexpr.offset = 0;
- /* If we determine the result is "anything", and we know this is readonly,
- say it points to readonly memory instead. */
- if (cexpr.var == anything_id && TREE_READONLY (t))
- {
- gcc_unreachable ();
- cexpr.type = ADDRESSOF;
- cexpr.var = readonly_id;
- }
/* If we are not taking the address of the constraint expr, add all
sub-fiels of the variable as well. */
@@ -3380,10 +3372,11 @@ get_constraint_for_1 (tree t, vec<ce_s> *results, bool address_p,
return;
}
- /* String constants are read-only. */
+ /* String constants are read-only, ideally we'd have a CONST_DECL
+ for those. */
if (TREE_CODE (t) == STRING_CST)
{
- temp.var = readonly_id;
+ temp.var = string_id;
temp.type = SCALAR;
temp.offset = 0;
results->safe_push (temp);
@@ -6112,8 +6105,8 @@ find_what_var_points_to (varinfo_t orig_vi)
else if (vi->is_heap_var)
/* We represent heapvars in the points-to set properly. */
;
- else if (vi->id == readonly_id)
- /* Nobody cares. */
+ else if (vi->id == string_id)
+ /* Nobody cares - STRING_CSTs are read-only entities. */
;
else if (vi->id == anything_id
|| vi->id == integer_id)
@@ -6501,7 +6494,7 @@ init_base_vars (void)
struct constraint_expr lhs, rhs;
varinfo_t var_anything;
varinfo_t var_nothing;
- varinfo_t var_readonly;
+ varinfo_t var_string;
varinfo_t var_escaped;
varinfo_t var_nonlocal;
varinfo_t var_storedanything;
@@ -6547,27 +6540,17 @@ init_base_vars (void)
but this one are redundant. */
constraints.safe_push (new_constraint (lhs, rhs));
- /* Create the READONLY variable, used to represent that a variable
- points to readonly memory. */
- var_readonly = new_var_info (NULL_TREE, "READONLY");
- gcc_assert (var_readonly->id == readonly_id);
- var_readonly->is_artificial_var = 1;
- var_readonly->offset = 0;
- var_readonly->size = ~0;
- var_readonly->fullsize = ~0;
- var_readonly->is_special_var = 1;
-
- /* readonly memory points to anything, in order to make deref
- easier. In reality, it points to anything the particular
- readonly variable can point to, but we don't track this
- separately. */
- lhs.type = SCALAR;
- lhs.var = readonly_id;
- lhs.offset = 0;
- rhs.type = ADDRESSOF;
- rhs.var = readonly_id; /* FIXME */
- rhs.offset = 0;
- process_constraint (new_constraint (lhs, rhs));
+ /* 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");
+ gcc_assert (var_string->id == string_id);
+ var_string->is_artificial_var = 1;
+ var_string->offset = 0;
+ var_string->size = ~0;
+ var_string->fullsize = ~0;
+ var_string->is_special_var = 1;
+ var_string->may_have_pointers = 0;
/* Create the ESCAPED variable, used to represent the set of escaped
memory. */