home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 7 / FreshFishVol7.bin / bbs / gnu / gcc-2.3.3-src.lha / GNU / src / amiga / gcc-2.3.3 / config / mot3300.h < prev    next >
C/C++ Source or Header  |  1994-02-06  |  28KB  |  796 lines

  1. /* Definitions of target machine for GNU compiler.  
  2.    SysV68 Motorola 3300 Delta Series
  3.  
  4.    Written by Abramo and Roberto Bagnara
  5.    after Alex Crain's 3B1 definitions.
  6.  
  7.    Bug reports to bagnara@dipisa.di.unipi.it
  8.  
  9.    Copyright (C) 1987 Free Software Foundation, Inc.
  10.  
  11. This file is part of GNU CC.
  12.  
  13. GNU CC is free software; you can redistribute it and/or modify
  14. it under the terms of the GNU General Public License as published by
  15. the Free Software Foundation; either version 2, or (at your option)
  16. any later version.
  17.  
  18. GNU CC is distributed in the hope that it will be useful,
  19. but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  21. GNU General Public License for more details.
  22.  
  23. You should have received a copy of the GNU General Public License
  24. along with GNU CC; see the file COPYING.  If not, write to
  25. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  26.  
  27. #define MOTOROLA        /* Use Motorola syntax rather than "MIT" */
  28. #define SGS            /* Uses SGS assembler */
  29. #define SGS_CMP_ORDER        /* Takes cmp operands in reverse order */
  30. #define SGS_SWAP_W        /* Use swap.w rather than just plain swap */
  31. #define SGS_SWITCH_TABLES    /* Different switch table handling */
  32.  
  33. #include "m68k.h"
  34.  
  35. /* See m68k.h.  7 means 68020 with 68881.  */
  36.  
  37. #ifndef TARGET_DEFAULT
  38. #define    TARGET_DEFAULT 7
  39. #endif
  40.  
  41. /* NYI: FP= is equivalent to -msoft-float  */
  42.  
  43. /* We use /lib/libp/lib* when profiling.  */
  44.  
  45. /* NYI: if FP=M68881U library is -lc881u  */
  46. /* NYI: if FP= library is -lc.  */
  47. /* Default for us: FP=M68881 library is -lc881  */
  48. #undef LIB_SPEC
  49. #define LIB_SPEC "%{!shlib:%{p:-L/usr/lib/libp} %{pg:-L/usr/lib/libp} -lc881}"
  50.  
  51. #define CPP_SPEC "%{!msoft-float:-D__HAVE_68881__}"
  52.  
  53. /* Shared libraries need to use crt0s.o  */
  54.  
  55. #undef STARTFILE_SPEC
  56. #define STARTFILE_SPEC \
  57.   "%{!shlib:%{pg:mcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}\
  58.    %{shlib:crt0s.o%s shlib.ifile%s} "
  59.  
  60. /* Generate calls to memcpy, memcmp and memset.  */
  61.  
  62. #define TARGET_MEM_FUNCTIONS
  63.  
  64. /* size_t is unsigned int.  */
  65.  
  66. #define SIZE_TYPE "unsigned int"
  67.  
  68. /* Every structure or union's size must be a multiple of 2 bytes.  */
  69.  
  70. #define STRUCTURE_SIZE_BOUNDARY 16
  71.  
  72. /* cpp has to support a #sccs directive for the /usr/include files */
  73.  
  74. #define SCCS_DIRECTIVE
  75.  
  76. /* Make output for SDB.  */
  77.  
  78. #define SDB_DEBUGGING_INFO
  79.  
  80. #undef REGISTER_NAMES
  81. #define REGISTER_NAMES \
  82. {"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7",    \
  83.  "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%fp", "%sp",    \
  84.  "%fp0", "%fp1", "%fp2", "%fp3", "%fp4", "%fp5", "%fp6", "%fp7"}
  85.  
  86. #undef FUNCTION_PROLOGUE
  87. #define FUNCTION_PROLOGUE(FILE, SIZE)     \
  88. { register int regno;                        \
  89.   register int mask = 0;                    \
  90.   extern char call_used_regs[];                    \
  91.   int fsize = (SIZE);                        \
  92.   if (frame_pointer_needed)                    \
  93.     { if (fsize < 0x8000)                    \
  94.         fprintf (FILE, "\tlink.w %%fp,&%d\n", -fsize);        \
  95.       else if (TARGET_68020)                    \
  96.         fprintf (FILE, "\tlink.l %%fp,&%d\n", -fsize);        \
  97.       else                            \
  98.     fprintf (FILE, "\tlink.w %%fp,&0\n\tsub.l &%d,%%sp\n", fsize); }  \
  99.   for (regno = 16; regno < FIRST_PSEUDO_REGISTER; regno++)    \
  100.     if (regs_ever_live[regno] && ! call_used_regs[regno])    \
  101.        mask |= 1 << (regno - 16);                \
  102.   if (mask != 0)                        \
  103.     fprintf (FILE, "\tfmovem &0x%x,-(%%sp)\n", mask & 0xff);    \
  104.   mask = 0;                            \
  105.   for (regno = 0; regno < 16; regno++)                \
  106.     if (regs_ever_live[regno] && ! call_used_regs[regno])    \
  107.        mask |= 1 << (15 - regno);                \
  108.   if (frame_pointer_needed)                    \
  109.     mask &= ~ (1 << (15-FRAME_POINTER_REGNUM));            \
  110.   if (exact_log2 (mask) >= 0)                    \
  111.     fprintf (FILE, "\tmov.l %s,-(%%sp)\n", reg_names[15 - exact_log2 (mask)]);  \
  112.   else if (mask) fprintf (FILE, "\tmovm.l &0x%x,-(%%sp)\n", mask); }
  113.  
  114. #undef FUNCTION_PROFILER
  115. #define FUNCTION_PROFILER(FILE, LABEL_NO)    \
  116.     fprintf (FILE, "\tmov.l &LP%%%d,%%a0\n\tjsr mcount%%\n", (LABEL_NO))
  117.  
  118. #undef FUNCTION_EPILOGUE
  119. #define FUNCTION_EPILOGUE(FILE, SIZE) \
  120. { register int regno;                        \
  121.   register int mask, fmask;                    \
  122.   register int nregs;                        \
  123.   int offset, foffset;                        \
  124.   extern char call_used_regs[];                    \
  125.   int fsize = (SIZE);                        \
  126.   int big = 0;                            \
  127.   nregs = 0;  fmask = 0;                    \
  128.   for (regno = 16; regno < FIRST_PSEUDO_REGISTER; regno++)    \
  129.     if (regs_ever_live[regno] && ! call_used_regs[regno])    \
  130.       { nregs++; fmask |= 1 << (23 - regno); }            \
  131.   foffset = nregs * 12;                        \
  132.   nregs = 0;  mask = 0;                        \
  133.   if (frame_pointer_needed) regs_ever_live[FRAME_POINTER_REGNUM] = 0; \
  134.   for (regno = 0; regno < 16; regno++)                \
  135.     if (regs_ever_live[regno] && ! call_used_regs[regno])    \
  136.       { nregs++; mask |= 1 << regno; }                \
  137.   offset = foffset + nregs * 4;                    \
  138.   if (offset + fsize >= 0x8000 && frame_pointer_needed)        \
  139.     { fprintf (FILE, "\tmov.l &%d,%%a0\n", -fsize);        \
  140.       fsize = 0, big = 1; }                    \
  141.   if (exact_log2 (mask) >= 0) {                    \
  142.     if (big)                            \
  143.       fprintf (FILE, "\tmov.l -%d(%%fp,%%a0.l),%s\n",        \
  144.            offset + fsize, reg_names[exact_log2 (mask)]);    \
  145.     else if (! frame_pointer_needed)                \
  146.       fprintf (FILE, "\tmov.l (%%sp)+,%s\n",            \
  147.            reg_names[exact_log2 (mask)]);            \
  148.     else                            \
  149.       fprintf (FILE, "\tmov.l -%d(%%fp),%s\n",            \
  150.            offset + fsize, reg_names[exact_log2 (mask)]); }    \
  151.   else if (mask) {                        \
  152.     if (big)                            \
  153.       fprintf (FILE, "\tmovm.l -%d(%%fp,%%a0.l),&0x%x\n",    \
  154.            offset + fsize, mask);                \
  155.     else if (! frame_pointer_needed)                \
  156.       fprintf (FILE, "\tmovm.l (%%sp)+,&0x%x\n", mask);        \
  157.     else                            \
  158.       fprintf (FILE, "\tmovm.l -%d(%%fp),&0x%x\n",        \
  159.            offset + fsize, mask); }                \
  160.   if (fmask) {                            \
  161.     if (big)                            \
  162.       fprintf (FILE, "\tfmovem -%d(%%fp,%%a0.l),&0x%x\n",    \
  163.            foffset + fsize, fmask);                \
  164.     else if (! frame_pointer_needed)                \
  165.       fprintf (FILE, "\tfmovem (%%sp)+,&0x%x\n", fmask);    \
  166.     else                            \
  167.       fprintf (FILE, "\tfmovem -%d(%%fp),&0x%x\n",        \
  168.            foffset + fsize, fmask); }            \
  169.   if (frame_pointer_needed)                    \
  170.     fprintf (FILE, "\tunlk %%fp\n");                \
  171.   if (current_function_pops_args)                \
  172.     fprintf (FILE, "\trtd &%d\n", current_function_pops_args);    \
  173.   else fprintf (FILE, "\trts\n"); }
  174.  
  175. /* This is how to output an insn to push a register on the stack.
  176.    It need not be very fast code.  */
  177.  
  178. #undef ASM_OUTPUT_REG_PUSH
  179. #define ASM_OUTPUT_REG_PUSH(FILE,REGNO)  \
  180.   fprintf (FILE, "\tmov.l %s,-(%%sp)\n", reg_names[REGNO])
  181.  
  182. /* This is how to output an insn to pop a register from the stack.
  183.    It need not be very fast code.  */
  184.  
  185. #undef ASM_OUTPUT_REG_POP
  186. #define ASM_OUTPUT_REG_POP(FILE,REGNO)  \
  187.   fprintf (FILE, "\tmov.l (%%sp)+,%s\n", reg_names[REGNO])
  188.  
  189. #undef ASM_APP_ON
  190. #define ASM_APP_ON ""
  191.  
  192. #undef ASM_APP_OFF
  193. #define ASM_APP_OFF ""
  194.  
  195. #undef TEXT_SECTION_ASM_OP
  196. #define TEXT_SECTION_ASM_OP "text"
  197. #undef DATA_SECTION_ASM_OP
  198. #define DATA_SECTION_ASM_OP "data"
  199. #undef ASCII_DATA_ASM_OP
  200. #define    ASCII_DATA_ASM_OP "byte"
  201.  
  202. /* The file command should always begin the output.  */
  203.  
  204. #undef ASM_FILE_START
  205. #define ASM_FILE_START(FILE) \
  206. output_file_directive ((FILE), main_input_filename)
  207.  
  208. /* Don't try to define `gcc_compiled.' since the assembler might not
  209.    accept symbols with periods and GDB doesn't run on this machine anyway.  */
  210.  
  211. #define ASM_IDENTIFY_GCC(FILE)
  212.  
  213. /* Names to predefine in the preprocessor for this target machine.  */
  214. /* ihnp4!lmayk!lgm@eddie.mit.edu says mc68000 and m68k should not be here,
  215.    on the other hand I don't care what he says.  */
  216.  
  217. #undef CPP_PREDEFINES
  218. #define CPP_PREDEFINES "-Dm68k -Dunix -DsysV68"
  219.  
  220. /* Specify how to pad function arguments.
  221.    Value should be `upward', `downward' or `none'.
  222.    Same as the default, except no padding for large or variable-size args.  */
  223.  
  224. #define FUNCTION_ARG_PADDING(MODE, TYPE)                \
  225.   (((MODE) == BLKmode                            \
  226.     ? ((TYPE) && TREE_CODE (TYPE_SIZE (TYPE))    == INTEGER_CST        \
  227.        && int_size_in_bytes (TYPE) < PARM_BOUNDARY / BITS_PER_UNIT)    \
  228.     : GET_MODE_BITSIZE (MODE) < PARM_BOUNDARY)                \
  229.    ? downward : none)
  230.  
  231. /* Override part of the obstack macros.  */
  232.  
  233. #define __PTR_TO_INT(P) ((int)(P))
  234. #define __INT_TO_PTR(P) ((char *)(P))
  235.  
  236. #undef TARGET_VERSION
  237. #define TARGET_VERSION fprintf (s