This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Minor enhancements to decl/expr tracking for MEM
- From: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 5 Dec 01 06:29:31 EST
- Subject: Minor enhancements to decl/expr tracking for MEM
As RTH and I discussed, I'll probably be making a more major improvement,
but I did this in the meantime. It probably mostly affects Ada.
Tested on alphaev56-dec-osfv4.0c.
Wed Dec 5 06:26:27 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* emit-rtl.c (component_ref_for_mem_expr): Try harder to find decl
underneath COMPONENT_REFs.
(set_mem_attributes): Also strip VIEW_CONVERT_EXPR.
*** emit-rtl.c 2001/12/03 23:01:44 1.234
--- emit-rtl.c 2001/12/05 11:27:38
*************** component_ref_for_mem_expr (ref)
*** 1650,1660 ****
if (TREE_CODE (inner) == COMPONENT_REF)
inner = component_ref_for_mem_expr (inner);
! else if (! DECL_P (inner))
! inner = NULL_TREE;
if (inner == TREE_OPERAND (ref, 0))
return ref;
else
! return build (COMPONENT_REF, TREE_TYPE (ref), inner, TREE_OPERAND (ref, 1));
}
--- 1650,1678 ----
if (TREE_CODE (inner) == COMPONENT_REF)
inner = component_ref_for_mem_expr (inner);
! else
! {
! tree placeholder_ptr = 0;
!
! /* Now remove any conversions: they don't change what the underlying
! object is. Likewise for SAVE_EXPR. Also handle PLACEHOLDER_EXPR. */
! while (TREE_CODE (inner) == NOP_EXPR || TREE_CODE (inner) == CONVERT_EXPR
! || TREE_CODE (inner) == NON_LVALUE_EXPR
! || TREE_CODE (inner) == VIEW_CONVERT_EXPR
! || TREE_CODE (inner) == SAVE_EXPR
! || TREE_CODE (inner) == PLACEHOLDER_EXPR)
! if (TREE_CODE (inner) == PLACEHOLDER_EXPR)
! inner = find_placeholder (inner, &placeholder_ptr);
! else
! inner = TREE_OPERAND (inner, 0);
!
! if (! DECL_P (inner))
! inner = NULL_TREE;
! }
if (inner == TREE_OPERAND (ref, 0))
return ref;
else
! return build (COMPONENT_REF, TREE_TYPE (ref), inner,
! TREE_OPERAND (ref, 1));
}
*************** set_mem_attributes (ref, t, objectp)
*** 1724,1731 ****
MEM_VOLATILE_P (ref) = 1;
! /* Now remove any NOPs: they don't change what the underlying object is.
! Likewise for SAVE_EXPR. */
while (TREE_CODE (t) == NOP_EXPR || TREE_CODE (t) == CONVERT_EXPR
! || TREE_CODE (t) == NON_LVALUE_EXPR || TREE_CODE (t) == SAVE_EXPR)
t = TREE_OPERAND (t, 0);
--- 1742,1751 ----
MEM_VOLATILE_P (ref) = 1;
! /* Now remove any conversions: they don't change what the underlying
! object is. Likewise for SAVE_EXPR. */
while (TREE_CODE (t) == NOP_EXPR || TREE_CODE (t) == CONVERT_EXPR
! || TREE_CODE (t) == NON_LVALUE_EXPR
! || TREE_CODE (t) == VIEW_CONVERT_EXPR
! || TREE_CODE (t) == SAVE_EXPR)
t = TREE_OPERAND (t, 0);