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 / m68ksgs.h < prev    next >
C/C++ Source or Header  |  1994-02-06  |  16KB  |  436 lines

  1. /* Definitions of target machine for GNU compiler for m68k targets using
  2.    assemblers derived from AT&T "SGS" releases.
  3.  
  4.    Copyright (C) 1991 Free Software Foundation, Inc.
  5.  
  6.    Written by Fred Fish (fnf@cygnus.com)
  7.  
  8. This file is part of GNU CC.
  9.  
  10. GNU CC is free software; you can redistribute it and/or modify
  11. it under the terms of the GNU General Public License as published by
  12. the Free Software Foundation; either version 1, or (at your option)
  13. any later version.
  14.  
  15. GNU CC is distributed in the hope that it will be useful,
  16. but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18. GNU General Public License for more details.
  19.  
  20. You should have received a copy of the GNU General Public License
  21. along with GNU CC; see the file COPYING.  If not, write to
  22. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  23.  
  24. /* Control assembler-syntax conditionals in m68k.md and conditionals in
  25.    m68k.h.  Note that some systems may also require SGS_SWAP_W and/or
  26.    SGS_SWITCH_TABLES to be defined as well.  */
  27.  
  28. #define MOTOROLA        /* Use Motorola syntax rather than "MIT" */
  29. #define SGS            /* Uses SGS assembler */
  30. #define SGS_CMP_ORDER        /* Takes cmp operands in reverse order */
  31.  
  32. #include "m68k.h"
  33.  
  34. /* SGS specific assembler pseudo ops. */
  35.  
  36. #define    BYTE_ASM_OP        ".byte"
  37. #define WORD_ASM_OP        ".short"
  38. #define LONG_ASM_OP        ".long"
  39. #define SPACE_ASM_OP        ".space"
  40. #define ALIGN_ASM_OP        ".align"
  41. #undef GLOBAL_ASM_OP
  42. #define GLOBAL_ASM_OP        ".global"
  43. #define SWBEG_ASM_OP        ".swbeg"
  44. #define SET_ASM_OP        ".set"
  45.  
  46. #define UNALIGNED_SHORT_ASM_OP    ".short"    /* Used in dwarfout.c */
  47. #define UNALIGNED_INT_ASM_OP    ".long"        /* Used in dwarfout.c */
  48.  
  49. #define ASM_PN_FORMAT        "%s_%d"        /* Format for private names */
  50.  
  51. /* Here are four prefixes that are used by asm_fprintf to
  52.    facilitate customization for alternate assembler syntaxes.
  53.    Machines with no likelihood of an alternate syntax need not
  54.    define these and need not use asm_fprintf.  */
  55.  
  56. /* The prefix for register names.  Note that REGISTER_NAMES
  57.    is supposed to include this prefix. Also note that this is NOT an
  58.    fprintf format string, it is a literal string */
  59.  
  60. #undef REGISTER_PREFIX
  61. #define REGISTER_PREFIX "%"
  62.  
  63. /* The prefix for local (compiler generated) labels.
  64.    These labels will not appear in the symbol table. */
  65.  
  66. #undef LOCAL_LABEL_PREFIX
  67. #define LOCAL_LABEL_PREFIX "."
  68.  
  69. /* The prefix to add to user-visible assembler symbols. */
  70.  
  71. #undef USER_LABEL_PREFIX
  72. #define USER_LABEL_PREFIX ""
  73.  
  74. /* The prefix for immediate operands.  */
  75.  
  76. #undef IMMEDIATE_PREFIX
  77. #define IMMEDIATE_PREFIX "&"
  78.  
  79. /* How to refer to registers in assembler output.
  80.    This sequence is indexed by compiler's hard-register-number.
  81.    Motorola format uses different register names than defined in m68k.h.
  82.    We also take this chance to convert 'a6' to 'fp' */
  83.  
  84. #undef REGISTER_NAMES
  85.  
  86. #ifndef SUPPORT_SUN_FPA
  87.  
  88. #define REGISTER_NAMES \
  89. {"%d0",   "%d1",   "%d2",   "%d3",   "%d4",   "%d5",   "%d6",   "%d7",         \
  90.  "%a0",   "%a1",   "%a2",   "%a3",   "%a4",   "%a5",   "%fp",   "%sp",         \
  91.  "%fp0",  "%fp1",  "%fp2",  "%fp3",  "%fp4",  "%fp5",  "%fp6",  "%fp7" }
  92.  
  93. #else /* SUPPORTED_SUN_FPA */
  94.  
  95. #define REGISTER_NAMES \
  96. {"%d0",   "%d1",   "%d2",   "%d3",   "%d4",   "%d5",   "%d6",   "%d7",         \
  97.  "%a0",   "%a1",   "%a2",   "%a3",   "%a4",   "%a5",   "%fp",   "%sp",         \
  98.  "%fp0",  "%fp1",  "%fp2",  "%fp3",  "%fp4",  "%fp5",  "%fp6",  "%fp7",         \
  99.  "%fpa0", "%fpa1", "%fpa2", "%fpa3", "%fpa4", "%fpa5", "%fpa6","%fpa7",         \
  100.  "%fpa8", "%fpa9", "%fpa10","%fpa11","%fpa12","%fpa13","%fpa14","%fpa15",    \
  101.  "%fpa16","%fpa17","%fpa18","%fpa19","%fpa20","%fpa21","%fpa22","%fpa23",    \
  102.  "%fpa24","%fpa25","%fpa26","%fpa27","%fpa28","%fpa29","%fpa30","%fpa31" }
  103.  
  104. #endif /* defined SUPPORT_SUN_FPA */
  105.  
  106. /* When using an SGS assembler, modify the name of the artificial label which
  107.    identifies this file as having been compiled with gcc, and the macro that
  108.    emits such a label in the assembly output, to use '%' rather than '.' */
  109.  
  110. #define ASM_IDENTIFY_GCC(FILE)                \
  111.  { fprintf ((FILE), "%s:\n", "gcc2_compiled%"); }
  112.  
  113. /* This is how to output an assembler line defining an `int' constant.  */
  114. /* The SGS assembler doesn't understand ".word". */
  115.  
  116. #undef ASM_OUTPUT_SHORT
  117. #define ASM_OUTPUT_SHORT(FILE,VALUE)            \
  118. ( fprintf ((FILE), "\t%s ", WORD_ASM_OP),        \
  119.   output_addr_const ((FILE), (VALUE)),            \
  120.   fprintf ((FILE), "\n"))
  121.  
  122. /* This is how to output an assembler line defining a `double' constant.  */
  123.  
  124. #undef ASM_OUTPUT_DOUBLE
  125. #define ASM_OUTPUT_DOUBLE(FILE,VALUE)            \
  126. do { union { double d; long l[2]; } tem;        \
  127.      tem.d = (VALUE);                    \
  128.      fprintf((FILE), "\t%s 0x%x,0x%x\n", LONG_ASM_OP,    \
  129.          tem.l[0], tem.l[1]);            \
  130.    } while (0)
  131.  
  132. /* This is how to output an assembler line defining a `float' constant.  */
  133.  
  134. #undef ASM_OUTPUT_FLOAT
  135. #define ASM_OUTPUT_FLOAT(FILE,VALUE)            \
  136. do { union { float f; long l;} tem;            \
  137.      tem.f = (VALUE);                    \
  138.      fprintf ((FILE), "\t%s 0x%x\n", LONG_ASM_OP, tem.l); \
  139.    } while (0)
  140.  
  141. /* This is how to output an assembler line that says to advance the
  142.    location counter to a multiple of 2**LOG bytes.  */
  143.  
  144. #undef ASM_OUTPUT_ALIGN
  145. #define ASM_OUTPUT_ALIGN(FILE,LOG)                \
  146.   if ((LOG) > 0)                        \
  147.     fprintf ((FILE), "\t%s \t%u\n", ALIGN_ASM_OP, 1 << (LOG));    \
  148.   else if ((LOG) > 31)                        \
  149.     abort ();
  150.  
  151. /* The routine used to output null terminated string literals.  We cannot
  152.    use the ".string" pseudo op, because it silently truncates strings to
  153.    1023 bytes.  There is no "partial string op" which works like ".string"
  154.    but doesn't append a null byte, so we can't chop the input string up
  155.    into small pieces and use that.  Our only remaining alternative is to
  156.    output the string one byte at a time. */
  157.  
  158. #define ASM_OUTPUT_ASCII(FILE,PTR,LEN)                \
  159. {                                \
  160.   register int sp = 0, lp = 0, ch;                \
  161.   fprintf ((FILE), "\t%s ", BYTE_ASM_OP);            \
  162.   do {                                \
  163.     ch = (PTR)[sp];                        \
  164.     if (ch > ' ' && ! (ch & 0x80) && ch != '\\')        \
  165.       {                                \
  166.     fprintf ((FILE), "'%c", ch);                \
  167.       }                                \
  168.     else                            \
  169.       {                                \
  170.     fprintf ((FILE), "0x%x", ch);                \
  171.       }                                \
  172.     if (++sp < (LEN))                        \
  173.       {                                \
  174.     if ((sp % 10) == 0)                    \
  175.       {                            \
  176.         fprintf ((FILE), "\n\t%s ", BYTE_ASM_OP);        \
  177.       }                            \
  178.     else                            \
  179.       {                            \
  180.         putc (',', (FILE));                    \
  181.       }                            \
  182.       }                                \
  183.   } while (sp < (LEN));                        \
  184.   putc ('\n', (FILE));                        \
  185. }
  186.  
  187.  
  188. /* SGS based assemblers don't understand #NO_APP and #APP, so just don't
  189.    bother emitting them. */
  190.  
  191. #undef ASM_APP_ON
  192. #define ASM_APP_ON ""
  193.  
  194. #undef ASM_APP_OFF
  195. #define ASM_APP_OFF ""
  196.  
  197. /* When using SGS derived assemblers, change the "MIT" or "MOTOROLA"
  198.    to "SGS/AT&T"  */
  199.  
  200. #undef TARGET_VERSION
  201. #define TARGET_VERSION fprintf (stderr, " (68k, SGS/AT&T syntax)");
  202.  
  203. /* Use proper assembler syntax for these macros.  */
  204. #undef ASM_OUTPUT_REG_PUSH
  205. #define ASM_OUTPUT_REG_PUSH(FILE,REGNO)  \
  206.   asm_fprintf (FILE, "\t%Omove.l %s,-(%Rsp)\n", reg_names[REGNO])
  207.  
  208. #undef ASM_OUTPUT_REG_POP
  209. #define ASM_OUTPUT_REG_POP(FILE,REGNO)  \
  210.   asm_fprintf (FILE, "\t%Omove.l (%Rsp)+,%s\n", reg_names[REGNO])
  211.  
  212. #undef PRINT_OPERAND_PRINT_FLOAT
  213. #define PRINT_OPERAND_PRINT_FLOAT(CODE,FILE)            \
  214.     asm_fprintf ((FILE), "%I0x%x", u1.i);
  215.  
  216. #undef ASM_OUTPUT_DOUBLE_OPERAND
  217. #define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE)            \
  218.   do {  union real_extract u;                    \
  219.     u.d = (VALUE);                        \
  220.     asm_fprintf ((FILE),"%I0x%x%08x", u.i[0], u.i[1]); } while (0)
  221.  
  222. /* How to output a block of SIZE zero bytes.  Note that the `space' pseudo,
  223.    when used in the text segment, causes SGS assemblers to output nop insns
  224.    rather than 0s, so we set ASM_NO_SKIP_IN_TEXT to prevent this. */
  225.  
  226. #define ASM_NO_SKIP_IN_TEXT 1
  227.  
  228. #undef ASM_OUTPUT_SKIP
  229. #define ASM_OUTPUT_SKIP(FILE,SIZE)  \
  230.   fprintf (FILE, "\t%s %u\n", SPACE_ASM_OP, (SIZE))
  231.  
  232. /* Translate Motorola opcodes such as `jbeq' into SGS opcodes such
  233.    as `beq.w'.
  234.    Delete the `e' in `move...' and `fmove'.
  235.    Change `ftst' to `ftest'.
  236.    Change `fbne' to `fbneq'
  237.    Change `fsne' to `fsneq'
  238.    Change `divsl' to `tdivs' (32/32 -> 32r:32q)
  239.    Change `divul' to `tdivu' (32/32 -> 32r:32q)
  240.    Optionally change swap