From 4b228e61a98d8bdd1286e536a1f74cdbce50d0ff Mon Sep 17 00:00:00 2001 From: Richard Guenther Date: Mon, 16 Aug 2010 09:55:54 +0000 Subject: tree-cfg.c (verify_types_in_gimple_reference): Verify TARGET_MEM_REF a bit. 2010-08-16 Richard Guenther * 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. From-SVN: r163278 --- gcc/tree-dfa.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'gcc/tree-dfa.c') diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c index 461e2cf..10fd41e 100644 --- a/gcc/tree-dfa.c +++ b/gcc/tree-dfa.c @@ -878,6 +878,37 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset, } goto done; + case TARGET_MEM_REF: + /* 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)) + { + exp = TMR_SYMBOL (exp); + bit_offset = 0; + maxsize = -1; + goto done; + } + if (integer_zerop (TMR_OFFSET (exp))) + exp = TMR_SYMBOL (exp); + else + { + double_int off = mem_ref_offset (exp); + off = double_int_lshift (off, + BITS_PER_UNIT == 8 + ? 3 : exact_log2 (BITS_PER_UNIT), + HOST_BITS_PER_DOUBLE_INT, true); + off = double_int_add (off, shwi_to_double_int (bit_offset)); + if (double_int_fits_in_shwi_p (off)) + { + bit_offset = double_int_to_shwi (off); + exp = TMR_SYMBOL (exp); + } + } + } + goto done; + default: goto done; } @@ -1010,6 +1041,22 @@ get_addr_base_and_unit_offset (tree exp, HOST_WIDE_INT *poffset) } goto done; + case TARGET_MEM_REF: + /* Hand back the decl for MEM[&decl, off]. */ + if (TMR_SYMBOL (exp)) + { + if (TMR_SYMBOL (exp)) + return NULL_TREE; + if (!integer_zerop (TMR_OFFSET (exp))) + { + double_int off = mem_ref_offset (exp); + gcc_assert (off.high == -1 || off.high == 0); + byte_offset += double_int_to_shwi (off); + } + exp = TMR_SYMBOL (exp); + } + goto done; + default: goto done; } -- cgit v1.1