summaryrefslogtreecommitdiff
path: root/gcc/tree-ssanames.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2010-08-12 10:36:08 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2010-08-12 10:36:08 +0000
commit153c3b5050025f879d92be6cd675dbb0686255e3 (patch)
tree9a3a2a1cd2ab3e673bfae829eadbac8146e824a5 /gcc/tree-ssanames.c
parentaadb75a702993e265e9f0dbda27187420f0a9b1f (diff)
downloadgcc-153c3b5050025f879d92be6cd675dbb0686255e3.tar.gz
2010-08-12 Richard Guenther <rguenther@suse.de>
* tree-flow.h (struct ptr_info_def): Add align and misalign fields. * tree-ssa-alias.c (get_ptr_info): Move ... * tree-ssanames.c (get_ptr_info): ... here. Initialize align and misalign fields conservatively. * tree-ssa-ccp.c (ccp_finalize): From partially constant pointers derive alignment information. (evaluate_stmt): Derive alignment information from memory allocation functions. * tree.h (get_pointer_alignment): Make unsigned. * builtins.c (get_object_alignment): Use alignment information we have computed for pointers. (get_pointer_alignment): Likewise. Make conservative, return and unsigned value. (expand_builtin_strlen): Adjust. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (get_builtin_sync_mem): Use at least mode alignment. (fold_builtin_memset): Adjust. (fold_builtin_memory_op): Likewise. * gimple-pretty-print.c (dump_gimple_phi): Alongside alias information also dump pointer alignment knowledge. (dump_gimple_stmt): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@163189 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssanames.c')
-rw-r--r--gcc/tree-ssanames.c42
1 files changed, 33 insertions, 9 deletions
diff --git a/gcc/tree-ssanames.c b/gcc/tree-ssanames.c
index 79b844ffe7c..0d63fe9fe63 100644
--- a/gcc/tree-ssanames.c
+++ b/gcc/tree-ssanames.c
@@ -240,20 +240,29 @@ release_ssa_name (tree var)
}
}
-/* Creates a duplicate of a ssa name NAME defined in statement STMT. */
-tree
-duplicate_ssa_name (tree name, gimple stmt)
+/* Return the alias information associated with pointer T. It creates a
+ new instance if none existed. */
+
+struct ptr_info_def *
+get_ptr_info (tree t)
{
- tree new_name = make_ssa_name (SSA_NAME_VAR (name), stmt);
- struct ptr_info_def *old_ptr_info = SSA_NAME_PTR_INFO (name);
+ struct ptr_info_def *pi;
- if (old_ptr_info)
- duplicate_ssa_name_ptr_info (new_name, old_ptr_info);
+ gcc_assert (POINTER_TYPE_P (TREE_TYPE (t)));
- return new_name;
-}
+ pi = SSA_NAME_PTR_INFO (t);
+ if (pi == NULL)
+ {
+ pi = ggc_alloc_cleared_ptr_info_def ();
+ pt_solution_reset (&pi->pt);
+ pi->align = 1;
+ pi->misalign = 0;
+ SSA_NAME_PTR_INFO (t) = pi;
+ }
+ return pi;
+}
/* Creates a duplicate of the ptr_info_def at PTR_INFO for use by
the SSA name NAME. */
@@ -276,6 +285,21 @@ duplicate_ssa_name_ptr_info (tree name, struct ptr_info_def *ptr_info)
}
+/* Creates a duplicate of a ssa name NAME tobe defined by statement STMT. */
+
+tree
+duplicate_ssa_name (tree name, gimple stmt)
+{
+ tree new_name = make_ssa_name (SSA_NAME_VAR (name), stmt);
+ struct ptr_info_def *old_ptr_info = SSA_NAME_PTR_INFO (name);
+
+ if (old_ptr_info)
+ duplicate_ssa_name_ptr_info (new_name, old_ptr_info);
+
+ return new_name;
+}
+
+
/* Release all the SSA_NAMEs created by STMT. */
void