* target.h (asm_out.byte_op, asm_out.aligned_op, asm_out.unaligned_op,
[official-gcc.git] / gcc / config / i860 / fx2800.h
blobb12cb123742786988d740c8f05798e23a4bb02c9
1 /* Target definitions for GNU compiler for Alliant FX/2800
2 running Concentrix 2.2
3 Copyright (C) 1991, 1996, 1998, 1999, 2000 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 /* #define NEED_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 { static const char *const dtyps[] = { \
104 "", "char", "short int", "int", "logical*1", \
105 "logical*2", "logical*4", "float", "double", "complex", \
106 "doublecomplex", "character", "void", "nil", "boolean", \
107 "unsigned char", "short unsigned int", "unsigned int", \
108 "logical*8", "long long int", "long long unsigned int",""}; \
110 tree decl; \
111 int i; \
113 for (i=1;*dtyps[i];i++) \
114 for (decl = syms; decl; decl = TREE_CHAIN(decl)) \
115 if ((TREE_CODE (decl) == TYPE_DECL) && DECL_NAME(decl) && \
116 !strcmp(IDENTIFIER_POINTER(DECL_NAME(decl)), dtyps[i])) { \
117 TYPE_SYMTAB_ADDRESS (TREE_TYPE (decl)) = i; \
118 typevec[i] = TYPE_DEFINED; \
119 dbxout_symbol (decl, 0); \
120 break; \
123 for (decl = syms; decl; decl = TREE_CHAIN(decl)) \
124 if ((TREE_CODE (decl) == TYPE_DECL) && DECL_NAME(decl) && \
125 !strcmp(IDENTIFIER_POINTER(DECL_NAME(decl)),"long int")) { \
126 TYPE_SYMTAB_ADDRESS (TREE_TYPE (decl)) = i; \
127 typevec[i] = TYPE_DEFINED; \
128 fprintf(asmfile,".stab \"long int:t%d=3\",0,0x%x,0,0\n", \
129 i++,N_LSYM); \
130 TREE_ASM_WRITTEN (decl) = 1; \
131 break; \
134 for (decl = syms; decl; decl = TREE_CHAIN(decl)) \
135 if ((TREE_CODE (decl) == TYPE_DECL) && DECL_NAME(decl) && !strcmp( \
136 IDENTIFIER_POINTER(DECL_NAME(decl)),"long unsigned int")) { \
137 TYPE_SYMTAB_ADDRESS (TREE_TYPE (decl)) = i; \
138 typevec[i] = TYPE_DEFINED; \
139 fprintf(asmfile,".stab \"long unsigned int:t%d=17\",0,0x%x,0,0\n",\
140 i++,N_LSYM); \
141 TREE_ASM_WRITTEN (decl) = 1; \
142 break; \
144 next_type_number = i; };
146 /* Alliant dbx doesn't understand split names... */
148 #define DBX_CONTIN_LENGTH 0
150 /* The syntax for stabs records is also different; there is only a single
151 ".stab" directive instead of the 3 directives in BSD, and the order of
152 arguments is slightly changed. */
154 #define ASM_STABS_OP "\t.stab "
155 #define ASM_STABN_OP "\t.stab "
156 #define ASM_STABD_OP "\t.stab "
158 #define DBX_MEMPARM_STABS_LETTER 'k'
159 #define DBX_REGPARM_STABS_LETTER 'r'
161 #undef ASM_OUTPUT_SOURCE_LINE
162 #define ASM_OUTPUT_SOURCE_LINE(file,num) \
163 fprintf (file, "\t.stab \"\",.,0x%x,0,%d\n", \
164 N_SLINE,num)
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
175 #define DBX_OUTPUT_MAIN_SOURCE_FILENAME(file,name) \
176 fprintf (file, ".stab "); \
177 output_quoted_string (file, name); \
178 fprintf (file, ",.Ltext0,0x%x,0,0\n", N_SO); \
179 text_section (); \
180 ASM_OUTPUT_INTERNAL_LABEL (file, "Ltext", 0)
182 #define DBX_OUTPUT_SOURCE_FILENAME(file,name) \
183 do { fprintf (file, ".stab "); \
184 output_quoted_string (file, name); \
185 fprintf (file, ",.Ltext0,0x%x,0,0\n", N_SOL); \
186 } while (0)
188 #define DBX_OUTPUT_CONSTANT_SYMBOL(file,name,ival) \
189 fprintf (file, ".stab \"%s:c=i%d\",0,0x%x,0,0\n", \
190 name, ival, N_LSYM)
192 #define DBX_FINISH_SYMBOL(decl) \
193 int line = 0; \
194 fprintf (asmfile, "\","); \
195 if (current_sym_addr) \
196 output_addr_const (asmfile, current_sym_addr); \
197 else \
198 fprintf (asmfile, "%d", current_sym_value); \
199 if (decl != 0 && TREE_CODE(decl) == FUNCTION_DECL) \
200 line=DECL_SOURCE_LINE (decl); \
201 fprintf (asmfile, ",0x%x,%d,%d\n", current_sym_code, \
202 line!=0?64:0,line)
204 #define DBX_OUTPUT_CATCH(file,decl,name) \
205 fprintf (file, ".stab \"%s:C1\",", \
206 IDENTIFIER_POINTER (DECL_NAME (decl))); \
207 assemble_name (file, name); \
208 fprintf (file, ",0x%x,0,0\n", N_CATCH)
210 #define DBX_OUTPUT_LBRAC(file,name) \
211 if (depth > 1) { \
212 fprintf (file, ".stab \"\","); \
213 assemble_name (file, name); \
214 fprintf (file, ",0x%x,0,%d\n", N_LBRAC, depth); }
216 #define DBX_OUTPUT_RBRAC(file,name) \
217 if (depth > 1) { \
218 fprintf (file, ".stab \"\","); \
219 assemble_name (file, name); \
220 fprintf (file, ",0x%x,0,%d\n", N_RBRAC, depth); }
222 #define DBX_OUTPUT_ENUM(file,type) \
223 fprintf (file, "e3"); \
224 CHARS(2); \
225 for (tem = TYPE_VALUES (type); tem; tem = TREE_CHAIN (tem)) \
227 fprintf (asmfile, "%s:%d,", \
228 IDENTIFIER_POINTER (TREE_PURPOSE (tem)), \
229 TREE_INT_CST_LOW (TREE_VALUE (tem))); \
230 CHARS (11 + IDENTIFIER_LENGTH (TREE_PURPOSE (tem))); \
231 if (TREE_CHAIN (tem) != 0) \
232 CONTIN; \
234 putc (';', asmfile); \
235 CHARS (1);
237 /* Undefine some things defined in i860.h because the native C compiler
238 on the FX/2800 emits code to do these operations inline. For GCC,
239 we will use the default implementation of these things... i.e.
240 generating calls to libgcc routines. */
242 #undef DIVSI3_LIBCALL
243 #undef UDIVSI3_LIBCALL
244 #undef REMSI3_LIBCALL
245 #undef UREMSI3_LIBCALL
247 /* Global pointer needs to be 8 byte aligned? Link error if not... */
249 #define DATA_ALIGNMENT(dummy,align) \
250 ((TREE_PUBLIC (decl) && \
251 (POINTER_TYPE_P (TREE_TYPE (decl)))) ? 64: align)
253 #undef FUNCTION_PROFILER
254 #define FUNCTION_PROFILER(FILE, LABELNO) \
255 fprintf (FILE, "\tcall __mcount_\n\tnop\n")
257 /* Overrides for i860v4.h begin here */
259 /* Provide a set of pre-definitions and pre-assertions appropriate for
260 the i860 running Concentrix 2.x. */
262 #undef CPP_PREDEFINES
263 #define CPP_PREDEFINES "-Di860 -Dunix -DBSD4_3 -Dalliant -Asystem=unix -Asystem=bsd -Acpu=i860 -Amachine=i860"
265 #undef I860_REG_PREFIX
266 #undef ASM_COMMENT_START
267 #define ASM_COMMENT_START "//"
269 /* Use definitions of ASM_OUTPUT_{DOUBLE,FLOAT} as given in i860.h */
271 #undef ASM_OUTPUT_DOUBLE
272 #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
273 fprintf(FILE, "\t.double %.20e\n", (VALUE))
274 #undef ASM_OUTPUT_FLOAT
275 #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
276 fprintf(FILE, "\t.float %.12e\n", (VALUE))
278 #undef ASM_FILE_START
279 #define ASM_FILE_START(FILE)
280 #undef ASM_OUTPUT_FUNCTION_PREFIX
281 #define ASM_OUTPUT_FUNCTION_PREFIX(FILE,NAME) \
282 fputs("\tnop\n", (FILE)); \
283 current_function_original_name = (NAME)
284 #undef ASM_OUTPUT_PROLOGUE_SUFFIX
286 /* Overrides for svr4.h begin here */
288 #undef SWITCH_TAKES_ARG
289 #undef WORD_SWITCH_TAKES_ARG
291 #undef ASM_SPEC
292 #undef ASM_FINAL_SPEC
293 #undef MD_STARTFILE_PREFIX
294 #undef MD_EXEC_PREFIX
296 /* Generate an error message if -p option is selected. Concentrix 2.x
297 does not support prof format profiling, only gprof is supported. */
299 #define CPP_SPEC "%{p:%e-p option not supported: use -pg instead}"
301 /* Provide an appropriate LIB_SPEC. The crtend.o file provides part of the
302 support for getting C++ file-scope static objects constructed before
303 entering `main'. */
305 #undef LIB_SPEC
306 #define LIB_SPEC \
307 "%{g*:-lg} %{!pg:-lc}%{pg:-lc_p} crtend.o%s"
309 /* Tell linker to strip local symbols, since assembler may not. */
311 #undef LINK_SPEC
312 #define LINK_SPEC "-X"
314 /* Get the correct startup file for regular or profiled code. Also
315 use the crtbegin.o file for C++ ... */
317 #undef STARTFILE_SPEC
318 #define STARTFILE_SPEC \
319 "%{!pg:crt0.o%s}%{pg:gcrt0.o%s} crtbegin.o%s"
321 #undef SCCS_DIRECTIVE
322 #undef NO_DOLLAR_IN_LABEL
323 #undef TARGET_MEM_FUNCTIONS
325 #undef DWARF_DEBUGGING_INFO
327 /* The prefix to add to user-visible assembler symbols. */
329 #undef USER_LABEL_PREFIX
330 #define USER_LABEL_PREFIX "_"
332 #undef ASM_OUTPUT_EXTERNAL_LIBCALL
334 /* ??? Is this used anywhere? */
335 #undef BSS_ASM_OP
336 #define BSS_ASM_OP "\t.lcomm "
338 #undef ASM_FILE_END
339 #define ASM_FILE_END(FILE) \
340 do { \
341 if (current_function_original_name != NULL) { \
342 const char *long_op = integer_asm_op (4, FALSE); \
343 tdesc_section(); \
344 fprintf ((FILE), "%s __ETEXT\n", long_op); \
345 fprintf ((FILE), "%s 0\n", long_op); \
346 fputs ("\t.long\t__ETEXT\n", (FILE)); \
347 fputs ("\t.long\t0\n", (FILE)); \
348 text_section(); \
349 fputs("__ETEXT:\n", (FILE)); \
351 if (!flag_no_ident) \
352 fprintf ((FILE), "\t.ident\t\"GCC: (GNU) %s\"\n", \
353 version_string); \
354 } while (0)