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