summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-address.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2010-08-16 09:55:54 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2010-08-16 09:55:54 +0000
commit9a14ba4fd861436294514c3008d03f1f77de058a (patch)
tree4edd6a80f5f5a0a0c23401f9e90a871371fc79be /gcc/tree-ssa-address.c
parent30f7a5ed3b1d1e529a563db9e8d03507c8c59e0a (diff)
downloadgcc-9a14ba4fd861436294514c3008d03f1f77de058a.tar.gz
2010-08-16 Richard Guenther <rguenther@suse.de>
* tree-cfg.c (verify_types_in_gimple_reference): Verify TARGET_MEM_REF a bit. * tree-ssa-address.c (addr_for_mem_ref): Adjust. (create_mem_ref_raw): Always create TMR_OFFSET, store the alias pointer type via it. (copy_mem_ref_info): Adjust. (maybe_fold_tmr): Likewise. * tree.c (mem_ref_offset): Also handle TARGET_MEM_REF. (reference_alias_ptr_type): Likewise. * tree.def (TARGET_MEM_REF): Remove TMR_ORIGINAL operand, adjust documentation of TMR_OFFSET operand. * alias.c (get_alias_set): Do not look at TMR_ORIGINAL but use the alias pointer type. * expr.c (expand_expr_real_1): Do not use TMR_ORIGINAL to initialize mem attrs but the TMR itself. * tree-eh.c (tree_could_trap_p): Handle TARGET_MEM_REF similar to MEM_REF. * tree-pretty-print.c (dump_generic_node): Do not dump TMR_ORIGINAL. * tree-ssa-loop-ivopts.c (idx_remove_ssa_names): Remove. (unshare_and_remove_ssa_names): Likewise. (copy_ref_info): Adjust. * tree-ssa-pre.c (create_component_ref_by_pieces_1): Simplify TARGET_MEM_REF case. * tree-ssa-sccvn.c (copy_reference_ops_from_ref): Do not look at TMR_ORIGINAL. * tree.h (TMR_ORIGINAL): Remove. * gimple.c (get_base_address): For TARGET_MEM_REF with a symbol return that. * tree-dfa.c (get_ref_base_and_extent): Handle TARGET_MEM_REF with a symbol. (get_addr_base_and_unit_offset): Likewise. * tree-ssa-alias.c (indirect_ref_may_alias_decl_p): Handle TARGET_MEM_REFs. (indirect_ref_may_alias_decl_p): Likewise. (refs_may_alias_p_1): Do not bail out for TARGET_MEM_REFs. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@163278 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-address.c')
-rw-r--r--gcc/tree-ssa-address.c47
1 files changed, 19 insertions, 28 deletions
diff --git a/gcc/tree-ssa-address.c b/gcc/tree-ssa-address.c
index 474a7986a23..305a0135e55 100644
--- a/gcc/tree-ssa-address.c
+++ b/gcc/tree-ssa-address.c
@@ -198,7 +198,10 @@ addr_for_mem_ref (struct mem_address *addr, addr_space_t as,
st = NULL_RTX;
if (addr->offset && !integer_zerop (addr->offset))
- off = immed_double_int_const (tree_to_double_int (addr->offset), address_mode);
+ off = immed_double_int_const
+ (double_int_sext (tree_to_double_int (addr->offset),
+ TYPE_PRECISION (TREE_TYPE (addr->offset))),
+ address_mode);
else
off = NULL_RTX;
@@ -346,8 +349,10 @@ create_mem_ref_raw (tree type, tree alias_ptr_type, struct mem_address *addr)
if (addr->step && integer_onep (addr->step))
addr->step = NULL_TREE;
- if (addr->offset && integer_zerop (addr->offset))
- addr->offset = NULL_TREE;
+ if (addr->offset)
+ addr->offset = fold_convert (alias_ptr_type, addr->offset);
+ else
+ addr->offset = build_int_cst (alias_ptr_type, 0);
/* If possible use a plain MEM_REF instead of a TARGET_MEM_REF. */
if (alias_ptr_type
@@ -355,22 +360,18 @@ create_mem_ref_raw (tree type, tree alias_ptr_type, struct mem_address *addr)
&& !addr->step
&& (!addr->base || POINTER_TYPE_P (TREE_TYPE (addr->base))))
{
- tree base, offset;
+ tree base;
gcc_assert (!addr->symbol ^ !addr->base);
if (addr->symbol)
base = build_fold_addr_expr (addr->symbol);
else
base = addr->base;
- if (addr->offset)
- offset = fold_convert (alias_ptr_type, addr->offset);
- else
- offset = build_int_cst (alias_ptr_type, 0);
- return fold_build2 (MEM_REF, type, base, offset);
+ return fold_build2 (MEM_REF, type, base, addr->offset);
}
- return build6 (TARGET_MEM_REF, type,
+ return build5 (TARGET_MEM_REF, type,
addr->symbol, addr->base, addr->index,
- addr->step, addr->offset, NULL);
+ addr->step, addr->offset);
}
/* Returns true if OBJ is an object whose address is a link time constant. */
@@ -820,7 +821,6 @@ void
copy_mem_ref_info (tree to, tree from)
{
/* And the info about the original reference. */
- TMR_ORIGINAL (to) = TMR_ORIGINAL (from);
TREE_SIDE_EFFECTS (to) = TREE_SIDE_EFFECTS (from);
TREE_THIS_VOLATILE (to) = TREE_THIS_VOLATILE (from);
}
@@ -839,13 +839,9 @@ maybe_fold_tmr (tree ref)
if (addr.base && TREE_CODE (addr.base) == INTEGER_CST)
{
- if (addr.offset)
- addr.offset = fold_binary_to_constant (PLUS_EXPR, sizetype,
- addr.offset,
- fold_convert (sizetype, addr.base));
- else
- addr.offset = addr.base;
-
+ addr.offset = fold_binary_to_constant (PLUS_EXPR,
+ TREE_TYPE (addr.offset),
+ addr.offset, addr.base);
addr.base = NULL_TREE;
changed = true;
}
@@ -860,14 +856,9 @@ maybe_fold_tmr (tree ref)
addr.step = NULL_TREE;
}
- if (addr.offset)
- {
- addr.offset = fold_binary_to_constant (PLUS_EXPR, sizetype,
- addr.offset, off);
- }
- else
- addr.offset = off;
-
+ addr.offset = fold_binary_to_constant (PLUS_EXPR,
+ TREE_TYPE (addr.offset),
+ addr.offset, off);
addr.index = NULL_TREE;
changed = true;
}
@@ -875,7 +866,7 @@ maybe_fold_tmr (tree ref)
if (!changed)
return NULL_TREE;
- ret = create_mem_ref_raw (TREE_TYPE (ref), NULL_TREE, &addr);
+ ret = create_mem_ref_raw (TREE_TYPE (ref), TREE_TYPE (addr.offset), &addr);
if (!ret)
return NULL_TREE;