Commit acd92049 by Richard Henderson Committed by Richard Henderson

alpha.c (alpha_function_name): Delete.

        * alpha.c (alpha_function_name): Delete.
        (alpha_ra_ever_killed): Notice current_function_is_thunk.
        (alpha_sa_mask, alpha_sa_size, alpha_does_function_need_gp): Likewise.
        (alpha_start_function): Reorg from output_prologue.
        (alpha_end_function): Reorg from output_epilogue.
        * alpha.h (ASM_DECLARE_FUNCTION_NAME): Call alpha_start_function.
        (ASM_DECLARE_FUNCTION_SIZE): New.
        (FUNCTION_PROLOGUE, FUNCTION_EPILOGUE): Delete.
        (PROFILE_BEFORE_PROLOGUE): Set.
        (ASM_OUTPUT_MI_THUNK): Remove bits now output by start/end_function.
        * alpha/win-nt.h (ASM_OUTPUT_MI_THUNK): Likewise.

From-SVN: r20709
parent ed48174c
Thu Jun 25 01:00:48 1998 Richard Henderson <rth@cygnus.com>
* alpha.c (alpha_function_name): Delete.
(alpha_ra_ever_killed): Notice current_function_is_thunk.
(alpha_sa_mask, alpha_sa_size, alpha_does_function_need_gp): Likewise.
(alpha_start_function): Reorg from output_prologue.
(alpha_end_function): Reorg from output_epilogue.
* alpha.h (ASM_DECLARE_FUNCTION_NAME): Call alpha_start_function.
(ASM_DECLARE_FUNCTION_SIZE): New.
(FUNCTION_PROLOGUE, FUNCTION_EPILOGUE): Delete.
(PROFILE_BEFORE_PROLOGUE): Set.
(ASM_OUTPUT_MI_THUNK): Remove bits now output by start/end_function.
* alpha/win-nt.h (ASM_OUTPUT_MI_THUNK): Likewise.
Thu Jun 25 01:18:47 1998 John Wehle (john@feith.com) Thu Jun 25 01:18:47 1998 John Wehle (john@feith.com)
* i386/freebsd-elf.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Define. * i386/freebsd-elf.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Define.
......
...@@ -79,11 +79,6 @@ char *alpha_mlat_string; /* -mmemory-latency= */ ...@@ -79,11 +79,6 @@ char *alpha_mlat_string; /* -mmemory-latency= */
rtx alpha_compare_op0, alpha_compare_op1; rtx alpha_compare_op0, alpha_compare_op1;
int alpha_compare_fp_p; int alpha_compare_fp_p;
/* Save the name of the current function as used by the assembler. This
is used by the epilogue. */
char *alpha_function_name;
/* Non-zero if inside of a function, because the Alpha asm can't /* Non-zero if inside of a function, because the Alpha asm can't
handle .files inside of functions. */ handle .files inside of functions. */
...@@ -2459,6 +2454,10 @@ alpha_return_addr (count, frame) ...@@ -2459,6 +2454,10 @@ alpha_return_addr (count, frame)
static int static int
alpha_ra_ever_killed () alpha_ra_ever_killed ()
{ {
#ifdef ASM_OUTPUT_MI_THUNK
if (current_function_is_thunk)
return 0;
#endif
if (!alpha_return_addr_rtx) if (!alpha_return_addr_rtx)
return regs_ever_live[REG_RA]; return regs_ever_live[REG_RA];
...@@ -2930,7 +2929,7 @@ static int vms_save_fp_regno; ...@@ -2930,7 +2929,7 @@ static int vms_save_fp_regno;
/* Register number used to reference objects off our PV. */ /* Register number used to reference objects off our PV. */
static int vms_base_regno; static int vms_base_regno;
/* Compute register masks for saved registers. */ /* Compute register masks for saved registers. */
static void static void
alpha_sa_mask (imaskP, fmaskP) alpha_sa_mask (imaskP, fmaskP)
...@@ -2941,28 +2940,30 @@ alpha_sa_mask (imaskP, fmaskP) ...@@ -2941,28 +2940,30 @@ alpha_sa_mask (imaskP, fmaskP)
unsigned long fmask = 0; unsigned long fmask = 0;
int i; int i;
if (TARGET_OPEN_VMS && vms_is_stack_procedure) #ifdef ASM_OUTPUT_MI_THUNK
imask |= (1L << HARD_FRAME_POINTER_REGNUM); if (!current_function_is_thunk)
#endif
/* One for every register we have to save. */ {
if (TARGET_OPEN_VMS && vms_is_stack_procedure)
imask |= (1L << HARD_FRAME_POINTER_REGNUM);
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) /* One for every register we have to save. */
if (! fixed_regs[i] && ! call_used_regs[i] for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
&& regs_ever_live[i] && i != REG_RA) if (! fixed_regs[i] && ! call_used_regs[i]
{ && regs_ever_live[i] && i != REG_RA)
if (i < 32) {
imask |= (1L << i); if (i < 32)
else imask |= (1L << i);
fmask |= (1L << (i - 32)); else
} fmask |= (1L << (i - 32));
}
if (imask || fmask || alpha_ra_ever_killed ()) if (imask || fmask || alpha_ra_ever_killed ())
imask |= (1L << REG_RA); imask |= (1L << REG_RA);
}
*imaskP = imask; *imaskP = imask;
*fmaskP = fmask; *fmaskP = fmask;
return;
} }
int int
...@@ -2971,12 +2972,18 @@ alpha_sa_size () ...@@ -2971,12 +2972,18 @@ alpha_sa_size ()
int sa_size = 0; int sa_size = 0;
int i; int i;
/* One for every register we have to save. */ #ifdef ASM_OUTPUT_MI_THUNK
if (current_function_is_thunk)
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) sa_size = 0;
if (! fixed_regs[i] && ! call_used_regs[i] else
&& regs_ever_live[i] && i != REG_RA) #endif
sa_size++; {
/* One for every register we have to save. */
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
if (! fixed_regs[i] && ! call_used_regs[i]
&& regs_ever_live[i] && i != REG_RA)
sa_size++;
}
if (TARGET_OPEN_VMS) if (TARGET_OPEN_VMS)
{ {
...@@ -3070,6 +3077,11 @@ alpha_does_function_need_gp () ...@@ -3070,6 +3077,11 @@ alpha_does_function_need_gp ()
return 1; return 1;
#endif #endif
#ifdef ASM_OUTPUT_MI_THUNK
if (current_function_is_thunk)
return 1;
#endif
/* If we need a GP (we have a LDSYM insn or a CALL_INSN), load it first. /* If we need a GP (we have a LDSYM insn or a CALL_INSN), load it first.
Even if we are a static function, we still need to do this in case Even if we are a static function, we still need to do this in case
our address is taken and passed to something like qsort. */ our address is taken and passed to something like qsort. */
...@@ -3328,12 +3340,13 @@ alpha_expand_prologue () ...@@ -3328,12 +3340,13 @@ alpha_expand_prologue ()
emit_insn (gen_blockage ()); emit_insn (gen_blockage ());
} }
/* Output the rest of the textual info surrounding the prologue. */ /* Output the textual info surrounding the prologue. */
void void
output_prologue (file, size) alpha_start_function (file, fnname, decl)
FILE *file; FILE *file;
HOST_WIDE_INT size; char *fnname;
tree decl;
{ {
unsigned long imask = 0; unsigned long imask = 0;
unsigned long fmask = 0; unsigned long fmask = 0;
...@@ -3343,7 +3356,7 @@ output_prologue (file, size) ...@@ -3343,7 +3356,7 @@ output_prologue (file, size)
HOST_WIDE_INT frame_size; HOST_WIDE_INT frame_size;
/* Offset from base reg to register save area. */ /* Offset from base reg to register save area. */
HOST_WIDE_INT reg_offset; HOST_WIDE_INT reg_offset;
char *entry_label = (char *) alloca (strlen (alpha_function_name) + 6); char *entry_label = (char *) alloca (strlen (fnname) + 6);
int i; int i;
sa_size = alpha_sa_size (); sa_size = alpha_sa_size ();
...@@ -3388,11 +3401,11 @@ output_prologue (file, size) ...@@ -3388,11 +3401,11 @@ output_prologue (file, size)
if (TARGET_OPEN_VMS || !flag_inhibit_size_directive) if (TARGET_OPEN_VMS || !flag_inhibit_size_directive)
{ {
fputs ("\t.ent ", file); fputs ("\t.ent ", file);
assemble_name (file, alpha_function_name); assemble_name (file, fnname);
putc ('\n', file); putc ('\n', file);
} }
strcpy (entry_label, alpha_function_name); strcpy (entry_label, fnname);
if (TARGET_OPEN_VMS) if (TARGET_OPEN_VMS)
strcat (entry_label, "..en"); strcat (entry_label, "..en");
ASM_OUTPUT_LABEL (file, entry_label); ASM_OUTPUT_LABEL (file, entry_label);
...@@ -3482,7 +3495,7 @@ output_prologue (file, size) ...@@ -3482,7 +3495,7 @@ output_prologue (file, size)
fputs ("\tldgp $29,0($27)\n", file); fputs ("\tldgp $29,0($27)\n", file);
putc ('$', file); putc ('$', file);
assemble_name (file, alpha_function_name); assemble_name (file, fnname);
fputs ("..ng:\n", file); fputs ("..ng:\n", file);
} }
...@@ -3491,21 +3504,21 @@ output_prologue (file, size) ...@@ -3491,21 +3504,21 @@ output_prologue (file, size)
available then. */ available then. */
readonly_section (); readonly_section ();
fprintf (file, "\t.align 3\n"); fprintf (file, "\t.align 3\n");
assemble_name (file, alpha_function_name); fputs ("..na:\n", file); assemble_name (file, fnname); fputs ("..na:\n", file);
fputs ("\t.ascii \"", file); fputs ("\t.ascii \"", file);
assemble_name (file, alpha_function_name); assemble_name (file, fnname);
fputs ("\\0\"\n", file); fputs ("\\0\"\n", file);
link_section (); link_section ();
fprintf (file, "\t.align 3\n"); fprintf (file, "\t.align 3\n");
fputs ("\t.name ", file); fputs ("\t.name ", file);
assemble_name (file, alpha_function_name); assemble_name (file, fnname);
fputs ("..na\n", file); fputs ("..na\n", file);
ASM_OUTPUT_LABEL (file, alpha_function_name); ASM_OUTPUT_LABEL (file, fnname);
fprintf (file, "\t.pdesc "); fprintf (file, "\t.pdesc ");
assemble_name (file, alpha_function_name); assemble_name (file, fnname);
fprintf (file, "..en,%s\n", vms_is_stack_procedure ? "stack" : "reg"); fprintf (file, "..en,%s\n", vms_is_stack_procedure ? "stack" : "reg");
alpha_need_linkage (alpha_function_name, 1); alpha_need_linkage (fnname, 1);
text_section (); text_section ();
#endif #endif
} }
...@@ -3709,15 +3722,16 @@ alpha_expand_epilogue () ...@@ -3709,15 +3722,16 @@ alpha_expand_epilogue ()
/* Output the rest of the textual info surrounding the epilogue. */ /* Output the rest of the textual info surrounding the epilogue. */
void void
output_epilogue (file, size) alpha_end_function (file, fnname, decl)
FILE *file; FILE *file;
int size; char *fnname;
tree decl;
{ {
/* End the function. */ /* End the function. */
if (!flag_inhibit_size_directive) if (!flag_inhibit_size_directive)
{ {
fputs ("\t.end ", file); fputs ("\t.end ", file);
assemble_name (file, alpha_function_name); assemble_name (file, fnname);
putc ('\n', file); putc ('\n', file);
} }
inside_function = FALSE; inside_function = FALSE;
......
...@@ -1090,7 +1090,6 @@ extern struct rtx_def *alpha_compare_op0, *alpha_compare_op1; ...@@ -1090,7 +1090,6 @@ extern struct rtx_def *alpha_compare_op0, *alpha_compare_op1;
extern int alpha_compare_fp_p; extern int alpha_compare_fp_p;
/* Make (or fake) .linkage entry for function call. /* Make (or fake) .linkage entry for function call.
IS_LOCAL is 0 if name is used in call, 1 if name is used in definition. */ IS_LOCAL is 0 if name is used in call, 1 if name is used in definition. */
extern void alpha_need_linkage (); extern void alpha_need_linkage ();
...@@ -1098,30 +1097,26 @@ extern void alpha_need_linkage (); ...@@ -1098,30 +1097,26 @@ extern void alpha_need_linkage ();
#define ASM_COMMENT_START " #" #define ASM_COMMENT_START " #"
/* This macro produces the initial definition of a function name. On the /* This macro produces the initial definition of a function. */
Alpha, we need to save the function name for the prologue and epilogue. */
extern char *alpha_function_name;
#define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \ #define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \
{ \ alpha_start_function(FILE,NAME,DECL);
alpha_function_name = NAME; \ extern void alpha_start_function ();
}
/* This macro generates the assembly code for function entry.
FILE is a stdio stream to output the code to.
SIZE is an int: how many units of temporary storage to allocate.
Refer to the array `regs_ever_live' to determine which registers
to save; `regs_ever_live[I]' is nonzero if register number I
is ever used in the function. This macro is responsible for
knowing which registers should not be saved even if used. */
#define FUNCTION_PROLOGUE(FILE, SIZE) output_prologue (FILE, SIZE) /* This macro closes up a function definition for the assembler. */
#define ASM_DECLARE_FUNCTION_SIZE(FILE,NAME,DECL) \
alpha_end_function(FILE,NAME,DECL)
extern void alpha_end_function ();
/* This macro notes the end of the prologue. */ /* This macro notes the end of the prologue. */
#define FUNCTION_END_PROLOGUE(FILE) output_end_prologue (FILE) #define FUNCTION_END_PROLOGUE(FILE) output_end_prologue (FILE)
/* Output any profiling code before the prologue. */
#define PROFILE_BEFORE_PROLOGUE 1
/* Output assembler code to FILE to increment profiler label # LABELNO /* Output assembler code to FILE to increment profiler label # LABELNO
for profiling a function entry. Under OSF/1, profiling is enabled for profiling a function entry. Under OSF/1, profiling is enabled
by simply passing -pg to the assembler and linker. */ by simply passing -pg to the assembler and linker. */
...@@ -1170,19 +1165,6 @@ extern char *alpha_function_name; ...@@ -1170,19 +1165,6 @@ extern char *alpha_function_name;
No definition is equivalent to always zero. */ No definition is equivalent to always zero. */
#define EXIT_IGNORE_STACK 1 #define EXIT_IGNORE_STACK 1
/* This macro generates the assembly code for function exit,
on machines that need it. If FUNCTION_EPILOGUE is not defined
then individual return instructions are generated for each
return statement. Args are same as for FUNCTION_PROLOGUE.
The function epilogue should not depend on the current stack pointer!
It should use the frame pointer only. This is mandatory because
of alloca; we also take advantage of it to omit stack adjustments
before returning. */
#define FUNCTION_EPILOGUE(FILE, SIZE) output_epilogue (FILE, SIZE)
/* Output assembler code for a block containing the constant parts /* Output assembler code for a block containing the constant parts
of a trampoline, leaving space for the variable parts. of a trampoline, leaving space for the variable parts.
...@@ -2124,16 +2106,8 @@ literal_section () \ ...@@ -2124,16 +2106,8 @@ literal_section () \
do { \ do { \
char *fn_name = XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0); \ char *fn_name = XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0); \
\ \
fprintf (FILE, "\t.ent "); \ /* Mark end of prologue. */ \
assemble_name (FILE, alpha_function_name); \ output_end_prologue (FILE); \
fputc ('\n', FILE); \
ASM_OUTPUT_LABEL (FILE, alpha_function_name); \
fprintf (FILE, "\tldgp $29,0($27)\n"); \
fputc ('$', FILE); \
assemble_name (FILE, alpha_function_name); \
fprintf (FILE, "..ng:\n"); \
fprintf (FILE, "\t.frame $30,0,$26,0\n"); \
fprintf (FILE, "\t.prologue 1\n"); \
\ \
/* Rely on the assembler to macro expand a large delta. */ \ /* Rely on the assembler to macro expand a large delta. */ \
fprintf (FILE, "\tlda $16,%ld($16)\n", (long)(DELTA)); \ fprintf (FILE, "\tlda $16,%ld($16)\n", (long)(DELTA)); \
...@@ -2146,18 +2120,11 @@ do { \ ...@@ -2146,18 +2120,11 @@ do { \
} \ } \
else \ else \
{ \ { \
fprintf (FILE, "\tlda $27,"); \ fprintf (FILE, "\tjmp $31,"); \
assemble_name (FILE, fn_name); \
fprintf (FILE, "\n\tjmp $31,($27),"); \
assemble_name (FILE, fn_name); \ assemble_name (FILE, fn_name); \
fputc ('\n', FILE); \ fputc ('\n', FILE); \
} \ } \
\
fprintf (FILE, "\t.end "); \
assemble_name (FILE, alpha_function_name); \
fputc ('\n', FILE); \
} while (0) } while (0)
/* Define results of standard character escape sequences. */ /* Define results of standard character escape sequences. */
#define TARGET_BELL 007 #define TARGET_BELL 007
......
...@@ -136,36 +136,20 @@ Boston, MA 02111-1307, USA. */ ...@@ -136,36 +136,20 @@ Boston, MA 02111-1307, USA. */
/* Output code to add DELTA to the first argument, and then jump to FUNCTION. /* Output code to add DELTA to the first argument, and then jump to FUNCTION.
Used for C++ multiple inheritance. */ Used for C++ multiple inheritance. */
#undef ASM_OUTPUT_MI_THUNK
#define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \ #define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \
do { \ do { \
char *fn_name = XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0); \ char *op, *fn_name = XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0); \
\ \
fprintf (FILE, "\t.ent "); \ /* Mark end of prologue. */ \
assemble_name (FILE, alpha_function_name); \ output_end_prologue (FILE); \
fputc ('\n', FILE); \
ASM_OUTPUT_LABEL (FILE, alpha_function_name); \
fprintf (FILE, "\t.frame $30,0,$26,0\n"); \
fprintf (FILE, "\t.prologue 1\n"); \
\ \
/* Rely on the assembler to macro expand a large delta. */ \ /* Rely on the assembler to macro expand a large delta. */ \
fprintf (FILE, "\tlda $16,%ld($16)\n", (long)(DELTA)); \ fprintf (FILE, "\tlda $16,%ld($16)\n", (long)(DELTA)); \
\ \
op = "jsr"; \
if (current_file_function_operand (XEXP (DECL_RTL (FUNCTION), 0))) \ if (current_file_function_operand (XEXP (DECL_RTL (FUNCTION), 0))) \
{ \ op = "br"; \
fprintf (FILE, "\tbr $31,"); \ fprintf (FILE, "\t%s $31,", op); \
assemble_name (FILE, fn_name); \ assemble_name (FILE, fn_name); \
fputc ('\n', FILE); \
} \
else \
{ \
fprintf (FILE, "\tjmp $31,"); \
assemble_name (FILE, fn_name); \
fputc ('\n', FILE); \
} \
\
fprintf (FILE, "\t.end "); \
assemble_name (FILE, alpha_function_name); \
fputc ('\n', FILE); \ fputc ('\n', FILE); \
} while (0) } while (0)
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