diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c9d4cbb1d88..a852ef736ae 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2002-07-21 Richard Henderson + + * 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 * libgcc2.c (__divdi3, __moddi3): Use unary minus operator diff --git a/gcc/alias.c b/gcc/alias.c index 2e6a2b084e1..68a827224fa 100644 --- a/gcc/alias.c +++ b/gcc/alias.c @@ -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; diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index af537d257f0..ab73f00c6bb 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -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; } } diff --git a/gcc/print-rtl.c b/gcc/print-rtl.c index 15538052c18..25704eb39a0 100644 --- a/gcc/print-rtl.c +++ b/gcc/print-rtl.c @@ -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)