emit-rtl.c (set_mem_attributes): Preserve indirection of PARM_DECL when flag_argument_noalias == 2.

* 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
This commit is contained in:
Richard Henderson 2002-07-21 17:23:47 -07:00 committed by Richard Henderson
parent b68daef415
commit c67a1cf6a8
4 changed files with 56 additions and 1 deletions

View 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

View 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;

View 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;
}
}

View 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)