From 6fca22eb3bfe6201a15c0caaa4e3fe052376f863 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Thu, 8 Feb 2001 11:15:37 -0800 Subject: [PATCH] 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 --- gcc/ChangeLog | 120 +++++++++++++++++++--------------- gcc/config/i386/i386-protos.h | 2 + gcc/config/i386/i386.c | 35 ++++++++++ gcc/config/i386/i386.h | 11 +++- gcc/config/i386/sco5.h | 4 +- gcc/config/i386/svr3gas.h | 4 +- gcc/config/i386/sysv3.h | 4 +- gcc/config/i386/v3gas.h | 4 +- 8 files changed, 123 insertions(+), 61 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b2d50401335..64633565eb4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,19 @@ +2001-02-08 Richard Henderson + + * 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 * config/sparc/sparc.c (function_arg_record_value_3): Fix @@ -91,19 +107,19 @@ Thu Feb 8 11:21:28 2001 Richard Kenner 2001-01-30 Bruce Korb - fixinc/fixincl.c(process): Emit error message only if appropriate :) - (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/fixincl.c(process): Emit error message only if appropriate :) + (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/inclhack.def(irix_limits_const): add test_text 2001-02-06 Neil Booth - * cppexp.c (parse_defined): Improve diagnostics for invalid - syntax. + * cppexp.c (parse_defined): Improve diagnostics for invalid + syntax. 2001-02-06 Neil Booth - * 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 @@ -155,13 +171,13 @@ Mon Feb 5 21:56:16 2001 Richard Kenner 2001-02-05 Chandrakala Chavva * final.c: Move the declaration of profile_label_no to ... - * output.h: ... here. - * function.c (expand_function_start): Call PROFILE_HOOK. - * config/rs6000/aix.h: Define PROFILE_HOOK. - * config/rs6000/rs6000-protos.h: output_profile_hook new. - * config/rs6000/rs6000.c (output_profile_hook): Define. - (output_prolog): Do nothing for ABI_AIX as it is taken care by - output_profile_hook. + * output.h: ... here. + * function.c (expand_function_start): Call PROFILE_HOOK. + * config/rs6000/aix.h: Define PROFILE_HOOK. + * config/rs6000/rs6000-protos.h: output_profile_hook new. + * config/rs6000/rs6000.c (output_profile_hook): Define. + (output_prolog): Do nothing for ABI_AIX as it is taken care by + output_profile_hook. tm.texi : Explain new macro PROFILE_HOOK. 2001-02-06 Hans-Peter Nilsson @@ -176,7 +192,7 @@ Mon Feb 5 21:56:16 2001 Richard Kenner * Makefile.in (gcc_gxx_target_include_dir): Use $(target_alias). 2001-02-05 Franz Sirl - David Edelsohn + David Edelsohn * config/rs6000/rs6000.c (rs6000_return_addr): Use PIC code for AIX, even without flag_pic. @@ -317,13 +333,13 @@ Sun Feb 4 15:52:44 2001 Richard Kenner 2001-02-03 Neil Booth - * cpphash.h: Rename _ALIGN POOL_ALIGN. - * cpplex.c (new_chunk, _cpp_pool_reserve): Update. + * cpphash.h: Rename _ALIGN POOL_ALIGN. + * cpplex.c (new_chunk, _cpp_pool_reserve): Update. 2001-02-03 Neil Booth - * cpphash.h: Rename ALIGN _ALIGN. - * cpplex.c (new_chunk, _cpp_pool_reserve): Update. + * cpphash.h: Rename ALIGN _ALIGN. + * cpplex.c (new_chunk, _cpp_pool_reserve): Update. Fri Feb 2 23:15:29 2001 Christopher Faylor @@ -433,16 +449,16 @@ Fri Feb 2 20:03:50 2001 Richard Kenner 2001-02-01 Neil Booth - * cpphash.h (struct cpp_buffer): Move saved_flags from cpp_reader. - * cpplex.c (_cpp_lex_token): New token picks up the saved flags, - and AVOID_LPASTE is cleared on meeting an unescaped newline. - * cppmacro.c (builtin_macro): Set builtin flags here. - (paste_all_tokens): Preserve AVOID_LPASTE on pasted token. - (replace_args): Clarify intent. - (cpp_get_token): Macro expansion tokens get the saved flags. - Update. - * cppmain.c (scan_buffer): Remove now-redundant print.printed - check. + * cpphash.h (struct cpp_buffer): Move saved_flags from cpp_reader. + * cpplex.c (_cpp_lex_token): New token picks up the saved flags, + and AVOID_LPASTE is cleared on meeting an unescaped newline. + * cppmacro.c (builtin_macro): Set builtin flags here. + (paste_all_tokens): Preserve AVOID_LPASTE on pasted token. + (replace_args): Clarify intent. + (cpp_get_token): Macro expansion tokens get the saved flags. + Update. + * cppmain.c (scan_buffer): Remove now-redundant print.printed + check. 2001-02-01 Jeffrey Oldham @@ -520,14 +536,14 @@ Thu Feb 1 07:22:41 2001 Richard Kenner 2001-01-31 Neil Booth - * cpplib.c (T_ELIF): Move to STDC89, not that it matters. - (_cpp_handle_directive): Suggest not using #elif with -Wtraditional. + * cpplib.c (T_ELIF): Move to STDC89, not that it matters. + (_cpp_handle_directive): Suggest not using #elif with -Wtraditional. 2001-01-31 Neil Booth - * cpphash.h (struct cpp_reader): New saved_flags. - * cppmacro.c (cpp_get_token): Use saved_flags to remember - to avoid a paste after a pasted token. + * cpphash.h (struct cpp_reader): New saved_flags. + * cppmacro.c (cpp_get_token): Use saved_flags to remember + to avoid a paste after a pasted token. 2001-01-31 Alexandre Oliva @@ -568,10 +584,10 @@ Thu Feb 1 07:22:41 2001 Richard Kenner 2001-01-30 Neil Booth - * c-decl.c (c_expand_body): Check TYPE_SIZE_UNIT (ret_type) - is not NULL. - * toplev.c (decode_W_option): Update warn_larger_than - unconditionally for each processed switch. + * c-decl.c (c_expand_body): Check TYPE_SIZE_UNIT (ret_type) + is not NULL. + * toplev.c (decode_W_option): Update warn_larger_than + unconditionally for each processed switch. 2001-01-30 John David Anglin @@ -585,7 +601,7 @@ Thu Feb 1 07:22:41 2001 Richard Kenner 2001-01-29 lars brinkhoff - * tm.texi (PUSH_ROUNDING): Remove duplicate lines. + * tm.texi (PUSH_ROUNDING): Remove duplicate lines. 2001-01-29 John David Anglin Jeff Law @@ -632,8 +648,8 @@ Mon Jan 29 20:38:19 2001 Christopher Faylor 2001-01-29 Neil Booth - * cpplib.c (T_BAD_DIRECTIVE): Remove. - (_cpp_init_stacks): Loop from 0 to N_DIRECTIVES - 1. + * cpplib.c (T_BAD_DIRECTIVE): Remove. + (_cpp_init_stacks): Loop from 0 to N_DIRECTIVES - 1. 2001-01-29 Joseph S. Myers @@ -668,18 +684,18 @@ Mon Jan 29 20:38:19 2001 Christopher Faylor 2001-01-28 Neil Booth - * cpphash.c (_cpp_cleanup_hashtable, _cpp_lookup_with_hash) - : Don't set fe_value. - * cpplib.h (AVOID_LPASTE): New flag. - (struct cpp_hashnode): Remove fe_value. - * cpplex.c (cpp_avoid_paste): Don't paste '.' with a number. - * cppmacro.c (builtin_macro): Don't set flags here. - (replace_args): Set AVOID_LPASTE flag on first token of an - argument, and the token following it. - (cpp_get_token): Set AVOID_LPASTE flag on first token of a - macro expansion, and on the token following it. Do it for - builtins too. - * cppmain.c (scan_buffer): Avoid pasting only flagged tokens. + * cpphash.c (_cpp_cleanup_hashtable, _cpp_lookup_with_hash) + : Don't set fe_value. + * cpplib.h (AVOID_LPASTE): New flag. + (struct cpp_hashnode): Remove fe_value. + * cpplex.c (cpp_avoid_paste): Don't paste '.' with a number. + * cppmacro.c (builtin_macro): Don't set flags here. + (replace_args): Set AVOID_LPASTE flag on first token of an + argument, and the token following it. + (cpp_get_token): Set AVOID_LPASTE flag on first token of a + macro expansion, and on the token following it. Do it for + builtins too. + * cppmain.c (scan_buffer): Avoid pasting only flagged tokens. 2001-01-27 Richard Henderson diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h index e9cb3a88f97..03fa84f3795 100644 --- a/gcc/config/i386/i386-protos.h +++ b/gcc/config/i386/i386-protos.h @@ -25,6 +25,8 @@ extern void order_regs_for_local_alloc PARAMS ((void)); extern void optimization_options PARAMS ((int, int)); 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 load_pic_register PARAMS ((void)); diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 708e8ee0849..2737b6bccd4 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -331,6 +331,7 @@ struct rtx_def *ix86_compare_op1 = NULL_RTX; struct machine_function { rtx stack_locals[(int) MAX_MACHINE_MODE][MAX_386_STACK_LOCALS]; + int accesses_prev_frame; }; #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); 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]; diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 016aac6c31a..48008724198 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -852,7 +852,16 @@ extern int ix86_arch; Zero means the frame pointer need not be set up (and parms may be accessed via the stack pointer) in functions that seem suitable. 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. */ #define ARG_POINTER_REGNUM 16 diff --git a/gcc/config/i386/sco5.h b/gcc/config/i386/sco5.h index b23990bb799..ae832b91f5f 100644 --- a/gcc/config/i386/sco5.h +++ b/gcc/config/i386/sco5.h @@ -632,8 +632,8 @@ dtors_section () \ } \ } -#undef FRAME_POINTER_REQUIRED -#define FRAME_POINTER_REQUIRED \ +#undef SUBTARGET_FRAME_POINTER_REQUIRED +#define SUBTARGET_FRAME_POINTER_REQUIRED \ ((TARGET_ELF) ? 0 : \ (current_function_calls_setjmp || current_function_calls_longjmp)) diff --git a/gcc/config/i386/svr3gas.h b/gcc/config/i386/svr3gas.h index d196008f829..e5bf3db5b4b 100644 --- a/gcc/config/i386/svr3gas.h +++ b/gcc/config/i386/svr3gas.h @@ -37,8 +37,8 @@ Boston, MA 02111-1307, USA. */ Since a frame pointer will be required in such a function, it is OK that the stack pointer is not restored. */ -#undef FRAME_POINTER_REQUIRED -#define FRAME_POINTER_REQUIRED \ +#undef SUBTARGET_FRAME_POINTER_REQUIRED +#define SUBTARGET_FRAME_POINTER_REQUIRED \ (current_function_calls_setjmp || current_function_calls_longjmp) /* Modify ASM_OUTPUT_LOCAL slightly to test -msvr3-shlib, adapted to gas */ diff --git a/gcc/config/i386/sysv3.h b/gcc/config/i386/sysv3.h index ffcf3bfa408..9d7350283d2 100644 --- a/gcc/config/i386/sysv3.h +++ b/gcc/config/i386/sysv3.h @@ -78,8 +78,8 @@ Boston, MA 02111-1307, USA. */ Since a frame pointer will be required in such a function, it is OK that the stack pointer is not restored. */ -#undef FRAME_POINTER_REQUIRED -#define FRAME_POINTER_REQUIRED \ +#undef SUBTARGET_FRAME_POINTER_REQUIRED +#define SUBTARGET_FRAME_POINTER_REQUIRED \ (current_function_calls_setjmp || current_function_calls_longjmp) /* Modify ASM_OUTPUT_LOCAL slightly to test -msvr3-shlib. */ diff --git a/gcc/config/i386/v3gas.h b/gcc/config/i386/v3gas.h index fe558d265b4..a350ab40bcd 100644 --- a/gcc/config/i386/v3gas.h +++ b/gcc/config/i386/v3gas.h @@ -37,8 +37,8 @@ Boston, MA 02111-1307, USA. */ Since a frame pointer will be required in such a function, it is OK that the stack pointer is not restored. */ -#undef FRAME_POINTER_REQUIRED -#define FRAME_POINTER_REQUIRED \ +#undef SUBTARGET_FRAME_POINTER_REQUIRED +#define SUBTARGET_FRAME_POINTER_REQUIRED \ (current_function_calls_setjmp || current_function_calls_longjmp) /* Modify ASM_OUTPUT_LOCAL slightly to test -msvr3-shlib, adapted to gas */ -- 2.30.2