summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-14 13:39:18 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-14 13:39:18 +0000
commita67e70de1c49f027c4b41970e31d5dfad9d03007 (patch)
tree73e843d67156115387cd0f5f57159c563c46f468 /gcc
parent805b30f1e3d8d6998dfacf60b44d6c97c41df9a8 (diff)
downloadgcc-a67e70de1c49f027c4b41970e31d5dfad9d03007.tar.gz
* sched-deps.c (sched_insn_is_legitimate_for_speculation): Invoke
may_trap_or_fault_p instead of may_trap_p predicate. * tree.c (substitute_in_expr): Propagate the TREE_THIS_NOTRAP flag. (substitute_placeholder_in_expr): Likewise. * tree-inline.c (remap_gimple_op_r): Propagate the TREE_THIS_NOTRAP flag on MEM_REF nodes. (copy_tree_body_r): Propagate the TREE_READONLY and TREE_THIS_NOTRAP flags on INDIRECT_REF nodes. ada/ * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Type>: Set TREE_THIS_NOTRAP on the INDIRECT_REF node built for the template. * gcc-interface/trans.c (Identifier_to_gnu): Set TREE_THIS_NOTRAP on the INDIRECT_REF node built for objects used by reference. * gcc-interface/utils2.c (build_binary_op): Add short-circuit for constant result. Set TREE_THIS_NOTRAP on ARRAY_REF and ARRAY_RANGE_REF. (gnat_stabilize_reference_1): Propagate the TREE_THIS_NOTRAP flag. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165468 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/ada/ChangeLog10
-rw-r--r--gcc/ada/gcc-interface/decl.c1
-rw-r--r--gcc/ada/gcc-interface/trans.c24
-rw-r--r--gcc/ada/gcc-interface/utils2.c22
-rw-r--r--gcc/sched-deps.c4
-rw-r--r--gcc/tree-inline.c3
-rw-r--r--gcc/tree.c8
8 files changed, 68 insertions, 15 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 97f9a0d5fbe..5281089eff2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,14 @@
+2010-10-14 Eric Botcazou <ebotcazou@adacore.com>
+
+ * sched-deps.c (sched_insn_is_legitimate_for_speculation): Invoke
+ may_trap_or_fault_p instead of may_trap_p predicate.
+ * tree.c (substitute_in_expr): Propagate the TREE_THIS_NOTRAP flag.
+ (substitute_placeholder_in_expr): Likewise.
+ * tree-inline.c (remap_gimple_op_r): Propagate the TREE_THIS_NOTRAP
+ flag on MEM_REF nodes.
+ (copy_tree_body_r): Propagate the TREE_READONLY and TREE_THIS_NOTRAP
+ flags on INDIRECT_REF nodes.
+
2010-10-14 Nathan Froyd <froydnj@codesourcery.com>
* config.gcc (arm*-*-linux-*eabi) <tm_file>: Add bpabi.h from
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 4218907b2b8..a05dfa3fc7a 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,13 @@
+2010-10-14 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Type>: Set
+ TREE_THIS_NOTRAP on the INDIRECT_REF node built for the template.
+ * gcc-interface/trans.c (Identifier_to_gnu): Set TREE_THIS_NOTRAP on
+ the INDIRECT_REF node built for objects used by reference.
+ * gcc-interface/utils2.c (build_binary_op): Add short-circuit for
+ constant result. Set TREE_THIS_NOTRAP on ARRAY_REF and ARRAY_RANGE_REF.
+ (gnat_stabilize_reference_1): Propagate the TREE_THIS_NOTRAP flag.
+
2010-10-13 Richard Henderson <rth@redhat.com>
* gcc-interface/misc.c (gnat_eh_personality): Update call to
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index 1719d1cae5a..3dbb3b59063 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -1942,6 +1942,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
gnu_template_reference
= build_unary_op (INDIRECT_REF, gnu_template_type, tem);
TREE_READONLY (gnu_template_reference) = 1;
+ TREE_THIS_NOTRAP (gnu_template_reference) = 1;
/* Now create the GCC type for each index and add the fields for that
index to the template. */
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index 9d021b8a782..c2068c0e478 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -978,14 +978,22 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p)
if (TREE_CODE (gnu_result) == PARM_DECL
&& DECL_BY_DOUBLE_REF_P (gnu_result))
- gnu_result = build_unary_op (INDIRECT_REF, NULL_TREE, gnu_result);
+ {
+ gnu_result = build_unary_op (INDIRECT_REF, NULL_TREE, gnu_result);
+ if (TREE_CODE (gnu_result) == INDIRECT_REF)
+ TREE_THIS_NOTRAP (gnu_result) = 1;
+ }
if (TREE_CODE (gnu_result) == PARM_DECL
&& DECL_BY_COMPONENT_PTR_P (gnu_result))
- gnu_result
- = build_unary_op (INDIRECT_REF, NULL_TREE,
- convert (build_pointer_type (gnu_result_type),
- gnu_result));
+ {
+ gnu_result
+ = build_unary_op (INDIRECT_REF, NULL_TREE,
+ convert (build_pointer_type (gnu_result_type),
+ gnu_result));
+ if (TREE_CODE (gnu_result) == INDIRECT_REF)
+ TREE_THIS_NOTRAP (gnu_result) = 1;
+ }
/* If it's a renaming pointer and we are at the right binding level,
we can reference the renamed object directly, since the renamed
@@ -1003,7 +1011,11 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p)
DECL_INITIAL (gnu_result));
else
- gnu_result = build_unary_op (INDIRECT_REF, NULL_TREE, gnu_result);
+ {
+ gnu_result = build_unary_op (INDIRECT_REF, NULL_TREE, gnu_result);
+ if (TREE_CODE (gnu_result) == INDIRECT_REF)
+ TREE_THIS_NOTRAP (gnu_result) = 1;
+ }
if (read_only)
TREE_READONLY (gnu_result) = 1;
diff --git a/gcc/ada/gcc-interface/utils2.c b/gcc/ada/gcc-interface/utils2.c
index 8d5bbeff7a6..0748b327e9e 100644
--- a/gcc/ada/gcc-interface/utils2.c
+++ b/gcc/ada/gcc-interface/utils2.c
@@ -960,14 +960,19 @@ build_binary_op (enum tree_code op_code, tree result_type,
result
= fold_build2 (op_code, operation_type, left_operand, right_operand);
- TREE_SIDE_EFFECTS (result) |= has_side_effects;
- TREE_CONSTANT (result)
- |= (TREE_CONSTANT (left_operand) & TREE_CONSTANT (right_operand)
- && op_code != ARRAY_REF && op_code != ARRAY_RANGE_REF);
+ if (TREE_CONSTANT (result))
+ ;
+ else if (op_code == ARRAY_REF || op_code == ARRAY_RANGE_REF)
+ {
+ TREE_THIS_NOTRAP (result) = 1;
+ if (TYPE_VOLATILE (operation_type))
+ TREE_THIS_VOLATILE (result) = 1;
+ }
+ else
+ TREE_CONSTANT (result)
+ |= (TREE_CONSTANT (left_operand) && TREE_CONSTANT (right_operand));
- if ((op_code == ARRAY_REF || op_code == ARRAY_RANGE_REF)
- && TYPE_VOLATILE (operation_type))
- TREE_THIS_VOLATILE (result) = 1;
+ TREE_SIDE_EFFECTS (result) |= has_side_effects;
/* If we are working with modular types, perform the MOD operation
if something above hasn't eliminated the need for it. */
@@ -2347,6 +2352,9 @@ gnat_stabilize_reference_1 (tree e, bool force)
TREE_SIDE_EFFECTS (result) |= TREE_SIDE_EFFECTS (e);
TREE_THIS_VOLATILE (result) = TREE_THIS_VOLATILE (e);
+ if (code == INDIRECT_REF || code == ARRAY_REF || code == ARRAY_RANGE_REF)
+ TREE_THIS_NOTRAP (result) = TREE_THIS_NOTRAP (e);
+
return result;
}
diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c
index dddf836063b..d2e3bb89f38 100644
--- a/gcc/sched-deps.c
+++ b/gcc/sched-deps.c
@@ -598,8 +598,8 @@ sched_insn_is_legitimate_for_speculation_p (const_rtx insn, ds_t ds)
/* The following instructions, which depend on a speculatively scheduled
instruction, cannot be speculatively scheduled along. */
{
- if (may_trap_p (PATTERN (insn)))
- /* If instruction might trap, it cannot be speculatively scheduled.
+ if (may_trap_or_fault_p (PATTERN (insn)))
+ /* If instruction might fault, it cannot be speculatively scheduled.
For control speculation it's obvious why and for data speculation
it's because the insn might get wrong input if speculation
wasn't successful. */
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index b0627be0d3d..5aa7bb064b5 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -858,6 +858,7 @@ remap_gimple_op_r (tree *tp, int *walk_subtrees, void *data)
*tp = fold_build2 (MEM_REF, TREE_TYPE (*tp),
ptr, TREE_OPERAND (*tp, 1));
TREE_THIS_VOLATILE (*tp) = TREE_THIS_VOLATILE (old);
+ TREE_THIS_NOTRAP (*tp) = TREE_THIS_NOTRAP (old);
}
TREE_NO_WARNING (*tp) = TREE_NO_WARNING (old);
*walk_subtrees = 0;
@@ -1087,6 +1088,8 @@ copy_tree_body_r (tree *tp, int *walk_subtrees, void *data)
*tp = build1 (INDIRECT_REF, type, new_tree);
TREE_THIS_VOLATILE (*tp) = TREE_THIS_VOLATILE (old);
TREE_SIDE_EFFECTS (*tp) = TREE_SIDE_EFFECTS (old);
+ TREE_READONLY (*tp) = TREE_READONLY (old);
+ TREE_THIS_NOTRAP (*tp) = TREE_THIS_NOTRAP (old);
}
}
*walk_subtrees = 0;
diff --git a/gcc/tree.c b/gcc/tree.c
index 4d505b7f1ad..2f3b21e8e8b 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -3190,6 +3190,10 @@ substitute_in_expr (tree exp, tree f, tree r)
}
TREE_READONLY (new_tree) |= TREE_READONLY (exp);
+
+ if (code == INDIRECT_REF || code == ARRAY_REF || code == ARRAY_RANGE_REF)
+ TREE_THIS_NOTRAP (new_tree) |= TREE_THIS_NOTRAP (exp);
+
return new_tree;
}
@@ -3357,6 +3361,10 @@ substitute_placeholder_in_expr (tree exp, tree obj)
}
TREE_READONLY (new_tree) |= TREE_READONLY (exp);
+
+ if (code == INDIRECT_REF || code == ARRAY_REF || code == ARRAY_RANGE_REF)
+ TREE_THIS_NOTRAP (new_tree) |= TREE_THIS_NOTRAP (exp);
+
return new_tree;
}