OSDN Git Service

2010-09-01 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 1 Sep 2010 13:28:46 +0000 (13:28 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 1 Sep 2010 13:28:46 +0000 (13:28 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@163733 138bc75d-0d04-0410-961f-82ee72b054a4

14 files changed:
gcc/ChangeLog
gcc/alias.c
gcc/builtins.c
gcc/cfgexpand.c
gcc/gimple.c
gcc/gimplify.c
gcc/tree-cfg.c
gcc/tree-dfa.c
gcc/tree-eh.c
gcc/tree-pretty-print.c
gcc/tree-ssa-address.c
gcc/tree-ssa-alias.c
gcc/tree-ssa-operands.c
gcc/tree.def

index 970394e..6a621ec 100644 (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>
 
        * config/i386/i386.h (enum ix86_tune_indices) <X86_TUNE_SINGLE_POP>:
index 98706a0..580f898 100644 (file)
@@ -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);
     }
index 4b540d8..2cebb0e 100644 (file)
@@ -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;
index bf1149f..1852885 100644 (file)
@@ -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
index 7433b14..c0b5052 100644 (file)
@@ -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
index b0468c6..bdb97ec 100644 (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;
 
            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))
index dfe6d8f..1dc99aa 100644 (file)
@@ -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))))
index 10fd41e..c60e107 100644 (file)
@@ -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;
 
index 9fab7ad..3d7859b 100644 (file)
@@ -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);
 
index 2182fef..dbbd06c 100644 (file)
@@ -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)
index ffc5541..d642425 100644 (file)
@@ -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)
index a8d580e..fe017d7 100644 (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 (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;
     }
index 5b17ce2..90c2460 100644 (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));
 
   if (TMR_SYMBOL (expr))
-    mark_address_taken (TMR_SYMBOL (expr));
+    mark_address_taken (TREE_OPERAND (TMR_SYMBOL (expr), 0));
 
   add_virtual_operand (stmt, flags);
 }
index c71a875..bd8434a 100644 (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.  */
 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.