From b4c25db2dfed2c3c86dc6b61c6fc7eee757c6c71 Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Sun, 8 Jul 2001 19:55:57 +0000 Subject: [PATCH] final.c (no_asm_to_stream): New. * final.c (no_asm_to_stream): New. (final_scan_insn): Use target structures for prologue ends and epilogue starts. * output.h (no_asm_to_stream): New. * target-def.h (TARGET_ASM_FUNCTION_END_PROLOGUE, TARGET_ASM_FUNCTION_BEGIN_EPILOGUE): New. (TARGET_ASM_OUT): Update. * target.h (struct gcc_target): New members function_end_prologue and function_begin_epilogue. config: * 1750/1750.h (ASM_OUTPUT_FUNNAM): Delete as unused. * alpha/alpha-protos.h (output_end_prologue): Delete. * alpha/alpha.c (output_end_prologue): Rename to alpha_output_function_end_prologue. Use in target struct and make static. * alpha/alpha.h (FUNCTION_END_PROLOGUE): Delete. * ia64/ia64-protos.h (ia64_output_end_prologue): Delete. * ia64/ia64.c (ia64_output_end_prologue): Rename to ia64_output_function_end_prologue. Use in target struct and make static. (ia64_function_prologue, ia64_funciton_epilogue): Rename mistyped prototypes. * ia64/ia64.h (FUNCTION_END_PROLOGUE): Delete. * m88k/m88k-protos.h (m88k_end_prologue, m88k_begin_epilogue): Delete. * m88k/m88k.c (m88k_end_prologue, m88k_begin_epilogue): Rename an use in target struct, make static. * ia64/ia64.h (FUNCTION_END_PROLOGUE, FUNCTION_BEGIN_EPILOGUE): Delete. From-SVN: r43849 --- gcc/ChangeLog | 31 +++++++++++++++++++++++++++++++ gcc/config/1750a/1750a.h | 3 --- gcc/config/alpha/alpha-protos.h | 1 - gcc/config/alpha/alpha.c | 9 +++++++-- gcc/config/alpha/alpha.h | 4 ---- gcc/config/ia64/ia64-protos.h | 1 - gcc/config/ia64/ia64.c | 11 +++++++---- gcc/config/ia64/ia64.h | 4 ---- gcc/config/m88k/m88k-protos.h | 2 -- gcc/config/m88k/m88k.c | 14 ++++++++++---- gcc/config/m88k/m88k.h | 6 ------ gcc/final.c | 15 +++++++++------ gcc/output.h | 3 +++ gcc/target-def.h | 7 ++++++- gcc/target.h | 6 ++++++ 15 files changed, 79 insertions(+), 38 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d0929d8fc97..066f66cde2a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,34 @@ +2001-07-08 Neil Booth + + * final.c (no_asm_to_stream): New. + (final_scan_insn): Use target structures for prologue ends + and epilogue starts. + * output.h (no_asm_to_stream): New. + * target-def.h (TARGET_ASM_FUNCTION_END_PROLOGUE, + TARGET_ASM_FUNCTION_BEGIN_EPILOGUE): New. + (TARGET_ASM_OUT): Update. + * target.h (struct gcc_target): New members function_end_prologue + and function_begin_epilogue. +config: + * 1750/1750.h (ASM_OUTPUT_FUNNAM): Delete as unused. + * alpha/alpha-protos.h (output_end_prologue): Delete. + * alpha/alpha.c (output_end_prologue): Rename to + alpha_output_function_end_prologue. Use in target struct + and make static. + * alpha/alpha.h (FUNCTION_END_PROLOGUE): Delete. + * ia64/ia64-protos.h (ia64_output_end_prologue): Delete. + * ia64/ia64.c (ia64_output_end_prologue): Rename to + ia64_output_function_end_prologue. Use in target struct + and make static. + (ia64_function_prologue, ia64_funciton_epilogue): Rename + mistyped prototypes. + * ia64/ia64.h (FUNCTION_END_PROLOGUE): Delete. + * m88k/m88k-protos.h (m88k_end_prologue, m88k_begin_epilogue): Delete. + * m88k/m88k.c (m88k_end_prologue, m88k_begin_epilogue): Rename + an use in target struct, make static. + * ia64/ia64.h (FUNCTION_END_PROLOGUE, FUNCTION_BEGIN_EPILOGUE): Delete. + + 2001-07-08 Richard Henderson * stmt.c (emit_case_nodes): Convert modes properly in low+high test. diff --git a/gcc/config/1750a/1750a.h b/gcc/config/1750a/1750a.h index 26ce2edb277..abaa7439713 100644 --- a/gcc/config/1750a/1750a.h +++ b/gcc/config/1750a/1750a.h @@ -973,9 +973,6 @@ enum reg_class { NO_REGS, R2, R0_1, INDEX_REGS, BASE_REGS, ALL_REGS, LIM_REG_CLA #define ASM_COMMENT_START ";" -#define ASM_OUTPUT_FUNNAM(FILE,NAME) \ - fprintf(FILE,"%s\n",NAME) - #define ASM_OUTPUT_OPCODE(FILE,PTR) do { \ while (*(PTR) != '\0' && *(PTR) != ' ') { \ putc (*(PTR), FILE); \ diff --git a/gcc/config/alpha/alpha-protos.h b/gcc/config/alpha/alpha-protos.h index dfed787f806..a625ece21af 100644 --- a/gcc/config/alpha/alpha-protos.h +++ b/gcc/config/alpha/alpha-protos.h @@ -28,7 +28,6 @@ extern int alpha_pv_save_size PARAMS ((void)); extern int alpha_using_fp PARAMS ((void)); extern void alpha_write_verstamp PARAMS ((FILE *)); extern void alpha_expand_prologue PARAMS ((void)); -extern void output_end_prologue PARAMS ((FILE *)); extern void alpha_expand_epilogue PARAMS ((void)); extern void alpha_output_filename PARAMS ((FILE *, const char *)); extern void alpha_output_lineno PARAMS ((FILE *, int)); diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index 72767c0ba27..ec70eb10bf0 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -129,6 +129,8 @@ static void alpha_emit_xfloating_libcall PARAMS ((const char *, rtx, rtx[], int, rtx)); static rtx alpha_emit_xfloating_compare PARAMS ((enum rtx_code, rtx, rtx)); +static void alpha_output_function_end_prologue + PARAMS ((FILE *)); /* Get the number of args of a function in one of two ways. */ #ifdef OPEN_VMS @@ -147,6 +149,9 @@ static rtx alpha_emit_xfloating_compare # define TARGET_VALID_DECL_ATTRIBUTE vms_valid_decl_attribute_p #endif +#undef TARGET_ASM_FUNCTION_END_PROLOGUE +#define TARGET_ASM_FUNCTION_END_PROLOGUE alpha_output_function_end_prologue + struct gcc_target targetm = TARGET_INITIALIZER; /* Parse target option strings. */ @@ -5001,8 +5006,8 @@ alpha_start_function (file, fnname, decl) /* Emit the .prologue note at the scheduled end of the prologue. */ -void -output_end_prologue (file) +static void +alpha_output_function_end_prologue (file) FILE *file; { if (TARGET_OPEN_VMS) diff --git a/gcc/config/alpha/alpha.h b/gcc/config/alpha/alpha.h index f11fa184db3..832c8951c40 100644 --- a/gcc/config/alpha/alpha.h +++ b/gcc/config/alpha/alpha.h @@ -1202,10 +1202,6 @@ extern struct alpha_compare alpha_compare; #define ASM_DECLARE_FUNCTION_SIZE(FILE,NAME,DECL) \ alpha_end_function(FILE,NAME,DECL) -/* This macro notes the end of the prologue. */ - -#define FUNCTION_END_PROLOGUE(FILE) output_end_prologue (FILE) - /* Output any profiling code before the prologue. */ #define PROFILE_BEFORE_PROLOGUE 1 diff --git a/gcc/config/ia64/ia64-protos.h b/gcc/config/ia64/ia64-protos.h index 1bdfbc4cee1..80f7479a148 100644 --- a/gcc/config/ia64/ia64-protos.h +++ b/gcc/config/ia64/ia64-protos.h @@ -128,7 +128,6 @@ extern void ia64_encode_section_info PARAMS((tree)); extern int ia64_register_move_cost PARAMS((enum reg_class, enum reg_class)); extern int ia64_epilogue_uses PARAMS((int)); extern void emit_safe_across_calls PARAMS((FILE *)); -extern void ia64_output_end_prologue PARAMS((FILE *)); extern void ia64_init_builtins PARAMS((void)); extern void ia64_override_options PARAMS((void)); extern int ia64_dbx_register_number PARAMS((int)); diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index 2588612ca7e..a09a7b7b471 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -137,8 +137,9 @@ static rtx ia64_expand_lock_test_and_set PARAMS ((enum machine_mode, tree, rtx)); static rtx ia64_expand_lock_release PARAMS ((enum machine_mode, tree, rtx)); static int ia64_valid_type_attribute PARAMS((tree, tree, tree, tree)); -static void ia64_function_prologue PARAMS((FILE *, HOST_WIDE_INT)); -static void ia64_function_epilogue PARAMS((FILE *, HOST_WIDE_INT)); +static void ia64_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT)); +static void ia64_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT)); +static void ia64_output_function_end_prologue PARAMS ((FILE *)); /* Initialize the GCC target structure. */ #undef TARGET_VALID_TYPE_ATTRIBUTE @@ -146,6 +147,8 @@ static void ia64_function_epilogue PARAMS((FILE *, HOST_WIDE_INT)); #undef TARGET_ASM_FUNCTION_PROLOGUE #define TARGET_ASM_FUNCTION_PROLOGUE ia64_output_function_prologue +#undef TARGET_ASM_FUNCTION_END_PROLOGUE +#define TARGET_ASM_FUNCTION_END_PROLOGUE ia64_output_function_end_prologue #undef TARGET_ASM_FUNCTION_EPILOGUE #define TARGET_ASM_FUNCTION_EPILOGUE ia64_output_function_epilogue @@ -2572,8 +2575,8 @@ ia64_output_function_prologue (file, size) /* Emit the .body directive at the scheduled end of the prologue. */ -void -ia64_output_end_prologue (file) +static void +ia64_output_function_end_prologue (file) FILE *file; { if (!flag_unwind_tables && (!flag_exceptions || USING_SJLJ_EXCEPTIONS)) diff --git a/gcc/config/ia64/ia64.h b/gcc/config/ia64/ia64.h index 05b8f9eba21..0944daa548a 100644 --- a/gcc/config/ia64/ia64.h +++ b/gcc/config/ia64/ia64.h @@ -1458,10 +1458,6 @@ do { \ /* Function Entry and Exit */ -/* This macro notes the end of the prologue. */ - -#define FUNCTION_END_PROLOGUE(FILE) ia64_output_end_prologue (FILE) - /* Define this macro as a C expression that is nonzero if the return instruction or the function epilogue ignores the value of the stack pointer; in other words, if it is safe to delete an instruction to adjust the stack diff --git a/gcc/config/m88k/m88k-protos.h b/gcc/config/m88k/m88k-protos.h index a8204a37dec..93818aea10b 100644 --- a/gcc/config/m88k/m88k-protos.h +++ b/gcc/config/m88k/m88k-protos.h @@ -84,9 +84,7 @@ extern int null_prologue PARAMS ((void)); extern int integer_ok_for_set PARAMS ((unsigned)); extern void m88k_layout_frame PARAMS ((void)); extern void m88k_expand_prologue PARAMS ((void)); -extern void m88k_end_prologue PARAMS ((FILE *)); extern void m88k_expand_epilogue PARAMS ((void)); -extern void m88k_begin_epilogue PARAMS ((FILE *)); extern void output_function_profiler PARAMS ((FILE *, int, const char *, int)); extern void output_function_block_profiler PARAMS ((FILE *, int)); extern void output_block_profiler PARAMS ((FILE *, int)); diff --git a/gcc/config/m88k/m88k.c b/gcc/config/m88k/m88k.c index 80867f2df06..63e46448bfc 100644 --- a/gcc/config/m88k/m88k.c +++ b/gcc/config/m88k/m88k.c @@ -65,10 +65,16 @@ enum processor_type m88k_cpu; /* target cpu */ static void m88k_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT)); static void m88k_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT)); +static void m88k_output_function_end_prologue PARAMS ((FILE *)); +static void m88k_output_function_begin_epilogue PARAMS ((FILE *)); /* Initialize the GCC target structure. */ #undef TARGET_ASM_FUNCTION_PROLOGUE #define TARGET_ASM_FUNCTION_PROLOGUE m88k_output_function_prologue +#undef TARGET_ASM_FUNCTION_END_PROLOGUE +#define TARGET_ASM_FUNCTION_END_PROLOGUE m88k_output_function_end_prologue +#undef TARGET_ASM_FUNCTION_BEGIN_EPILOGUE +#define TARGET_ASM_FUNCTION_BEGIN_EPILOGUE m88k_output_function_begin_epilogue #undef TARGET_ASM_FUNCTION_EPILOGUE #define TARGET_ASM_FUNCTION_EPILOGUE m88k_output_function_epilogue @@ -1954,8 +1960,8 @@ m88k_output_function_prologue (stream, size) m88k_prologue_done = 1; /* it's ok now to put out ln directives */ } -void -m88k_end_prologue (stream) +static void +m88k_output_function_end_prologue (stream) FILE *stream; { if (TARGET_OCS_DEBUG_INFO && !prologue_marked) @@ -2031,8 +2037,8 @@ m88k_expand_prologue () This is mandatory because of alloca; we also take advantage of it to omit stack adjustments before returning. */ -void -m88k_begin_epilogue (stream) +static void +m88k_output_function_begin_epilogue (stream) FILE *stream; { if (TARGET_OCS_DEBUG_INFO && !epilogue_marked && prologue_marked) diff --git a/gcc/config/m88k/m88k.h b/gcc/config/m88k/m88k.h index 3af1c291a6d..9520aa8bd8e 100644 --- a/gcc/config/m88k/m88k.h +++ b/gcc/config/m88k/m88k.h @@ -1046,9 +1046,6 @@ enum reg_class { NO_REGS, AP_REG, XRF_REGS, GENERAL_REGS, AGRF_REGS, #define EXPAND_BUILTIN_VA_ARG(valist, type) \ m88k_va_arg (valist, type) -/* Perform special actions at the point where the prologue ends. */ -#define FUNCTION_END_PROLOGUE(FILE) m88k_end_prologue(FILE) - /* Output assembler code to FILE to increment profiler label # LABELNO for profiling a function entry. Redefined in sysv3.h, sysv4.h and dgux.h. */ @@ -1080,9 +1077,6 @@ enum reg_class { NO_REGS, AP_REG, XRF_REGS, GENERAL_REGS, AGRF_REGS, No definition is equivalent to always zero. */ #define EXIT_IGNORE_STACK (1) -/* Perform special actions at the point where the epilogue begins. */ -#define FUNCTION_BEGIN_EPILOGUE(FILE) m88k_begin_epilogue(FILE) - /* 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. diff --git a/gcc/final.c b/gcc/final.c index 7509fbe0eff..35fda053ae1 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -546,6 +546,13 @@ default_function_pro_epilogue (file, size) { } +/* Default target hook that outputs nothing to a stream. */ +void +no_asm_to_stream (file) + FILE *file ATTRIBUTE_UNUSED; +{ +} + /* Enable APP processing of subsequent output. Used before the output from an `asm' statement. */ @@ -2090,16 +2097,12 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) break; case NOTE_INSN_PROLOGUE_END: -#ifdef FUNCTION_END_PROLOGUE - FUNCTION_END_PROLOGUE (file); -#endif + (*targetm.asm_out.function_end_prologue) (file); profile_after_prologue (file); break; case NOTE_INSN_EPILOGUE_BEG: -#ifdef FUNCTION_BEGIN_EPILOGUE - FUNCTION_BEGIN_EPILOGUE (file); -#endif + (*targetm.asm_out.function_begin_epilogue) (file); break; case NOTE_INSN_FUNCTION_BEG: diff --git a/gcc/output.h b/gcc/output.h index a1d5923411d..db4894c54c0 100644 --- a/gcc/output.h +++ b/gcc/output.h @@ -451,3 +451,6 @@ extern int profile_label_no; /* Default target function prologue and epilogue assembler output. */ extern void default_function_pro_epilogue PARAMS ((FILE *, HOST_WIDE_INT)); + +/* Default target hook that outputs nothing to a stream. */ +extern void no_asm_to_stream PARAMS ((FILE *)); diff --git a/gcc/target-def.h b/gcc/target-def.h index c0894936f66..ec0b6606f04 100644 --- a/gcc/target-def.h +++ b/gcc/target-def.h @@ -25,10 +25,15 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. We want to have non-NULL default definitions of all hook functions, even if they do nothing. */ +/* Assembler output. */ #define TARGET_ASM_FUNCTION_PROLOGUE default_function_pro_epilogue #define TARGET_ASM_FUNCTION_EPILOGUE default_function_pro_epilogue +#define TARGET_ASM_FUNCTION_END_PROLOGUE no_asm_to_stream +#define TARGET_ASM_FUNCTION_BEGIN_EPILOGUE no_asm_to_stream -#define TARGET_ASM_OUT {TARGET_ASM_FUNCTION_PROLOGUE, \ +#define TARGET_ASM_OUT {TARGET_ASM_FUNCTION_PROLOGUE, \ + TARGET_ASM_FUNCTION_END_PROLOGUE, \ + TARGET_ASM_FUNCTION_BEGIN_EPILOGUE, \ TARGET_ASM_FUNCTION_EPILOGUE} /* All in tree.c. */ diff --git a/gcc/target.h b/gcc/target.h index 11d0a0e08c4..45143abb3de 100644 --- a/gcc/target.h +++ b/gcc/target.h @@ -52,6 +52,12 @@ struct gcc_target /* Output the assembler code for entry to a function. */ void (* function_prologue) PARAMS ((FILE *, HOST_WIDE_INT)); + /* Output the assembler code for end of prologue. */ + void (* function_end_prologue) PARAMS ((FILE *)); + + /* Output the assembler code for start of epilogue. */ + void (* function_begin_epilogue) PARAMS ((FILE *)); + /* Output the assembler code for function exit. */ void (* function_epilogue) PARAMS ((FILE *, HOST_WIDE_INT)); } asm_out; -- 2.30.2