From acd9204960d4417b564e75ce036618359ce5eeda Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Wed, 24 Jun 1998 18:09:06 -0700 Subject: [PATCH] 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 --- gcc/ChangeLog | 14 +++++ gcc/config/alpha/alpha.c | 104 +++++++++++++++++++++----------------- gcc/config/alpha/alpha.h | 65 ++++++------------------ gcc/config/alpha/win-nt.h | 30 +++-------- 4 files changed, 96 insertions(+), 117 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8c01484ece0..6918eb95575 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +Thu Jun 25 01:00:48 1998 Richard Henderson + + * 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) * i386/freebsd-elf.h (ASM_OUTPUT_MAX_SKIP_ALIGN): Define. diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index 172bf69b15c..f04e06509d3 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -79,11 +79,6 @@ char *alpha_mlat_string; /* -mmemory-latency= */ rtx alpha_compare_op0, alpha_compare_op1; 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 handle .files inside of functions. */ @@ -2459,6 +2454,10 @@ alpha_return_addr (count, frame) static int alpha_ra_ever_killed () { +#ifdef ASM_OUTPUT_MI_THUNK + if (current_function_is_thunk) + return 0; +#endif if (!alpha_return_addr_rtx) return regs_ever_live[REG_RA]; @@ -2930,7 +2929,7 @@ static int vms_save_fp_regno; /* Register number used to reference objects off our PV. */ static int vms_base_regno; -/* Compute register masks for saved registers. */ +/* Compute register masks for saved registers. */ static void alpha_sa_mask (imaskP, fmaskP) @@ -2941,28 +2940,30 @@ alpha_sa_mask (imaskP, fmaskP) unsigned long fmask = 0; int i; - if (TARGET_OPEN_VMS && vms_is_stack_procedure) - imask |= (1L << HARD_FRAME_POINTER_REGNUM); +#ifdef ASM_OUTPUT_MI_THUNK + if (!current_function_is_thunk) +#endif + { + if (TARGET_OPEN_VMS && vms_is_stack_procedure) + imask |= (1L << HARD_FRAME_POINTER_REGNUM); - /* One for every register we have to save. */ + /* 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) + { + if (i < 32) + imask |= (1L << i); + else + fmask |= (1L << (i - 32)); + } - for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) - if (! fixed_regs[i] && ! call_used_regs[i] - && regs_ever_live[i] && i != REG_RA) - { - if (i < 32) - imask |= (1L << i); - else - fmask |= (1L << (i - 32)); - } - - if (imask || fmask || alpha_ra_ever_killed ()) - imask |= (1L << REG_RA); + if (imask || fmask || alpha_ra_ever_killed ()) + imask |= (1L << REG_RA); + } *imaskP = imask; *fmaskP = fmask; - - return; } int @@ -2971,12 +2972,18 @@ alpha_sa_size () int sa_size = 0; int i; - /* 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++; +#ifdef ASM_OUTPUT_MI_THUNK + if (current_function_is_thunk) + sa_size = 0; + else +#endif + { + /* 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) { @@ -3070,6 +3077,11 @@ alpha_does_function_need_gp () return 1; #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. 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. */ @@ -3328,12 +3340,13 @@ alpha_expand_prologue () emit_insn (gen_blockage ()); } -/* Output the rest of the textual info surrounding the prologue. */ +/* Output the textual info surrounding the prologue. */ void -output_prologue (file, size) +alpha_start_function (file, fnname, decl) FILE *file; - HOST_WIDE_INT size; + char *fnname; + tree decl; { unsigned long imask = 0; unsigned long fmask = 0; @@ -3343,7 +3356,7 @@ output_prologue (file, size) HOST_WIDE_INT frame_size; /* Offset from base reg to register save area. */ 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; sa_size = alpha_sa_size (); @@ -3388,11 +3401,11 @@ output_prologue (file, size) if (TARGET_OPEN_VMS || !flag_inhibit_size_directive) { fputs ("\t.ent ", file); - assemble_name (file, alpha_function_name); + assemble_name (file, fnname); putc ('\n', file); } - strcpy (entry_label, alpha_function_name); + strcpy (entry_label, fnname); if (TARGET_OPEN_VMS) strcat (entry_label, "..en"); ASM_OUTPUT_LABEL (file, entry_label); @@ -3482,7 +3495,7 @@ output_prologue (file, size) fputs ("\tldgp $29,0($27)\n", file); putc ('$', file); - assemble_name (file, alpha_function_name); + assemble_name (file, fnname); fputs ("..ng:\n", file); } @@ -3491,21 +3504,21 @@ output_prologue (file, size) available then. */ readonly_section (); 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); - assemble_name (file, alpha_function_name); + assemble_name (file, fnname); fputs ("\\0\"\n", file); link_section (); fprintf (file, "\t.align 3\n"); fputs ("\t.name ", file); - assemble_name (file, alpha_function_name); + assemble_name (file, fnname); fputs ("..na\n", file); - ASM_OUTPUT_LABEL (file, alpha_function_name); + ASM_OUTPUT_LABEL (file, fnname); 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"); - alpha_need_linkage (alpha_function_name, 1); + alpha_need_linkage (fnname, 1); text_section (); #endif } @@ -3709,15 +3722,16 @@ alpha_expand_epilogue () /* Output the rest of the textual info surrounding the epilogue. */ void -output_epilogue (file, size) +alpha_end_function (file, fnname, decl) FILE *file; - int size; + char *fnname; + tree decl; { /* End the function. */ if (!flag_inhibit_size_directive) { fputs ("\t.end ", file); - assemble_name (file, alpha_function_name); + assemble_name (file, fnname); putc ('\n', file); } inside_function = FALSE; diff --git a/gcc/config/alpha/alpha.h b/gcc/config/alpha/alpha.h index f81efdfec7b..da129637cff 100644 --- a/gcc/config/alpha/alpha.h +++ b/gcc/config/alpha/alpha.h @@ -1090,7 +1090,6 @@ extern struct rtx_def *alpha_compare_op0, *alpha_compare_op1; extern int alpha_compare_fp_p; /* 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. */ extern void alpha_need_linkage (); @@ -1098,30 +1097,26 @@ extern void alpha_need_linkage (); #define ASM_COMMENT_START " #" -/* This macro produces the initial definition of a function name. On the - Alpha, we need to save the function name for the prologue and epilogue. */ +/* This macro produces the initial definition of a function. */ -extern char *alpha_function_name; +#define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \ + alpha_start_function(FILE,NAME,DECL); +extern void alpha_start_function (); -#define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \ -{ \ - alpha_function_name = NAME; \ -} +/* 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 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 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 + /* Output assembler code to FILE to increment profiler label # LABELNO for profiling a function entry. Under OSF/1, profiling is enabled by simply passing -pg to the assembler and linker. */ @@ -1170,19 +1165,6 @@ extern char *alpha_function_name; No definition is equivalent to always zero. */ #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 of a trampoline, leaving space for the variable parts. @@ -2124,16 +2106,8 @@ literal_section () \ do { \ char *fn_name = XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0); \ \ - fprintf (FILE, "\t.ent "); \ - assemble_name (FILE, alpha_function_name); \ - 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"); \ + /* Mark end of prologue. */ \ + output_end_prologue (FILE); \ \ /* Rely on the assembler to macro expand a large delta. */ \ fprintf (FILE, "\tlda $16,%ld($16)\n", (long)(DELTA)); \ @@ -2146,18 +2120,11 @@ do { \ } \ else \ { \ - fprintf (FILE, "\tlda $27,"); \ - assemble_name (FILE, fn_name); \ - fprintf (FILE, "\n\tjmp $31,($27),"); \ + 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); \ } while (0) - /* Define results of standard character escape sequences. */ #define TARGET_BELL 007 diff --git a/gcc/config/alpha/win-nt.h b/gcc/config/alpha/win-nt.h index ca35925c058..0f57cf327a2 100644 --- a/gcc/config/alpha/win-nt.h +++ b/gcc/config/alpha/win-nt.h @@ -136,36 +136,20 @@ Boston, MA 02111-1307, USA. */ /* Output code to add DELTA to the first argument, and then jump to FUNCTION. Used for C++ multiple inheritance. */ -#undef ASM_OUTPUT_MI_THUNK #define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \ 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 "); \ - assemble_name (FILE, alpha_function_name); \ - 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"); \ + /* Mark end of prologue. */ \ + output_end_prologue (FILE); \ \ /* Rely on the assembler to macro expand a large delta. */ \ fprintf (FILE, "\tlda $16,%ld($16)\n", (long)(DELTA)); \ \ + op = "jsr"; \ if (current_file_function_operand (XEXP (DECL_RTL (FUNCTION), 0))) \ - { \ - fprintf (FILE, "\tbr $31,"); \ - 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); \ + op = "br"; \ + fprintf (FILE, "\t%s $31,", op); \ + assemble_name (FILE, fn_name); \ fputc ('\n', FILE); \ } while (0) -