i386.c (ix86_frame_pointer_required): New.

* config/i386/i386.c (ix86_frame_pointer_required): New.
        (ix86_setup_frame_addresses): New.
        (struct machine_funciton): Add accesses_prev_frame.
        * config/i386/i386.h (FRAME_POINTER_REQUIRED): Call
        ix86_frame_pointer_required.
        (SUBTARGET_FRAME_POINTER_REQUIRED): New.
        (SETUP_FRAME_ADDRESSES): New.
        * config/i386/i386-protos.h: Update.
        * config/i386/sco5.h (SUBTARGET_FRAME_POINTER_REQUIRED): Rename
        from FRAME_POINTER_REQUIRED.
        * config/i386/svr3gas.h: Likewise.
        * config/i386/sysv3.h: Likewise.
        * config/i386/v3gas.h: Likewise.

From-SVN: r39545
This commit is contained in:
Richard Henderson 2001-02-08 11:15:37 -08:00
parent 0020b823d6
commit 6fca22eb3b
8 changed files with 123 additions and 61 deletions

View File

@ -1,3 +1,19 @@
2001-02-08 Richard Henderson <rth@redhat.com>
* config/i386/i386.c (ix86_frame_pointer_required): New.
(ix86_setup_frame_addresses): New.
(struct machine_funciton): Add accesses_prev_frame.
* config/i386/i386.h (FRAME_POINTER_REQUIRED): Call
ix86_frame_pointer_required.
(SUBTARGET_FRAME_POINTER_REQUIRED): New.
(SETUP_FRAME_ADDRESSES): New.
* config/i386/i386-protos.h: Update.
* config/i386/sco5.h (SUBTARGET_FRAME_POINTER_REQUIRED): Rename
from FRAME_POINTER_REQUIRED.
* config/i386/svr3gas.h: Likewise.
* config/i386/sysv3.h: Likewise.
* config/i386/v3gas.h: Likewise.
2001-02-08 Richard Henderson <rth@redhat.com> 2001-02-08 Richard Henderson <rth@redhat.com>
* config/sparc/sparc.c (function_arg_record_value_3): Fix * config/sparc/sparc.c (function_arg_record_value_3): Fix
@ -91,19 +107,19 @@ Thu Feb 8 11:21:28 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
2001-01-30 Bruce Korb <bkorb@gnu.org> 2001-01-30 Bruce Korb <bkorb@gnu.org>
fixinc/fixincl.c(process): Emit error message only if appropriate :) fixinc/fixincl.c(process): Emit error message only if appropriate :)
(load_file): do not rely on load_file_data() to close file pointer (load_file): do not rely on load_file_data() to close file pointer
fixinc/fixlib.c(load_file_data): do not close passed in file pointer fixinc/fixlib.c(load_file_data): do not close passed in file pointer
fixinc/inclhack.def(irix_limits_const): add test_text fixinc/inclhack.def(irix_limits_const): add test_text
2001-02-06 Neil Booth <neil@daikokuya.demon.co.uk> 2001-02-06 Neil Booth <neil@daikokuya.demon.co.uk>
* cppexp.c (parse_defined): Improve diagnostics for invalid * cppexp.c (parse_defined): Improve diagnostics for invalid
syntax. syntax.
2001-02-06 Neil Booth <neil@daikokuya.demon.co.uk> 2001-02-06 Neil Booth <neil@daikokuya.demon.co.uk>
* cppmacro.c (cpp_get_token): Avoid pasting after a builtin. * cppmacro.c (cpp_get_token): Avoid pasting after a builtin.
2001-02-06 Mark Mitchell <mark@codesourcery.com> 2001-02-06 Mark Mitchell <mark@codesourcery.com>
@ -155,13 +171,13 @@ Mon Feb 5 21:56:16 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
2001-02-05 Chandrakala Chavva <cchavva@redhat.com> 2001-02-05 Chandrakala Chavva <cchavva@redhat.com>
* final.c: Move the declaration of profile_label_no to ... * final.c: Move the declaration of profile_label_no to ...
* output.h: ... here. * output.h: ... here.
* function.c (expand_function_start): Call PROFILE_HOOK. * function.c (expand_function_start): Call PROFILE_HOOK.
* config/rs6000/aix.h: Define PROFILE_HOOK. * config/rs6000/aix.h: Define PROFILE_HOOK.
* config/rs6000/rs6000-protos.h: output_profile_hook new. * config/rs6000/rs6000-protos.h: output_profile_hook new.
* config/rs6000/rs6000.c (output_profile_hook): Define. * config/rs6000/rs6000.c (output_profile_hook): Define.
(output_prolog): Do nothing for ABI_AIX as it is taken care by (output_prolog): Do nothing for ABI_AIX as it is taken care by
output_profile_hook. output_profile_hook.
tm.texi : Explain new macro PROFILE_HOOK. tm.texi : Explain new macro PROFILE_HOOK.
2001-02-06 Hans-Peter Nilsson <hp@axis.com> 2001-02-06 Hans-Peter Nilsson <hp@axis.com>
@ -176,7 +192,7 @@ Mon Feb 5 21:56:16 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* Makefile.in (gcc_gxx_target_include_dir): Use $(target_alias). * Makefile.in (gcc_gxx_target_include_dir): Use $(target_alias).
2001-02-05 Franz Sirl <Franz.Sirl-kernel@lauterbach.com> 2001-02-05 Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
David Edelsohn <edelsohn@gnu.org> David Edelsohn <edelsohn@gnu.org>
* config/rs6000/rs6000.c (rs6000_return_addr): Use PIC * config/rs6000/rs6000.c (rs6000_return_addr): Use PIC
code for AIX, even without flag_pic. code for AIX, even without flag_pic.
@ -317,13 +333,13 @@ Sun Feb 4 15:52:44 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
2001-02-03 Neil Booth <neil@daikokuya.demon.co.uk> 2001-02-03 Neil Booth <neil@daikokuya.demon.co.uk>
* cpphash.h: Rename _ALIGN POOL_ALIGN. * cpphash.h: Rename _ALIGN POOL_ALIGN.
* cpplex.c (new_chunk, _cpp_pool_reserve): Update. * cpplex.c (new_chunk, _cpp_pool_reserve): Update.
2001-02-03 Neil Booth <neil@daikokuya.demon.co.uk> 2001-02-03 Neil Booth <neil@daikokuya.demon.co.uk>
* cpphash.h: Rename ALIGN _ALIGN. * cpphash.h: Rename ALIGN _ALIGN.
* cpplex.c (new_chunk, _cpp_pool_reserve): Update. * cpplex.c (new_chunk, _cpp_pool_reserve): Update.
Fri Feb 2 23:15:29 2001 Christopher Faylor <cgf@cygnus.com> Fri Feb 2 23:15:29 2001 Christopher Faylor <cgf@cygnus.com>
@ -433,16 +449,16 @@ Fri Feb 2 20:03:50 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
2001-02-01 Neil Booth <neil@daikokuya.demon.co.uk> 2001-02-01 Neil Booth <neil@daikokuya.demon.co.uk>
* cpphash.h (struct cpp_buffer): Move saved_flags from cpp_reader. * cpphash.h (struct cpp_buffer): Move saved_flags from cpp_reader.
* cpplex.c (_cpp_lex_token): New token picks up the saved flags, * cpplex.c (_cpp_lex_token): New token picks up the saved flags,
and AVOID_LPASTE is cleared on meeting an unescaped newline. and AVOID_LPASTE is cleared on meeting an unescaped newline.
* cppmacro.c (builtin_macro): Set builtin flags here. * cppmacro.c (builtin_macro): Set builtin flags here.
(paste_all_tokens): Preserve AVOID_LPASTE on pasted token. (paste_all_tokens): Preserve AVOID_LPASTE on pasted token.
(replace_args): Clarify intent. (replace_args): Clarify intent.
(cpp_get_token): Macro expansion tokens get the saved flags. (cpp_get_token): Macro expansion tokens get the saved flags.
Update. Update.
* cppmain.c (scan_buffer): Remove now-redundant print.printed * cppmain.c (scan_buffer): Remove now-redundant print.printed
check. check.
2001-02-01 Jeffrey Oldham <oldham@codesourcery.com> 2001-02-01 Jeffrey Oldham <oldham@codesourcery.com>
@ -520,14 +536,14 @@ Thu Feb 1 07:22:41 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
2001-01-31 Neil Booth <neil@daikokuya.demon.co.uk> 2001-01-31 Neil Booth <neil@daikokuya.demon.co.uk>
* cpplib.c (T_ELIF): Move to STDC89, not that it matters. * cpplib.c (T_ELIF): Move to STDC89, not that it matters.
(_cpp_handle_directive): Suggest not using #elif with -Wtraditional. (_cpp_handle_directive): Suggest not using #elif with -Wtraditional.
2001-01-31 Neil Booth <neil@daikokuya.demon.co.uk> 2001-01-31 Neil Booth <neil@daikokuya.demon.co.uk>
* cpphash.h (struct cpp_reader): New saved_flags. * cpphash.h (struct cpp_reader): New saved_flags.
* cppmacro.c (cpp_get_token): Use saved_flags to remember * cppmacro.c (cpp_get_token): Use saved_flags to remember
to avoid a paste after a pasted token. to avoid a paste after a pasted token.
2001-01-31 Alexandre Oliva <aoliva@redhat.com> 2001-01-31 Alexandre Oliva <aoliva@redhat.com>
@ -568,10 +584,10 @@ Thu Feb 1 07:22:41 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
2001-01-30 Neil Booth <neil@daikokuya.demon.co.uk> 2001-01-30 Neil Booth <neil@daikokuya.demon.co.uk>
* c-decl.c (c_expand_body): Check TYPE_SIZE_UNIT (ret_type) * c-decl.c (c_expand_body): Check TYPE_SIZE_UNIT (ret_type)
is not NULL. is not NULL.
* toplev.c (decode_W_option): Update warn_larger_than * toplev.c (decode_W_option): Update warn_larger_than
unconditionally for each processed switch. unconditionally for each processed switch.
2001-01-30 John David Anglin <dave@hiauly1.hia.nrc.ca> 2001-01-30 John David Anglin <dave@hiauly1.hia.nrc.ca>
@ -585,7 +601,7 @@ Thu Feb 1 07:22:41 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
2001-01-29 lars brinkhoff <lars@nocrew.org> 2001-01-29 lars brinkhoff <lars@nocrew.org>
* tm.texi (PUSH_ROUNDING): Remove duplicate lines. * tm.texi (PUSH_ROUNDING): Remove duplicate lines.
2001-01-29 John David Anglin <dave@hiauly1.hia.nrc.ca> 2001-01-29 John David Anglin <dave@hiauly1.hia.nrc.ca>
Jeff Law <law@redhat.com> Jeff Law <law@redhat.com>
@ -632,8 +648,8 @@ Mon Jan 29 20:38:19 2001 Christopher Faylor <cgf@cygnus.com>
2001-01-29 Neil Booth <neil@daikokuya.demon.co.uk> 2001-01-29 Neil Booth <neil@daikokuya.demon.co.uk>
* cpplib.c (T_BAD_DIRECTIVE): Remove. * cpplib.c (T_BAD_DIRECTIVE): Remove.
(_cpp_init_stacks): Loop from 0 to N_DIRECTIVES - 1. (_cpp_init_stacks): Loop from 0 to N_DIRECTIVES - 1.
2001-01-29 Joseph S. Myers <jsm28@cam.ac.uk> 2001-01-29 Joseph S. Myers <jsm28@cam.ac.uk>
@ -668,18 +684,18 @@ Mon Jan 29 20:38:19 2001 Christopher Faylor <cgf@cygnus.com>
2001-01-28 Neil Booth <neil@daikokuya.demon.co.uk> 2001-01-28 Neil Booth <neil@daikokuya.demon.co.uk>
* cpphash.c (_cpp_cleanup_hashtable, _cpp_lookup_with_hash) * cpphash.c (_cpp_cleanup_hashtable, _cpp_lookup_with_hash)
: Don't set fe_value. : Don't set fe_value.
* cpplib.h (AVOID_LPASTE): New flag. * cpplib.h (AVOID_LPASTE): New flag.
(struct cpp_hashnode): Remove fe_value. (struct cpp_hashnode): Remove fe_value.
* cpplex.c (cpp_avoid_paste): Don't paste '.' with a number. * cpplex.c (cpp_avoid_paste): Don't paste '.' with a number.
* cppmacro.c (builtin_macro): Don't set flags here. * cppmacro.c (builtin_macro): Don't set flags here.
(replace_args): Set AVOID_LPASTE flag on first token of an (replace_args): Set AVOID_LPASTE flag on first token of an
argument, and the token following it. argument, and the token following it.
(cpp_get_token): Set AVOID_LPASTE flag on first token of a (cpp_get_token): Set AVOID_LPASTE flag on first token of a
macro expansion, and on the token following it. Do it for macro expansion, and on the token following it. Do it for
builtins too. builtins too.
* cppmain.c (scan_buffer): Avoid pasting only flagged tokens. * cppmain.c (scan_buffer): Avoid pasting only flagged tokens.
2001-01-27 Richard Henderson <rth@redhat.com> 2001-01-27 Richard Henderson <rth@redhat.com>

View File

@ -25,6 +25,8 @@ extern void order_regs_for_local_alloc PARAMS ((void));
extern void optimization_options PARAMS ((int, int)); extern void optimization_options PARAMS ((int, int));
extern int ix86_can_use_return_insn_p PARAMS ((void)); extern int ix86_can_use_return_insn_p PARAMS ((void));
extern int ix86_frame_pointer_required PARAMS ((void));
extern void ix86_setup_frame_addresses PARAMS ((void));
extern void ix86_asm_file_end PARAMS ((FILE *)); extern void ix86_asm_file_end PARAMS ((FILE *));
extern void load_pic_register PARAMS ((void)); extern void load_pic_register PARAMS ((void));

View File

@ -331,6 +331,7 @@ struct rtx_def *ix86_compare_op1 = NULL_RTX;
struct machine_function struct machine_function
{ {
rtx stack_locals[(int) MAX_MACHINE_MODE][MAX_386_STACK_LOCALS]; rtx stack_locals[(int) MAX_MACHINE_MODE][MAX_386_STACK_LOCALS];
int accesses_prev_frame;
}; };
#define ix86_stack_locals (cfun->machine->stack_locals) #define ix86_stack_locals (cfun->machine->stack_locals)
@ -1700,6 +1701,40 @@ ix86_can_use_return_insn_p ()
tsize = ix86_compute_frame_size (get_frame_size (), &nregs, NULL, NULL); tsize = ix86_compute_frame_size (get_frame_size (), &nregs, NULL, NULL);
return tsize == 0 && nregs == 0; return tsize == 0 && nregs == 0;
} }
/* Value should be nonzero if functions must have frame pointers.
Zero means the frame pointer need not be set up (and parms may
be accessed via the stack pointer) in functions that seem suitable. */
int
ix86_frame_pointer_required ()
{
/* If we accessed previous frames, then the generated code expects
to be able to access the saved ebp value in our frame. */
if (cfun->machine->accesses_prev_frame)
return 1;
/* Several x86 os'es need a frame pointer for other reasons,
usually pertaining to setjmp. */
if (SUBTARGET_FRAME_POINTER_REQUIRED)
return 1;
/* In override_options, TARGET_OMIT_LEAF_FRAME_POINTER turns off
the frame pointer by default. Turn it back on now if we've not
got a leaf function. */
if (TARGET_OMIT_LEAF_FRAME_POINTER && ! leaf_function_p ())
return 1;
return 0;
}
/* Record that the current function accesses previous call frames. */
void
ix86_setup_frame_addresses ()
{
cfun->machine->accesses_prev_frame = 1;
}
static char pic_label_name[32]; static char pic_label_name[32];

View File

@ -852,7 +852,16 @@ extern int ix86_arch;
Zero means the frame pointer need not be set up (and parms Zero means the frame pointer need not be set up (and parms
may be accessed via the stack pointer) in functions that seem suitable. may be accessed via the stack pointer) in functions that seem suitable.
This is computed in `reload', in reload1.c. */ This is computed in `reload', in reload1.c. */
#define FRAME_POINTER_REQUIRED (TARGET_OMIT_LEAF_FRAME_POINTER && !leaf_function_p ()) #define FRAME_POINTER_REQUIRED ix86_frame_pointer_required ()
/* Override this in other tm.h files to cope with various OS losage
requiring a frame pointer. */
#ifndef SUBTARGET_FRAME_POINTER_REQUIRED
#define SUBTARGET_FRAME_POINTER_REQUIRED 0
#endif
/* Make sure we can access arbitrary call frames. */
#define SETUP_FRAME_ADDRESSES() ix86_setup_frame_addresses ()
/* Base register for access to arguments of the function. */ /* Base register for access to arguments of the function. */
#define ARG_POINTER_REGNUM 16 #define ARG_POINTER_REGNUM 16

View File

@ -632,8 +632,8 @@ dtors_section () \
} \ } \
} }
#undef FRAME_POINTER_REQUIRED #undef SUBTARGET_FRAME_POINTER_REQUIRED
#define FRAME_POINTER_REQUIRED \ #define SUBTARGET_FRAME_POINTER_REQUIRED \
((TARGET_ELF) ? 0 : \ ((TARGET_ELF) ? 0 : \
(current_function_calls_setjmp || current_function_calls_longjmp)) (current_function_calls_setjmp || current_function_calls_longjmp))

View File

@ -37,8 +37,8 @@ Boston, MA 02111-1307, USA. */
Since a frame pointer will be required in such a function, it is OK Since a frame pointer will be required in such a function, it is OK
that the stack pointer is not restored. */ that the stack pointer is not restored. */
#undef FRAME_POINTER_REQUIRED #undef SUBTARGET_FRAME_POINTER_REQUIRED
#define FRAME_POINTER_REQUIRED \ #define SUBTARGET_FRAME_POINTER_REQUIRED \
(current_function_calls_setjmp || current_function_calls_longjmp) (current_function_calls_setjmp || current_function_calls_longjmp)
/* Modify ASM_OUTPUT_LOCAL slightly to test -msvr3-shlib, adapted to gas */ /* Modify ASM_OUTPUT_LOCAL slightly to test -msvr3-shlib, adapted to gas */

View File

@ -78,8 +78,8 @@ Boston, MA 02111-1307, USA. */
Since a frame pointer will be required in such a function, it is OK Since a frame pointer will be required in such a function, it is OK
that the stack pointer is not restored. */ that the stack pointer is not restored. */
#undef FRAME_POINTER_REQUIRED #undef SUBTARGET_FRAME_POINTER_REQUIRED
#define FRAME_POINTER_REQUIRED \ #define SUBTARGET_FRAME_POINTER_REQUIRED \
(current_function_calls_setjmp || current_function_calls_longjmp) (current_function_calls_setjmp || current_function_calls_longjmp)
/* Modify ASM_OUTPUT_LOCAL slightly to test -msvr3-shlib. */ /* Modify ASM_OUTPUT_LOCAL slightly to test -msvr3-shlib. */

View File

@ -37,8 +37,8 @@ Boston, MA 02111-1307, USA. */
Since a frame pointer will be required in such a function, it is OK Since a frame pointer will be required in such a function, it is OK
that the stack pointer is not restored. */ that the stack pointer is not restored. */
#undef FRAME_POINTER_REQUIRED #undef SUBTARGET_FRAME_POINTER_REQUIRED
#define FRAME_POINTER_REQUIRED \ #define SUBTARGET_FRAME_POINTER_REQUIRED \
(current_function_calls_setjmp || current_function_calls_longjmp) (current_function_calls_setjmp || current_function_calls_longjmp)
/* Modify ASM_OUTPUT_LOCAL slightly to test -msvr3-shlib, adapted to gas */ /* Modify ASM_OUTPUT_LOCAL slightly to test -msvr3-shlib, adapted to gas */