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