diff options
-rw-r--r-- | gcc/ChangeLog | 15 | ||||
-rw-r--r-- | gcc/builtins.c | 9 | ||||
-rw-r--r-- | gcc/function.c | 55 | ||||
-rw-r--r-- | gcc/function.h | 2 | ||||
-rw-r--r-- | gcc/stmt.c | 11 |
5 files changed, 54 insertions, 38 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6b90b3eb84f..2484f2fd970 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,14 @@ 2001-08-27 Richard Henderson <rth@redhat.com> + * 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. + +2001-08-27 Richard Henderson <rth@redhat.com> + * final.c (final_scan_insn): Don't enter APP_ON mode for empty asm strings. @@ -13,7 +22,7 @@ 2001-08-25 Dan Nicolaescu <dann@ics.uci.edu> - * ssa-ccp.c (ssa_const_prop): Free ssa_edges. + * ssa-ccp.c (ssa_const_prop): Free ssa_edges. 2001-08-27 Alan Modra <amodra@bigpond.net.au> @@ -79,8 +88,8 @@ Sun Aug 26 20:25:44 2001 Denis Chertykov <denisc@overta.ru> 2001-08-26 Aldy Hernandez <aldyh@redhat.com> - * config/mips/mips.c (mips_function_value): Handle complex return - values. + * config/mips/mips.c (mips_function_value): Handle complex return + values. 2001-08-25 Hans-Peter Nilsson <hp@bitrange.com> diff --git a/gcc/builtins.c b/gcc/builtins.c index 53f6fa006b6..70ed30e118a 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -557,14 +557,9 @@ expand_builtin_setjmp_receiver (receiver_label) #endif { /* Now restore our arg pointer from the address at which it - was saved in our stack frame. - If there hasn't be space allocated for it yet, make - some now. */ - if (arg_pointer_save_area == 0) - arg_pointer_save_area - = assign_stack_local (Pmode, GET_MODE_SIZE (Pmode), 0); + was saved in our stack frame. */ emit_move_insn (virtual_incoming_args_rtx, - copy_to_reg (arg_pointer_save_area)); + copy_to_reg (get_arg_pointer_save_area (cfun))); } } #endif 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). */ diff --git a/gcc/function.h b/gcc/function.h index b35f8590112..24c99ccb97c 100644 --- a/gcc/function.h +++ b/gcc/function.h @@ -609,6 +609,8 @@ extern void clobber_return_register PARAMS ((void)); extern void use_return_register PARAMS ((void)); #endif +extern rtx get_arg_pointer_save_area PARAMS ((struct function *)); + extern void init_virtual_regs PARAMS ((struct emit_status *)); /* Called once, at initialization, to initialize function.c. */ diff --git a/gcc/stmt.c b/gcc/stmt.c index 0a15a4a8992..123c9d3c2b7 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -3490,16 +3490,9 @@ expand_nl_goto_receiver () #endif { /* Now restore our arg pointer from the address at which it - was saved in our stack frame. - If there hasn't be space allocated for it yet, make - some now. */ - if (arg_pointer_save_area == 0) - arg_pointer_save_area - = assign_stack_local (Pmode, GET_MODE_SIZE (Pmode), 0); + was saved in our stack frame. */ emit_move_insn (virtual_incoming_args_rtx, - /* We need a pseudo here, or else - instantiate_virtual_regs_1 complains. */ - copy_to_reg (arg_pointer_save_area)); + copy_to_reg (get_arg_pointer_save_area (cfun))); } } #endif |