diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-07-05 14:51:16 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-07-05 14:51:16 +0000 |
commit | 9614eeffe73081e7a1048f8e6dfd9cd2b80d607e (patch) | |
tree | 26e22ad4b9ee130b7097d46360e487d9f427ecf0 /gcc/tree.c | |
parent | 2a48831125500430e0d17d354d983360eeac064d (diff) | |
download | gcc-9614eeffe73081e7a1048f8e6dfd9cd2b80d607e.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161840 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/tree.c b/gcc/tree.c index cb2c276b715..e6deacce0f7 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, |