diff options
author | Richard Guenther <rguenther@suse.de> | 2010-07-05 14:51:16 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2010-07-05 14:51:16 +0000 |
commit | a41e5e86c0bbcb0dca6311a5e6dab8d7e005a076 (patch) | |
tree | 26e22ad4b9ee130b7097d46360e487d9f427ecf0 /gcc/tree.c | |
parent | 5c144a5fadc5f5d8df422e6f85e8464c1b918780 (diff) | |
download | gcc-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.c | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -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, |