aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2010-07-05 14:51:16 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2010-07-05 14:51:16 +0000
commita41e5e86c0bbcb0dca6311a5e6dab8d7e005a076 (patch)
tree26e22ad4b9ee130b7097d46360e487d9f427ecf0 /gcc/tree.c
parent5c144a5fadc5f5d8df422e6f85e8464c1b918780 (diff)
downloadgcc-a41e5e86c0bbcb0dca6311a5e6dab8d7e005a076.zip
gcc-a41e5e86c0bbcb0dca6311a5e6dab8d7e005a076.tar.gz
gcc-a41e5e86c0bbcb0dca6311a5e6dab8d7e005a076.tar.bz2
tree.c (reference_alias_ptr_type): New function.
2010-07-05 Richard Guenther <rguenther@suse.de> * tree.c (reference_alias_ptr_type): New function. * tree.h (reference_alias_ptr_type): Declare. * tree-ssa-loop-ivopts.c (copy_ref_info): Restructure to allow non-TARGET_MEM_REF new refs. (rewrite_use_address): Pass old alias pointer type to create_mem_ref. * tree-ssa-address.c (create_mem_ref_raw): Get alias pointer type. Build a MEM_REF instead of a TARGET_MEM_REF if possible. (create_mem_ref): Get alias pointer type. Adjust calls to create_mem_ref_raw. (maybe_fold_tmr): Likewise. * tree-flow.h (create_mem_ref): Adjust prototype. From-SVN: r161840
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index cb2c276..e6deacc 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -3913,6 +3913,25 @@ mem_ref_offset (const_tree t)
TYPE_PRECISION (TREE_TYPE (toff)));
}
+/* Return the pointer-type relevant for TBAA purposes from the
+ gimple memory reference tree T. This is the type to be used for
+ the offset operand of MEM_REF or TARGET_MEM_REF replacements of T. */
+
+tree
+reference_alias_ptr_type (const_tree t)
+{
+ const_tree base = t;
+ while (handled_component_p (base))
+ base = TREE_OPERAND (base, 0);
+ if (TREE_CODE (base) == MEM_REF)
+ return TREE_TYPE (TREE_OPERAND (base, 1));
+ else if (TREE_CODE (base) == TARGET_MEM_REF
+ || TREE_CODE (base) == MISALIGNED_INDIRECT_REF)
+ return NULL_TREE;
+ else
+ return build_pointer_type (TYPE_MAIN_VARIANT (TREE_TYPE (base)));
+}
+
/* Similar except don't specify the TREE_TYPE
and leave the TREE_SIDE_EFFECTS as 0.
It is permissible for arguments to be null,