aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1994-12-02 18:11:17 -0500
committerRichard Kenner <kenner@gcc.gnu.org>1994-12-02 18:11:17 -0500
commit2132517db072e7c3d48c8594d6116e1a743ebf14 (patch)
tree84dc9ac84b1f465a982486be8bb0920bb29da005
parent83b93f40ff739b33969532e40836e45fda586665 (diff)
downloadgcc-2132517db072e7c3d48c8594d6116e1a743ebf14.zip
gcc-2132517db072e7c3d48c8594d6116e1a743ebf14.tar.gz
gcc-2132517db072e7c3d48c8594d6116e1a743ebf14.tar.bz2
(expand_inline_function): If called function calls alloca, save and
restore SP around its call. From-SVN: r8601
-rw-r--r--gcc/integrate.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/integrate.c b/gcc/integrate.c
index a419350..12f0389 100644
--- a/gcc/integrate.c
+++ b/gcc/integrate.c
@@ -1167,6 +1167,7 @@ expand_inline_function (fndecl, parms, target, ignore, type, structure_value_add
int nargs;
rtx local_return_label = 0;
rtx loc;
+ rtx stack_save = 0;
rtx temp;
struct inline_remap *map;
rtx cc0_insn = 0;
@@ -1648,6 +1649,13 @@ expand_inline_function (fndecl, parms, target, ignore, type, structure_value_add
global_const_equiv_map = map->const_equiv_map;
global_const_equiv_map_size = map->const_equiv_map_size;
+ /* If the called fucntion does an alloca, save and restore the
+ frame pointer around the call. This saves stack space, but
+ also is required if this inline is being done between two
+ pushes. */
+ if (FUNCTION_FLAGS (header) & FUNCTION_FLAGS_CALLS_ALLOCA)
+ emit_stack_save (SAVE_BLOCK, &stack_save, NULL_RTX);
+
/* Now copy the insns one by one. Do this in two passes, first the insns and
then their REG_NOTES, just like save_for_inline. */
@@ -1868,6 +1876,10 @@ expand_inline_function (fndecl, parms, target, ignore, type, structure_value_add
if (local_return_label)
emit_label (local_return_label);
+ /* Restore the stack pointer if we saved it above. */
+ if (FUNCTION_FLAGS (header) & FUNCTION_FLAGS_CALLS_ALLOCA)
+ emit_stack_restore (SAVE_BLOCK, stack_save, NULL_RTX);
+
/* Make copies of the decls of the symbols in the inline function, so that
the copies of the variables get declared in the current function. Set
up things so that lookup_static_chain knows that to interpret registers