summaryrefslogtreecommitdiff
path: root/gcc/tree-inline.c
diff options
context:
space:
mode:
authorEric Christopher <echristo@gcc.gnu.org>2004-08-19 21:34:37 +0000
committerEric Christopher <echristo@gcc.gnu.org>2004-08-19 21:34:37 +0000
commit19114537c55ae227cf8b295be3e2c924965cdb18 (patch)
tree88aec2ccf229fd9ceeed5fc48cb4d5e3f6b7c217 /gcc/tree-inline.c
parentb85058289589ba4346f6881b5f0cba0410299fc0 (diff)
downloadgcc-19114537c55ae227cf8b295be3e2c924965cdb18.tar.gz
langhooks-def.h (LANG_HOOKS_UNSAVE_EXPR_NOW): Remove.
2004-08-19 Eric Christopher <echristo@redhat.com> * langhooks-def.h (LANG_HOOKS_UNSAVE_EXPR_NOW): Remove. * langhooks.h (unsave_expr_now): Ditto. * tree.h (unsave_expr_1): Remove prototype. (lhd_unsave_expr_now): Rename to unsave_expr_now. * tree-inline.c (unsave_expr_1): Move here from tree.c. Make static. (unsave_expr_now): Rename from lhd_unsave_expr_now. * tree-sra.c: Fix up for rename. * tree-ssa-copy.c: Ditto. * tree-eh.c: Ditto. * tree.c (unsave_expr_1): Move to tree-inline.c. 2004-08-19 Eric Christopher <echristo@redhat.com> * cp-tree.h (cxx_unsave_expr_now): Delete prototype. * tree.c (cxx_unsave_expr_now): Delete. (cp_unsave_r): Ditto. From-SVN: r86277
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r--gcc/tree-inline.c32
1 files changed, 29 insertions, 3 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index b34844d82f3..6f65f0900a8 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -135,6 +135,7 @@ static void remap_block (tree *, inline_data *);
static tree remap_decls (tree, inline_data *);
static void copy_bind_expr (tree *, int *, inline_data *);
static tree mark_local_for_remap_r (tree *, int *, void *);
+static void unsave_expr_1 (tree);
static tree unsave_r (tree *, int *, void *);
static void declare_inline_vars (tree bind_expr, tree vars);
@@ -2370,6 +2371,31 @@ mark_local_for_remap_r (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
return NULL_TREE;
}
+/* Perform any modifications to EXPR required when it is unsaved. Does
+ not recurse into EXPR's subtrees. */
+
+static void
+unsave_expr_1 (tree expr)
+{
+ switch (TREE_CODE (expr))
+ {
+ case TARGET_EXPR:
+ /* Don't mess with a TARGET_EXPR that hasn't been expanded.
+ It's OK for this to happen if it was part of a subtree that
+ isn't immediately expanded, such as operand 2 of another
+ TARGET_EXPR. */
+ if (TREE_OPERAND (expr, 1))
+ break;
+
+ TREE_OPERAND (expr, 1) = TREE_OPERAND (expr, 3);
+ TREE_OPERAND (expr, 3) = NULL_TREE;
+ break;
+
+ default:
+ break;
+ }
+}
+
/* Called via walk_tree when an expression is unsaved. Using the
splay_tree pointed to by ST (which is really a `splay_tree'),
remaps all local declarations to appropriate replacements. */
@@ -2411,11 +2437,11 @@ unsave_r (tree *tp, int *walk_subtrees, void *data)
return NULL_TREE;
}
-/* Default lang hook for "unsave_expr_now". Copies everything in EXPR and
- replaces variables, labels and SAVE_EXPRs local to EXPR. */
+/* Copies everything in EXPR and replaces variables, labels
+ and SAVE_EXPRs local to EXPR. */
tree
-lhd_unsave_expr_now (tree expr)
+unsave_expr_now (tree expr)
{
inline_data id;