summaryrefslogtreecommitdiffstats
path: root/gcc/function.c
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2001-08-27 17:36:20 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2001-08-27 17:36:20 +0000
commit05927e409381dcdbb63e22b18f2906f1241775c6 (patch)
tree6974cc8c80b55c205754b981c6f2050865b697e6 /gcc/function.c
parent38606abfc3739b1525c09d7f860dcb0081906b0a (diff)
downloadppe42-gcc-05927e409381dcdbb63e22b18f2906f1241775c6.tar.gz
ppe42-gcc-05927e409381dcdbb63e22b18f2906f1241775c6.zip
* function.c (expand_function_end): Don't init arg_pointer_save_area.
(get_arg_pointer_save_area): New. Create an init it here. (fix_lexical_addr): Use it. * function.h: Declare it. * builtins.c (expand_builtin_setjmp_receiver): Use it. * stmt.c (expand_nl_goto_receiver): Use it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@45200 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/function.c')
-rw-r--r--gcc/function.c55
1 files changed, 36 insertions, 19 deletions
diff --git a/gcc/function.c b/gcc/function.c
index fa440e36284..4c87e581472 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -5557,11 +5557,8 @@ fix_lexical_addr (addr, var)
#ifdef NEED_SEPARATE_AP
rtx addr;
- if (fp->x_arg_pointer_save_area == 0)
- fp->x_arg_pointer_save_area
- = assign_stack_local_1 (Pmode, GET_MODE_SIZE (Pmode), 0, fp);
-
- addr = fix_lexical_addr (XEXP (fp->x_arg_pointer_save_area, 0), var);
+ addr = get_arg_pointer_save_area (fp);
+ addr = fix_lexical_addr (XEXP (addr, 0), var);
addr = memory_address (Pmode, addr);
base = gen_rtx_MEM (Pmode, addr);
@@ -6703,20 +6700,6 @@ expand_function_end (filename, line, end_bindings)
}
#endif
- /* Save the argument pointer if a save area was made for it. */
- if (arg_pointer_save_area)
- {
- /* arg_pointer_save_area may not be a valid memory address, so we
- have to check it and fix it if necessary. */
- rtx seq;
- start_sequence ();
- emit_move_insn (validize_mem (arg_pointer_save_area),
- virtual_incoming_args_rtx);
- seq = gen_sequence ();
- end_sequence ();
- emit_insn_before (seq, tail_recursion_reentry);
- }
-
/* Initialize any trampolines required by this function. */
for (link = trampoline_list; link; link = TREE_CHAIN (link))
{
@@ -7013,6 +6996,40 @@ expand_function_end (filename, line, end_bindings)
then you will lose. */
expand_fixups (get_insns ());
}
+
+rtx
+get_arg_pointer_save_area (f)
+ struct function *f;
+{
+ rtx ret = f->x_arg_pointer_save_area;
+
+ if (! ret)
+ {
+ rtx seq;
+
+ ret = assign_stack_local_1 (Pmode, GET_MODE_SIZE (Pmode), 0, f);
+ f->x_arg_pointer_save_area = ret;
+
+ /* Save the arg pointer at the beginning of the function. The
+ generated stack slot may not be a valid memory address, so w
+ have to check it and fix it if necessary. */
+ start_sequence ();
+ emit_move_insn (validize_mem (ret), virtual_incoming_args_rtx);
+ seq = gen_sequence ();
+ end_sequence ();
+
+ if (f == cfun)
+ {
+ push_topmost_sequence ();
+ emit_insn_after (seq, get_insns ());
+ pop_topmost_sequence ();
+ }
+ else
+ emit_insn_before (seq, f->x_tail_recursion_reentry);
+ }
+
+ return ret;
+}
/* Extend a vector that records the INSN_UIDs of INSNS (either a
sequence or a single insn). */
OpenPOWER on IntegriCloud