diff options
-rw-r--r-- | gcc/ChangeLog | 27 | ||||
-rw-r--r-- | gcc/alias.c | 6 | ||||
-rw-r--r-- | gcc/builtins.c | 5 | ||||
-rw-r--r-- | gcc/cfgexpand.c | 3 | ||||
-rw-r--r-- | gcc/gimple.c | 2 | ||||
-rw-r--r-- | gcc/gimplify.c | 11 | ||||
-rw-r--r-- | gcc/tree-cfg.c | 7 | ||||
-rw-r--r-- | gcc/tree-dfa.c | 15 | ||||
-rw-r--r-- | gcc/tree-eh.c | 2 | ||||
-rw-r--r-- | gcc/tree-pretty-print.c | 3 | ||||
-rw-r--r-- | gcc/tree-ssa-address.c | 16 | ||||
-rw-r--r-- | gcc/tree-ssa-alias.c | 18 | ||||
-rw-r--r-- | gcc/tree-ssa-operands.c | 2 | ||||
-rw-r--r-- | gcc/tree.def | 4 |
14 files changed, 83 insertions, 38 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 970394e..6a621ec 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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> * config/i386/i386.h (enum ix86_tune_indices) <X86_TUNE_SINGLE_POP>: diff --git a/gcc/alias.c b/gcc/alias.c index 98706a0..580f898 100644 --- a/gcc/alias.c +++ b/gcc/alias.c @@ -302,13 +302,13 @@ ao_ref_from_mem (ao_ref *ref, const_rtx mem) } else if (TREE_CODE (base) == TARGET_MEM_REF && TMR_SYMBOL (base) - && TREE_CODE (TMR_SYMBOL (base)) == VAR_DECL - && ! TREE_STATIC (TMR_SYMBOL (base)) + && TREE_CODE (TREE_OPERAND (TMR_SYMBOL (base), 0)) == VAR_DECL + && ! TREE_STATIC (TREE_OPERAND (TMR_SYMBOL (base), 0)) && cfun->gimple_df->decls_to_pointers != NULL) { void *namep; namep = pointer_map_contains (cfun->gimple_df->decls_to_pointers, - TMR_SYMBOL (base)); + TREE_OPERAND (TMR_SYMBOL (base), 0)); if (namep) ref->base = build_simple_mem_ref (*(tree *)namep); } diff --git a/gcc/builtins.c b/gcc/builtins.c index 4b540d8..2cebb0e 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -369,7 +369,8 @@ get_object_alignment (tree exp, unsigned int max_align) else if (TREE_CODE (exp) == TARGET_MEM_REF && 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)) bitpos += TREE_INT_CST_LOW (TMR_OFFSET (exp)) * BITS_PER_UNIT; 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)) align = BITS_PER_UNIT; + if (TMR_BASE (exp)) + align = BITS_PER_UNIT; } else align = BITS_PER_UNIT; diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index bf1149f..1852885 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -2468,7 +2468,8 @@ expand_debug_expr (tree exp) return op0; 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; op0 = expand_debug_expr diff --git a/gcc/gimple.c b/gcc/gimple.c index 7433b14..c0b5052 100644 --- a/gcc/gimple.c +++ b/gcc/gimple.c @@ -3009,7 +3009,7 @@ get_base_address (tree t) t = TREE_OPERAND (TREE_OPERAND (t, 0), 0); else if (TREE_CODE (t) == TARGET_MEM_REF && TMR_SYMBOL (t)) - t = TMR_SYMBOL (t); + t = TREE_OPERAND (TMR_SYMBOL (t), 0); if (SSA_VAR_P (t) || TREE_CODE (t) == STRING_CST diff --git a/gcc/gimplify.c b/gcc/gimplify.c index b0468c6..bdb97ec 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -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; if (TMR_SYMBOL (*expr_p)) - r0 = gimplify_expr (&TMR_SYMBOL (*expr_p), pre_p, - post_p, is_gimple_lvalue, fb_either); - else if (TMR_BASE (*expr_p)) + /* We can't gimplify the symbol part. Assert it is + already gimple instead. + ??? 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, post_p, is_gimple_val, fb_either); if (TMR_INDEX (*expr_p)) diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index dfe6d8f..1dc99aa 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -2990,6 +2990,13 @@ verify_types_in_gimple_reference (tree expr, bool require_lvalue) } 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) || TREE_CODE (TMR_OFFSET (expr)) != INTEGER_CST || !POINTER_TYPE_P (TREE_TYPE (TMR_OFFSET (expr)))) diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c index 10fd41e..c60e107 100644 --- a/gcc/tree-dfa.c +++ b/gcc/tree-dfa.c @@ -882,16 +882,17 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset, /* Hand back the decl for MEM[&decl, off]. */ if (TMR_SYMBOL (exp)) { - /* Via the variable index we can reach the whole object. */ - if (TMR_INDEX (exp)) + /* Via the variable index or base we can reach the + whole object. */ + if (TMR_INDEX (exp) || TMR_BASE (exp)) { - exp = TMR_SYMBOL (exp); + exp = TREE_OPERAND (TMR_SYMBOL (exp), 0); bit_offset = 0; maxsize = -1; goto done; } if (integer_zerop (TMR_OFFSET (exp))) - exp = TMR_SYMBOL (exp); + exp = TREE_OPERAND (TMR_SYMBOL (exp), 0); else { 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)) { 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]. */ if (TMR_SYMBOL (exp)) { - if (TMR_SYMBOL (exp)) + if (TMR_INDEX (exp) || TMR_BASE (exp)) return NULL_TREE; 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); byte_offset += double_int_to_shwi (off); } - exp = TMR_SYMBOL (exp); + exp = TREE_OPERAND (TMR_SYMBOL (exp), 0); } goto done; diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c index 9fab7ad..3d7859b 100644 --- a/gcc/tree-eh.c +++ b/gcc/tree-eh.c @@ -2405,7 +2405,7 @@ tree_could_trap_p (tree expr) { case TARGET_MEM_REF: if (TMR_SYMBOL (expr) - && !TMR_INDEX (expr)) + && !TMR_INDEX (expr) && !TMR_BASE (expr)) return false; return !TREE_THIS_NOTRAP (expr); diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c index 2182fef..dbbd06c 100644 --- a/gcc/tree-pretty-print.c +++ b/gcc/tree-pretty-print.c @@ -858,7 +858,8 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags, pp_string (buffer, sep); sep = ", "; 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); if (tmp) diff --git a/gcc/tree-ssa-address.c b/gcc/tree-ssa-address.c index ffc5541..d642425 100644 --- a/gcc/tree-ssa-address.c +++ b/gcc/tree-ssa-address.c @@ -247,8 +247,7 @@ addr_for_mem_ref (struct mem_address *addr, addr_space_t as, /* Otherwise really expand the expressions. */ sym = (addr->symbol - ? expand_expr (build_addr (addr->symbol, current_function_decl), - NULL_RTX, address_mode, EXPAND_NORMAL) + ? expand_expr (addr->symbol, NULL_RTX, address_mode, EXPAND_NORMAL) : NULL_RTX); bse = (addr->base ? 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; if (sym) - addr_base = fold_convert (type, build_addr (sym, current_function_decl)); - else if (base && POINTER_TYPE_P (TREE_TYPE (base))) + addr_base = fold_convert (type, sym); + else if (base) { + gcc_assert (POINTER_TYPE_P (TREE_TYPE (base))); addr_base = fold_convert (type, base); base = NULL_TREE; } @@ -363,7 +363,7 @@ create_mem_ref_raw (tree type, tree alias_ptr_type, struct mem_address *addr) tree base; gcc_assert (!addr->symbol ^ !addr->base); if (addr->symbol) - base = build_fold_addr_expr (addr->symbol); + base = addr->symbol; else base = addr->base; 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) return; - parts->symbol = TREE_OPERAND (val, 0); + parts->symbol = val; 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) { - tmp = build_addr (parts.symbol, current_function_decl); + tmp = parts.symbol; gcc_assert (is_gimple_val (tmp)); /* 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) { 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"); } if (parts->base) diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index a8d580e..fe017d7 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -672,14 +672,14 @@ indirect_ref_may_alias_decl_p (tree ref1 ATTRIBUTE_UNUSED, tree base1, 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)))) return true; ptr1 = TMR_BASE (base1); } - else if (TMR_SYMBOL (base1)) - ptr1 = build_fold_addr_expr (TMR_SYMBOL (base1)); else 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 (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)))) return true; ptr1 = TMR_BASE (base1); } - else if (TMR_SYMBOL (base1)) - ptr1 = build_fold_addr_expr (TMR_SYMBOL (base1)); else 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 (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)))) return true; ptr2 = TMR_BASE (base2); } - else if (TMR_SYMBOL (base2)) - ptr2 = build_fold_addr_expr (TMR_SYMBOL (base2)); else return true; } diff --git a/gcc/tree-ssa-operands.c b/gcc/tree-ssa-operands.c index 5b17ce2..90c2460 100644 --- a/gcc/tree-ssa-operands.c +++ b/gcc/tree-ssa-operands.c @@ -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)); if (TMR_SYMBOL (expr)) - mark_address_taken (TMR_SYMBOL (expr)); + mark_address_taken (TREE_OPERAND (TMR_SYMBOL (expr), 0)); add_virtual_operand (stmt, flags); } diff --git a/gcc/tree.def b/gcc/tree.def index c71a875..bd8434a 100644 --- a/gcc/tree.def +++ b/gcc/tree.def @@ -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. */ DEFTREECODE (REALIGN_LOAD_EXPR, "realign_load", tcc_expression, 3) -/* Low-level memory addressing. Operands are SYMBOL (static or global - variable), BASE (register), INDEX (register), STEP (integer constant), +/* Low-level memory addressing. Operands are SYMBOL (address of static or + global variable), BASE (register), INDEX (register), STEP (integer constant), OFFSET (integer constant). Corresponding address is SYMBOL + BASE + STEP * INDEX + OFFSET. Only variations and values valid on the target are allowed. |