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

  1. /* Target definitions for GNU compiler for Intel 80860 running System V.4
  2.    Copyright (C) 1991 Free Software Foundation, Inc.
  3.  
  4.    Written by Ron Guilmette (rfg@ncd.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 2, 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. #include "i860.h"
  23. #include "svr4.h"
  24.  
  25. #undef TARGET_VERSION
  26. #define TARGET_VERSION fprintf (stderr, " (i860 System V Release 4)");
  27.  
  28. /* Provide a set of pre-definitions and pre-assertions appropriate for
  29.    the i860 running svr4.  Note that the symbol `__SVR4__' MUST BE
  30.    DEFINED!  It is needed so that the va_list struct in va-i860.h
  31.    will get correctly defined for the svr4 (ABI compliant) case rather
  32.    than for the previous (svr3, svr2, ...) case.  It also needs to be
  33.    defined so that the correct (svr4) version of __builtin_saveregs
  34.    will be selected when we are building gnulib2.c.
  35.    __svr4__ is our extension.  */
  36.  
  37. #define CPP_PREDEFINES \
  38.   "-Di860 -Dunix -DSVR4 -D__svr4__ -Asystem(unix) -Acpu(i860) -Amachine(i860)"
  39.  
  40. /* The prefix to be used in assembler output for all names of registers.
  41.    This string gets prepended to all i860 register names (svr4 only).  */
  42.  
  43. #define I860_REG_PREFIX    "%"
  44.  
  45. #define ASM_COMMENT_START "#"
  46.  
  47. #undef TYPE_OPERAND_FMT
  48. #define TYPE_OPERAND_FMT      "\"%s\""
  49.  
  50. #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
  51.  
  52. /* The following macro definition overrides the one in i860.h
  53.    because the svr4 i860 assembler requires a different syntax
  54.    for getting parts of constant/relocatable values.  */
  55.  
  56. #undef PRINT_OPERAND_PART
  57. #define PRINT_OPERAND_PART(FILE, X, PART_CODE)                \
  58.   do { fprintf (FILE, "[");                        \
  59.     output_address (X);                        \
  60.     fprintf (FILE, "]@%s", PART_CODE);                \
  61.   } while (0)
  62.  
  63. /* If the host and target formats match, output the floats as hex.  */
  64. #if HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT
  65. #if defined (HOST_WORDS_BIG_ENDIAN) == WORDS_BIG_ENDIAN
  66.  
  67. /* This is how to output an assembler line defining a `double' constant.
  68.    Note that the native i860/svr4 ELF assembler can't properly handle
  69.    infinity.  It generates an incorrect (non-infinity) value when given
  70.    `.double 99e9999' and it doesn't grok `inf' at all.  It also mishandles
  71.    NaNs and -0.0.  */
  72.  
  73. #undef ASM_OUTPUT_DOUBLE
  74. #define ASM_OUTPUT_DOUBLE(FILE,VALUE)                    \
  75.   {                                    \
  76.     if (REAL_VALUE_ISINF (VALUE)                    \
  77.         || REAL_VALUE_ISNAN (VALUE)                    \
  78.     || REAL_VALUE_MINUS_ZERO (VALUE))                \
  79.       {                                    \
  80.     long t[2];                            \
  81.     REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), t);            \
  82.     fprintf (FILE, "\t.word 0x%lx\n\t.word 0x%lx\n", t[0], t[1]);    \
  83.       }                                    \
  84.     else                                \
  85.       fprintf (FILE, "\t.double %.20e\n", VALUE);            \
  86.   }
  87.  
  88. /* This is how to output an assembler line defining a `float' constant.
  89.    Note that the native i860/svr4 ELF assembler can't properly handle
  90.    infinity.  It actually generates an assembly time error when given
  91.    `.float 99e9999' and it doesn't grok `inf' at all.  It also mishandles
  92.    NaNs and -0.0.  */
  93.  
  94. #undef ASM_OUTPUT_FLOAT
  95. #define ASM_OUTPUT_FLOAT(FILE,VALUE)                    \
  96.   {                                    \
  97.     if (REAL_VALUE_ISINF (VALUE)                    \
  98.         || REAL_VALUE_ISNAN (VALUE)                    \
  99.     || REAL_VALUE_MINUS_ZERO (VALUE))                \
  100.       {                                    \
  101.     long t;                                \
  102.     REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t);            \
  103.     fprintf (FILE, "\t.word 0x%lx\n", t);                \
  104.       }                                    \
  105.     else                                \
  106.       fprintf (FILE, "\t.float %.12e\n", VALUE);            \
  107.   }
  108.  
  109. #endif /* word order matches */
  110. #endif /* HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT */
  111.  
  112. #undef ASM_FILE_START
  113. #define ASM_FILE_START(FILE)                        \
  114.   do {    output_file_directive (FILE, main_input_filename);        \
  115.     fprintf (FILE, "\t.version\t\"01.01\"\n");            \
  116.   } while (0)
  117.  
  118. /* Output the special word the svr4 SDB wants to see just before
  119.    the first word of each function's prologue code.  */
  120.  
  121. extern char *current_function_original_name;
  122.  
  123. /* This special macro is used to output a magic word just before the
  124.    first word of each function.  On some versions of UNIX running on
  125.    the i860, this word can be any word that looks like a NOP, however
  126.    under svr4, this neds to be an `shr r0,r0,r0' instruction in which
  127.    the normally unused low-order bits contain the length of the function
  128.    prologue code (in bytes).  This is needed to make the svr4 SDB debugger
  129.    happy.  */
  130.  
  131. #undef ASM_OUTPUT_FUNCTION_PREFIX
  132. #define ASM_OUTPUT_FUNCTION_PREFIX(FILE, FNNAME)            \
  133.   do {    ASM_OUTPUT_ALIGN (FILE, 2);                    \
  134.       fprintf ((FILE), "\t.long\t.ep.");                \
  135.     assemble_name (FILE, FNNAME);                    \
  136.     fprintf (FILE, "-");                        \
  137.     assemble_name (FILE, FNNAME);                    \
  138.     fprintf (FILE, "+0xc8000000\n");                \
  139.     current_function_original_name = (FNNAME);            \
  140.   } while (0)
  141.  
  142. /* Output the special label that must go just after each function's
  143.    prologue code to support svr4 SDB.  */
  144.  
  145. #define ASM_OUTPUT_PROLOGUE_SUFFIX(FILE)                \
  146.   do {    fprintf (FILE, ".ep.");                        \
  147.     assemble_name (FILE, current_function_original_name);        \
  148.     fprintf (FILE, ":\n");                        \
  149.   } while (0)
  150.  
  151. #undef CTORS_SECTION_ASM_OP
  152. #define CTORS_SECTION_ASM_OP    ".section\t.ctors,\"a\",\"progbits\""
  153. #undef DTORS_SECTION_ASM_OP
  154. #define DTORS_SECTION_ASM_OP    ".section\t.dtors,\"a\",\"progbits\""
  155.  
  156. /* Add definitions to support the .tdesc section as specified in the svr4
  157.    ABI for the i860.  */
  158.  
  159. #define TDESC_SECTION_ASM_OP    ".section\t.tdesc"
  160.  
  161. #undef EXTRA_SECTIONS
  162. #define EXTRA_SECTIONS in_const, in_ctors, in_dtors, in_tdesc
  163.  
  164. #undef EXTRA_SECTION_FUNCTIONS
  165. #define EXTRA_SECTION_FUNCTIONS                        \
  166.   CONST_SECTION_FUNCTION                        \
  167.   CTORS_SECTION_FUNCTION                        \
  168.   DTORS_SECTION_FUNCTION                        \
  169.   TDESC_SECTION_FUNCTION
  170.  
  171. #define TDESC_SECTION_FUNCTION                        \
  172. void                                    \
  173. tdesc_section ()                            \
  174. {                                    \
  175.   if (in_section != in_tdesc)                        \
  176.     {                                    \
  177.       fprintf (asm_out_file, "%s\n", TDESC_SECTION_ASM_OP);        \
  178.       in_section = in_tdesc;                        \
  179.     }                                    \
  180. }
  181.  
  182. #ifdef OUTPUT_TDESC
  183. #undef ASM_FILE_END
  184. #define ASM_FILE_END(FILE)                    \
  185. do {                                 \
  186.      if (current_function_original_name != NULL) {        \
  187.        tdesc_section();                        \
  188.        fprintf ((FILE), "%s __ETEXT\n", ASM_LONG);        \
  189.        fprintf ((FILE), "%s 0\n", ASM_LONG);            \
  190.        text_section();                        \
  191.        fputs("__ETEXT:\n", (FILE));                \
  192.      }                                \
  193.      fprintf ((FILE), "\t.ident\t\"GCC: (GNU) %s\"\n",        \
  194.           version_string);                    \
  195.    } while (0)
  196. #endif
  197.