Commit b2b61607 by Richard Sandiford Committed by Richard Sandiford

mips.h (FUNCTION_NAME_ALREADY_DECLARED): Delete.

gcc/
2008-08-09  Richard Sandiford  <rdsandiford@googlemail.com>
	    Daniel Jacobowitz  <dan@codesourcery.com>

	* config/mips/mips.h (FUNCTION_NAME_ALREADY_DECLARED): Delete.
	* config/mips/linux.h (ASM_DECLARE_FUNCTION_NAME): Delete.
	(ASM_DECLARE_FUNCTION_SIZE, FUNCTION_NAME_ALREADY_DECLARED): Delete.
	* config/mips/mips.c (mips_start_function_definition): New function.
	(mips_end_function_definition): Likewise.
	(mips_output_function_prologue): Use mips_start_function_definition.
	(mips_output_function_epilogue): Use mips_end_function_definition.
	(build_mips16_function_stub): Use mips_start_function_definition
	and mips_end_function_definition.
	(build_mips16_call_stub): Likewise.

Co-Authored-By: Daniel Jacobowitz <dan@codesourcery.com>

From-SVN: r138908
parent 7c9577be
2008-08-09 Richard Sandiford <rdsandiford@googlemail.com>
Daniel Jacobowitz <dan@codesourcery.com>
* config/mips/mips.h (FUNCTION_NAME_ALREADY_DECLARED): Delete.
* config/mips/linux.h (ASM_DECLARE_FUNCTION_NAME): Delete.
(ASM_DECLARE_FUNCTION_SIZE, FUNCTION_NAME_ALREADY_DECLARED): Delete.
* config/mips/mips.c (mips_start_function_definition): New function.
(mips_end_function_definition): Likewise.
(mips_output_function_prologue): Use mips_start_function_definition.
(mips_output_function_epilogue): Use mips_end_function_definition.
(build_mips16_function_stub): Use mips_start_function_definition
and mips_end_function_definition.
(build_mips16_call_stub): Likewise.
2008-08-09 Richard Guenther <rguenther@suse.de> 2008-08-09 Richard Guenther <rguenther@suse.de>
* gimple.c (gimple_build_call_1): Deal with FUNCTION_DECL fn. * gimple.c (gimple_build_call_1): Deal with FUNCTION_DECL fn.
......
...@@ -96,36 +96,6 @@ along with GCC; see the file COPYING3. If not see ...@@ -96,36 +96,6 @@ along with GCC; see the file COPYING3. If not see
fputc ( '\n', FILE); \ fputc ( '\n', FILE); \
} while (0) } while (0)
#undef ASM_DECLARE_FUNCTION_NAME
#define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \
do { \
if (!flag_inhibit_size_directive) \
{ \
fputs ("\t.ent\t", STREAM); \
assemble_name (STREAM, NAME); \
putc ('\n', STREAM); \
} \
ASM_OUTPUT_TYPE_DIRECTIVE (STREAM, NAME, "function"); \
assemble_name (STREAM, NAME); \
fputs (":\n", STREAM); \
} while (0)
#undef ASM_DECLARE_FUNCTION_SIZE
#define ASM_DECLARE_FUNCTION_SIZE(STREAM, NAME, DECL) \
do { \
if (!flag_inhibit_size_directive) \
{ \
fputs ("\t.end\t", STREAM); \
assemble_name (STREAM, NAME); \
putc ('\n', STREAM); \
} \
} while (0)
/* Tell function_prologue in mips.c that we have already output the .ent/.end
pseudo-ops. */
#undef FUNCTION_NAME_ALREADY_DECLARED
#define FUNCTION_NAME_ALREADY_DECLARED 1
/* The glibc _mcount stub will save $v0 for us. Don't mess with saving /* The glibc _mcount stub will save $v0 for us. Don't mess with saving
it, since ASM_OUTPUT_REG_PUSH/ASM_OUTPUT_REG_POP do not work in the it, since ASM_OUTPUT_REG_PUSH/ASM_OUTPUT_REG_POP do not work in the
presence of $gp-relative calls. */ presence of $gp-relative calls. */
......
...@@ -5170,6 +5170,44 @@ mips_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p, ...@@ -5170,6 +5170,44 @@ mips_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
return addr; return addr;
} }
/* Start a definition of function NAME. MIPS16_P indicates whether the
function contains MIPS16 code. */
static void
mips_start_function_definition (const char *name, bool mips16_p)
{
if (mips16_p)
fprintf (asm_out_file, "\t.set\tmips16\n");
else
fprintf (asm_out_file, "\t.set\tnomips16\n");
if (!flag_inhibit_size_directive)
{
fputs ("\t.ent\t", asm_out_file);
assemble_name (asm_out_file, name);
fputs ("\n", asm_out_file);
}
ASM_OUTPUT_TYPE_DIRECTIVE (asm_out_file, name, "function");
/* Start the definition proper. */
assemble_name (asm_out_file, name);
fputs (":\n", asm_out_file);
}
/* End a function definition started by mips_start_function_definition. */
static void
mips_end_function_definition (const char *name)
{
if (!flag_inhibit_size_directive)
{
fputs ("\t.end\t", asm_out_file);
assemble_name (asm_out_file, name);
fputs ("\n", asm_out_file);
}
}
/* A chained list of functions for which mips16_build_call_stub has already /* A chained list of functions for which mips16_build_call_stub has already
generated a stub. NAME is the name of the function and FP_RET_P is true generated a stub. NAME is the name of the function and FP_RET_P is true
if the function returns a value in floating-point registers. */ if the function returns a value in floating-point registers. */
...@@ -5315,24 +5353,9 @@ mips16_build_function_stub (void) ...@@ -5315,24 +5353,9 @@ mips16_build_function_stub (void)
} }
fprintf (asm_out_file, ")\n"); fprintf (asm_out_file, ")\n");
/* Write the preamble leading up to the function declaration. */ /* Start the function definition. */
fprintf (asm_out_file, "\t.set\tnomips16\n"); assemble_start_function (stubdecl, stubname);
switch_to_section (function_section (stubdecl)); mips_start_function_definition (stubname, false);
ASM_OUTPUT_ALIGN (asm_out_file,
floor_log2 (FUNCTION_BOUNDARY / BITS_PER_UNIT));
/* ??? If FUNCTION_NAME_ALREADY_DECLARED is defined, then we are
within a .ent, and we cannot emit another .ent. */
if (!FUNCTION_NAME_ALREADY_DECLARED)
{
fputs ("\t.ent\t", asm_out_file);
assemble_name (asm_out_file, stubname);
fputs ("\n", asm_out_file);
}
/* Start the definition proper. */
assemble_name (asm_out_file, stubname);
fputs (":\n", asm_out_file);
/* Load the address of the MIPS16 function into $at. Do this first so /* Load the address of the MIPS16 function into $at. Do this first so
that targets with coprocessor interlocks can use an MFC1 to fill the that targets with coprocessor interlocks can use an MFC1 to fill the
...@@ -5349,12 +5372,7 @@ mips16_build_function_stub (void) ...@@ -5349,12 +5372,7 @@ mips16_build_function_stub (void)
fprintf (asm_out_file, "\tjr\t%s\n", reg_names[GP_REG_FIRST + 1]); fprintf (asm_out_file, "\tjr\t%s\n", reg_names[GP_REG_FIRST + 1]);
fprintf (asm_out_file, "\t.set\tat\n"); fprintf (asm_out_file, "\t.set\tat\n");
if (!FUNCTION_NAME_ALREADY_DECLARED) mips_end_function_definition (stubname);
{
fputs ("\t.end\t", asm_out_file);
assemble_name (asm_out_file, stubname);
fputs ("\n", asm_out_file);
}
switch_to_section (function_section (current_function_decl)); switch_to_section (function_section (current_function_decl));
} }
...@@ -5534,19 +5552,9 @@ mips16_build_call_stub (rtx retval, rtx fn, rtx args_size, int fp_code) ...@@ -5534,19 +5552,9 @@ mips16_build_call_stub (rtx retval, rtx fn, rtx args_size, int fp_code)
} }
fprintf (asm_out_file, ")\n"); fprintf (asm_out_file, ")\n");
/* Write the preamble leading up to the function declaration. */ /* Start the function definition. */
fprintf (asm_out_file, "\t.set\tnomips16\n");
assemble_start_function (stubdecl, stubname); assemble_start_function (stubdecl, stubname);
mips_start_function_definition (stubname, false);
if (!FUNCTION_NAME_ALREADY_DECLARED)
{
fputs ("\t.ent\t", asm_out_file);
assemble_name (asm_out_file, stubname);
fputs ("\n", asm_out_file);
assemble_name (asm_out_file, stubname);
fputs (":\n", asm_out_file);
}
if (!fp_ret_p) if (!fp_ret_p)
{ {
...@@ -5621,12 +5629,7 @@ mips16_build_call_stub (rtx retval, rtx fn, rtx args_size, int fp_code) ...@@ -5621,12 +5629,7 @@ mips16_build_call_stub (rtx retval, rtx fn, rtx args_size, int fp_code)
ASM_DECLARE_FUNCTION_SIZE (asm_out_file, stubname, stubdecl); ASM_DECLARE_FUNCTION_SIZE (asm_out_file, stubname, stubdecl);
#endif #endif
if (!FUNCTION_NAME_ALREADY_DECLARED) mips_end_function_definition (stubname);
{
fputs ("\t.end\t", asm_out_file);
assemble_name (asm_out_file, stubname);
fputs ("\n", asm_out_file);
}
/* Record this stub. */ /* Record this stub. */
l = XNEW (struct mips16_stub); l = XNEW (struct mips16_stub);
...@@ -8395,29 +8398,11 @@ mips_output_function_prologue (FILE *file, HOST_WIDE_INT size ATTRIBUTE_UNUSED) ...@@ -8395,29 +8398,11 @@ mips_output_function_prologue (FILE *file, HOST_WIDE_INT size ATTRIBUTE_UNUSED)
&& crtl->args.info.fp_code != 0) && crtl->args.info.fp_code != 0)
mips16_build_function_stub (); mips16_build_function_stub ();
/* Select the MIPS16 mode for this function. */ /* Get the function name the same way that toplev.c does before calling
if (TARGET_MIPS16) assemble_start_function. This is needed so that the name used here
fprintf (file, "\t.set\tmips16\n"); exactly matches the name used in ASM_DECLARE_FUNCTION_NAME. */
else fnname = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0);
fprintf (file, "\t.set\tnomips16\n"); mips_start_function_definition (fnname, TARGET_MIPS16);
if (!FUNCTION_NAME_ALREADY_DECLARED)
{
/* Get the function name the same way that toplev.c does before calling
assemble_start_function. This is needed so that the name used here
exactly matches the name used in ASM_DECLARE_FUNCTION_NAME. */
fnname = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0);
if (!flag_inhibit_size_directive)
{
fputs ("\t.ent\t", file);
assemble_name (file, fnname);
fputs ("\n", file);
}
assemble_name (file, fnname);
fputs (":\n", file);
}
/* Stop mips_file_end from treating this function as external. */ /* Stop mips_file_end from treating this function as external. */
if (TARGET_IRIX && mips_abi == ABI_32) if (TARGET_IRIX && mips_abi == ABI_32)
...@@ -8484,6 +8469,8 @@ static void ...@@ -8484,6 +8469,8 @@ static void
mips_output_function_epilogue (FILE *file ATTRIBUTE_UNUSED, mips_output_function_epilogue (FILE *file ATTRIBUTE_UNUSED,
HOST_WIDE_INT size ATTRIBUTE_UNUSED) HOST_WIDE_INT size ATTRIBUTE_UNUSED)
{ {
const char *fnname;
/* Reinstate the normal $gp. */ /* Reinstate the normal $gp. */
SET_REGNO (pic_offset_table_rtx, GLOBAL_POINTER_REGNUM); SET_REGNO (pic_offset_table_rtx, GLOBAL_POINTER_REGNUM);
mips_output_cplocal (); mips_output_cplocal ();
...@@ -8496,18 +8483,11 @@ mips_output_function_epilogue (FILE *file ATTRIBUTE_UNUSED, ...@@ -8496,18 +8483,11 @@ mips_output_function_epilogue (FILE *file ATTRIBUTE_UNUSED,
set_noreorder = set_nomacro = 0; set_noreorder = set_nomacro = 0;
} }
if (!FUNCTION_NAME_ALREADY_DECLARED && !flag_inhibit_size_directive) /* Get the function name the same way that toplev.c does before calling
{ assemble_start_function. This is needed so that the name used here
const char *fnname; exactly matches the name used in ASM_DECLARE_FUNCTION_NAME. */
fnname = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0);
/* Get the function name the same way that toplev.c does before calling mips_end_function_definition (fnname);
assemble_start_function. This is needed so that the name used here
exactly matches the name used in ASM_DECLARE_FUNCTION_NAME. */
fnname = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0);
fputs ("\t.end\t", file);
assemble_name (file, fnname);
fputs ("\n", file);
}
} }
/* Save register REG to MEM. Make the instruction frame-related. */ /* Save register REG to MEM. Make the instruction frame-related. */
......
...@@ -2703,10 +2703,6 @@ while (0) ...@@ -2703,10 +2703,6 @@ while (0)
#undef ASM_DECLARE_FUNCTION_NAME #undef ASM_DECLARE_FUNCTION_NAME
#define ASM_DECLARE_FUNCTION_NAME(STREAM,NAME,DECL) #define ASM_DECLARE_FUNCTION_NAME(STREAM,NAME,DECL)
#ifndef FUNCTION_NAME_ALREADY_DECLARED
#define FUNCTION_NAME_ALREADY_DECLARED 0
#endif
/* This is how to store into the string LABEL /* This is how to store into the string LABEL
the symbol_ref name of an internal numbered label where the symbol_ref name of an internal numbered label where
PREFIX is the class of label and NUM is the number within the class. PREFIX is the class of label and NUM is the number within the class.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment