OSDN Git Service

* config/xtensa/xtensa.c (xtensa_va_arg): Fix to handle arguments
[pf3gnuchains/gcc-fork.git] / gcc / config / m68k / news.h
1 /* Definitions of target machine for GNU compiler.  SONY NEWS-OS 4 version.
2    Copyright (C) 1987, 1989, 1993, 1994, 1996, 1997, 1998, 1999
3    Free Software Foundation, Inc.
4
5 This file is part of GNU CC.
6
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING.  If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA.  */
21
22 #ifndef USE_GAS
23 /* This controls conditionals in m68k.h.  */
24 #define MOTOROLA                /* Use Motorola syntax rather than "MIT" */
25 #define SGS_NO_LI               /* Suppress jump table label usage */
26 #endif
27
28 #define NEWS
29 #define NO_DOLLAR_IN_LABEL
30 #define NO_DOT_IN_LABEL
31
32 #include "m68k/m68k.h"
33
34 /* See m68k.h.  7 means 68020 with 68881.  */
35
36 #define TARGET_DEFAULT (MASK_BITFIELD|MASK_68881|MASK_68020)
37
38 /* Define __HAVE_68881__ in preprocessor, unless -msoft-float is specified.
39    This will control the use of inline 68881 insns in certain macros.  */
40
41 #define CPP_SPEC "%{!msoft-float:-D__HAVE_68881__}"
42
43 /* Names to predefine in the preprocessor for this target machine.  */
44 /* These are the ones defined by Sony, plus mc68000 for uniformity with
45    GCC on other 68000 systems.  */
46
47 #ifdef MOTOROLA
48 #define CPP_PREDEFINES "-Dunix -Dbsd43 -Dsony -Dsony_news -Dmc68000 -Dmc68020 -Dnews700 -D__motorola__ -Asystem=unix -Asystem=bsd -Acpu=m68k -Amachine=m68k"
49 #else
50 #define CPP_PREDEFINES "-Dunix -Dbsd43 -Dsony -Dsony_news -Dmc68000 -Dmc68020 -Dnews700 -Asystem=unix -Asystem=bsd -Acpu=m68k -Amachine=m68k"
51 #endif
52
53 /* These conditionals tested for different submodels,
54    but they were incorrect since they tested the host rather than the target.
55    The choice of model shouldn't actually matter.  */
56
57 #if 0
58 #ifdef news800
59 #define CPP_PREDEFINES "-Dunix -Dbsd43 -Dsony -Dsony_news -Dmc68000 -Dmc68020 -Dnews800 -Asystem=unix -Asystem=bsd -Acpu=m68k -Amachine=m68k"
60 #endif
61 #ifdef news900
62 #define CPP_PREDEFINES "-Dunix -Dbsd43 -Dsony -Dsony_news -Dmc68000 -Dmc68020 -Dnews900 -Asystem=unix -Asystem=bsd -Acpu=m68k -Amachine=m68k"
63 #endif
64 #ifdef news1500
65 #define CPP_PREDEFINES "-Dunix -Dbsd43 -Dsony -Dsony_news -Dmc68000 -Dmc68020 -Dmc68030 -Dnews1500 -Asystem=unix -Asystem=bsd -Acpu=m68k -Amachine=m68k"
66 #endif
67 #ifdef news1700
68 #define CPP_PREDEFINES "-Dunix -Dbsd43 -Dsony -Dsony_news -Dmc68000 -Dmc68020 -Dmc68030 -Dnews1700 -Asystem=unix -Asystem=bsd -Acpu=m68k -Amachine=m68k"
69 #endif
70 #ifdef news1800
71 #define CPP_PREDEFINES "-Dunix -Dbsd43 -Dsony -Dsony_news -Dmc68000 -Dmc68020 -Dmc68030 -Dnews1800 -Asystem=unix -Asystem=bsd -Acpu=m68k -Amachine=m68k"
72 #endif
73 #ifdef news1900
74 #define CPP_PREDEFINES "-Dunix -Dbsd43 -Dsony -Dsony_news -Dmc68000 -Dmc68020 -Dmc68030 -Dnews1900 -Asystem=unix -Asystem=bsd -Acpu=m68k -Amachine=m68k"
75 #endif
76 #endif
77
78 /* Link with libg.a when debugging, for dbx's sake.  */
79
80 #define LIB_SPEC "%{g:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} "
81
82 /* This is BSD, so it wants DBX format.  */
83
84 #define DBX_DEBUGGING_INFO
85
86 #if 0
87 /* This is to be compatible with types.h.
88    It was found to be necessary with Newsos 3.  */
89
90 #define SIZE_TYPE "long int"
91 #endif
92 \f
93 /* Override parts of m68k.h to fit Sony's assembler syntax.  */
94
95 #undef BIGGEST_ALIGNMENT
96 #undef CALL_USED_REGISTERS
97 #undef FUNCTION_VALUE
98 #undef LIBCALL_VALUE
99 #undef FUNCTION_PROFILER
100
101 #ifdef MOTOROLA
102 #undef REGISTER_NAMES
103 #undef ASM_OUTPUT_REG_PUSH
104 #undef ASM_OUTPUT_REG_POP
105 #undef ASM_OUTPUT_SKIP
106 #undef ASM_FORMAT_PRIVATE_NAME
107 #endif  
108
109 #undef ASM_OUTPUT_ALIGN
110
111 /* There is no point aligning anything to a rounder boundary than this.  */
112 #define BIGGEST_ALIGNMENT 32
113
114 /* A bitfield declared as `int' forces `int' alignment for the struct.  */
115 #define PCC_BITFIELD_TYPE_MATTERS 1
116   
117 /* NEWS makes d2, d3, fp2 and fp3 unsaved registers, unlike the Sun system.  */
118   
119 #define CALL_USED_REGISTERS \
120  {1, 1, 1, 1, 0, 0, 0, 0, \
121   1, 1, 0, 0, 0, 0, 0, 1, \
122   1, 1, 1, 1, 0, 0, 0, 0}
123
124 /* NEWS returns floats and doubles in fp0, not d0/d1.  */
125
126 #define FUNCTION_VALUE(VALTYPE,FUNC) LIBCALL_VALUE (TYPE_MODE (VALTYPE))
127
128 #define LIBCALL_VALUE(MODE)                                     \
129  gen_rtx_REG ((MODE),                                           \
130               ((TARGET_68881                                    \
131                 && ((MODE) == SFmode || (MODE) == DFmode        \
132                     || (MODE) == XFmode))                       \
133                ? 16 : 0))
134
135 #define ASM_OUTPUT_ALIGN(FILE,LOG)      \
136   fprintf (FILE, "\t.align %d\n", (LOG))
137 \f
138 #ifdef MOTOROLA
139
140 #define FUNCTION_PROFILER(FILE, LABEL_NO) \
141    fprintf (FILE, "\tmove.l #LP%d,d0\n\tjsr mcount\n", (LABEL_NO));
142
143 /* Difference from m68k.h is in `fp' instead of `a6'.  */
144
145 #define REGISTER_NAMES \
146 {"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",        \
147  "a0", "a1", "a2", "a3", "a4", "a5", "fp", "sp",        \
148  "fp0", "fp1", "fp2", "fp3", "fp4", "fp5", "fp6", "fp7"}
149
150 /* This is how to output an insn to push a register on the stack.
151    It need not be very fast code.  */
152
153 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO)  \
154   fprintf (FILE, "\tmove.l %s,-(sp)\n", reg_names[REGNO])
155
156 /* This is how to output an insn to pop a register from the stack.
157    It need not be very fast code.  */
158
159 #define ASM_OUTPUT_REG_POP(FILE,REGNO)  \
160   fprintf (FILE, "\tmove.l (sp)+,%s\n", reg_names[REGNO])
161   
162 #define ASM_OUTPUT_SKIP(FILE,SIZE)  \
163   fprintf (FILE, "\t.space %u\n", (SIZE))
164
165 #if 0
166 /* The NEWS assembler in version 3.4 complains about fmove.d, but this
167    macro proved not to work right.  3.4 is old, so forget about it.  */
168 #define ASM_OUTPUT_OPCODE(FILE, STRING) \
169 {                                               \
170   if (!strncmp (STRING, "fmove.d", 7)           \
171       && CONSTANT_P (operands[1]))              \
172     {                                           \
173       fprintf (FILE, "fmove.x");                \
174       STRING += 7;                              \
175     }                                           \
176 }
177 #endif
178
179 /* Store in OUTPUT a string (made with alloca) containing
180    an assembler-name for a local static variable named NAME.
181    LABELNO is an integer which is different for each call.  */
182
183 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO)  \
184 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 13),    \
185   sprintf ((OUTPUT), "%s$$$%d", (NAME), (LABELNO)))
186
187 /* Output a float value (represented as a C double) as an immediate operand.
188    This macro is a 68k-specific macro.  */
189
190 #undef ASM_OUTPUT_FLOAT_OPERAND
191 #define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE)                       \
192  do {                                                                   \
193       if (CODE == 'f')                                                  \
194         {                                                               \
195           char dstr[30];                                                \
196           REAL_VALUE_TO_DECIMAL (VALUE, "%.9e", dstr);                  \
197           if (REAL_VALUE_ISINF (VALUE) || REAL_VALUE_ISNAN (VALUE))     \
198             {                                                           \
199               if (REAL_VALUE_NEGATIVE (VALUE))                          \
200                 fprintf (FILE, "#0f-99e999");                           \
201               else                                                      \
202                 fprintf (FILE, "#0f99e999");                            \
203             }                                                           \
204           else if (REAL_VALUE_MINUS_ZERO (VALUE))                       \
205             fprintf (FILE, "#0f-0.0");                                  \
206           else                                                          \
207             fprintf (FILE, "#0f%s", dstr);                              \
208         }                                                               \
209       else                                                              \
210         {                                                               \
211           long l;                                                       \
212           REAL_VALUE_TO_TARGET_SINGLE (VALUE, l);                       \
213           fprintf (FILE, "#0x%lx", l);                                  \
214         }                                                               \
215      } while (0)
216
217 /* Output a double value (represented as a C double) as an immediate operand.
218    This macro is a 68k-specific macro.  */
219 #undef ASM_OUTPUT_DOUBLE_OPERAND
220 #define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE)                           \
221  do { char dstr[30];                                                    \
222       REAL_VALUE_TO_DECIMAL (VALUE, "%.20e", dstr );                    \
223       if (REAL_VALUE_ISINF (VALUE) || REAL_VALUE_ISNAN (VALUE))         \
224         {                                                               \
225         if (REAL_VALUE_NEGATIVE (VALUE))                                \
226           fprintf (FILE, "#0d-99e999");                                 \
227         else                                                            \
228           fprintf (FILE, "#0d99e999");                                  \
229         }                                                               \
230       else if (REAL_VALUE_MINUS_ZERO (VALUE))                           \
231           fprintf (FILE, "#0d-0.0");                                    \
232       else                                                              \
233           fprintf (FILE, "#0d%s", dstr);                                \
234     } while (0)
235
236 /* Note, long double immediate operands are not actually
237    generated by m68k.md.  */
238 #undef ASM_OUTPUT_LONG_DOUBLE_OPERAND
239 #define ASM_OUTPUT_LONG_DOUBLE_OPERAND(FILE,VALUE)                      \
240  do { char dstr[30];                                                    \
241       REAL_VALUE_TO_DECIMAL (VALUE, "%.20g", dstr);                     \
242       asm_fprintf (FILE, "%I0r%s", dstr);                               \
243     } while (0)
244
245 #if 0
246 #undef PRINT_OPERAND
247 #define PRINT_OPERAND(FILE, X, CODE)  \
248 { if (CODE == '.') fprintf (FILE, ".");                                 \
249   else if (CODE == '#') fprintf (FILE, "#");                            \
250   else if (CODE == '-') fprintf (FILE, "-(sp)");                        \
251   else if (CODE == '+') fprintf (FILE, "(sp)+");                        \
252   else if (CODE == '@') fprintf (FILE, "(sp)");                         \
253   else if (CODE == '!') fprintf (FILE, "fpcr");                         \
254   else if (CODE == '$') {if (TARGET_68040_ONLY) fprintf (FILE, "s");}   \
255   else if (CODE == '&') {if (TARGET_68040_ONLY) fprintf (FILE, "d");}   \
256   else if (CODE == '/')                                                 \
257     ;                                                                   \
258   else if (GET_CODE (X) == REG)                                         \
259     fprintf (FILE, "%s", reg_names[REGNO (X)]);                         \
260   else if (GET_CODE (X) == MEM)                                         \
261     output_address (XEXP (X, 0));                                       \
262   else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == SFmode)      \
263     { REAL_VALUE_TYPE r;                                                \
264       REAL_VALUE_FROM_CONST_DOUBLE (r, X);                              \
265       if (CODE == 'f')                                                  \
266         { char dstr[30];                                                \
267           REAL_VALUE_TO_DECIMAL (r, "%.9e", dstr);                      \
268           if (REAL_VALUE_ISINF (r) || REAL_VALUE_ISNAN (r)) {           \
269             if (REAL_VALUE_NEGATIVE (r))                                \
270               fprintf (FILE, "#0f-99e999");                             \
271             else                                                        \
272               fprintf (FILE, "#0f99e999"); }                            \
273           else if (REAL_VALUE_MINUS_ZERO (r))                           \
274             fprintf (FILE, "#0f-0.0");                                  \
275           else                                                          \
276             fprintf (FILE, "#0f%s", dstr);                              \
277         }                                                               \
278       else                                                              \
279         { long l;                                                       \
280           REAL_VALUE_TO_TARGET_SINGLE (r, l);                           \
281           fprintf (FILE, "#0x%lx", l);                                  \
282         }}                                                              \
283   else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == XFmode)      \
284     { REAL_VALUE_TYPE r;                                                \
285       REAL_VALUE_FROM_CONST_DOUBLE (r, X);                              \
286       ASM_OUTPUT_LONG_DOUBLE_OPERAND (FILE, r); }                       \
287   else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == DFmode)      \
288     { REAL_VALUE_TYPE r; char dstr[30];                                 \
289       REAL_VALUE_FROM_CONST_DOUBLE (r, X);                              \
290       REAL_VALUE_TO_DECIMAL (r, "%.20e", dstr );                        \
291       if (REAL_VALUE_ISINF (r) || REAL_VALUE_ISNAN (r)) {               \
292         if (REAL_VALUE_NEGATIVE (r))                                    \
293           fprintf (FILE, "#0d-99e999");                                 \
294         else                                                            \
295           fprintf (FILE, "#0d99e999"); }                                \
296       else if (REAL_VALUE_MINUS_ZERO (r))                               \
297           fprintf (FILE, "#0d-0.0");                                    \
298       else                                                              \
299           fprintf (FILE, "#0d%s", dstr); }                              \
300   else if (CODE == 'b') output_addr_const (FILE, X);                    \
301   else { putc ('#', FILE); output_addr_const (FILE, X); }}
302 #endif
303
304 #undef PRINT_OPERAND_ADDRESS
305 #define PRINT_OPERAND_ADDRESS(FILE, ADDR)  \
306 { register rtx reg1, reg2, breg, ireg;                                  \
307   register rtx addr = ADDR;                                             \
308   rtx offset;                                                           \
309   switch (GET_CODE (addr))                                              \
310     {                                                                   \
311     case REG:                                                           \
312       fprintf (FILE, "(%s)", reg_names[REGNO (addr)]);                  \
313       break;                                                            \
314     case PRE_DEC:                                                       \
315       fprintf (FILE, "-(%s)", reg_names[REGNO (XEXP (addr, 0))]);       \
316       break;                                                            \
317     case POST_INC:                                                      \
318       fprintf (FILE, "(%s)+", reg_names[REGNO (XEXP (addr, 0))]);       \
319       break;                                                            \
320     case PLUS:                                                          \
321       reg1 = 0; reg2 = 0;                                               \
322       ireg = 0; breg = 0;                                               \
323       offset = 0;                                                       \
324       if (CONSTANT_ADDRESS_P (XEXP (addr, 0)))                          \
325         {                                                               \
326           offset = XEXP (addr, 0);                                      \
327           addr = XEXP (addr, 1);                                        \
328         }                                                               \
329       else if (CONSTANT_ADDRESS_P (XEXP (addr, 1)))                     \
330         {                                                               \
331           offset = XEXP (addr, 1);                                      \
332           addr = XEXP (addr, 0);                                        \
333         }                                                               \
334       if (GET_CODE (addr) != PLUS) ;                                    \
335       else if (GET_CODE (XEXP (addr, 0)) == SIGN_EXTEND)                \
336         {                                                               \
337           reg1 = XEXP (addr, 0);                                        \
338           addr = XEXP (addr, 1);                                        \
339         }                                                               \
340       else if (GET_CODE (XEXP (addr, 1)) == SIGN_EXTEND)                \
341         {                                                               \
342           reg1 = XEXP (addr, 1);                                        \
343           addr = XEXP (addr, 0);                                        \
344         }                                                               \
345       else if (GET_CODE (XEXP (addr, 0)) == MULT)                       \
346         {                                                               \
347           reg1 = XEXP (addr, 0);                                        \
348           addr = XEXP (addr, 1);                                        \
349         }                                                               \
350       else if (GET_CODE (XEXP (addr, 1)) == MULT)                       \
351         {                                                               \
352           reg1 = XEXP (addr, 1);                                        \
353           addr = XEXP (addr, 0);                                        \
354         }                                                               \
355       else if (GET_CODE (XEXP (addr, 0)) == REG)                        \
356         {                                                               \
357           reg1 = XEXP (addr, 0);                                        \
358           addr = XEXP (addr, 1);                                        \
359         }                                                               \
360       else if (GET_CODE (XEXP (addr, 1)) == REG)                        \
361         {                                                               \
362           reg1 = XEXP (addr, 1);                                        \
363           addr = XEXP (addr, 0);                                        \
364         }                                                               \
365       if (GET_CODE (addr) == REG || GET_CODE (addr) == MULT             \
366           || GET_CODE (addr) == SIGN_EXTEND)                            \
367         { if (reg1 == 0) reg1 = addr; else reg2 = addr; addr = 0; }     \
368       if (offset != 0) { if (addr != 0) abort (); addr = offset; }      \
369       if ((reg1 && (GET_CODE (reg1) == SIGN_EXTEND                      \
370                     || GET_CODE (reg1) == MULT))                        \
371           || (reg2 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg2))))         \
372         { breg = reg2; ireg = reg1; }                                   \
373       else if (reg1 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg1)))         \
374         { breg = reg1; ireg = reg2; }                                   \
375       if (ireg != 0 && breg == 0 && GET_CODE (addr) == LABEL_REF)       \
376         { int scale = 1;                                                \
377           if (GET_CODE (ireg) == MULT)                                  \
378             { scale = INTVAL (XEXP (ireg, 1));                          \
379               ireg = XEXP (ireg, 0); }                                  \
380           if (GET_CODE (ireg) == SIGN_EXTEND)                           \
381             fprintf (FILE, "(L%d.b,pc,%s.w",                            \
382                      CODE_LABEL_NUMBER (XEXP (addr, 0)),                \
383                      reg_names[REGNO (XEXP (ireg, 0))]);                \
384           else                                                          \
385             fprintf (FILE, "(L%d.b,pc,%s.l",                            \
386                      CODE_LABEL_NUMBER (XEXP (addr, 0)),                \
387                      reg_names[REGNO (ireg)]);                          \
388           if (scale != 1) fprintf (FILE, "*%d", scale);                 \
389           putc (')', FILE);                                             \
390           break; }                                                      \
391       if (breg != 0 && ireg == 0 && GET_CODE (addr) == LABEL_REF)       \
392         { fprintf (FILE, "(L%d.b,pc,%s.l",                              \
393                    CODE_LABEL_NUMBER (XEXP (addr, 0)),                  \
394                    reg_names[REGNO (breg)]);                            \
395           putc (')', FILE);                                             \
396           break; }                                                      \
397       if (ireg != 0 || breg != 0)                                       \
398         { int scale = 1;                                                \
399           if (breg == 0)                                                \
400             abort ();                                                   \
401           if (addr && GET_CODE (addr) == LABEL_REF) abort ();           \
402           fprintf (FILE, "(");                                          \
403           if (addr != 0) {                                              \
404             output_addr_const (FILE, addr);                             \
405             putc (',', FILE); }                                         \
406           fprintf (FILE, "%s", reg_names[REGNO (breg)]);                \
407           if (ireg != 0)                                                \
408             putc (',', FILE);                                           \
409           if (ireg != 0 && GET_CODE (ireg) == MULT)                     \
410             { scale = INTVAL (XEXP (ireg, 1));                          \
411               ireg = XEXP (ireg, 0); }                                  \
412           if (ireg != 0 && GET_CODE (ireg) == SIGN_EXTEND)              \
413             fprintf (FILE, "%s.w", reg_names[REGNO (XEXP (ireg, 0))]);  \
414           else if (ireg != 0)                                           \
415             fprintf (FILE, "%s.l", reg_names[REGNO (ireg)]);            \
416           if (scale != 1) fprintf (FILE, "*%d", scale);                 \
417           putc (')', FILE);                                             \
418           break;                                                        \
419         }                                                               \
420       else if (reg1 != 0 && GET_CODE (addr) == LABEL_REF)               \
421         { fprintf (FILE, "(L%d.b,pc,%s.l)",                             \
422                    CODE_LABEL_NUMBER (XEXP (addr, 0)),                  \
423                    reg_names[REGNO (reg1)]);                            \
424           break; }                                                      \
425     default:                                                            \
426       if (GET_CODE (addr) == CONST_INT                                  \
427           && INTVAL (addr) < 0x8000                                     \
428           && INTVAL (addr) >= -0x8000)                                  \
429         fprintf (FILE, "%d.w", INTVAL (addr));                          \
430       else                                                              \
431         output_addr_const (FILE, addr);                                 \
432     }}
433
434 #else /* Using GAS, which uses the MIT assembler syntax, like a Sun.  */
435
436 #define FUNCTION_PROFILER(FILE, LABEL_NO) \
437    fprintf (FILE, "\tmovl #LP%d,d0\n\tjsr mcount\n", (LABEL_NO));
438
439 #endif /* MOTOROLA */