emit-rtl.c (set_mem_attributes): Preserve indirection of PARM_DECL when flag_argument...
authorRichard Henderson <rth@redhat.com>
Mon, 22 Jul 2002 00:23:47 +0000 (17:23 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Mon, 22 Jul 2002 00:23:47 +0000 (17:23 -0700)
        * emit-rtl.c (set_mem_attributes): Preserve indirection of PARM_DECL
        when flag_argument_noalias == 2.
        * alias.c (nonoverlapping_memrefs_p): Handle that.
        * print-rtl.c (print_mem_expr): Likewise.

From-SVN: r55633

gcc/ChangeLog
gcc/alias.c
gcc/emit-rtl.c
gcc/print-rtl.c

index c9d4cbb..a852ef7 100644 (file)
@@ -1,3 +1,10 @@
+2002-07-21  Richard Henderson  <rth@redhat.com>
+
+       * emit-rtl.c (set_mem_attributes): Preserve indirection of PARM_DECL
+       when flag_argument_noalias == 2.
+       * alias.c (nonoverlapping_memrefs_p): Handle that.
+       * print-rtl.c (print_mem_expr): Likewise.
+
 2002-07-21  Hartmut Schirmer  <hartmut.schirmer@arcor.de>
 
        * libgcc2.c (__divdi3, __moddi3): Use unary minus operator
index 2e6a2b0..68a8272 100644 (file)
@@ -1957,6 +1957,14 @@ nonoverlapping_memrefs_p (x, y)
       moffsetx = adjust_offset_for_component_ref (exprx, moffsetx);
       exprx = t;
     }
+  else if (TREE_CODE (exprx) == INDIRECT_REF)
+    {
+      exprx = TREE_OPERAND (exprx, 0);
+      if (flag_argument_noalias < 2
+         || TREE_CODE (exprx) != PARM_DECL)
+       return 0;
+    }
+
   moffsety = MEM_OFFSET (y);
   if (TREE_CODE (expry) == COMPONENT_REF)
     {
@@ -1966,6 +1974,13 @@ nonoverlapping_memrefs_p (x, y)
       moffsety = adjust_offset_for_component_ref (expry, moffsety);
       expry = t;
     }
+  else if (TREE_CODE (expry) == INDIRECT_REF)
+    {
+      expry = TREE_OPERAND (expry, 0);
+      if (flag_argument_noalias < 2
+         || TREE_CODE (expry) != PARM_DECL)
+       return 0;
+    }
 
   if (! DECL_P (exprx) || ! DECL_P (expry))
     return 0;
index af537d2..ab73f00 100644 (file)
@@ -1805,7 +1805,17 @@ set_mem_attributes (ref, t, objectp)
            }
          while (TREE_CODE (t) == ARRAY_REF);
 
-         if (TREE_CODE (t) == COMPONENT_REF)
+         if (DECL_P (t))
+           {
+             expr = t;
+             if (host_integerp (off_tree, 1))
+               offset = GEN_INT (tree_low_cst (off_tree, 1));
+             size = (DECL_SIZE_UNIT (t)
+                     && host_integerp (DECL_SIZE_UNIT (t), 1)
+                     ? GEN_INT (tree_low_cst (DECL_SIZE_UNIT (t), 1)) : 0);
+             align = DECL_ALIGN (t);
+           }
+         else if (TREE_CODE (t) == COMPONENT_REF)
            {
              expr = component_ref_for_mem_expr (t);
              if (host_integerp (off_tree, 1))
@@ -1813,6 +1823,23 @@ set_mem_attributes (ref, t, objectp)
              /* ??? Any reason the field size would be different than
                 the size we got from the type?  */
            }
+         else if (flag_argument_noalias > 1
+                  && TREE_CODE (t) == INDIRECT_REF
+                  && TREE_CODE (TREE_OPERAND (t, 0)) == PARM_DECL)
+           {
+             expr = t;
+             offset = NULL;
+           }
+       }
+
+      /* If this is a Fortran indirect argument reference, record the
+        parameter decl.  */
+      else if (flag_argument_noalias > 1
+              && TREE_CODE (t) == INDIRECT_REF
+              && TREE_CODE (TREE_OPERAND (t, 0)) == PARM_DECL)
+       {
+         expr = t;
+         offset = NULL;
        }
     }
 
index 1553805..25704eb 100644 (file)
@@ -92,6 +92,12 @@ print_mem_expr (outfile, expr)
        fprintf (outfile, ".%s",
                 IDENTIFIER_POINTER (DECL_NAME (TREE_OPERAND (expr, 1))));
     }
+  else if (TREE_CODE (expr) == INDIRECT_REF)
+    {
+      fputs (" (*", outfile);
+      print_mem_expr (outfile, TREE_OPERAND (expr, 0));
+      fputs (")", outfile);
+    }
   else if (DECL_NAME (expr))
     fprintf (outfile, " %s", IDENTIFIER_POINTER (DECL_NAME (expr)));
   else if (TREE_CODE (expr) == RESULT_DECL)