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 / tek6000.h < prev    next >
C/C++ Source or Header  |  1994-02-06  |  8KB  |  234 lines

  1. /* Definitions of target machine for GNU compiler.
  2.    Generic Tektronix 6000 series NS32000 version.
  3.    See tek6100.h and tek6200.h, which include this file.
  4.    Copyright (C) 1990 Free Software Foundation, Inc.
  5.    Created by Snoopy  (sopwith.uucp!snoopy).
  6.    Based on work by Mark Mason (mason@reed.bitnet,
  7.    pyramid!unify!mason@uunet.uu.net) and Keith Packard.
  8.  
  9. This file is part of GNU CC.
  10.  
  11. GNU CC is free software; you can redistribute it and/or modify
  12. it under the terms of the GNU General Public License as published by
  13. the Free Software Foundation; either version 2, or (at your option)
  14. any later version.
  15.  
  16. GNU CC is distributed in the hope that it will be useful,
  17. but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19. GNU General Public License for more details.
  20.  
  21. You should have received a copy of the GNU General Public License
  22. along with GNU CC; see the file COPYING.  If not, write to
  23. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  24.  
  25. /* Generate syntax for the UTek assembler. */
  26. #ifndef UTEK_ASM
  27. #define UTEK_ASM
  28. #endif
  29.  
  30. /* Two flags to control how addresses are printed in assembler insns.  */
  31.  
  32. /* The way PUT_ABSOLUTE_PREFIX in ns32k.h works, setting it to 0 will
  33.  * turn it off.  Define ABSOLUTE_PREFIX before including ns32k.h.
  34.  */
  35. #define ABSOLUTE_PREFIX        0
  36. #define IMMEDIATE_PREFIX    '$'
  37.  
  38. #include "ns32k.h"
  39.  
  40. /* Define these after ns32k.c so we will notice if gcc tries to
  41.  * output external mode addressing.  UTek's as and ld do not support
  42.  * external mode addressing, according to Daryl McDaniel (illian.uucp!darylm).
  43.  * Hopefully the UTek assembler will complain if gcc feeds it this stuff.
  44.  * They don't seem to do anything, I think that gcc is not actually
  45.  * trying to generate external mode operands.
  46.  */
  47. #undef PUT_EXTERNAL_PREFIX
  48. #define PUT_EXTERNAL_PREFIX(arg)  fprintf(arg, "  Should not be using external mode under UTek.  ")
  49. #define EXTERNAL_PREFIX '%'
  50.  
  51. /* Used in ns32k.c to control syntax. */
  52. #define NO_ABSOLUTE_PREFIX_IF_SYMBOLIC
  53. #define NO_IMMEDIATE_PREFIX_IF_SYMBOLIC
  54.  
  55. /* Used in ns32k.md to specify syntax of bsr/jsr operand. */
  56. #define CALL_MEMREF_IMPLICIT
  57.  
  58. /* #define PC_RELATIVE */    /* Seems to break things. */
  59. #define BASE_REG_NEEDED        /* Seems to fix problem where external mode
  60.                  * syntax was being generated.
  61.                  */
  62.  
  63. /*  ------------   Debugging Support   ----------------------------- */
  64.  
  65. /* The sdb support does not yet work with UTek.  Need to teach gcc
  66.  * how to create sdb type stabs as well as dbx style stabs.
  67.  */
  68. #define DBX_DEBUGGING_INFO
  69. /* #define SDB_DEBUGGING_INFO */
  70.  
  71. /* Act the same as the UTek complier: -g for dbx, -go for sdb.
  72.  * This is used in toplev.c.
  73.  */
  74. #define PREFERRED_DEBUGGING_TYPE \
  75.     ((len > 1 && !strncmp(str, "go", len)) ? SDB_DEBUG : DBX_DEBUG )
  76.  
  77. /* Sequent has some changes in the format of DBX symbols.  */
  78. #define DBX_NO_XREFS 1
  79.  
  80. /* Don't split DBX symbols into continuations.  */
  81. #define DBX_CONTIN_LENGTH 0
  82.  
  83. /* ------------------------------------------- */
  84.  
  85. #define TARGET_DEFAULT 1
  86.  
  87. /* These control the C++ compiler somehow.  */
  88. #define FASCIST_ASSEMBLER
  89. #define USE_COLLECT
  90.  
  91. /* Print subsidiary information on the compiler version in use.  */
  92. #undef TARGET_VERSION
  93. #define TARGET_VERSION fprintf (stderr, " (ns32k, UTek syntax)");
  94.  
  95. /* The tek6100.h and tek6200.h files add stratos or merlin respectively. */
  96.  
  97. #define CPP_PREDEFINES_Tek6000 \
  98.   "-Dns16000 -Dns32000 -Dns32k -Dns32016 -DUTek -DUTEK -Dbsd -DBSD"
  99. #undef CPP_PREDEFINES
  100. #define CPP_PREDEFINES "CPP_PREDEFINES_Tek6000"
  101.  
  102. /* This is how to align the code that follows an unconditional branch.
  103.    Don't define it, since it confuses the assembler (we hear).  */
  104.  
  105. #undef ASM_OUTPUT_ALIGN_CODE
  106.  
  107. /* Assembler pseudo-op for shared data segment. */
  108. #define SHARED_SECTION_ASM_OP ".shdata"
  109.  
  110. #ifdef UTEK_ASM
  111. #undef  FUNCTION_PROLOGUE
  112.  
  113. /* This differs from the one in ns32k.h in printing a bitmask
  114.    rather than a register list in the enter or save instruction.  */
  115.  
  116. #define FUNCTION_PROLOGUE(FILE, SIZE)     \
  117. { register int regno, g_regs_used = 0;                \
  118.   int used_regs_buf[8], *bufp = used_regs_buf;            \
  119.   int used_fregs_buf[8], *fbufp = used_fregs_buf;        \
  120.   extern char call_used_regs[];                    \
  121.   MAIN_FUNCTION_PROLOGUE;                    \
  122.   for (regno = 0; regno < 8; regno++)                \
  123.     if (regs_ever_live[regno]                    \
  124.     && ! call_used_regs[regno])                \
  125.     {                                \
  126.       *bufp++ = regno; g_regs_used++;                \
  127.     }                                \
  128.   *bufp = -1;                            \
  129.   for (; regno < 16; regno++)                    \
  130.     if (regs_ever_live[regno] && !call_used_regs[regno]) {    \
  131.       *fbufp++ = regno;                        \
  132.     }                                \
  133.   *fbufp = -1;                            \
  134.   bufp = used_regs_buf;                        \
  135.   if (frame_pointer_needed)                    \
  136.     fprintf (FILE, "\tenter ");                    \
  137.   else if (g_regs_used)                        \
  138.     fprintf (FILE, "\tsave ");                    \
  139.   if (frame_pointer_needed || g_regs_used)            \
  140.     {                                \
  141.       char mask = 0;                        \
  142.       while (*bufp >= 0)                    \
  143.     mask |= 1 << *bufp++;                    \
  144.       fprintf (FILE, "$0x%x", (int) mask & 0xff);        \
  145.     }                                \
  146.   if (frame_pointer_needed)                    \
  147.     fprintf (FILE, ",$%d\n", SIZE);                \
  148.   else if (g_regs_used)                        \
  149.     fprintf (FILE, "\n");                    \
  150.   fbufp = used_fregs_buf;                    \
  151.   while (*fbufp >= 0)                        \
  152.     {                                \
  153.       if ((*fbufp & 1) || (fbufp[0] != fbufp[1] - 1))        \
  154.     fprintf (FILE, "\tmovf f%d,tos\n", *fbufp++ - 8);    \
  155.       else                            \
  156.     {                            \
  157.       fprintf (FILE, "\tmovl f%d,tos\n", fbufp[0] - 8);    \
  158.       fbufp += 2;                        \
  159.     }                            \
  160.     }                                \
  161. }
  162.  
  163. #undef  FUNCTION_EPILOGUE
  164.  
  165. /* This differs from the one in ns32k.h in printing a bitmask
  166.    rather than a register list in the exit or restore instruction.  */
  167.  
  168. #define FUNCTION_EPILOGUE(FILE, SIZE) \
  169. { register int regno, g_regs_used = 0, f_regs_used = 0;        \
  170.   int used_regs_buf[8], *bufp = used_regs_buf;            \
  171.   int used_fregs_buf[8], *fbufp = used_fregs_buf;        \
  172.   extern char call_used_regs[];                    \
  173.   *fbufp++ = -2;                        \
  174.   for (regno = 8; regno < 16; regno++)                \
  175.     if (regs_ever_live[regno] && !call_used_regs[regno]) {    \
  176.        *fbufp++ = regno; f_regs_used++;                \
  177.     }                                \
  178.   fbufp--;                            \
  179.   for (regno = 0; regno < 8; regno++)                \
  180.     if (regs_ever_live[regno]                    \
  181.     && ! call_used_regs[regno])                \
  182.     {                                                             \
  183.       *bufp++ = regno; g_regs_used++;                \
  184.     }                                                             \
  185.   while (fbufp > used_fregs_buf)                \
  186.     {                                \
  187.       if ((*fbufp & 1) && fbufp[0] == fbufp[-1] + 1)        \
  188.     {                            \
  189.       fprintf (FILE, "\tmovl tos,f%d\n", fbufp[-1] - 8);    \
  190.       fbufp -= 2;                        \
  191.     }                            \
  192.       else fprintf (FILE, "\tmovf tos,f%d\n", *fbufp-- - 8);    \
  193.     }                                \
  194.   if (frame_pointer_needed)                    \
  195.     fprintf (FILE, "\texit ");                    \
  196.   else if (g_regs_used)                        \
  197.     fprintf (FILE, "\trestore ");                \
  198.   if (g_regs_used || frame_pointer_needed)            \
  199.     {                                \
  200.       char mask = 0;                        \
  201.                                 \
  202.       while (bufp > used_regs_buf)                \
  203.     {                            \
  204.       /* Utek assembler takes care of reversing this */    \
  205.       mask |= 1 << *--bufp;                    \
  206.     }                            \
  207.       fprintf (FILE, "$0x%x\n", (int) mask & 0xff);        \
  208.     }                                \
  209.   if (current_function_pops_args)                \
  210.     fprintf (FILE, "\tret $%d\n", current_function_pops_args);    \
  211.   else fprintf (FILE, "\tret $0\n"); }
  212.  
  213. /* UTek assembler needs "ret $0", not "ret 0". */
  214. #undef  TRANSFER_FROM_TRAMPOLINE
  215. #define TRANSFER_FROM_TRAMPOLINE    \
  216. void                    \
  217. __transfer_from_trampoline ()        \
  218. {                    \
  219.   asm ("___trampoline:");        \
  220.   asm ("movd 16(r2),tos");        \
  221.   asm ("movd 12(r2),r2");        \
  222.   asm ("ret $0");            \
  223. }
  224.  
  225. #endif /* UTEK_ASM */
  226.  
  227. #undef PRINT_OPERAND_ADDRESS
  228. #define PRINT_OPERAND_ADDRESS(FILE, ADDR)  print_operand_address(FILE, ADDR)
  229.  
  230. /* The UTek library supplies bcopy() and friends, not memcpy(). */
  231. #ifdef TARGET_MEM_FUNCTIONS
  232. #undef TARGET_MEM_FUNCTIONS
  233. #endif
  234.