home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / gcc-2.7.2.1-base.tgz / gcc-2.7.2.1-base.tar / fsf / gcc / config / i860 / fx2800.h < prev    next >
C/C++ Source or Header  |  1995-06-15  |  11KB  |  345 lines

  1. /* Target definitions for GNU compiler for Alliant FX/2800
  2.    running Concentrix 2.2
  3.  
  4.    Copyright (C) 1991 Free Software Foundation, Inc.
  5.  
  6.    Written by Howard Chu (hyc@hanauma.jpl.nasa.gov).
  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 2, 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, 59 Temple Place - Suite 330,
  23. Boston, MA 02111-1307, USA.  */
  24.  
  25. #define OUTPUT_TDESC
  26.  
  27. #include "i860/sysv4.h"
  28.  
  29. /* The Alliant fx2800 running Concentrix 2.x is weird.  This is basically
  30.    a BSD 4.3 based operating system, but it uses svr4 ELF format object
  31.    files and it somehow puts BSD stabs records into the ELF files for
  32.    symbolic debug information.  The assembler is "mostly an SVR4 assembler
  33.    with some Alliant additions. We based it on the `Intel 80860 Assembly
  34.    Language Specification' from AT&T." */
  35.  
  36. /* This file consists of three sections. The first section establishes
  37.    definitions unique to the Alliant FX/2800. The next section reconciles
  38.    differences between Alliant and i860v4.h, and the last overrides the
  39.    remaining differences with svr4.h */
  40.  
  41. #undef TARGET_VERSION
  42. #define TARGET_VERSION fprintf (stderr, " (i860 Alliant)");
  43.  
  44. /* atexit is not present prior to Concentrix 2.2. Uncomment the following
  45.    if you're on 2.1 or older. */
  46.  
  47. /* #undef HAVE_ATEXIT */
  48.  
  49. #define I860_STRICT_ABI_PROLOGUES
  50.  
  51. /* There is no avoiding this; -L does not exist at all (in Concentrix 2.2).  */
  52. #define LINK_LIBGCC_SPECIAL 1
  53.  
  54. /* Most of the Alliant-specific definitions here are to get stab info that
  55.    Alliant's dbx can understand. */
  56.  
  57. #define DBX_DEBUGGING_INFO
  58. #define DEFAULT_GDB_EXTENSIONS 0
  59. #define DBX_NO_XREFS
  60. #define DBX_NO_EXTRA_TAGS
  61.  
  62. /* Alliant dbx also needs to see the function stab before anything
  63.    else in the function. */
  64.  
  65. #define DBX_FUNCTION_FIRST
  66. #define DBX_LBRAC_FIRST
  67.  
  68. /* Alliant dbx also needs to see the end of a function somewhere. */
  69.  
  70. #define DBX_OUTPUT_FUNCTION_END(file,decl)    \
  71.     fprintf (file, ".stab \"\",.,0x%x,0,0\n", N_EFUN)
  72.  
  73. /* Alliant dbx has predefined types, so they must be emitted with the
  74.    proper type numbers. The defined types are:
  75.  
  76.      Type #    C, Fortran, Pascal Types
  77.     --    ------------------------
  78.      1    char, integer*1
  79.      2    short,     integer*2
  80.      3    int, long, integer*4, integer
  81.      4    logical*1, byte
  82.      5    logical*2
  83.      6    logical*4, logical
  84.      7    float, real*4,     real
  85.      8    double, real*8,    double
  86.      9    single complex, complex*8, complex
  87.     10    double complex, doublecomplex
  88.     11    character
  89.     12    void
  90.     13    nil
  91.     14    boolean
  92.     15    unsigned char, ubyte
  93.     16    unsigned short, uword
  94.     17    unsigned, unsigned int, unsigned long, ulong
  95.     18    quad, logical*8
  96.     19    long long, integer*8
  97.     20    unsigned long long, uquad*8
  98.     21-100    reserved for future predefined types
  99.     100    long redefine same as 3
  100.     101    unsigned long same as 17
  101.     --    --------------------
  102.     102    First user program type
  103.  
  104.    Since long and unsigned long are int references, they must be handled
  105.    as special cases. The Alliant compiler doesn't use types 18-20, so it
  106.    sets long & unsigned long in 18 & 19, not in 100 & 101 as shown above. */
  107.  
  108. #define DBX_OUTPUT_STANDARD_TYPES(syms)    \
  109. { char *dtyps[]={"", "char", "short int", "int", "logical*1",        \
  110.     "logical*2", "logical*4", "float", "double", "complex",        \
  111.     "doublecomplex", "character", "void", "nil", "boolean",        \
  112.     "unsigned char", "short unsigned int", "unsigned int",        \
  113.     "logical*8", "long long int", "long long unsigned int",""};    \
  114.                                     \
  115.   tree decl;                                \
  116.   int i;                                \
  117.                                     \
  118.   for (i=1;*dtyps[i];i++)                        \
  119.     for (decl = syms; decl; decl = TREE_CHAIN(decl))            \
  120.     if ((TREE_CODE (decl) == TYPE_DECL) && DECL_NAME(decl) &&    \
  121.         !strcmp(IDENTIFIER_POINTER(DECL_NAME(decl)), dtyps[i])) {    \
  122.         TYPE_SYMTAB_ADDRESS (TREE_TYPE (decl)) = i;        \
  123.         typevec[i] = TYPE_DEFINED;                \
  124.         dbxout_symbol (decl, 0);                \
  125.         break;                            \
  126.     }                                \
  127.                                     \
  128.   for (decl = syms; decl; decl = TREE_CHAIN(decl))            \
  129.     if ((TREE_CODE (decl) == TYPE_DECL) && DECL_NAME(decl) &&        \
  130.     !strcmp(IDENTIFIER_POINTER(DECL_NAME(decl)),"long int")) {    \
  131.       TYPE_SYMTAB_ADDRESS (TREE_TYPE (decl)) = i;            \
  132.       typevec[i] = TYPE_DEFINED;                    \
  133.       fprintf(asmfile,".stab \"long int:t%d=3\",0,0x%x,0,0\n",        \
  134.         i++,N_LSYM);                        \
  135.       TREE_ASM_WRITTEN (decl) = 1;                    \
  136.       break;                                \
  137.     }                                    \
  138.                                     \
  139.   for (decl = syms; decl; decl = TREE_CHAIN(decl))            \
  140.     if ((TREE_CODE (decl) == TYPE_DECL) && DECL_NAME(decl) && !strcmp(    \
  141.     IDENTIFIER_POINTER(DECL_NAME(decl)),"long unsigned int")) {    \
  142.       TYPE_SYMTAB_ADDRESS (TREE_TYPE (decl)) = i;            \
  143.       typevec[i] = TYPE_DEFINED;                    \
  144.       fprintf(asmfile,".stab \"long unsigned int:t%d=17\",0,0x%x,0,0\n",\
  145.         i++,N_LSYM);                        \
  146.       TREE_ASM_WRITTEN (decl) = 1;                    \
  147.       break;                                \
  148.     }                                    \
  149.   next_type_number = i; };
  150.  
  151. /* Alliant dbx doesn't understand split names... */
  152.  
  153. #define DBX_CONTIN_LENGTH 0
  154.  
  155. /* The syntax for stabs records is also different; there is only a single
  156.    ".stab" directive instead of the 3 directives in BSD, and the order of
  157.    arguments is slightly changed. */
  158.  
  159. #define ASM_STABS_OP    ".stab"
  160. #define ASM_STABN_OP    ".stab"
  161. #define ASM_STABD_OP    ".stab"
  162.  
  163. #define DBX_MEMPARM_STABS_LETTER 'k'
  164. #define DBX_REGPARM_STABS_LETTER 'r'
  165.  
  166. #define ASM_OUTPUT_SOURCE_LINE(file,num)        \
  167.     fprintf (file, "\t.stab \"\",.,0x%x,0,%d\n",    \
  168.         N_SLINE,num)
  169.  
  170. #if 0    /* Alliant dbx only reads first N_SO, so it
  171.        ignores the filename if dir is present. */
  172. #define DBX_OUTPUT_MAIN_SOURCE_DIRECTORY(file,name)        \
  173.     fprintf (file, ".stab \"%s/\",.Ltext0,0x%x,0,0\n",    \
  174.         name, N_SO)
  175. #else
  176. #define DBX_OUTPUT_MAIN_SOURCE_DIRECTORY(file,name)
  177. #endif
  178.  
  179. #define DBX_OUTPUT_MAIN_SOURCE_FILENAME(file,name)        \
  180.     fprintf (file, ".stab ");                \
  181.     output_quoted_string (file, name);            \
  182.     fprintf (file, ",.Ltext0,0x%x,0,0\n", N_SO);        \
  183.     text_section ();                    \
  184.     ASM_OUTPUT_INTERNAL_LABEL (file, "Ltext", 0)
  185.  
  186. #define DBX_OUTPUT_SOURCE_FILENAME(file,name)            \
  187.   do {    fprintf (file, ".stab ");                \
  188.     output_quoted_string (file, name);            \
  189.     fprintf (file, ",.Ltext0,0x%x,0,0\n", N_SOL);        \
  190.   } while (0)
  191.  
  192. #define DBX_OUTPUT_CONSTANT_SYMBOL(file,name,ival)        \
  193.     fprintf (file, ".stab \"%s:c=i%d\",0,0x%x,0,0\n",    \
  194.         name, ival, N_LSYM)
  195.  
  196. #define DBX_FINISH_SYMBOL(decl)    \
  197.     int line = 0;                        \
  198.     fprintf (asmfile, "\",");                \
  199.     if (current_sym_addr)                    \
  200.       output_addr_const (asmfile, current_sym_addr);    \
  201.     else                            \
  202.       fprintf (asmfile, "%d", current_sym_value);        \
  203.     if (decl != 0 && TREE_CODE(decl) == FUNCTION_DECL)    \
  204.       line=DECL_SOURCE_LINE (decl);                \
  205.     fprintf (asmfile, ",0x%x,%d,%d\n", current_sym_code,    \
  206.       line!=0?64:0,line)
  207.  
  208. #define DBX_OUTPUT_CATCH(file,decl,name)        \
  209.   fprintf (file, ".stab \"%s:C1\",",            \
  210.        IDENTIFIER_POINTER (DECL_NAME (decl)));    \
  211.   assemble_name (file, name);                \
  212.   fprintf (file, ",0x%x,0,0\n", N_CATCH)
  213.  
  214. #define DBX_OUTPUT_LBRAC(file,name)    \
  215.   if (depth > 1) {            \
  216.     fprintf (file, ".stab \"\",");    \
  217.     assemble_name (file, name);        \
  218.     fprintf (file, ",0x%x,0,%d\n", N_LBRAC, depth); }
  219.  
  220. #define DBX_OUTPUT_RBRAC(file,name)    \
  221.   if (depth > 1) {            \
  222.     fprintf (file, ".stab \"\",");    \
  223.     assemble_name (file, name);        \
  224.     fprintf (file, ",0x%x,0,%d\n", N_RBRAC, depth); }
  225.  
  226. #define DBX_OUTPUT_ENUM(file,type)                \
  227.   fprintf (file, "e3");                        \
  228.   CHARS(2);                            \
  229.   for (tem = TYPE_VALUES (type); tem; tem = TREE_CHAIN (tem))    \
  230.     {                                \
  231.       fprintf (asmfile, "%s:%d,",                \
  232.            IDENTIFIER_POINTER (TREE_PURPOSE (tem)),        \
  233.            TREE_INT_CST_LOW (TREE_VALUE (tem)));        \
  234.       CHARS (11 + IDENTIFIER_LENGTH (TREE_PURPOSE (tem)));    \
  235.       if (TREE_CHAIN (tem) != 0)                \
  236.     CONTIN;                            \
  237.     }                                \
  238.   putc (';', asmfile);                        \
  239.   CHARS (1);
  240.  
  241. /* Undefine some things defined in i860.h because the native C compiler
  242.    on the FX/2800 emits code to do these operations inline.  For GCC,
  243.    we will use the default implementation of these things... i.e.
  244.    generating calls to libgcc1 routines.  */
  245.  
  246. #undef DIVSI3_LIBCALL
  247. #undef UDIVSI3_LIBCALL
  248. #undef REMSI3_LIBCALL
  249. #undef UREMSI3_LIBCALL
  250.  
  251. /* The Alliant compiler's mod function gives the wrong result after a
  252.    shift operation. This bug typically hits in hash functions. */
  253.  
  254. #define perform_umodsi3(a, b)    a %= b; if (a == b) a=0; return a
  255. #define perform_modsi3(a, b)    a %= b; if (a == b) a=0; return a
  256.  
  257. /* Global pointer needs to be 8 byte aligned? Link error if not... */
  258.  
  259. #define DATA_ALIGNMENT(dummy,align)    \
  260.     ((TREE_PUBLIC (decl) &&    \
  261.      (TREE_CODE (TREE_TYPE (decl))==POINTER_TYPE)) ? 64:align)
  262.  
  263. #undef FUNCTION_PROFILER
  264. #define FUNCTION_PROFILER(FILE, LABELNO)    \
  265.     fprintf (FILE, "\tcall __mcount_\n\tnop\n")
  266.  
  267. /* Overrides for i860v4.h begin here */
  268.  
  269. /* Provide a set of pre-definitions and pre-assertions appropriate for
  270.    the i860 running Concentrix 2.x.  */
  271.  
  272. #undef CPP_PREDEFINES 
  273. #define CPP_PREDEFINES "-Di860 -Dunix -DBSD4_3 -Dalliant -Asystem(unix) -Asystem(bsd) -Acpu(i860) -Amachine(i860)"
  274.  
  275. #undef I860_REG_PREFIX
  276. #undef ASM_COMMENT_START
  277. #define ASM_COMMENT_START "//"
  278.  
  279. /* Use definitions of ASM_OUTPUT_{DOUBLE,FLOAT} as given in i860.h */
  280.  
  281. #undef ASM_OUTPUT_DOUBLE
  282. #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
  283.   fprintf(FILE, "\t.double %.20e\n", (VALUE))
  284. #undef ASM_OUTPUT_FLOAT
  285. #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
  286.   fprintf(FILE, "\t.float %.12e\n", (VALUE))
  287.  
  288. #undef ASM_FILE_START
  289. #define ASM_FILE_START(FILE)
  290. #undef ASM_OUTPUT_FUNCTION_PREFIX
  291. #define ASM_OUTPUT_FUNCTION_PREFIX(FILE,NAME) \
  292.   fputs("\tnop\n", (FILE));            \
  293.   current_function_original_name = (NAME)
  294. #undef ASM_OUTPUT_PROLOGUE_SUFFIX
  295.  
  296. /* Overrides for svr4.h begin here */
  297.  
  298. #undef SVR4
  299.  
  300. #undef SWITCH_TAKES_ARG
  301. #undef WORD_SWITCH_TAKES_ARG
  302.  
  303. #undef ASM_SPEC
  304. #undef ASM_FINAL_SPEC
  305. #undef MD_STARTFILE_PREFIX
  306. #undef MD_EXEC_PREFIX
  307.  
  308. /* Generate an error message if -p option is selected. Concentrix 2.x
  309.    does not support prof format profiling, only gprof is supported. */
  310.  
  311. #define CPP_SPEC    "%{p:%e-p option not supported: use -pg instead}"
  312.  
  313. /* Provide an appropriate LIB_SPEC. The crtend.o file provides part of the
  314.    support for getting C++ file-scope static objects constructed before
  315.    entering `main'. */
  316.  
  317. #undef LIB_SPEC
  318. #define LIB_SPEC \
  319.     "%{g*:-lg} %{!pg:-lc}%{pg:-lc_p} crtend.o%s"
  320.  
  321. /* Tell linker to strip local symbols, since assembler may not. */
  322.  
  323. #undef LINK_SPEC
  324. #define LINK_SPEC    "-X"
  325.  
  326. /* Get the correct startup file for regular or profiled code. Also
  327.    use the crtbegin.o file for C++ ... */
  328.  
  329. #undef STARTFILE_SPEC
  330. #define STARTFILE_SPEC \
  331.     "%{!pg:crt0.o%s}%{pg:gcrt0.o%s} crtbegin.o%s"
  332.  
  333. #undef SCCS_DIRECTIVE
  334. #undef NO_DOLLAR_IN_LABEL
  335. #undef TARGET_MEM_FUNCTIONS
  336.  
  337. #undef DWARF_DEBUGGING_INFO
  338.  
  339. #undef ASM_OUTPUT_LABELREF
  340. #define ASM_OUTPUT_LABELREF(FILE,NAME) fprintf (FILE, "_%s", NAME)
  341. #undef ASM_OUTPUT_EXTERNAL_LIBCALL
  342.  
  343. #undef BSS_ASM_OP
  344. #define BSS_ASM_OP    "\t.lcomm"
  345.