diff options
author | Richard Henderson <rth@redhat.com> | 2005-08-31 18:41:30 -0700 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2005-08-31 18:41:30 -0700 |
commit | 8476af981ecf1cebb425bc3d710fb5c75107d306 (patch) | |
tree | 37656adfd60567afda3655c971808032e83fd90b /gcc/emit-rtl.c | |
parent | 04885a24b01c4c7e1ad522b0b1b9e74b6e28518a (diff) | |
download | gcc-8476af981ecf1cebb425bc3d710fb5c75107d306.zip gcc-8476af981ecf1cebb425bc3d710fb5c75107d306.tar.gz gcc-8476af981ecf1cebb425bc3d710fb5c75107d306.tar.bz2 |
emit-rtl.c (set_mem_attributes_minus_bitpos): Look through component-like references for setting MEM_NOTRAP_P.
* emit-rtl.c (set_mem_attributes_minus_bitpos): Look through
component-like references for setting MEM_NOTRAP_P.
* config/i386/i386.c (ix86_setup_incoming_varargs): Set MEM_NOTRAP_P.
* config/alpha/alpha.c (alpha_setup_incoming_varargs): Likewise.
From-SVN: r103714
Diffstat (limited to 'gcc/emit-rtl.c')
-rw-r--r-- | gcc/emit-rtl.c | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index 18c71b1..d9e253e 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -1469,7 +1469,6 @@ set_mem_attributes_minus_bitpos (rtx ref, tree t, int objectp, MEM_VOLATILE_P (ref) |= TYPE_VOLATILE (type); MEM_IN_STRUCT_P (ref) = AGGREGATE_TYPE_P (type); MEM_POINTER (ref) = POINTER_TYPE_P (type); - MEM_NOTRAP_P (ref) = TREE_THIS_NOTRAP (t); /* If we are making an object of this type, or if this is a DECL, we know that it is a scalar if the type is not an aggregate. */ @@ -1500,16 +1499,7 @@ set_mem_attributes_minus_bitpos (rtx ref, tree t, int objectp, the expression. */ if (! TYPE_P (t)) { - tree base = get_base_address (t); - if (base && DECL_P (base) - && TREE_READONLY (base) - && (TREE_STATIC (base) || DECL_EXTERNAL (base))) - { - tree base_type = TREE_TYPE (base); - gcc_assert (!(base_type && TYPE_NEEDS_CONSTRUCTING (base_type)) - || DECL_ARTIFICIAL (base)); - MEM_READONLY_P (ref) = 1; - } + tree base; if (TREE_THIS_VOLATILE (t)) MEM_VOLATILE_P (ref) = 1; @@ -1522,6 +1512,36 @@ set_mem_attributes_minus_bitpos (rtx ref, tree t, int objectp, || TREE_CODE (t) == SAVE_EXPR) t = TREE_OPERAND (t, 0); + /* We may look through structure-like accesses for the purposes of + examining TREE_THIS_NOTRAP, but not array-like accesses. */ + base = t; + while (TREE_CODE (base) == COMPONENT_REF + || TREE_CODE (base) == REALPART_EXPR + || TREE_CODE (base) == IMAGPART_EXPR + || TREE_CODE (base) == BIT_FIELD_REF) + base = TREE_OPERAND (base, 0); + + if (DECL_P (base)) + { + if (CODE_CONTAINS_STRUCT (TREE_CODE (base), TS_DECL_WITH_VIS)) + MEM_NOTRAP_P (ref) = !DECL_WEAK (base); + else + MEM_NOTRAP_P (ref) = 1; + } + else + MEM_NOTRAP_P (ref) = TREE_THIS_NOTRAP (base); + + base = get_base_address (base); + if (base && DECL_P (base) + && TREE_READONLY (base) + && (TREE_STATIC (base) || DECL_EXTERNAL (base))) + { + tree base_type = TREE_TYPE (base); + gcc_assert (!(base_type && TYPE_NEEDS_CONSTRUCTING (base_type)) + || DECL_ARTIFICIAL (base)); + MEM_READONLY_P (ref) = 1; + } + /* If this expression uses it's parent's alias set, mark it such that we won't change it. */ if (component_uses_parent_alias_set (t)) |