alias.c (ao_ref_from_mem): Adjust.

2010-09-01  Richard Guenther  <rguenther@suse.de>

	* alias.c (ao_ref_from_mem): Adjust.
	* builtins.c (get_object_alignment): Likewise.
	* cfgexpand.c (expand_debug_expr): Likewise.
	* gimple.c (get_base_address): Likewise.
	* tree-dfa.c (get_ref_base_and_extent): Likewise.
	(get_addr_base_and_unit_offset): Likewise.  Fix for
	both TMR_SYMBOL and TMR_BASE being set.
	* tree-eh.c (tree_could_trap_p): Likewise.
	* gimplify.c (gimplify_expr): Do not attempt to gimplify
	TMR_SYMBOL.  Always gimplify TMR_BASE.
	* tree-cfg.c (verify_types_in_gimple_reference): Verify
	TMR_BASE if there is a TMR_SYMBOL.
	* tree-pretty-print.c (dump_generic_node): Adjust.
	* tree-ssa-address.c (addr_for_mem_ref): Likewise.
	(tree_mem_ref_addr): Likewise.
	(create_mem_ref_raw): Likewise.
	(move_fixed_address_to_symbol): Likewise.
	(create_mem_ref): Likewise.
	(dump_mem_address): Likewise.
	* tree-ssa-alias.c (indirect_ref_may_alias_decl_p): Adjust.
	Fix for both TMR_SYMBOL and TMR_BASE being set.
	(indirect_refs_may_alias_p): Likewise.
	* tree-ssa-operands.c (get_tmr_operands): Adjust.
	* tree.def (TARGET_MEM_REF): Adjust documentation.

From-SVN: r163733
This commit is contained in:
Richard Guenther 2010-09-01 13:28:46 +00:00 committed by Richard Biener
parent d8b08ecdf6
commit 23a534a102
14 changed files with 83 additions and 38 deletions

View File

@ -1,3 +1,30 @@
2010-09-01 Richard Guenther <rguenther@suse.de>
* alias.c (ao_ref_from_mem): Adjust.
* builtins.c (get_object_alignment): Likewise.
* cfgexpand.c (expand_debug_expr): Likewise.
* gimple.c (get_base_address): Likewise.
* tree-dfa.c (get_ref_base_and_extent): Likewise.
(get_addr_base_and_unit_offset): Likewise. Fix for
both TMR_SYMBOL and TMR_BASE being set.
* tree-eh.c (tree_could_trap_p): Likewise.
* gimplify.c (gimplify_expr): Do not attempt to gimplify
TMR_SYMBOL. Always gimplify TMR_BASE.
* tree-cfg.c (verify_types_in_gimple_reference): Verify
TMR_BASE if there is a TMR_SYMBOL.
* tree-pretty-print.c (dump_generic_node): Adjust.
* tree-ssa-address.c (addr_for_mem_ref): Likewise.
(tree_mem_ref_addr): Likewise.
(create_mem_ref_raw): Likewise.
(move_fixed_address_to_symbol): Likewise.
(create_mem_ref): Likewise.
(dump_mem_address): Likewise.
* tree-ssa-alias.c (indirect_ref_may_alias_decl_p): Adjust.
Fix for both TMR_SYMBOL and TMR_BASE being set.
(indirect_refs_may_alias_p): Likewise.
* tree-ssa-operands.c (get_tmr_operands): Adjust.
* tree.def (TARGET_MEM_REF): Adjust documentation.
2010-09-01 Uros Bizjak <ubizjak@gmail.com> 2010-09-01 Uros Bizjak <ubizjak@gmail.com>
* config/i386/i386.h (enum ix86_tune_indices) <X86_TUNE_SINGLE_POP>: * config/i386/i386.h (enum ix86_tune_indices) <X86_TUNE_SINGLE_POP>:

View File

@ -302,13 +302,13 @@ ao_ref_from_mem (ao_ref *ref, const_rtx mem)
} }
else if (TREE_CODE (base) == TARGET_MEM_REF else if (TREE_CODE (base) == TARGET_MEM_REF
&& TMR_SYMBOL (base) && TMR_SYMBOL (base)
&& TREE_CODE (TMR_SYMBOL (base)) == VAR_DECL && TREE_CODE (TREE_OPERAND (TMR_SYMBOL (base), 0)) == VAR_DECL
&& ! TREE_STATIC (TMR_SYMBOL (base)) && ! TREE_STATIC (TREE_OPERAND (TMR_SYMBOL (base), 0))
&& cfun->gimple_df->decls_to_pointers != NULL) && cfun->gimple_df->decls_to_pointers != NULL)
{ {
void *namep; void *namep;
namep = pointer_map_contains (cfun->gimple_df->decls_to_pointers, namep = pointer_map_contains (cfun->gimple_df->decls_to_pointers,
TMR_SYMBOL (base)); TREE_OPERAND (TMR_SYMBOL (base), 0));
if (namep) if (namep)
ref->base = build_simple_mem_ref (*(tree *)namep); ref->base = build_simple_mem_ref (*(tree *)namep);
} }

View File

@ -369,7 +369,8 @@ get_object_alignment (tree exp, unsigned int max_align)
else if (TREE_CODE (exp) == TARGET_MEM_REF else if (TREE_CODE (exp) == TARGET_MEM_REF
&& TMR_SYMBOL (exp)) && TMR_SYMBOL (exp))
{ {
align = get_object_alignment (TMR_SYMBOL (exp), max_align); align = get_object_alignment (TREE_OPERAND (TMR_SYMBOL (exp), 0),
max_align);
if (TMR_OFFSET (exp)) if (TMR_OFFSET (exp))
bitpos += TREE_INT_CST_LOW (TMR_OFFSET (exp)) * BITS_PER_UNIT; bitpos += TREE_INT_CST_LOW (TMR_OFFSET (exp)) * BITS_PER_UNIT;
if (TMR_INDEX (exp) && TMR_STEP (exp)) if (TMR_INDEX (exp) && TMR_STEP (exp))
@ -379,6 +380,8 @@ get_object_alignment (tree exp, unsigned int max_align)
} }
else if (TMR_INDEX (exp)) else if (TMR_INDEX (exp))
align = BITS_PER_UNIT; align = BITS_PER_UNIT;
if (TMR_BASE (exp))
align = BITS_PER_UNIT;
} }
else else
align = BITS_PER_UNIT; align = BITS_PER_UNIT;

View File

@ -2468,7 +2468,8 @@ expand_debug_expr (tree exp)
return op0; return op0;
case TARGET_MEM_REF: case TARGET_MEM_REF:
if (TMR_SYMBOL (exp) && !DECL_RTL_SET_P (TMR_SYMBOL (exp))) if (TMR_SYMBOL (exp)
&& !DECL_RTL_SET_P (TREE_OPERAND (TMR_SYMBOL (exp), 0)))
return NULL; return NULL;
op0 = expand_debug_expr op0 = expand_debug_expr

View File

@ -3009,7 +3009,7 @@ get_base_address (tree t)
t = TREE_OPERAND (TREE_OPERAND (t, 0), 0); t = TREE_OPERAND (TREE_OPERAND (t, 0), 0);
else if (TREE_CODE (t) == TARGET_MEM_REF else if (TREE_CODE (t) == TARGET_MEM_REF
&& TMR_SYMBOL (t)) && TMR_SYMBOL (t))
t = TMR_SYMBOL (t); t = TREE_OPERAND (TMR_SYMBOL (t), 0);
if (SSA_VAR_P (t) if (SSA_VAR_P (t)
|| TREE_CODE (t) == STRING_CST || TREE_CODE (t) == STRING_CST

View File

@ -6978,9 +6978,14 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
enum gimplify_status r0 = GS_ALL_DONE, r1 = GS_ALL_DONE; enum gimplify_status r0 = GS_ALL_DONE, r1 = GS_ALL_DONE;
if (TMR_SYMBOL (*expr_p)) if (TMR_SYMBOL (*expr_p))
r0 = gimplify_expr (&TMR_SYMBOL (*expr_p), pre_p, /* We can't gimplify the symbol part. Assert it is
post_p, is_gimple_lvalue, fb_either); already gimple instead.
else if (TMR_BASE (*expr_p)) ??? This isn't exactly the same as ADDR_EXPR
plus is_gimple_mem_ref_addr (), see fixed_address_object_p. */
gcc_assert (TREE_CODE (TMR_SYMBOL (*expr_p)) == ADDR_EXPR
&& (TREE_CODE (TREE_OPERAND (TMR_SYMBOL (*expr_p), 0))
== VAR_DECL));
if (TMR_BASE (*expr_p))
r0 = gimplify_expr (&TMR_BASE (*expr_p), pre_p, r0 = gimplify_expr (&TMR_BASE (*expr_p), pre_p,
post_p, is_gimple_val, fb_either); post_p, is_gimple_val, fb_either);
if (TMR_INDEX (*expr_p)) if (TMR_INDEX (*expr_p))

View File

@ -2990,6 +2990,13 @@ verify_types_in_gimple_reference (tree expr, bool require_lvalue)
} }
else if (TREE_CODE (expr) == TARGET_MEM_REF) else if (TREE_CODE (expr) == TARGET_MEM_REF)
{ {
if (TMR_SYMBOL (expr)
&& TMR_BASE (expr)
&& !useless_type_conversion_p (sizetype, TREE_TYPE (TMR_BASE (expr))))
{
error ("Non-sizetype base in TARGET_MEM_REF with symbol");
return true;
}
if (!TMR_OFFSET (expr) if (!TMR_OFFSET (expr)
|| TREE_CODE (TMR_OFFSET (expr)) != INTEGER_CST || TREE_CODE (TMR_OFFSET (expr)) != INTEGER_CST
|| !POINTER_TYPE_P (TREE_TYPE (TMR_OFFSET (expr)))) || !POINTER_TYPE_P (TREE_TYPE (TMR_OFFSET (expr))))

View File

@ -882,16 +882,17 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset,
/* Hand back the decl for MEM[&decl, off]. */ /* Hand back the decl for MEM[&decl, off]. */
if (TMR_SYMBOL (exp)) if (TMR_SYMBOL (exp))
{ {
/* Via the variable index we can reach the whole object. */ /* Via the variable index or base we can reach the
if (TMR_INDEX (exp)) whole object. */
if (TMR_INDEX (exp) || TMR_BASE (exp))
{ {
exp = TMR_SYMBOL (exp); exp = TREE_OPERAND (TMR_SYMBOL (exp), 0);
bit_offset = 0; bit_offset = 0;
maxsize = -1; maxsize = -1;
goto done; goto done;
} }
if (integer_zerop (TMR_OFFSET (exp))) if (integer_zerop (TMR_OFFSET (exp)))
exp = TMR_SYMBOL (exp); exp = TREE_OPERAND (TMR_SYMBOL (exp), 0);
else else
{ {
double_int off = mem_ref_offset (exp); double_int off = mem_ref_offset (exp);
@ -903,7 +904,7 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset,
if (double_int_fits_in_shwi_p (off)) if (double_int_fits_in_shwi_p (off))
{ {
bit_offset = double_int_to_shwi (off); bit_offset = double_int_to_shwi (off);
exp = TMR_SYMBOL (exp); exp = TREE_OPERAND (TMR_SYMBOL (exp), 0);
} }
} }
} }
@ -1045,7 +1046,7 @@ get_addr_base_and_unit_offset (tree exp, HOST_WIDE_INT *poffset)
/* Hand back the decl for MEM[&decl, off]. */ /* Hand back the decl for MEM[&decl, off]. */
if (TMR_SYMBOL (exp)) if (TMR_SYMBOL (exp))
{ {
if (TMR_SYMBOL (exp)) if (TMR_INDEX (exp) || TMR_BASE (exp))
return NULL_TREE; return NULL_TREE;
if (!integer_zerop (TMR_OFFSET (exp))) if (!integer_zerop (TMR_OFFSET (exp)))
{ {
@ -1053,7 +1054,7 @@ get_addr_base_and_unit_offset (tree exp, HOST_WIDE_INT *poffset)
gcc_assert (off.high == -1 || off.high == 0); gcc_assert (off.high == -1 || off.high == 0);
byte_offset += double_int_to_shwi (off); byte_offset += double_int_to_shwi (off);
} }
exp = TMR_SYMBOL (exp); exp = TREE_OPERAND (TMR_SYMBOL (exp), 0);
} }
goto done; goto done;

View File

@ -2405,7 +2405,7 @@ tree_could_trap_p (tree expr)
{ {
case TARGET_MEM_REF: case TARGET_MEM_REF:
if (TMR_SYMBOL (expr) if (TMR_SYMBOL (expr)
&& !TMR_INDEX (expr)) && !TMR_INDEX (expr) && !TMR_BASE (expr))
return false; return false;
return !TREE_THIS_NOTRAP (expr); return !TREE_THIS_NOTRAP (expr);

View File

@ -858,7 +858,8 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
pp_string (buffer, sep); pp_string (buffer, sep);
sep = ", "; sep = ", ";
pp_string (buffer, "symbol: "); pp_string (buffer, "symbol: ");
dump_generic_node (buffer, tmp, spc, flags, false); dump_generic_node (buffer, TREE_OPERAND (tmp, 0),
spc, flags, false);
} }
tmp = TMR_BASE (node); tmp = TMR_BASE (node);
if (tmp) if (tmp)

View File

@ -247,8 +247,7 @@ addr_for_mem_ref (struct mem_address *addr, addr_space_t as,
/* Otherwise really expand the expressions. */ /* Otherwise really expand the expressions. */
sym = (addr->symbol sym = (addr->symbol
? expand_expr (build_addr (addr->symbol, current_function_decl), ? expand_expr (addr->symbol, NULL_RTX, address_mode, EXPAND_NORMAL)
NULL_RTX, address_mode, EXPAND_NORMAL)
: NULL_RTX); : NULL_RTX);
bse = (addr->base bse = (addr->base
? expand_expr (addr->base, NULL_RTX, address_mode, EXPAND_NORMAL) ? expand_expr (addr->base, NULL_RTX, address_mode, EXPAND_NORMAL)
@ -273,9 +272,10 @@ tree_mem_ref_addr (tree type, tree mem_ref)
tree addr_base = NULL_TREE, addr_off = NULL_TREE; tree addr_base = NULL_TREE, addr_off = NULL_TREE;
if (sym) if (sym)
addr_base = fold_convert (type, build_addr (sym, current_function_decl)); addr_base = fold_convert (type, sym);
else if (base && POINTER_TYPE_P (TREE_TYPE (base))) else if (base)
{ {
gcc_assert (POINTER_TYPE_P (TREE_TYPE (base)));
addr_base = fold_convert (type, base); addr_base = fold_convert (type, base);
base = NULL_TREE; base = NULL_TREE;
} }
@ -363,7 +363,7 @@ create_mem_ref_raw (tree type, tree alias_ptr_type, struct mem_address *addr)
tree base; tree base;
gcc_assert (!addr->symbol ^ !addr->base); gcc_assert (!addr->symbol ^ !addr->base);
if (addr->symbol) if (addr->symbol)
base = build_fold_addr_expr (addr->symbol); base = addr->symbol;
else else
base = addr->base; base = addr->base;
return fold_build2 (MEM_REF, type, base, addr->offset); return fold_build2 (MEM_REF, type, base, addr->offset);
@ -408,7 +408,7 @@ move_fixed_address_to_symbol (struct mem_address *parts, aff_tree *addr)
if (i == addr->n) if (i == addr->n)
return; return;
parts->symbol = TREE_OPERAND (val, 0); parts->symbol = val;
aff_combination_remove_elt (addr, i); aff_combination_remove_elt (addr, i);
} }
@ -717,7 +717,7 @@ create_mem_ref (gimple_stmt_iterator *gsi, tree type, aff_tree *addr,
if (parts.symbol) if (parts.symbol)
{ {
tmp = build_addr (parts.symbol, current_function_decl); tmp = parts.symbol;
gcc_assert (is_gimple_val (tmp)); gcc_assert (is_gimple_val (tmp));
/* Add the symbol to base, eventually forcing it to register. */ /* Add the symbol to base, eventually forcing it to register. */
@ -883,7 +883,7 @@ dump_mem_address (FILE *file, struct mem_address *parts)
if (parts->symbol) if (parts->symbol)
{ {
fprintf (file, "symbol: "); fprintf (file, "symbol: ");
print_generic_expr (file, parts->symbol, TDF_SLIM); print_generic_expr (file, TREE_OPERAND (parts->symbol, 0), TDF_SLIM);
fprintf (file, "\n"); fprintf (file, "\n");
} }
if (parts->base) if (parts->base)

View File

@ -672,14 +672,14 @@ indirect_ref_may_alias_decl_p (tree ref1 ATTRIBUTE_UNUSED, tree base1,
if (TREE_CODE (base1) == TARGET_MEM_REF) if (TREE_CODE (base1) == TARGET_MEM_REF)
{ {
if (TMR_BASE (base1)) if (TMR_SYMBOL (base1))
ptr1 = TMR_SYMBOL (base1);
else if (TMR_BASE (base1))
{ {
if (!POINTER_TYPE_P (TREE_TYPE (TMR_BASE (base1)))) if (!POINTER_TYPE_P (TREE_TYPE (TMR_BASE (base1))))
return true; return true;
ptr1 = TMR_BASE (base1); ptr1 = TMR_BASE (base1);
} }
else if (TMR_SYMBOL (base1))
ptr1 = build_fold_addr_expr (TMR_SYMBOL (base1));
else else
return true; return true;
} }
@ -814,14 +814,14 @@ indirect_refs_may_alias_p (tree ref1 ATTRIBUTE_UNUSED, tree base1,
if (TREE_CODE (base1) == TARGET_MEM_REF) if (TREE_CODE (base1) == TARGET_MEM_REF)
{ {
if (TMR_BASE (base1)) if (TMR_SYMBOL (base1))
ptr1 = TMR_SYMBOL (base1);
else if (TMR_BASE (base1))
{ {
if (!POINTER_TYPE_P (TREE_TYPE (TMR_BASE (base1)))) if (!POINTER_TYPE_P (TREE_TYPE (TMR_BASE (base1))))
return true; return true;
ptr1 = TMR_BASE (base1); ptr1 = TMR_BASE (base1);
} }
else if (TMR_SYMBOL (base1))
ptr1 = build_fold_addr_expr (TMR_SYMBOL (base1));
else else
return true; return true;
} }
@ -830,14 +830,14 @@ indirect_refs_may_alias_p (tree ref1 ATTRIBUTE_UNUSED, tree base1,
if (TREE_CODE (base2) == TARGET_MEM_REF) if (TREE_CODE (base2) == TARGET_MEM_REF)
{ {
if (TMR_BASE (base2)) if (TMR_SYMBOL (base2))
ptr2 = TMR_SYMBOL (base2);
else if (TMR_BASE (base2))
{ {
if (!POINTER_TYPE_P (TREE_TYPE (TMR_BASE (base2)))) if (!POINTER_TYPE_P (TREE_TYPE (TMR_BASE (base2))))
return true; return true;
ptr2 = TMR_BASE (base2); ptr2 = TMR_BASE (base2);
} }
else if (TMR_SYMBOL (base2))
ptr2 = build_fold_addr_expr (TMR_SYMBOL (base2));
else else
return true; return true;
} }

View File

@ -756,7 +756,7 @@ get_tmr_operands (gimple stmt, tree expr, int flags)
get_expr_operands (stmt, &TMR_INDEX (expr), opf_use | (flags & opf_no_vops)); get_expr_operands (stmt, &TMR_INDEX (expr), opf_use | (flags & opf_no_vops));
if (TMR_SYMBOL (expr)) if (TMR_SYMBOL (expr))
mark_address_taken (TMR_SYMBOL (expr)); mark_address_taken (TREE_OPERAND (TMR_SYMBOL (expr), 0));
add_virtual_operand (stmt, flags); add_virtual_operand (stmt, flags);
} }

View File

@ -952,8 +952,8 @@ DEFTREECODE (WITH_SIZE_EXPR, "with_size_expr", tcc_expression, 2)
generated by the builtin targetm.vectorize.mask_for_load_builtin_decl. */ generated by the builtin targetm.vectorize.mask_for_load_builtin_decl. */
DEFTREECODE (REALIGN_LOAD_EXPR, "realign_load", tcc_expression, 3) DEFTREECODE (REALIGN_LOAD_EXPR, "realign_load", tcc_expression, 3)
/* Low-level memory addressing. Operands are SYMBOL (static or global /* Low-level memory addressing. Operands are SYMBOL (address of static or
variable), BASE (register), INDEX (register), STEP (integer constant), global variable), BASE (register), INDEX (register), STEP (integer constant),
OFFSET (integer constant). Corresponding address is OFFSET (integer constant). Corresponding address is
SYMBOL + BASE + STEP * INDEX + OFFSET. Only variations and values valid on SYMBOL + BASE + STEP * INDEX + OFFSET. Only variations and values valid on
the target are allowed. the target are allowed.