aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-inline.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>2004-07-28 02:27:20 +0000
committerRichard Kenner <kenner@gcc.gnu.org>2004-07-27 22:27:20 -0400
commit1a837f7746a6627e3651119531de18fcd95d6dfd (patch)
tree568e306fd21e996f7b463cb5bdd43364edf136f6 /gcc/tree-inline.c
parente847cc68ebc1e2a961941e75ae613fec9f90463b (diff)
downloadgcc-1a837f7746a6627e3651119531de18fcd95d6dfd.zip
gcc-1a837f7746a6627e3651119531de18fcd95d6dfd.tar.gz
gcc-1a837f7746a6627e3651119531de18fcd95d6dfd.tar.bz2
re PR tree-optimization/15077 (ICE in make_decl_rtl when inlining tail recursive nested function)
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. From-SVN: r85247
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r--gcc/tree-inline.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 6412ce0..139661e 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. */