aboutsummaryrefslogtreecommitdiff
path: root/gcc/emit-rtl.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>2001-12-05 11:33:28 +0000
committerRichard Kenner <kenner@gcc.gnu.org>2001-12-05 06:33:28 -0500
commitc56e3582c20263c442e00da7ea484edf9c912165 (patch)
treed4fa9aba7ca51b7c5c0ede030d6b72fd3dbd3d73 /gcc/emit-rtl.c
parentef31d0c25e53f56381e5de2a9788196c4fad1609 (diff)
downloadgcc-c56e3582c20263c442e00da7ea484edf9c912165.zip
gcc-c56e3582c20263c442e00da7ea484edf9c912165.tar.gz
gcc-c56e3582c20263c442e00da7ea484edf9c912165.tar.bz2
emit-rtl.c (component_ref_for_mem_expr): Try harder to find decl underneath COMPONENT_REFs.
* emit-rtl.c (component_ref_for_mem_expr): Try harder to find decl underneath COMPONENT_REFs. (set_mem_attributes): Also strip VIEW_CONVERT_EXPR. From-SVN: r47662
Diffstat (limited to 'gcc/emit-rtl.c')
-rw-r--r--gcc/emit-rtl.c32
1 files changed, 26 insertions, 6 deletions
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 6a30769..4238b8c 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -1649,13 +1649,31 @@ component_ref_for_mem_expr (ref)
if (TREE_CODE (inner) == COMPONENT_REF)
inner = component_ref_for_mem_expr (inner);
- else if (! DECL_P (inner))
- inner = NULL_TREE;
+ 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));
+ return build (COMPONENT_REF, TREE_TYPE (ref), inner,
+ TREE_OPERAND (ref, 1));
}
/* Given REF, a MEM, and T, either the type of X or the expression
@@ -1723,10 +1741,12 @@ set_mem_attributes (ref, t, objectp)
if (TREE_THIS_VOLATILE (t))
MEM_VOLATILE_P (ref) = 1;
- /* Now remove any NOPs: they don't change what the underlying object is.
- Likewise for SAVE_EXPR. */
+ /* 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) == SAVE_EXPR)
+ || TREE_CODE (t) == NON_LVALUE_EXPR
+ || TREE_CODE (t) == VIEW_CONVERT_EXPR
+ || TREE_CODE (t) == SAVE_EXPR)
t = TREE_OPERAND (t, 0);
/* If this expression can't be addressed (e.g., it contains a reference