home *** CD-ROM | disk | FTP | other *** search
/ Education Sampler 1992 [NeXTSTEP] / Education_1992_Sampler.iso / NeXT / GnuSource / cplusplus-8 / config / tm-encore.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-08-03  |  6.4 KB  |  203 lines

  1. /* Definitions of target machine for GNU compiler.  ENCORE NS32000 version.
  2.    Copyright (C) 1988 Free Software Foundation, Inc.
  3.    Adapted by Robert Brown (brown@harvard.harvard.edu) from the Sequent
  4.      version by Michael Tiemann (tiemann@mcc.com).
  5.  
  6. This file is part of GNU CC.
  7.  
  8. GNU CC is free software; you can redistribute it and/or modify
  9. it under the terms of the GNU General Public License as published by
  10. the Free Software Foundation; either version 1, or (at your option)
  11. any later version.
  12.  
  13. GNU CC is distributed in the hope that it will be useful,
  14. but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. GNU General Public License for more details.
  17.  
  18. You should have received a copy of the GNU General Public License
  19. along with GNU CC; see the file COPYING.  If not, write to
  20. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  21.  
  22.  
  23. /*
  24.  *  Looks like all multiprocessors have this bug!
  25.  */
  26.  
  27. #define SEQUENT_ADDRESS_BUG 1
  28.  
  29. #include "tm-ns32k.h"
  30.  
  31. #define SDB_DEBUGGING_INFO
  32. #undef DBX_REGISTER_NUMBER
  33. #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
  34.  
  35. /* Cause long-jump assembler to be used,
  36.    since otherwise some files fail to be assembled right.  */
  37. #define ASM_SPEC "-j"
  38.  
  39. #undef ASM_FILE_START
  40. #undef ASM_GENERATE_INTERNAL_LABEL
  41. #undef ASM_OUTPUT_ADDR_DIFF_ELT
  42. #undef ASM_OUTPUT_ALIGN
  43. #undef ASM_OUTPUT_ASCII
  44. #undef ASM_OUTPUT_DOUBLE
  45. #undef ASM_OUTPUT_INT
  46. #undef ASM_OUTPUT_INTERNAL_LABEL
  47. #undef ASM_OUTPUT_LOCAL
  48. #undef CPP_PREDEFINES
  49. #undef FUNCTION_BOUNDARY
  50. #undef PRINT_OPERAND
  51. #undef PRINT_OPERAND_ADDRESS
  52. #undef TARGET_VERSION
  53. #undef FUNCTION_PROFILER
  54.  
  55.  
  56. #define TARGET_DEFAULT 1
  57. #define TARGET_VERSION fprintf (stderr, " (32000, Encore syntax)");
  58. /* Note Encore does not standardly do -Dencore.  */
  59. /* budd: should have a -ns32332 (or -apc) switch! but no harm for now */
  60. #define CPP_PREDEFINES "-Dns32000 -Dn16 -Dns16000 -Dns32332 -Dunix"
  61.  
  62. /* Ignore certain cpp directives used in header files on sysV.  */
  63. #define SCCS_DIRECTIVE
  64.  
  65. /* Output #ident as a .ident.  */
  66. #define ASM_OUTPUT_IDENT(FILE, NAME) fprintf (FILE, "\t.ident \"%s\"\n", NAME);
  67.  
  68. /* The .file command should always begin the output.  */
  69. #define ASM_FILE_START(FILE) sdbout_filename ((FILE), main_input_filename)
  70.  
  71. #define FUNCTION_BOUNDARY 128        /* speed optimization */
  72.  
  73. /*
  74.  *  The Encore assembler uses ".align 2" to align on 2-byte boundaries.
  75.  */
  76.  
  77. #define ASM_OUTPUT_ALIGN(FILE,LOG)                    \
  78.     fprintf (FILE, "\t.align %d\n", 1 << (LOG))
  79.  
  80. /*
  81.  *  Internal labels are prefixed with a period.
  82.  */
  83.  
  84. #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM)            \
  85.     sprintf (LABEL, "*.%s%d", PREFIX, NUM)
  86. #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM)            \
  87.     fprintf (FILE, ".%s%d:\n", PREFIX, NUM)
  88. #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL)            \
  89.     fprintf (FILE, "\t.word .L%d-.LI%d\n", VALUE, REL)
  90.  
  91. /*
  92.  *  Different syntax for integer constants, double constants, and
  93.  *  uninitialized locals.
  94.  */
  95.  
  96. #define ASM_OUTPUT_INT(FILE,VALUE)                \
  97. ( fprintf (FILE, "\t.double "),                    \
  98.   output_addr_const (FILE, (VALUE)),                \
  99.   fprintf (FILE, "\n"))
  100.  
  101. #define ASM_OUTPUT_DOUBLE(FILE,VALUE)                \
  102.  fprintf (FILE, "\t.long 0f%.20e\n", (VALUE))
  103.  
  104. #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED)        \
  105. ( fputs ("\t.bss ", (FILE)),                    \
  106.   assemble_name ((FILE), (NAME)),                \
  107.   fprintf ((FILE), ",%u,%u\n", (SIZE), (ROUNDED)))
  108.  
  109.  /*
  110.   *  Encore assembler can't handle huge string constants like the one in
  111.   *  gcc.c.  If the default routine in varasm.c were more conservative, this
  112.   *  code could be eliminated.  It starts a new .ascii directive every 40
  113.   *  characters.
  114.   */
  115.  
  116. #define ASM_OUTPUT_ASCII(file, p, size)            \
  117. {                            \
  118.   for (i = 0; i < size; i++)                \
  119.     {                            \
  120.       register int c = p[i];                \
  121.       if ((i / 40) * 40 == i)                \
  122.       if (i == 0)                    \
  123.         fprintf (file, "\t.ascii \"");            \
  124.       else                        \
  125.         fprintf (file, "\"\n\t.ascii \"");        \
  126.       if (c == '\"' || c == '\\')            \
  127.         putc ('\\', file);                \
  128.       if (c >= ' ' && c < 0177)                \
  129.         putc (c, file);                    \
  130.       else                        \
  131.         {                        \
  132.           fprintf (file, "\\%o", c);            \
  133.           if (i < size - 1                 \
  134.               && p[i + 1] >= '0' && p[i + 1] <= '9')    \
  135.           fprintf (file, "\"\n\t.ascii \"");        \
  136.         }                        \
  137.     }                            \
  138.   fprintf (file, "\"\n");                \
  139. }
  140.  
  141.  /*
  142.   *  Dollar signs are required before immediate operands, double
  143.   *  floating point constants use $0f syntax, and external addresses
  144.   *  should be prefixed with a question mark to avoid assembler warnings
  145.   *  about undefined symbols.
  146.   */
  147.  
  148. #define PRINT_OPERAND(FILE, X, CODE)                    \
  149. { if (CODE == '$') putc ('$', FILE);                    \
  150.   else if (CODE == '?') fputc ('?', FILE);                \
  151.   else if (GET_CODE (X) == REG)                        \
  152.     fprintf (FILE, "%s", reg_names[REGNO (X)]);                \
  153.   else if (GET_CODE (X) == MEM)                        \
  154.     {                                    \
  155.       rtx xfoo;                                \
  156.       xfoo = XEXP (X, 0);                        \
  157.       switch (GET_CODE (xfoo))                        \
  158.     {                                \
  159.     case MEM:                            \
  160.       if (GET_CODE (XEXP (xfoo, 0)) == REG)                \
  161.         if (REGNO (XEXP (xfoo, 0)) == STACK_POINTER_REGNUM)        \
  162.           fprintf (FILE, "0(0(sp))");                \
  163.         else fprintf (FILE, "0(0(%s))",                \
  164.               reg_names[REGNO (XEXP (xfoo, 0))]);        \
  165.       else                                \
  166.         {                                \
  167.           fprintf (FILE, "0(");                    \
  168.           output_address (xfoo);                    \
  169.           putc (')', FILE);                        \
  170.         }                                \
  171.       break;                            \
  172.     case REG:                            \
  173.       fprintf (FILE, "0(%s)", reg_names[REGNO (xfoo)]);        \
  174.       break;                            \
  175.     case PRE_DEC:                            \
  176.     case POST_INC:                            \
  177.       fprintf (FILE, "tos");                    \
  178.       break;                            \
  179.     case CONST_INT:                            \
  180.       fprintf (FILE, "@%d", INTVAL (xfoo));                \
  181.       break;                            \
  182.     default:                            \
  183.       output_address (xfoo);                    \
  184.       break;                            \
  185.     }                                \
  186.     }                                    \
  187.   else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) != DImode)    \
  188.     if (GET_MODE (X) == DFmode)                        \
  189.       { union { double d; int i[2]; } u;                \
  190.     u.i[0] = CONST_DOUBLE_LOW (X); u.i[1] = CONST_DOUBLE_HIGH (X);    \
  191.     fprintf (FILE, "$0f%.20e", u.d); }                \
  192.     else { union { double d; int i[2]; } u;                \
  193.        u.i[0] = CONST_DOUBLE_LOW (X); u.i[1] = CONST_DOUBLE_HIGH (X); \
  194.        fprintf (FILE, "$0f%.20e", u.d); }                \
  195.   else if (GET_CODE (X) == CONST)                    \
  196.     output_addr_const (FILE, X);                    \
  197.   else { putc ('$', FILE); output_addr_const (FILE, X); }}
  198.  
  199. #define PRINT_OPERAND_ADDRESS(FILE, ADDR)  print_operand_address(FILE, ADDR)
  200.  
  201. #define FUNCTION_PROFILER(FILE, LABELNO)  \
  202.    fprintf (FILE, "\taddr .LP%d,r0\n\tjsr mcount\n", (LABELNO))
  203.