diff options
author | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-07-06 18:40:17 +0000 |
---|---|---|
committer | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-07-06 18:40:17 +0000 |
commit | 17d9b0c371c482b48e92d6556c5f4b2096a4c6e7 (patch) | |
tree | 0ff4b9170093f108e4988c09e21e8b9ff5dd462a /gcc/config/m68k | |
parent | 8faa719fbc0bd299bfbc7005ddef0e3a734f49f0 (diff) | |
download | gcc-17d9b0c371c482b48e92d6556c5f4b2096a4c6e7.tar.gz |
* Makefile.in (final.o): Depend on target.h.
* final.c: Include target.h.
(default_function_pro_epilogue): New.
(final_start_function): Use target structure for function prologues.
(final_end_function): Use target structure for function epilogues.
* fold-const.c (real_hex_to_f): Constify s and p.
* output.h (default_function_pro_epilogue): New.
* real.h (real_hex_to_f): Update prototype.
* target-def.h (TARGET_ASM_FUNCTION_PROLOGUE,
TARGET_ASM_FUNCTION_EPILOGUE, TARGET_ASM_OUT): New.
(TARGET_INITIALIZER): Update.
* target.h (gcc_target): Add struct asm_out.
* doc/tm.texi: Update.
config:
Update each arch to use TARGET_ASM_FUNCTION_PROLOGUE and
TARGET_ASM_FUNCTION_EPILOGUE. Move macro code to functions
in cpu/cpu.c, or rename old functions consistently. Take
a HOST_WIDE INT not an int as the SIZE parameter. Remove now
redundant macros and prototypes. Make new functions static.
* 1750a/1750a.c: Similarly.
* 1750a/1750a.h: Similarly.
* a29k/a29k-protos.h: Similarly.
* a29k/a29k.c: Similarly.
* a29k/a29k.h: Similarly.
* arc/arc-protos.h: Similarly.
* arc/arc.c: Similarly.
* arc/arc.h: Similarly.
* arm/arm-protos.h: Similarly.
* arm/arm.c: Similarly.
* arm/arm.h: Similarly.
* avr/avr-protos.h: Similarly.
* avr/avr.c: Similarly.
* avr/avr.h: Similarly.
* clipper/clipper-protos.h: Similarly.
* clipper/clipper.c: Similarly.
* clipper/clipper.h: Similarly.
* convex/convex.c: Similarly.
* convex/convex.h: Similarly.
* d30v/d30v-protos.h: Similarly.
* d30v/d30v.c: Similarly.
* d30v/d30v.h: Similarly.
* d30v/d30v.md: Similarly.
* dsp16xx/dsp16xx-protos.h: Similarly.
* dsp16xx/dsp16xx.c: Similarly.
* dsp16xx/dsp16xx.h: Similarly.
* elxsi/elxsi.c: Similarly.
* elxsi/elxsi.h: Similarly.
* fr30/fr30.c: Similarly.
* fr30/fr30.md: Similarly.
* h8300/h8300-protos.h: Similarly.
* h8300/h8300.c: Similarly.
* h8300/h8300.h: Similarly.
* i370/i370-protos.h: Similarly.
* i370/i370.c: Similarly.
* i370/i370.h: Similarly.
* i386/i386.c: Similarly.
* i386/osf1elf.h: Similarly.
* i386/osfrose.h: Similarly.
* i860/i860-protos.h: Similarly.
* i860/i860.c: Similarly.
* i860/i860.h: Similarly.
* i960/i960-protos.h: Similarly.
* i960/i960.c: Similarly.
* i960/i960.h: Similarly.
* ia64/ia64-protos.h: Similarly.
* ia64/ia64.c: Similarly.
* ia64/ia64.h: Similarly.
* m32r/m32r-protos.h: Similarly.
* m32r/m32r.c: Similarly.
* m32r/m32r.h: Similarly.
* m68hc11/m68hc11-protos.h: Similarly.
* m68hc11/m68hc11.c: Similarly.
* m68hc11/m68hc11.h: Similarly.
* m68k/crds.h: Similarly.
* m68k/dpx2.h: Similarly.
* m68k/m68k-protos.h: Similarly.
* m68k/m68k.c: Similarly.
* m68k/m68k.h: Similarly.
* m68k/news.h: Similarly.
* m88k/m88k-protos.h: Similarly.
* m88k/m88k.c: Similarly.
* m88k/m88k.h: Similarly.
* mips/mips-protos.h: Similarly.
* mips/mips.c: Similarly.
* mips/mips.h: Similarly.
* ns32k/merlin.h: Similarly.
* ns32k/ns32k.c: Similarly.
* ns32k/ns32k.h: Similarly.
* ns32k/tek6000.h: Similarly.
* pa/pa-protos.h: Similarly.
* pa/pa.c: Similarly.
* pa/pa.h: Similarly.
* pdp11/2bsd.h: Similarly.
* pdp11/pdp11-protos.h: Similarly.
* pdp11/pdp11.c: Similarly.
* pdp11/pdp11.h: Similarly.
* romp/romp-protos.h: Similarly.
* romp/romp.c: Similarly.
* romp/romp.h: Similarly.
* rs6000/rs6000-protos.h: Similarly.
* rs6000/rs6000.c: Similarly.
* rs6000/rs6000.h: Similarly.
* rs6000/sysv4.h: Similarly.
* sh/sh-protos.h: Similarly.
* sh/sh.c: Similarly.
* sh/sh.h: Similarly.
* sparc/sparc-protos.h: Similarly.
* sparc/sparc.c: Similarly.
* sparc/sparc.h: Similarly.
* vax/vax.c: Similarly.
* vax/vax.h: Similarly.
* vax/vms.h: Similarly.
* we32k/we32k.c: Similarly.
* we32k/we32k.h: Similarly.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@43817 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/m68k')
-rw-r--r-- | gcc/config/m68k/crds.h | 152 | ||||
-rw-r--r-- | gcc/config/m68k/dpx2.h | 265 | ||||
-rw-r--r-- | gcc/config/m68k/m68k-protos.h | 2 | ||||
-rw-r--r-- | gcc/config/m68k/m68k.c | 639 | ||||
-rw-r--r-- | gcc/config/m68k/m68k.h | 6 | ||||
-rw-r--r-- | gcc/config/m68k/news.h | 105 |
6 files changed, 627 insertions, 542 deletions
diff --git a/gcc/config/m68k/crds.h b/gcc/config/m68k/crds.h index 12f0fb797bc..b2442d48770 100644 --- a/gcc/config/m68k/crds.h +++ b/gcc/config/m68k/crds.h @@ -459,160 +459,8 @@ do { int i; \ (sdb_begin_function_line \ ? last_linenum - sdb_begin_function_line : 1)) -/* 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. */ - -/* Note that the order of the bit mask for fmovem is the opposite - of the order for movem! */ - -#undef FUNCTION_PROLOGUE -#define FUNCTION_PROLOGUE(FILE, SIZE) \ -{ register int regno; \ - register int mask = 0; \ - extern char call_used_regs[]; \ - int fsize = ((SIZE) + 3) & -4; \ - /* unos stack probe */ \ - if ( fsize > 30000 ) { \ - fprintf (FILE, "\tmovel sp,a0\n"); \ - fprintf (FILE, "\taddl $-%d,a0\n", 2048 + fsize); \ - fprintf (FILE, "\ttstb (a0)\n"); \ - } else { \ - fprintf (FILE, "\ttstb -%d(sp)\n", 2048 + fsize); \ - } \ - if (frame_pointer_needed) \ - { if (TARGET_68020 || fsize < 0x8000) \ - fprintf (FILE, "\tlink a6,$%d\n", -fsize); \ - else \ - fprintf (FILE, "\tlink a6,$0\n\tsubl $%d,sp\n", fsize); } \ - else if (fsize) \ - { \ - /* Adding negative number is faster on the 68040. */ \ - if (fsize + 4 < 0x8000) \ - { \ - fprintf (FILE, "\tadd.w #%d,sp\n", - (fsize + 4)); \ - } \ - else \ - { \ - fprintf (FILE, "\tadd.l #%d,sp\n", - (fsize + 4)); \ - } \ - } \ - for (regno = 16; regno < 24; regno++) \ - if (regs_ever_live[regno] && ! call_used_regs[regno]) \ - mask |= 1 << (regno - 16); \ - if ((mask & 0xff) != 0) \ - fprintf (FILE, "\tfmovem $0x%x,-(sp)\n", mask & 0xff); \ - mask = 0; \ - for (regno = 0; regno < 16; regno++) \ - if (regs_ever_live[regno] && ! call_used_regs[regno]) \ - mask |= 1 << (15 - regno); \ - if (frame_pointer_needed) \ - mask &= ~ (1 << (15-FRAME_POINTER_REGNUM)); \ - if (exact_log2 (mask) >= 0) \ - fprintf (FILE, "\tmovel %s,-(sp)\n", reg_names[15 - exact_log2 (mask)]); \ - else if (mask) fprintf (FILE, "\tmovem $0x%x,-(sp)\n", mask); } - /* Must put address in %a0 , not %d0 . -- LGM, 7/15/88 */ /* UNOS ?? */ #undef FUNCTION_PROFILER #define FUNCTION_PROFILER(FILE, LABEL_NO) \ fprintf (FILE, "\tmovl &LP%%%d,%%a0\n\tjsr mcount\n", (LABEL_NO)) - -/* 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. */ - -#undef FUNCTION_EPILOGUE -#define FUNCTION_EPILOGUE(FILE, SIZE) \ -{ register int regno; \ - register int mask, fmask; \ - register int nregs; \ - int offset, foffset, fpoffset; \ - extern char call_used_regs[]; \ - int fsize = ((SIZE) + 3) & -4; \ - int big = 0; \ - nregs = 0; fmask = 0; fpoffset = 0; \ - for (regno = 16; regno < 24; regno++) \ - if (regs_ever_live[regno] && ! call_used_regs[regno]) \ - { nregs++; fmask |= 1 << (23 - regno); } \ - foffset = fpoffset + nregs * 12; \ - nregs = 0; mask = 0; \ - if (frame_pointer_needed) regs_ever_live[FRAME_POINTER_REGNUM] = 0; \ - for (regno = 0; regno < 16; regno++) \ - if (regs_ever_live[regno] && ! call_used_regs[regno]) \ - { nregs++; mask |= 1 << regno; } \ - offset = foffset + nregs * 4; \ - if (offset + fsize >= 0x8000 \ - && frame_pointer_needed \ - && (mask || fmask || fpoffset)) \ - { fprintf (FILE, "\tmovel $%d,a0\n", -fsize); \ - fsize = 0, big = 1; } \ - if (exact_log2 (mask) >= 0) { \ - if (big) \ - fprintf (FILE, "\tmovel -%d(a6,a0.l),%s\n", \ - offset + fsize, reg_names[exact_log2 (mask)]); \ - else if (! frame_pointer_needed) \ - fprintf (FILE, "\tmovel (sp)+,%s\n", \ - reg_names[exact_log2 (mask)]); \ - else \ - fprintf (FILE, "\tmovel -%d(a6),%s\n", \ - offset + fsize, reg_names[exact_log2 (mask)]); } \ - else if (mask) { \ - if (big) \ - fprintf (FILE, "\tmovem -%d(a6,a0.l),$0x%x\n", \ - offset + fsize, mask); \ - else if (! frame_pointer_needed) \ - fprintf (FILE, "\tmovem (sp)+,$0x%x\n", mask); \ - else \ - fprintf (FILE, "\tmovem -%d(a6),$0x%x\n", \ - offset + fsize, mask); } \ - if (fmask) { \ - if (big) \ - fprintf (FILE, "\tfmovem -%d(a6,a0.l),$0x%x\n", \ - foffset + fsize, fmask); \ - else if (! frame_pointer_needed) \ - fprintf (FILE, "\tfmovem (sp)+,$0x%x\n", fmask); \ - else \ - fprintf (FILE, "\tfmovem -%d(a6),$0x%x\n", \ - foffset + fsize, fmask); } \ - if (fpoffset != 0) \ - for (regno = 55; regno >= 24; regno--) \ - if (regs_ever_live[regno] && ! call_used_regs[regno]) { \ - if (big) \ - fprintf(FILE, "\tfpmoved -%d(a6,a0.l), %s\n", \ - fpoffset + fsize, reg_names[regno]); \ - else if (! frame_pointer_needed) \ - fprintf(FILE, "\tfpmoved (sp)+, %s\n", \ - reg_names[regno]); \ - else \ - fprintf(FILE, "\tfpmoved -%d(a6), %s\n", \ - fpoffset + fsize, reg_names[regno]); \ - fpoffset -= 8; \ - } \ - if (frame_pointer_needed) \ - fprintf (FILE, "\tunlk a6\n"); \ - else if (fsize) \ - { \ - if (fsize + 4 < 0x8000) \ - { \ - fprintf (FILE, "\tadd.w #%d,sp\n", fsize + 4); \ - } \ - else \ - { \ - fprintf (FILE, "\tadd.l #%d,sp\n", fsize + 4); \ - } \ - } \ - if (current_function_pops_args) \ - fprintf (FILE, "\trtd $%d\n", current_function_pops_args); \ - else fprintf (FILE, "\trts\n"); } - diff --git a/gcc/config/m68k/dpx2.h b/gcc/config/m68k/dpx2.h index 0b45c8273ef..886a34b2f7a 100644 --- a/gcc/config/m68k/dpx2.h +++ b/gcc/config/m68k/dpx2.h @@ -31,6 +31,8 @@ Boston, MA 02111-1307, USA. */ #undef SELECT_RTX_SECTION #include "svr3.h" +#define DPX2 + /* See m68k.h. 7 means 68020 with 68881. * We really have 68030 and 68882, * but this will get us going. @@ -238,269 +240,6 @@ Boston, MA 02111-1307, USA. */ /* Output type in decimal not in octal as done in sdbout.c */ #define PUT_SDB_TYPE(a) fprintf(asm_out_file, "\t.type\t0%d%s", a, SDB_DELIM) -#undef FUNCTION_PROLOGUE -#define FUNCTION_PROLOGUE(FILE, SIZE) \ -{ \ - register int regno; \ - register int mask = 0; \ - int num_saved_regs = 0, first = 1; \ - extern char call_used_regs[]; \ - int fsize = ((SIZE) + 3) & -4; \ - \ - \ - if (frame_pointer_needed) \ - { \ - /* Adding negative number is faster on the 68040. */ \ - if (fsize < 0x8000 && !TARGET_68040) \ - { \ - fprintf (FILE, "\tlink %s,#%d\n", \ - reg_names[FRAME_POINTER_REGNUM], -fsize); \ - } \ - else if (TARGET_68020) \ - { \ - fprintf (FILE, "\tlink %s,#%d\n", \ - reg_names[FRAME_POINTER_REGNUM], -fsize); \ - } \ - else \ - { \ - fprintf (FILE, "\tlink %s,#0\n\tadd.l #%d,sp\n", \ - reg_names[FRAME_POINTER_REGNUM], -fsize); \ - } \ - } \ - else if (fsize) \ - { \ - /* Adding negative number is faster on the 68040. */ \ - if (fsize + 4 < 0x8000) \ - { \ - fprintf (FILE, "\tadd.w #%d,sp\n", - (fsize + 4)); \ - } \ - else \ - { \ - fprintf (FILE, "\tadd.l #%d,sp\n", - (fsize + 4)); \ - } \ - } \ - for (regno = 23; regno >= 16; regno--) \ - if (regs_ever_live[regno] && ! call_used_regs[regno]) \ - if (first) { \ - fprintf (FILE, "\tfmovem.x %s", reg_names[regno]); \ - first = 0; \ - } \ - else fprintf (FILE, "/%s", reg_names[regno]); \ - if (!first) fprintf (FILE, ",-(sp)\n"); \ - \ - mask = 0; \ - for (regno = 0; regno < 16; regno++) \ - if (regs_ever_live[regno] && ! call_used_regs[regno]) \ - { \ - mask |= 1 << (15 - regno); \ - num_saved_regs++; \ - } \ - if (frame_pointer_needed) \ - { \ - mask &= ~ (1 << (15 - FRAME_POINTER_REGNUM)); \ - num_saved_regs--; \ - } \ - \ - \ - if (num_saved_regs <= 2) \ - { \ - /* Store each separately in the same order moveml uses. \ - Using two movel instructions instead of a single moveml \ - is about 15% faster for the 68020 and 68030 at no expense \ - in code size */ \ - \ - int i; \ - \ - /* Undo the work from above. */ \ - for (i = 0; i< 16; i++) \ - if (mask & (1 << i)) \ - fprintf (FILE, "\tmove.l %s,-(sp)\n", reg_names[15 - i]); \ - } \ - else if (mask) \ - { \ - first = 1; \ - for (regno = 0; regno < 16; regno++) \ - if (mask & (1 << regno)) \ - if (first) { \ - fprintf (FILE, "\tmovem.l %s", reg_names[15 - regno]); \ - first = 0; \ - } \ - else fprintf (FILE, "/%s", reg_names[15 - regno]); \ - fprintf (FILE, ",-(sp)\n"); \ - } \ - if (flag_pic && current_function_uses_pic_offset_table) \ - { \ - fprintf (FILE, "\tmove.l #__GLOBAL_OFFSET_TABLE_, %s\n", \ - reg_names[PIC_OFFSET_TABLE_REGNUM]); \ - fprintf (FILE, "\tlea.l (pc,%s.l),%s\n", \ - reg_names[PIC_OFFSET_TABLE_REGNUM], \ - reg_names[PIC_OFFSET_TABLE_REGNUM]); \ - } \ -} - - -#undef FUNCTION_EPILOGUE -#define FUNCTION_EPILOGUE(FILE, SIZE) \ -{ \ - register int regno; \ - register int mask, fmask; \ - register int nregs; \ - int offset, foffset, fpoffset, first = 1; \ - extern char call_used_regs[]; \ - int fsize = ((SIZE) + 3) & -4; \ - int big = 0; \ - rtx insn = get_last_insn (); \ - \ - /* If the last insn was a BARRIER, we don't have to write any code. */ \ - if (GET_CODE (insn) == NOTE) \ - insn = prev_nonnote_insn (insn); \ - if (insn && GET_CODE (insn) == BARRIER) \ - { \ - /* Output just a no-op so that debuggers don't get confused \ - about which function the pc is in at this address. */ \ - fprintf (FILE, "\tnop\n"); \ - return; \ - } \ - \ - nregs = 0; fmask = 0; fpoffset = 0; \ - for (regno = 16; regno < 24; regno++) \ - if (regs_ever_live[regno] && ! call_used_regs[regno]) \ - { \ - nregs++; \ - fmask |= 1 << (23 - regno); \ - } \ - foffset = fpoffset + nregs * 12; \ - nregs = 0; mask = 0; \ - if (frame_pointer_needed) \ - regs_ever_live[FRAME_POINTER_REGNUM] = 0; \ - for (regno = 0; regno < 16; regno++) \ - if (regs_ever_live[regno] && ! call_used_regs[regno]) \ - { \ - nregs++; \ - mask |= 1 << regno; \ - } \ - offset = foffset + nregs * 4; \ - if (offset + fsize >= 0x8000 \ - && frame_pointer_needed \ - && (mask || fmask || fpoffset)) \ - { \ - fprintf (FILE, "\tmove.l #%d,a0\n", -fsize); \ - fsize = 0, big = 1; \ - } \ - if (nregs <= 2) \ - { \ - /* Restore each separately in the same order moveml does. \ - Using two movel instructions instead of a single moveml \ - is about 15% faster for the 68020 and 68030 at no expense \ - in code size. */ \ - \ - int i; \ - \ - /* Undo the work from above. */ \ - for (i = 0; i< 16; i++) \ - if (mask & (1 << i)) \ - { \ - if (big) \ - { \ - fprintf (FILE, "\tmove.l -%d(%s,a0.l),%s\n", \ - offset + fsize, \ - reg_names[FRAME_POINTER_REGNUM], \ - reg_names[i]); \ - } \ - else if (! frame_pointer_needed) \ - { \ - fprintf (FILE, "\tmove.l (sp)+,%s\n", \ - reg_names[i]); \ - } \ - else \ - { \ - fprintf (FILE, "\tmove.l -%d(%s),%s\n", \ - offset + fsize, \ - reg_names[FRAME_POINTER_REGNUM], \ - reg_names[i]); \ - } \ - offset = offset - 4; \ - } \ - } \ - else if (mask) \ - { \ - first = 1; \ - for (regno = 0; regno < 16; regno++) \ - if (mask & (1 << regno)) \ - if (first && big) { \ - fprintf (FILE, "\tmovem.l -%d(%s,a0.l),%s", \ - offset + fsize, \ - reg_names[FRAME_POINTER_REGNUM], \ - reg_names[regno]); \ - first = 0; \ - } \ - else if (first && ! frame_pointer_needed) { \ - fprintf (FILE, "\tmovem.l (sp)+,%s", \ - offset + fsize, \ - reg_names[FRAME_POINTER_REGNUM], \ - reg_names[regno]); \ - first = 0; \ - } \ - else if (first) { \ - fprintf (FILE, "\tmovem.l -%d(%s),%s", \ - offset + fsize, \ - reg_names[FRAME_POINTER_REGNUM], \ - reg_names[regno]); \ - first = 0; \ - } \ - else \ - fprintf (FILE, "/%s", reg_names[regno]); \ - fprintf (FILE, "\n"); \ - } \ - if (fmask) \ - { \ - first = 1; \ - for (regno = 16; regno < 24; regno++) \ - if (fmask & (1 << (23 - regno))) \ - if (first && big) { \ - fprintf (FILE, "\tfmovem.x -%d(%s,a0.l),%s", \ - foffset + fsize, \ - reg_names[FRAME_POINTER_REGNUM], \ - reg_names[regno]); \ - first = 0; \ - } \ - else if (first && ! frame_pointer_needed) { \ - fprintf (FILE, "\tfmovem.x (sp)+,%s", \ - foffset + fsize, \ - reg_names[FRAME_POINTER_REGNUM], \ - reg_names[regno]); \ - first = 0; \ - } \ - else if (first) { \ - fprintf (FILE, "\tfmovem.x -%d(%s),%s", \ - foffset + fsize, \ - reg_names[FRAME_POINTER_REGNUM], \ - reg_names[regno]); \ - first = 0; \ - } \ - else fprintf (FILE, "/%s", reg_names[regno]); \ - fprintf (FILE, "\n"); \ - } \ - if (frame_pointer_needed) \ - fprintf (FILE, "\tunlk %s\n", \ - reg_names[FRAME_POINTER_REGNUM]); \ - else if (fsize) \ - { \ - if (fsize + 4 < 0x8000) \ - { \ - fprintf (FILE, "\tadd.w #%d,sp\n", fsize + 4); \ - } \ - else \ - { \ - fprintf (FILE, "\tadd.l #%d,sp\n", fsize + 4); \ - } \ - } \ - if (current_function_pops_args) \ - fprintf (FILE, "\trtd #%d\n", current_function_pops_args); \ - else \ - fprintf (FILE, "\trts\n"); \ -} - /* Translate Motorola opcodes such as `jbeq' into VERSAdos opcodes such as `beq'. Change `fbeq' to `fbseq', `fbne' to `fbsneq'. diff --git a/gcc/config/m68k/m68k-protos.h b/gcc/config/m68k/m68k-protos.h index b73c628a9ff..6a132beeb62 100644 --- a/gcc/config/m68k/m68k-protos.h +++ b/gcc/config/m68k/m68k-protos.h @@ -65,8 +65,6 @@ extern rtx legitimize_pic_address PARAMS ((rtx, enum machine_mode, rtx)); #endif /* RTX_CODE */ extern int flags_in_68881 PARAMS ((void)); -extern void output_function_prologue PARAMS ((FILE *, int)); -extern void output_function_epilogue PARAMS ((FILE *, int)); extern int use_return_insn PARAMS ((void)); extern void override_options PARAMS ((void)); extern void init_68881_table PARAMS ((void)); diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c index 8eaee6ec424..5df64bf1503 100644 --- a/gcc/config/m68k/m68k.c +++ b/gcc/config/m68k/m68k.c @@ -56,6 +56,8 @@ int switch_table_difference_label_flag; static rtx find_addr_reg PARAMS ((rtx)); static const char *singlemove_string PARAMS ((rtx *)); +static void m68k_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT)); +static void m68k_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT)); /* Alignment to use for loops and jumps */ @@ -79,6 +81,10 @@ int m68k_align_funcs; int m68k_last_compare_had_fp_operands; /* Initialize the GCC target structure. */ +#undef TARGET_ASM_FUNCTION_PROLOGUE +#define TARGET_ASM_FUNCTION_PROLOGUE m68k_output_function_prologue +#undef TARGET_ASM_FUNCTION_EPILOGUE +#define TARGET_ASM_FUNCTION_EPILOGUE m68k_output_function_epilogue struct gcc_target target = TARGET_INITIALIZER; @@ -146,18 +152,236 @@ override_options () /* Note that the order of the bit mask for fmovem is the opposite of the order for movem! */ +#ifdef CRDS -void -output_function_prologue (stream, size) +static void +m68k_output_function_prologue (stream, size) + FILE *stream; + HOST_WIDE_INT size; +{ + register int regno; + register int mask = 0; + extern char call_used_regs[]; + HOST_WIDE_INT fsize = ((size) + 3) & -4; + + /* unos stack probe */ + if (fsize > 30000) + { + fprintf (stream, "\tmovel sp,a0\n"); + fprintf (stream, "\taddl $-%d,a0\n", 2048 + fsize); + fprintf (stream, "\ttstb (a0)\n"); + } + else + fprintf (stream, "\ttstb -%d(sp)\n", 2048 + fsize); + + if (frame_pointer_needed) + { + if (TARGET_68020 || fsize < 0x8000) + fprintf (stream, "\tlink a6,$%d\n", -fsize); + else + fprintf (stream, "\tlink a6,$0\n\tsubl $%d,sp\n", fsize); + } + else if (fsize) + { + /* Adding negative number is faster on the 68040. */ + if (fsize + 4 < 0x8000) + fprintf (stream, "\tadd.w #%d,sp\n", - (fsize + 4)); + else + fprintf (stream, "\tadd.l #%d,sp\n", - (fsize + 4)); + } + + for (regno = 16; regno < 24; regno++) + if (regs_ever_live[regno] && ! call_used_regs[regno]) + mask |= 1 << (regno - 16); + + if ((mask & 0xff) != 0) + fprintf (stream, "\tfmovem $0x%x,-(sp)\n", mask & 0xff); + + mask = 0; + for (regno = 0; regno < 16; regno++) + if (regs_ever_live[regno] && ! call_used_regs[regno]) + mask |= 1 << (15 - regno); + if (frame_pointer_needed) + mask &= ~ (1 << (15-FRAME_POINTER_REGNUM)); + + if (exact_log2 (mask) >= 0) + fprintf (stream, "\tmovel %s,-(sp)\n", reg_names[15 - exact_log2 (mask)]); + else if (mask) + fprintf (stream, "\tmovem $0x%x,-(sp)\n", mask); +} + +#else +#if defined (DPX2) && defined (MOTOROLA) + +static void +m68k_output_function_prologue (stream, size) + FILE *stream; + HOST_WIDE_INT size; +{ + register int regno; + register int mask = 0; + int num_saved_regs = 0, first = 1; + extern char call_used_regs[]; + HOST_WIDE_INT fsize = ((size) + 3) & -4; + + if (frame_pointer_needed) + { + /* Adding negative number is faster on the 68040. */ + if (fsize < 0x8000 && !TARGET_68040) + fprintf (stream, "\tlink %s,#%d\n", + reg_names[FRAME_POINTER_REGNUM], -fsize); + else if (TARGET_68020) + fprintf (stream, "\tlink %s,#%d\n", + reg_names[FRAME_POINTER_REGNUM], -fsize); + else + fprintf (stream, "\tlink %s,#0\n\tadd.l #%d,sp\n", + reg_names[FRAME_POINTER_REGNUM], -fsize); + } + else if (fsize) + { + /* Adding negative number is faster on the 68040. */ + if (fsize + 4 < 0x8000) + fprintf (stream, "\tadd.w #%d,sp\n", - (fsize + 4)); + else + fprintf (stream, "\tadd.l #%d,sp\n", - (fsize + 4)); + } + + for (regno = 23; regno >= 16; regno--) + if (regs_ever_live[regno] && ! call_used_regs[regno]) + { + if (first) + { + fprintf (stream, "\tfmovem.x %s", reg_names[regno]); + first = 0; + } + else + fprintf (stream, "/%s", reg_names[regno]); + } + if (!first) + fprintf (stream, ",-(sp)\n"); + + mask = 0; + for (regno = 0; regno < 16; regno++) + if (regs_ever_live[regno] && ! call_used_regs[regno]) + { + mask |= 1 << (15 - regno); + num_saved_regs++; + } + + if (frame_pointer_needed) + { + mask &= ~ (1 << (15 - FRAME_POINTER_REGNUM)); + num_saved_regs--; + } + + if (num_saved_regs <= 2) + { + /* Store each separately in the same order moveml uses. + Using two movel instructions instead of a single moveml + is about 15% faster for the 68020 and 68030 at no expense + in code size */ + + int i; + + /* Undo the work from above. */ + for (i = 0; i< 16; i++) + if (mask & (1 << i)) + fprintf (stream, "\tmove.l %s,-(sp)\n", reg_names[15 - i]); + } + else if (mask) + { + first = 1; + for (regno = 0; regno < 16; regno++) + if (mask & (1 << regno)) + { + if (first) + { + fprintf (stream, "\tmovem.l %s", reg_names[15 - regno]); + first = 0; + } + else + fprintf (stream, "/%s", reg_names[15 - regno]); + } + fprintf (stream, ",-(sp)\n"); + } + + if (flag_pic && current_function_uses_pic_offset_table) + { + fprintf (stream, "\tmove.l #__GLOBAL_OFFSET_TABLE_, %s\n", + reg_names[PIC_OFFSET_TABLE_REGNUM]); + fprintf (stream, "\tlea.l (pc,%s.l),%s\n", + reg_names[PIC_OFFSET_TABLE_REGNUM], + reg_names[PIC_OFFSET_TABLE_REGNUM]); + } +} + +#else +#if defined (NEWS) && defined (MOTOROLA) + +static void +m68k_output_function_prologue (stream, size) FILE *stream; - int size; + HOST_WIDE_INT size; +{ + register int regno; + register int mask = 0; + extern char call_used_regs[]; + HOST_WIDE_INT fsize = ((size) + 3) & -4; + + if (frame_pointer_needed) + { + if (fsize < 0x8000) + fprintf (stream, "\tlink fp,#%d\n", -fsize); + else if (TARGET_68020) + fprintf (stream, "\tlink.l fp,#%d\n", -fsize); + else + fprintf (stream, "\tlink fp,#0\n\tsub.l #%d,sp\n", fsize); + } + else if (fsize) + { + int amt = fsize + 4; + /* Adding negative number is faster on the 68040. */ + if (fsize + 4 < 0x8000) + asm_fprintf (stream, "\tadd.w %0I%d,%Rsp\n", - amt); + else + asm_fprintf (stream, "\tadd.l %0I%d,%Rsp\n", - amt); + } + + for (regno = 16; regno < FIRST_PSEUDO_REGISTER; regno++) + if (regs_ever_live[regno] && ! call_used_regs[regno]) + mask |= 1 << (regno - 16); + + if (mask != 0) + fprintf (stream, "\tfmovem.x #0x%x,-(sp)\n", mask & 0xff); + + mask = 0; + for (regno = 0; regno < 16; regno++) + if (regs_ever_live[regno] && ! call_used_regs[regno]) + mask |= 1 << (15 - regno); + + if (frame_pointer_needed) + mask &= ~ (1 << (15-FRAME_POINTER_REGNUM)); + + if (exact_log2 (mask) >= 0) + fprintf (stream, "\tmove.l %s,-(sp)\n", reg_names[15 - exact_log2 (mask)]); + else + if (mask) fprintf (stream, "\tmovem.l #0x%x,-(sp)\n", mask); +} + +#else /* !CRDS && ! (NEWS && MOTOROLA) && ! (DPX2 && MOTOROLA) */ + +static void +m68k_output_function_prologue (stream, size) + FILE *stream; + HOST_WIDE_INT size; { register int regno; register int mask = 0; int num_saved_regs = 0; extern char call_used_regs[]; - int fsize = (size + 3) & -4; - int cfa_offset = INCOMING_FRAME_SP_OFFSET, cfa_store_offset = cfa_offset; + HOST_WIDE_INT fsize = (size + 3) & -4; + HOST_WIDE_INT cfa_offset = INCOMING_FRAME_SP_OFFSET; + HOST_WIDE_INT cfa_store_offset = cfa_offset; /* If the stack limit is a symbol, we can check it here, before actually allocating the space. */ @@ -385,11 +609,7 @@ output_function_prologue (stream, size) #if NEED_PROBE #ifdef MOTOROLA -#ifdef CRDS - asm_fprintf (stream, "\ttstl %d(%Rsp)\n", NEED_PROBE - num_saved_regs * 4); -#else asm_fprintf (stream, "\ttst.l %d(%Rsp)\n", NEED_PROBE - num_saved_regs * 4); -#endif #else asm_fprintf (stream, "\ttstl %Rsp@(%d)\n", NEED_PROBE - num_saved_regs * 4); #endif @@ -515,6 +735,9 @@ output_function_prologue (stream, size) #endif } } +#endif /* ! (DPX2 && MOTOROLA) */ +#endif /* ! (NEWS && MOTOROLA) */ +#endif /* !CRDS */ /* Return true if this function's epilogue can be output as RTL. */ @@ -540,24 +763,406 @@ use_return_insn () } /* This function generates the assembly code for function exit, - on machines that need it. Args are same as for FUNCTION_PROLOGUE. + on machines that need it. The function epilogue should not depend on the current stack pointer! It should use the frame pointer only, if there is a frame pointer. This is mandatory because of alloca; we also take advantage of it to omit stack adjustments before returning. */ -void -output_function_epilogue (stream, size) +#ifdef CRDS + +static void +m68k_output_function_epilogue (stream, size) FILE *stream; - int size; + HOST_WIDE_INT size; { register int regno; register int mask, fmask; register int nregs; - int offset, foffset, fpoffset; + HOST_WIDE_INT offset, foffset, fpoffset; extern char call_used_regs[]; - int fsize = (size + 3) & -4; + HOST_WIDE_INT fsize = ((size) + 3) & -4; + int big = 0; + + nregs = 0; fmask = 0; fpoffset = 0; + for (regno = 16; regno < 24; regno++) + if (regs_ever_live[regno] && ! call_used_regs[regno]) + { + nregs++; + fmask |= 1 << (23 - regno); + } + + foffset = fpoffset + nregs * 12; + nregs = 0; mask = 0; + if (frame_pointer_needed) + regs_ever_live[FRAME_POINTER_REGNUM] = 0; + + for (regno = 0; regno < 16; regno++) + if (regs_ever_live[regno] && ! call_used_regs[regno]) + { + nregs++; + mask |= 1 << regno; + } + + offset = foffset + nregs * 4; + if (offset + fsize >= 0x8000 + && frame_pointer_needed + && (mask || fmask || fpoffset)) + { + fprintf (stream, "\tmovel $%d,a0\n", -fsize); + fsize = 0, big = 1; + } + + if (exact_log2 (mask) >= 0) + { + if (big) + fprintf (stream, "\tmovel -%d(a6,a0.l),%s\n", + offset + fsize, reg_names[exact_log2 (mask)]); + else if (! frame_pointer_needed) + fprintf (stream, "\tmovel (sp)+,%s\n", + reg_names[exact_log2 (mask)]); + else + fprintf (stream, "\tmovel -%d(a6),%s\n", + offset + fsize, reg_names[exact_log2 (mask)]); + } + else if (mask) + { + if (big) + fprintf (stream, "\tmovem -%d(a6,a0.l),$0x%x\n", + offset + fsize, mask); + else if (! frame_pointer_needed) + fprintf (stream, "\tmovem (sp)+,$0x%x\n", mask); + else + fprintf (stream, "\tmovem -%d(a6),$0x%x\n", + offset + fsize, mask); + } + + if (fmask) + { + if (big) + fprintf (stream, "\tfmovem -%d(a6,a0.l),$0x%x\n", + foffset + fsize, fmask); + else if (! frame_pointer_needed) + fprintf (stream, "\tfmovem (sp)+,$0x%x\n", fmask); + else + fprintf (stream, "\tfmovem -%d(a6),$0x%x\n", + foffset + fsize, fmask); + } + + if (fpoffset != 0) + for (regno = 55; regno >= 24; regno--) + if (regs_ever_live[regno] && ! call_used_regs[regno]) + { + if (big) + fprintf(stream, "\tfpmoved -%d(a6,a0.l), %s\n", + fpoffset + fsize, reg_names[regno]); + else if (! frame_pointer_needed) + fprintf(stream, "\tfpmoved (sp)+, %s\n", + reg_names[regno]); + else + fprintf(stream, "\tfpmoved -%d(a6), %s\n", + fpoffset + fsize, reg_names[regno]); + fpoffset -= 8; + } + + if (frame_pointer_needed) + fprintf (stream, "\tunlk a6\n"); + else if (fsize) + { + if (fsize + 4 < 0x8000) + fprintf (stream, "\tadd.w #%d,sp\n", fsize + 4); + else + fprintf (stream, "\tadd.l #%d,sp\n", fsize + 4); + } + + if (current_function_pops_args) + fprintf (stream, "\trtd $%d\n", current_function_pops_args); + else + fprintf (stream, "\trts\n"); +} + +#else +#if defined (DPX2) && defined (MOTOROLA) + +static void +m68k_output_function_epilogue (stream, size) + FILE *stream; + HOST_WIDE_INT size; +{ + register int regno; + register int mask, fmask; + register int nregs; + HOST_WIDE_INT offset, foffset, fpoffset, first = 1; + extern char call_used_regs[]; + HOST_WIDE_INT fsize = ((size) + 3) & -4; + int big = 0; + rtx insn = get_last_insn (); + + /* If the last insn was a BARRIER, we don't have to write any code. */ + if (GET_CODE (insn) == NOTE) + insn = prev_nonnote_insn (insn); + if (insn && GET_CODE (insn) == BARRIER) + { + /* Output just a no-op so that debuggers don't get confused + about which function the pc is in at this address. */ + fprintf (stream, "\tnop\n"); + return; + } + + nregs = 0; fmask = 0; fpoffset = 0; + for (regno = 16; regno < 24; regno++) + if (regs_ever_live[regno] && ! call_used_regs[regno]) + { + nregs++; + fmask |= 1 << (23 - regno); + } + + foffset = fpoffset + nregs * 12; + nregs = 0; mask = 0; + if (frame_pointer_needed) + regs_ever_live[FRAME_POINTER_REGNUM] = 0; + + for (regno = 0; regno < 16; regno++) + if (regs_ever_live[regno] && ! call_used_regs[regno]) + { + nregs++; + mask |= 1 << regno; + } + + offset = foffset + nregs * 4; + if (offset + fsize >= 0x8000 + && frame_pointer_needed + && (mask || fmask || fpoffset)) + { + fprintf (stream, "\tmove.l #%d,a0\n", -fsize); + fsize = 0, big = 1; + } + + if (nregs <= 2) + { + /* Restore each separately in the same order moveml does. + Using two movel instructions instead of a single moveml + is about 15% faster for the 68020 and 68030 at no expense + in code size. */ + + int i; + + /* Undo the work from above. */ + for (i = 0; i< 16; i++) + if (mask & (1 << i)) + { + if (big) + fprintf (stream, "\tmove.l -%d(%s,a0.l),%s\n", + offset + fsize, + reg_names[FRAME_POINTER_REGNUM], + reg_names[i]); + else if (! frame_pointer_needed) + fprintf (stream, "\tmove.l (sp)+,%s\n", + reg_names[i]); + else + fprintf (stream, "\tmove.l -%d(%s),%s\n", + offset + fsize, + reg_names[FRAME_POINTER_REGNUM], + reg_names[i]); + offset = offset - 4; + } + } + else if (mask) + { + first = 1; + for (regno = 0; regno < 16; regno++) + if (mask & (1 << regno)) + { + if (first && big) + { + fprintf (stream, "\tmovem.l -%d(%s,a0.l),%s", + offset + fsize, + reg_names[FRAME_POINTER_REGNUM], + reg_names[regno]); + first = 0; + } + else if (first && ! frame_pointer_needed) + { + fprintf (stream, "\tmovem.l (sp)+,%s", + reg_names[regno]); + first = 0; + } + else if (first) + { + fprintf (stream, "\tmovem.l -%d(%s),%s", + offset + fsize, + reg_names[FRAME_POINTER_REGNUM], + reg_names[regno]); + first = 0; + } + else + fprintf (stream, "/%s", reg_names[regno]); + } + fprintf (stream, "\n"); + } + + if (fmask) + { + first = 1; + for (regno = 16; regno < 24; regno++) + if (fmask & (1 << (23 - regno))) + { + if (first && big) + { + fprintf (stream, "\tfmovem.x -%d(%s,a0.l),%s", + foffset + fsize, + reg_names[FRAME_POINTER_REGNUM], + reg_names[regno]); + first = 0; + } + else if (first && ! frame_pointer_needed) + { + fprintf (stream, "\tfmovem.x (sp)+,%s", + reg_names[regno]); + first = 0; + } + else if (first) + { + fprintf (stream, "\tfmovem.x -%d(%s),%s", + foffset + fsize, + reg_names[FRAME_POINTER_REGNUM], + reg_names[regno]); + first = 0; + } + else + fprintf (stream, "/%s", reg_names[regno]); + } + fprintf (stream, "\n"); + } + + if (frame_pointer_needed) + fprintf (stream, "\tunlk %s\n", + reg_names[FRAME_POINTER_REGNUM]); + else if (fsize) + { + if (fsize + 4 < 0x8000) + fprintf (stream, "\tadd.w #%d,sp\n", fsize + 4); + else + fprintf (stream, "\tadd.l #%d,sp\n", fsize + 4); + } + + if (current_function_pops_args) + fprintf (stream, "\trtd #%d\n", current_function_pops_args); + else + fprintf (stream, "\trts\n"); +} + +#else +#if defined (NEWS) && defined (MOTOROLA) + +static void +m68k_output_function_epilogue (stream, size) + FILE *stream; + HOST_WIDE_INT size; +{ + register int regno; + register int mask, fmask; + register int nregs; + HOST_WIDE_INT offset, foffset; + extern char call_used_regs[]; + HOST_WIDE_INT fsize = ((size) + 3) & -4; + int big = 0; + + nregs = 0; fmask = 0; + for (regno = 16; regno < FIRST_PSEUDO_REGISTER; regno++) + if (regs_ever_live[regno] && ! call_used_regs[regno]) + { + nregs++; + fmask |= 1 << (23 - regno); + } + + foffset = nregs * 12; + nregs = 0; mask = 0; + if (frame_pointer_needed) + regs_ever_live[FRAME_POINTER_REGNUM] = 0; + + for (regno = 0; regno < 16; regno++) + if (regs_ever_live[regno] && ! call_used_regs[regno]) + { + nregs++; + mask |= 1 << regno; + } + + offset = foffset + nregs * 4; + if (offset + fsize >= 0x8000 + && frame_pointer_needed + && (mask || fmask)) + { + fprintf (stream, "\tmove.l #%d,a0\n", -fsize); + fsize = 0, big = 1; + } + + if (exact_log2 (mask) >= 0) + { + if (big) + fprintf (stream, "\tmove.l (-%d,fp,a0.l),%s\n", + offset + fsize, reg_names[exact_log2 (mask)]); + else if (! frame_pointer_needed) + fprintf (stream, "\tmove.l (sp)+,%s\n", + reg_names[exact_log2 (mask)]); + else + fprintf (stream, "\tmove.l (-%d,fp),%s\n", + offset + fsize, reg_names[exact_log2 (mask)]); + } + else if (mask) + { + if (big) + fprintf (stream, "\tmovem.l (-%d,fp,a0.l),#0x%x\n", + offset + fsize, mask); + else if (! frame_pointer_needed) + fprintf (stream, "\tmovem.l (sp)+,#0x%x\n", mask); + else + fprintf (stream, "\tmovem.l (-%d,fp),#0x%x\n", + offset + fsize, mask); + } + + if (fmask) + { + if (big) + fprintf (stream, "\tfmovem.x (-%d,fp,a0.l),#0x%x\n", + foffset + fsize, fmask); + else if (! frame_pointer_needed) + fprintf (stream, "\tfmovem.x (sp)+,#0x%x\n", fmask); + else + fprintf (stream, "\tfmovem.x (-%d,fp),#0x%x\n", + foffset + fsize, fmask); + } + + if (frame_pointer_needed) + fprintf (stream, "\tunlk fp\n"); + else if (fsize) + { + if (fsize + 4 < 0x8000) + fprintf (stream, "\tadd.w #%d,sp\n", fsize + 4); + else + fprintf (stream, "\tadd.l #%d,sp\n", fsize + 4); + } + + if (current_function_pops_args) + fprintf (stream, "\trtd #%d\n", current_function_pops_args); + else + fprintf (stream, "\trts\n"); +} + +#else /* !CRDS && ! (NEWS && MOTOROLA) && ! (DPX2 && MOTOROLA) */ + +static void +m68k_output_function_epilogue (stream, size) + FILE *stream; + HOST_WIDE_INT size; +{ + register int regno; + register int mask, fmask; + register int nregs; + HOST_WIDE_INT offset, foffset, fpoffset; + extern char call_used_regs[]; + HOST_WIDE_INT fsize = (size + 3) & -4; int big = 0; rtx insn = get_last_insn (); int restore_from_sp = 0; @@ -875,6 +1480,10 @@ output_function_epilogue (stream, size) else fprintf (stream, "\trts\n"); } + +#endif /* ! (DPX2 && MOTOROLA) */ +#endif /* ! (NEWS && MOTOROLA) */ +#endif /* !CRDS */ /* Similar to general_operand, but exclude stack_pointer_rtx. */ diff --git a/gcc/config/m68k/m68k.h b/gcc/config/m68k/m68k.h index 133e16ff297..68017af17de 100644 --- a/gcc/config/m68k/m68k.h +++ b/gcc/config/m68k/m68k.h @@ -1050,9 +1050,6 @@ extern enum reg_class regno_reg_class[]; : GET_MODE_SIZE (MODE)))) \ ? 2 - (CUM) / 4 : 0) -/* Generate the assembly code for function entry. */ -#define FUNCTION_PROLOGUE(FILE, SIZE) output_function_prologue(FILE, SIZE) - /* Output assembler code to FILE to increment profiler label # LABELNO for profiling a function entry. */ @@ -1228,9 +1225,6 @@ while(0) #define EXIT_IGNORE_STACK 1 -/* Generate the assembly code for function exit. */ -#define FUNCTION_EPILOGUE(FILE, SIZE) output_function_epilogue (FILE, SIZE) - /* This is a hook for other tm files to change. */ /* #define FUNCTION_EXTRA_EPILOGUE(FILE, SIZE) */ diff --git a/gcc/config/m68k/news.h b/gcc/config/m68k/news.h index 25e820e772b..96ce23c53f1 100644 --- a/gcc/config/m68k/news.h +++ b/gcc/config/m68k/news.h @@ -25,6 +25,7 @@ Boston, MA 02111-1307, USA. */ #define SGS_NO_LI /* Suppress jump table label usage */ #endif +#define NEWS #define NO_DOLLAR_IN_LABEL #define NO_DOT_IN_LABEL @@ -98,8 +99,6 @@ Boston, MA 02111-1307, USA. */ #undef FUNCTION_PROFILER #ifdef MOTOROLA -#undef FUNCTION_PROLOGUE -#undef FUNCTION_EPILOGUE #undef REGISTER_NAMES #undef ASM_OUTPUT_REG_PUSH #undef ASM_OUTPUT_REG_POP @@ -139,111 +138,9 @@ Boston, MA 02111-1307, USA. */ #ifdef MOTOROLA -#define FUNCTION_PROLOGUE(FILE, SIZE) \ -{ register int regno; \ - register int mask = 0; \ - extern char call_used_regs[]; \ - int fsize = ((SIZE) + 3) & -4; \ - if (frame_pointer_needed) \ - { if (fsize < 0x8000) \ - fprintf (FILE, "\tlink fp,#%d\n", -fsize); \ - else if (TARGET_68020) \ - fprintf (FILE, "\tlink.l fp,#%d\n", -fsize); \ - else \ - fprintf (FILE, "\tlink fp,#0\n\tsub.l #%d,sp\n", fsize);\ - } \ - else if (fsize) \ - { \ - int amt = fsize + 4; \ - /* Adding negative number is faster on the 68040. */ \ - if (fsize + 4 < 0x8000) \ - asm_fprintf (FILE, "\tadd.w %0I%d,%Rsp\n", - amt); \ - else \ - asm_fprintf (FILE, "\tadd.l %0I%d,%Rsp\n", - amt); \ - } \ - for (regno = 16; regno < FIRST_PSEUDO_REGISTER; regno++) \ - if (regs_ever_live[regno] && ! call_used_regs[regno]) \ - mask |= 1 << (regno - 16); \ - if (mask != 0) \ - fprintf (FILE, "\tfmovem.x #0x%x,-(sp)\n", mask & 0xff); \ - mask = 0; \ - for (regno = 0; regno < 16; regno++) \ - if (regs_ever_live[regno] && ! call_used_regs[regno]) \ - mask |= 1 << (15 - regno); \ - if (frame_pointer_needed) \ - mask &= ~ (1 << (15-FRAME_POINTER_REGNUM)); \ - if (exact_log2 (mask) >= 0) \ - fprintf (FILE, "\tmove.l %s,-(sp)\n", reg_names[15 - exact_log2 (mask)]); \ - else if (mask) fprintf (FILE, "\tmovem.l #0x%x,-(sp)\n", mask); } - #define FUNCTION_PROFILER(FILE, LABEL_NO) \ fprintf (FILE, "\tmove.l #LP%d,d0\n\tjsr mcount\n", (LABEL_NO)); -#define FUNCTION_EPILOGUE(FILE, SIZE) \ -{ register int regno; \ - register int mask, fmask; \ - register int nregs; \ - int offset, foffset; \ - extern char call_used_regs[]; \ - int fsize = ((SIZE) + 3) & -4; \ - int big = 0; \ - nregs = 0; fmask = 0; \ - for (regno = 16; regno < FIRST_PSEUDO_REGISTER; regno++) \ - if (regs_ever_live[regno] && ! call_used_regs[regno]) \ - { nregs++; fmask |= 1 << (23 - regno); } \ - foffset = nregs * 12; \ - nregs = 0; mask = 0; \ - if (frame_pointer_needed) regs_ever_live[FRAME_POINTER_REGNUM] = 0; \ - for (regno = 0; regno < 16; regno++) \ - if (regs_ever_live[regno] && ! call_used_regs[regno]) \ - { nregs++; mask |= 1 << regno; } \ - offset = foffset + nregs * 4; \ - if (offset + fsize >= 0x8000 \ - && frame_pointer_needed \ - && (mask || fmask)) \ - { fprintf (FILE, "\tmove.l #%d,a0\n", -fsize); \ - fsize = 0, big = 1; } \ - if (exact_log2 (mask) >= 0) { \ - if (big) \ - fprintf (FILE, "\tmove.l (-%d,fp,a0.l),%s\n", \ - offset + fsize, reg_names[exact_log2 (mask)]); \ - else if (! frame_pointer_needed) \ - fprintf (FILE, "\tmove.l (sp)+,%s\n", \ - reg_names[exact_log2 (mask)]); \ - else \ - fprintf (FILE, "\tmove.l (-%d,fp),%s\n", \ - offset + fsize, reg_names[exact_log2 (mask)]); } \ - else if (mask) { \ - if (big) \ - fprintf (FILE, "\tmovem.l (-%d,fp,a0.l),#0x%x\n", \ - offset + fsize, mask); \ - else if (! frame_pointer_needed) \ - fprintf (FILE, "\tmovem.l (sp)+,#0x%x\n", mask); \ - else \ - fprintf (FILE, "\tmovem.l (-%d,fp),#0x%x\n", \ - offset + fsize, mask); } \ - if (fmask) { \ - if (big) \ - fprintf (FILE, "\tfmovem.x (-%d,fp,a0.l),#0x%x\n", \ - foffset + fsize, fmask); \ - else if (! frame_pointer_needed) \ - fprintf (FILE, "\tfmovem.x (sp)+,#0x%x\n", fmask); \ - else \ - fprintf (FILE, "\tfmovem.x (-%d,fp),#0x%x\n", \ - foffset + fsize, fmask); } \ - if (frame_pointer_needed) \ - fprintf (FILE, "\tunlk fp\n"); \ - else if (fsize) \ - { \ - if (fsize + 4 < 0x8000) \ - fprintf (FILE, "\tadd.w #%d,sp\n", fsize + 4); \ - else \ - fprintf (FILE, "\tadd.l #%d,sp\n", fsize + 4); \ - } \ - if (current_function_pops_args) \ - fprintf (FILE, "\trtd #%d\n", current_function_pops_args); \ - else fprintf (FILE, "\trts\n"); } - /* Difference from m68k.h is in `fp' instead of `a6'. */ #define REGISTER_NAMES \ |