summaryrefslogtreecommitdiffstats
path: root/gcc
diff options
context:
space:
mode:
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>2004-07-28 02:27:20 +0000
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>2004-07-28 02:27:20 +0000
commitff6fba0d15eea6dfb7ffd13b42f293a7430b7661 (patch)
tree568e306fd21e996f7b463cb5bdd43364edf136f6 /gcc
parentc2514472e15476dac16d57406e535ccc2ed0fa08 (diff)
downloadppe42-gcc-ff6fba0d15eea6dfb7ffd13b42f293a7430b7661.tar.gz
ppe42-gcc-ff6fba0d15eea6dfb7ffd13b42f293a7430b7661.zip
PR optimization/15077
* function.h (struct function): Add field saved_static_chain_decl. Fix comment for static_chain_decl. * tree-inline.c (save_body): Add new arg and handle static_chain_decl. * tree-inline.h (save_body): Add new arg. * tree-optimize.c (tree_rest_of_compilation): Handle saving static_chain_decl. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@85247 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/function.h3
-rw-r--r--gcc/tree-inline.c19
-rw-r--r--gcc/tree-inline.h8
-rw-r--r--gcc/tree-optimize.c5
5 files changed, 36 insertions, 9 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f19695ff364..b1d01918c1e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2004-07-27 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ PR optimization/15077
+ * function.h (struct function): Add field saved_static_chain_decl.
+ Fix comment for static_chain_decl.
+ * tree-inline.c (save_body): Add new arg and handle static_chain_decl.
+ * tree-inline.h (save_body): Add new arg.
+ * tree-optimize.c (tree_rest_of_compilation): Handle saving
+ static_chain_decl.
+
2004-07-27 Richard Henderson <rth@redhat.com>
* gimplify.c (is_gimple_addr_expr_arg_or_indirect): Remove.
diff --git a/gcc/function.h b/gcc/function.h
index 60baf84e12d..b3e750fd6b0 100644
--- a/gcc/function.h
+++ b/gcc/function.h
@@ -173,6 +173,7 @@ struct function GTY(())
inlining */
tree saved_tree;
tree saved_args;
+ tree saved_static_chain_decl;
/* For function.c. */
@@ -254,7 +255,7 @@ struct function GTY(())
If stack grows up, this is the address for the next slot. */
HOST_WIDE_INT x_frame_offset;
- /* A VAR_DECL that should contain the static chain for this function.
+ /* A PARM_DECL that should contain the static chain for this function.
It will be initialized at the beginning of the function. */
tree static_chain_decl;
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 6412ce0306d..139661e4b50 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1877,10 +1877,11 @@ clone_body (tree clone, tree fn, void *arg_map)
append_to_statement_list_force (copy_body (&id), &DECL_SAVED_TREE (clone));
}
-/* Save duplicate of body in FN. MAP is used to pass around splay tree
- used to update arguments in restore_body. */
+/* Make and return duplicate of body in FN. Put copies of DECL_ARGUMENTS
+ in *arg_copy and of the static chain, if any, in *sc_copy. */
+
tree
-save_body (tree fn, tree *arg_copy)
+save_body (tree fn, tree *arg_copy, tree *sc_copy)
{
inline_data id;
tree body, *parg;
@@ -1904,6 +1905,18 @@ save_body (tree fn, tree *arg_copy)
*parg = new;
}
+ *sc_copy = DECL_STRUCT_FUNCTION (fn)->static_chain_decl;
+ if (*sc_copy)
+ {
+ tree new = copy_node (*sc_copy);
+
+ lang_hooks.dup_lang_specific_decl (new);
+ DECL_ABSTRACT_ORIGIN (new) = DECL_ORIGIN (*sc_copy);
+ insert_decl_map (&id, *sc_copy, new);
+ TREE_CHAIN (new) = TREE_CHAIN (*sc_copy);
+ *sc_copy = new;
+ }
+
insert_decl_map (&id, DECL_RESULT (fn), DECL_RESULT (fn));
/* Actually copy the body. */
diff --git a/gcc/tree-inline.h b/gcc/tree-inline.h
index 4619e314bef..b62b42447e9 100644
--- a/gcc/tree-inline.h
+++ b/gcc/tree-inline.h
@@ -26,10 +26,10 @@ Boston, MA 02111-1307, USA. */
void optimize_inline_calls (tree);
bool tree_inlinable_function_p (tree);
-tree copy_tree_r (tree*, int*, void*);
-void clone_body (tree, tree, void*);
-tree save_body (tree, tree *);
-void remap_save_expr (tree*, void*, int*);
+tree copy_tree_r (tree *, int *, void *);
+void clone_body (tree, tree, void *);
+tree save_body (tree, tree *, tree *);
+void remap_save_expr (tree *, void *, int *);
int estimate_num_insns (tree expr);
/* 0 if we should not perform inlining.
diff --git a/gcc/tree-optimize.c b/gcc/tree-optimize.c
index 7cdb30bbcf4..d575990cce6 100644
--- a/gcc/tree-optimize.c
+++ b/gcc/tree-optimize.c
@@ -524,7 +524,9 @@ tree_rest_of_compilation (tree fndecl, bool nested_p)
if (!e->inline_failed)
cgraph_clone_inlined_nodes (e, true);
}
- cfun->saved_tree = save_body (fndecl, &cfun->saved_args);
+ cfun->saved_static_chain_decl = cfun->static_chain_decl;
+ cfun->saved_tree = save_body (fndecl, &cfun->saved_args,
+ &cfun->saved_static_chain_decl);
}
if (flag_inline_trees)
@@ -557,6 +559,7 @@ tree_rest_of_compilation (tree fndecl, bool nested_p)
{
DECL_SAVED_TREE (fndecl) = cfun->saved_tree;
DECL_ARGUMENTS (fndecl) = cfun->saved_args;
+ cfun->static_chain_decl = cfun->saved_static_chain_decl;
/* When not in unit-at-a-time mode, we must preserve out of line copy
representing node before inlining. Restore original outgoing edges
OpenPOWER on IntegriCloud