OSDN Git Service

2004-06-26 Andrew Haley <aph@redhat.com>
authoraph <aph@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 26 Jun 2004 10:10:25 +0000 (10:10 +0000)
committeraph <aph@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 26 Jun 2004 10:10:25 +0000 (10:10 +0000)
* emit-rtl.c (set_mem_attributes_minus_bitpos): Check
TREE_THIS_NOTRAP when setting MEM_NOTRAP_P.
* tree-eh.c (tree_could_trap_p): Check TREE_THIS_NOTRAP.
* tree.h (TREE_THIS_NOTRAP): New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@83706 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/emit-rtl.c
gcc/tree-eh.c
gcc/tree.h

index cebde31..21586ce 100644 (file)
@@ -1,3 +1,10 @@
+2004-06-26  Andrew Haley  <aph@redhat.com>
+
+       * emit-rtl.c (set_mem_attributes_minus_bitpos): Check
+       TREE_THIS_NOTRAP when setting MEM_NOTRAP_P.
+       * tree-eh.c (tree_could_trap_p): Check TREE_THIS_NOTRAP.
+       * tree.h (TREE_THIS_NOTRAP): New.
+
 2004-06-26  Kaz Kojima  <kkojima@gcc.gnu.org>
 
        * genattrtab.c (write_test_expr): Put a unsigned cast before
 2004-06-26  Kaz Kojima  <kkojima@gcc.gnu.org>
 
        * genattrtab.c (write_test_expr): Put a unsigned cast before
index 984f81f..91ef8e9 100644 (file)
@@ -1543,6 +1543,7 @@ set_mem_attributes_minus_bitpos (rtx ref, tree t, int objectp,
         && (TYPE_READONLY (type) || (t != type && TREE_READONLY (t))))
        || (! TYPE_P (t) && TREE_CONSTANT (t)));
   MEM_POINTER (ref) = POINTER_TYPE_P (type);
         && (TYPE_READONLY (type) || (t != type && TREE_READONLY (t))))
        || (! TYPE_P (t) && TREE_CONSTANT (t)));
   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.  */
 
   /* 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.  */
index 21c3a1c..f15fe09 100644 (file)
@@ -1688,9 +1688,11 @@ tree_could_trap_p (tree expr)
     case IMAGPART_EXPR:
     case BIT_FIELD_REF:
       t = get_base_address (expr);
     case IMAGPART_EXPR:
     case BIT_FIELD_REF:
       t = get_base_address (expr);
-      return !t || TREE_CODE (t) == INDIRECT_REF;
+      return !t || tree_could_trap_p (t);
 
     case INDIRECT_REF:
 
     case INDIRECT_REF:
+      return (TREE_THIS_NOTRAP (expr) == false);
+
     case TRUNC_DIV_EXPR:
     case CEIL_DIV_EXPR:
     case FLOOR_DIV_EXPR:
     case TRUNC_DIV_EXPR:
     case CEIL_DIV_EXPR:
     case FLOOR_DIV_EXPR:
index 41f75d8..a369827 100644 (file)
@@ -304,6 +304,9 @@ struct tree_common GTY(())
        TYPE_ALIGN_OK in
           ..._TYPE
 
        TYPE_ALIGN_OK in
           ..._TYPE
 
+       TREE_THIS_NOTRAP in
+          INDIRECT_REF
+
    deprecated_flag:
 
        TREE_DEPRECATED in
    deprecated_flag:
 
        TREE_DEPRECATED in
@@ -760,6 +763,12 @@ extern void tree_operand_check_failed (int, enum tree_code,
    If this bit is set in an expression, so is TREE_SIDE_EFFECTS.  */
 #define TREE_THIS_VOLATILE(NODE) ((NODE)->common.volatile_flag)
 
    If this bit is set in an expression, so is TREE_SIDE_EFFECTS.  */
 #define TREE_THIS_VOLATILE(NODE) ((NODE)->common.volatile_flag)
 
+/* Nonzero means this node will not trap.  In an INDIRECT_REF, means
+   accessing the memory pointed to won't generate a trap.  However,
+   this only applies to an object when used appropriately: it doesn't
+   mean that writing a READONLY mem won't trap.  */
+#define TREE_THIS_NOTRAP(NODE) ((NODE)->common.nothrow_flag)
+
 /* In a VAR_DECL, PARM_DECL or FIELD_DECL, or any kind of ..._REF node,
    nonzero means it may not be the lhs of an assignment.  */
 #define TREE_READONLY(NODE) (NON_TYPE_CHECK (NODE)->common.readonly_flag)
 /* In a VAR_DECL, PARM_DECL or FIELD_DECL, or any kind of ..._REF node,
    nonzero means it may not be the lhs of an assignment.  */
 #define TREE_READONLY(NODE) (NON_TYPE_CHECK (NODE)->common.readonly_flag)