This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Target-ize FUNCTION_{END_PROLOGUE,BEGIN_EPILOGUE}
- To: gcc-patches at gcc dot gnu dot org
- Subject: Target-ize FUNCTION_{END_PROLOGUE,BEGIN_EPILOGUE}
- From: Neil Booth <neil at daikokuya dot demon dot co dot uk>
- Date: Sun, 8 Jul 2001 14:55:27 +0100
This pach adds these to the target structure. It also fixes a couple
of typos from my previous target patch in ia64, and removes an unused
macro in 1750/1750.h.
There is no documentation update since these are not documented, and I
am not qualified to document them.
It only affects alpha, ia64 and m88k, so I'm doing some compile tests
with those targets. When they pass, OK to commit?
Neil.
* 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.
Index: gcc/final.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/final.c,v
retrieving revision 1.179
diff -u -p -r1.179 final.c
--- final.c 2001/07/07 01:07:17 1.179
+++ final.c 2001/07/08 13:42:38
@@ -546,6 +546,13 @@ default_function_pro_epilogue (file, siz
{
}
+/* 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, p
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:
Index: gcc/output.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/output.h,v
retrieving revision 1.61
diff -u -p -r1.61 output.h
--- output.h 2001/07/06 18:39:58 1.61
+++ output.h 2001/07/08 13:42:39
@@ -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 *));
Index: gcc/target-def.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/target-def.h,v
retrieving revision 1.4
diff -u -p -r1.4 target-def.h
--- target-def.h 2001/07/06 18:40:00 1.4
+++ target-def.h 2001/07/08 13:42:39
@@ -25,10 +25,15 @@ Foundation, 59 Temple Place - Suite 330,
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. */
Index: gcc/target.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/target.h,v
retrieving revision 1.5
diff -u -p -r1.5 target.h
--- target.h 2001/07/07 01:07:17 1.5
+++ target.h 2001/07/08 13:42:40
@@ -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;
Index: gcc/config/1750a/1750a.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/1750a/1750a.h,v
retrieving revision 1.23
diff -u -p -r1.23 1750a.h
--- 1750a.h 2001/07/06 18:40:00 1.23
+++ 1750a.h 2001/07/08 13:42:44
@@ -973,9 +973,6 @@ enum reg_class { NO_REGS, R2, R0_1, INDE
#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); \
Index: gcc/config/alpha/alpha-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/alpha/alpha-protos.h,v
retrieving revision 1.16
diff -u -p -r1.16 alpha-protos.h
--- alpha-protos.h 2001/07/07 06:52:34 1.16
+++ alpha-protos.h 2001/07/08 13:42:46
@@ -28,7 +28,6 @@ extern int alpha_pv_save_size PARAMS ((v
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));
Index: gcc/config/alpha/alpha.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/alpha/alpha.c,v
retrieving revision 1.169
diff -u -p -r1.169 alpha.c
--- alpha.c 2001/07/07 06:52:34 1.169
+++ alpha.c 2001/07/08 13:42:59
@@ -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)
Index: gcc/config/alpha/alpha.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/alpha/alpha.h,v
retrieving revision 1.122
diff -u -p -r1.122 alpha.h
--- alpha.h 2001/06/26 06:36:24 1.122
+++ alpha.h 2001/07/08 13:43:07
@@ -1202,10 +1202,6 @@ extern struct alpha_compare alpha_compar
#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
Index: gcc/config/ia64/ia64-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/ia64/ia64-protos.h,v
retrieving revision 1.30
diff -u -p -r1.30 ia64-protos.h
--- ia64-protos.h 2001/07/06 18:40:12 1.30
+++ ia64-protos.h 2001/07/08 13:43:07
@@ -128,7 +128,6 @@ extern void ia64_encode_section_info PAR
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));
Index: gcc/config/ia64/ia64.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/ia64/ia64.c,v
retrieving revision 1.100
diff -u -p -r1.100 ia64.c
--- ia64.c 2001/07/07 01:07:19 1.100
+++ ia64.c 2001/07/08 13:43:24
@@ -137,8 +137,9 @@ static rtx ia64_expand_lock_test_and_set
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 PARAM
#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, siz
/* 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))
Index: gcc/config/ia64/ia64.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/ia64/ia64.h,v
retrieving revision 1.72
diff -u -p -r1.72 ia64.h
--- ia64.h 2001/07/06 18:40:12 1.72
+++ ia64.h 2001/07/08 13:43:33
@@ -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
Index: gcc/config/m88k/m88k-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m88k/m88k-protos.h,v
retrieving revision 1.2
diff -u -p -r1.2 m88k-protos.h
--- m88k-protos.h 2001/07/06 18:40:13 1.2
+++ m88k-protos.h 2001/07/08 13:43:34
@@ -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));
Index: gcc/config/m88k/m88k.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m88k/m88k.c,v
retrieving revision 1.35
diff -u -p -r1.35 m88k.c
--- m88k.c 2001/07/07 01:07:20 1.35
+++ m88k.c 2001/07/08 13:43:42
@@ -65,10 +65,16 @@ enum processor_type m88k_cpu; /* target
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, s
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)
Index: gcc/config/m88k/m88k.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m88k/m88k.h,v
retrieving revision 1.32
diff -u -p -r1.32 m88k.h
--- m88k.h 2001/07/06 18:40:14 1.32
+++ m88k.h 2001/07/08 13:43:50
@@ -1046,9 +1046,6 @@ enum reg_class { NO_REGS, AP_REG, XRF_RE
#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. */
@@ -1079,9 +1076,6 @@ enum reg_class { NO_REGS, AP_REG, XRF_RE
functions that have frame pointers.
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