aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2004-03-16 19:05:56 +0000
committerDale Johannesen <dalej@apple.com>2004-03-16 19:05:56 +0000
commit50f6616bc05060f19cd65dc3d9c5bb3bebfac310 (patch)
tree46463d1657f85aac7167ff0cfd4eeaa58b4b9788
parentd0c7945f37c5c1ac2418602b93461603e89fc8fd (diff)
2004-03-16 Dale Johannesen <dale@apple.com>
PR optimization/14498 * gimplify.c (copy_if_shared_r): Mark VA_ARGS_EXPRs as volatile. (mark_decls_volatile_r): Moved higher in file (unchanged). git-svn-id: https://gcc.gnu.org/svn/gcc/branches/tree-ssa-20020619-branch@79541 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog.tree-ssa6
-rw-r--r--gcc/gimplify.c39
2 files changed, 30 insertions, 15 deletions
diff --git a/gcc/ChangeLog.tree-ssa b/gcc/ChangeLog.tree-ssa
index 2118f6ec01d..72c3511f6bb 100644
--- a/gcc/ChangeLog.tree-ssa
+++ b/gcc/ChangeLog.tree-ssa
@@ -1,3 +1,9 @@
+2004-03-16 Dale Johannesen <dale@apple.com>
+
+ PR optimization/14498
+ * gimplify.c (copy_if_shared_r): Mark VA_ARGS_EXPRs as volatile.
+ (mark_decls_volatile_r): Moved higher in file (unchanged).
+
2004-03-16 Daniel Berlin <dberlin@dberlin.org>
PR optimization/14562
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 2f0d4a5cc6d..f432c8856e4 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -601,6 +601,20 @@ mostly_copy_tree_r (tree *tp, int *walk_subtrees, void *data)
return NULL_TREE;
}
+/* Mark all the _DECL nodes under *TP as volatile. FIXME: This must die
+ after VA_ARG_EXPRs are properly lowered. */
+
+static tree
+mark_decls_volatile_r (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
+ void *data ATTRIBUTE_UNUSED)
+{
+ if (SSA_VAR_P (*tp))
+ TREE_THIS_VOLATILE (*tp) = 1;
+
+ return NULL_TREE;
+}
+
+
/* Callback for walk_tree to unshare most of the shared trees rooted at
*TP. If *TP has been visited already (i.e., TREE_VISITED (*TP) == 1),
then *TP is deep copied by calling copy_tree_r.
@@ -622,9 +636,18 @@ copy_if_shared_r (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
*walk_subtrees = 0;
}
else
+ {
/* Otherwise, mark the tree as visited and keep looking. */
TREE_VISITED (*tp) = 1;
-
+ if (TREE_CODE (*tp) == VA_ARG_EXPR)
+ {
+ /* Mark any _DECL inside the operand as volatile to avoid the
+ optimizers messing around with it. FIXME: Remove this once
+ VA_ARG_EXPRs are properly lowered. */
+ walk_tree (&TREE_OPERAND (*tp, 0), mark_decls_volatile_r,
+ NULL, NULL);
+ }
+ }
return NULL_TREE;
}
@@ -2929,20 +2952,6 @@ gimplify_to_stmt_list (tree *stmt_p)
}
-/* Mark all the _DECL nodes under *TP as volatile. FIXME: This must die
- after VA_ARG_EXPRs are properly lowered. */
-
-static tree
-mark_decls_volatile_r (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
- void *data ATTRIBUTE_UNUSED)
-{
- if (SSA_VAR_P (*tp))
- TREE_THIS_VOLATILE (*tp) = 1;
-
- return NULL_TREE;
-}
-
-
/* Gimplifies the expression tree pointed by EXPR_P. Return 0 if
gimplification failed.