From 50f6616bc05060f19cd65dc3d9c5bb3bebfac310 Mon Sep 17 00:00:00 2001 From: Dale Johannesen Date: Tue, 16 Mar 2004 19:05:56 +0000 Subject: 2004-03-16 Dale Johannesen 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 --- gcc/ChangeLog.tree-ssa | 6 ++++++ gcc/gimplify.c | 39 ++++++++++++++++++++++++--------------- 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 + + 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 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. -- cgit v1.2.3