]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/m68k/dpx2.h
hooks.c (hook_tree_bool_false): New.
[thirdparty/gcc.git] / gcc / config / m68k / dpx2.h
1 /* Definitions of target machine for GNU compiler.
2 Bull DPX/2 200 and 300 systems (m68k, SysVr3).
3 Copyright (C) 1987, 1993, 1994, 1995, 1996, 1999, 2000, 2002
4 Free Software Foundation, Inc.
5 Contributed by Frederic Pierresteguy (F.Pierresteguy@frcl.bull.fr).
6
7 This file is part of GNU CC.
8
9 GNU CC is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option)
12 any later version.
13
14 GNU CC is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with GNU CC; see the file COPYING. If not, write to
21 the Free Software Foundation, 59 Temple Place - Suite 330,
22 Boston, MA 02111-1307, USA. */
23
24
25 #ifndef USE_GAS
26 #define MOTOROLA /* Use Motorola syntax rather than "MIT" */
27 #define SGS_NO_LI /* Suppress jump table label usage */
28 #define VERSADOS /* This is the name of the assembler we have */
29 #endif
30
31 #include "m68k/m68k.h"
32 #undef SELECT_RTX_SECTION
33 #include "svr3.h"
34
35 #undef INT_OP_GROUP
36 #define INT_OP_GROUP INT_OP_DC
37
38 /* We use collect2 instead of ctors_section constructors. */
39 #undef INIT_SECTION_ASM_OP
40 #undef FINI_SECTION_ASM_OP
41 #undef DTORS_SECTION_ASM_OP
42 #undef DO_GLOBAL_CTORS_BODY
43
44 /* Remove handling for a separate constant data section. We put
45 constant data in text_section, which is the default. */
46 #undef TARGET_ASM_SELECT_SECTION
47 #undef SELECT_RTX_SECTION
48 #undef EXTRA_SECTIONS
49 #undef EXTRA_SECTION_FUNCTIONS
50 #undef CONST_SECTION_ASM_OP
51 #undef READONLY_DATA_SECTION
52
53 #define DPX2
54
55 /* See m68k.h. 7 means 68020 with 68881.
56 * We really have 68030 and 68882,
57 * but this will get us going.
58 */
59 #ifndef TARGET_DEFAULT
60 #define TARGET_DEFAULT (MASK_BITFIELD|MASK_68881|MASK_68020)
61 #endif
62
63 #define OBJECT_FORMAT_COFF
64
65 #ifdef CPP_PREDEFINES
66 #undef CPP_PREDEFINES
67 #endif
68 /*
69 * define all the things the compiler should
70 */
71 #ifdef ncl_mr
72 # define CPP_PREDEFINES "-Dunix -Dbull -DDPX2 -DSVR3 -Dmc68000 -Dmc68020 -Dncl_mr=1 -D_BULL_SOURCE -D_POSIX_SOURCE -D_XOPEN_SOURCE -Asystem=unix -Asystem=svr3 -Acpu=m68k -Amachine=m68k"
73 #else
74 # ifdef ncl_el
75 # define CPP_PREDEFINES "-Dunix -Dbull -DDPX2 -DSVR3 -Dmc68000 -Dmc68020 -Dncl_el -D_BULL_SOURCE -D_POSIX_SOURCE -D_XOPEN_SOURCE -Asystem=unix -Asystem=svr3 -Acpu=m68k -Amachine=m68k"
76 # else
77 # define CPP_PREDEFINES "-Dunix -Dbull -DDPX2 -DSVR3 -Dmc68000 -Dmc68020 -D_BULL_SOURCE -D_POSIX_SOURCE -D_XOPEN_SOURCE -Asystem=unix -Asystem=svr3 -Acpu=m68k -Amachine=m68k"
78 # endif
79 #endif
80
81 #undef CPP_SPEC
82 /*
83 * you can't get a DPX/2 without a 68882 but allow it
84 * to be ignored...
85 */
86 # define __HAVE_68881__ 1
87 # define CPP_SPEC "%{!msoft-float:-D__HAVE_68881__ }"
88
89 #undef DO_GLOBAL_CTORS_BODY /* don't use svr3.h version */
90 #undef DO_GLOBAL_DTORS_BODY
91
92 #ifndef USE_GAS
93 /*
94 * handle the native MOTOROLA VERSAdos assembler.
95 */
96
97 /* See m68k.h. 3 means 68020 with 68881 and no bitfield
98 * bitfield instructions do not seem to work a clean way.
99 */
100 #undef TARGET_DEFAULT
101 #define TARGET_DEFAULT (MASK_68881|MASK_68020)
102
103 /* The native assembler doesn't support fmovecr. */
104 #define NO_ASM_FMOVECR
105
106 #undef TEXT_SECTION_ASM_OP
107 #define TEXT_SECTION_ASM_OP "\tsection 10"
108 #undef DATA_SECTION_ASM_OP
109 #define DATA_SECTION_ASM_OP "\tsection 15"
110 #define BSS_SECTION_ASM_OP "\tsection 14"
111
112
113 /* Don't try using XFmode. */
114 #undef LONG_DOUBLE_TYPE_SIZE
115 #define LONG_DOUBLE_TYPE_SIZE 64
116
117 #undef ASM_OUTPUT_SOURCE_FILENAME
118 #define ASM_OUTPUT_SOURCE_FILENAME(FILE, NA) \
119 do { fprintf ((FILE), "\t.file\t'%s'\n", (NA)); } while (0)
120
121 /*
122 * we don't seem to support any of:
123 * .globl
124 * .even
125 * .align
126 * .ascii
127 */
128 #undef ASM_OUTPUT_SKIP
129 #define ASM_OUTPUT_SKIP(FILE,SIZE) \
130 fprintf (FILE, "\tdcb.b %u,0\n", (SIZE))
131
132 #undef GLOBAL_ASM_OP
133 #define GLOBAL_ASM_OP "\txdef\t"
134
135 #undef ASM_OUTPUT_ALIGN
136 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
137 if ((LOG) >= 1) \
138 fprintf (FILE, "\tds.w 0\n");
139
140
141 #define STRING_LIMIT (0)
142 #undef ASM_APP_ON
143 #define ASM_APP_ON ""
144 #undef ASM_APP_OFF
145 #define ASM_APP_OFF ""
146 /*
147 * dc.b 'hello, world!'
148 * dc.b 10,0
149 * is how we have to output "hello, world!\n"
150 */
151 #undef ASM_OUTPUT_ASCII
152 #define ASM_OUTPUT_ASCII(asm_out_file, p, thissize) \
153 do { register int i, c, f=0, len=0; \
154 for (i = 0; i < thissize; i++) { \
155 c = p[i]; \
156 if (c == '\'' || c < ' ' || c > 127) { \
157 switch(f) { \
158 case 0: /* need to output dc.b etc */ \
159 fprintf(asm_out_file, "\tdc.b %d", c); \
160 f=1; \
161 break; \
162 case 1: \
163 fprintf(asm_out_file, ",%d", c); \
164 break; \
165 default: \
166 /* close a string */ \
167 fprintf(asm_out_file, "'\n\tdc.b %d", c); \
168 f=1; \
169 break; \
170 } \
171 } else { \
172 switch(f) { \
173 case 0: \
174 fprintf(asm_out_file, "\tdc.b '%c", c); \
175 f=2; \
176 break; \
177 case 2: \
178 if (len >= 79) { \
179 fprintf(asm_out_file, "'\n\tdc.b '%c", c); \
180 len = 0; } \
181 else \
182 fprintf(asm_out_file, "%c", c); \
183 break; \
184 default: \
185 len = 0; \
186 fprintf(asm_out_file, "\n\tdc.b '%c", c); \
187 f=2; \
188 break; \
189 } \
190 } \
191 len++; \
192 } \
193 if (f==2) \
194 putc('\'', asm_out_file); \
195 putc('\n', asm_out_file); } while (0)
196
197 /* This is how to output an insn to push a register on the stack.
198 It need not be very fast code. */
199
200 #undef ASM_OUTPUT_REG_PUSH
201 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
202 fprintf (FILE, "\tmove.l %s,-(sp)\n", reg_names[REGNO])
203
204 /* This is how to output an insn to pop a register from the stack.
205 It need not be very fast code. */
206
207 #undef ASM_OUTPUT_REG_POP
208 #define ASM_OUTPUT_REG_POP(FILE,REGNO) \
209 fprintf (FILE, "\tmove.l (sp)+,%s\n", reg_names[REGNO])
210
211
212 #define PUT_SDB_FUNCTION_START(LINE) \
213 fprintf (asm_out_file, \
214 "\t.def\t.bf%s\t.val\t*%s\t.scl\t101%s\t.line\t%d%s\t.endef\n", \
215 SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
216
217 #define PUT_SDB_FUNCTION_END(LINE) \
218 fprintf (asm_out_file, \
219 "\t.def\t.ef%s\t.val\t*%s\t.scl\t101%s\t.line\t%d%s\t.endef\n", \
220 SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
221
222 #define PUT_SDB_BLOCK_START(LINE) \
223 fprintf (asm_out_file, \
224 "\t.def\t.bb%s\t.val\t*%s\t.scl\t100%s\t.line\t%d%s\t.endef\n", \
225 SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
226
227 #define PUT_SDB_BLOCK_END(LINE) \
228 fprintf (asm_out_file, \
229 "\t.def\t.eb%s\t.val\t*%s\t.scl\t100%s\t.line\t%d%s\t.endef\n", \
230 SDB_DELIM, SDB_DELIM, SDB_DELIM, (LINE), SDB_DELIM)
231
232 #define PUT_SDB_EPILOGUE_END(NAME)
233
234 /* Output type in decimal not in octal as done in sdbout.c */
235 #define PUT_SDB_TYPE(a) fprintf(asm_out_file, "\t.type\t0%d%s", a, SDB_DELIM)
236
237 /* Translate Motorola opcodes such as `jbeq'
238 into VERSAdos opcodes such as `beq'.
239 Change `fbeq' to `fbseq', `fbne' to `fbsneq'.
240 */
241
242 #undef ASM_OUTPUT_OPCODE
243 #define ASM_OUTPUT_OPCODE(FILE, PTR) \
244 { if ((PTR)[0] == 'j' && (PTR)[1] == 'b') \
245 { ++(PTR); \
246 while (*(PTR) != ' ') \
247 { putc (*(PTR), (FILE)); ++(PTR); } \
248 } \
249 else if ((PTR)[0] == 'f') \
250 { \
251 if (!strncmp ((PTR), "fbeq", 4)) \
252 { fprintf ((FILE), "fbseq"); (PTR) += 4; } \
253 else if (!strncmp ((PTR), "fbne", 4)) \
254 { fprintf ((FILE), "fbsneq"); (PTR) += 4; } \
255 } \
256 else if ((PTR)[0] == 'b' && (PTR)[1] == 'f') \
257 { \
258 char *s; \
259 if ((s = (char*)strchr ((PTR), '{'))) \
260 while (*s != '}') { \
261 if (*s == 'b') \
262 /* hack, I replace it with R ie nothing */ \
263 *s = '0'; \
264 s++; } \
265 } \
266 }
267
268 /* This is how to output an element of a case-vector that is absolute.
269 (The 68000 does not use such vectors,
270 but we must define this macro anyway.) */
271 #undef ASM_OUTPUT_ADDR_VEC_ELT
272 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
273 asm_fprintf (FILE, "\tdc.l %LL%d\n", VALUE)
274
275 /* This is how to output an element of a case-vector that is relative. */
276 #undef ASM_OUTPUT_ADDR_DIFF_ELT
277 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
278 asm_fprintf (FILE, "\tdc.w %LL%d-%LL%d\n", VALUE, REL)
279
280 /* Currently, JUMP_TABLES_IN_TEXT_SECTION must be defined in order to
281 keep switch tables in the text section. */
282 #define JUMP_TABLES_IN_TEXT_SECTION 1
283
284 /* Output a float value (represented as a C double) as an immediate operand.
285 This macro is a 68k-specific macro. */
286 #undef ASM_OUTPUT_FLOAT_OPERAND
287 #define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE) \
288 do { \
289 if (CODE == 'f') \
290 { \
291 char dstr[30]; \
292 REAL_VALUE_TO_DECIMAL (VALUE, "%.9g", dstr); \
293 asm_fprintf ((FILE), "%I%s", dstr); \
294 } \
295 else \
296 { \
297 long l; \
298 REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
299 if (sizeof (int) == sizeof (long)) \
300 asm_fprintf ((FILE), "%I$%x", (int) l); \
301 else \
302 asm_fprintf ((FILE), "%I$%lx", l); \
303 } \
304 } while (0)
305
306 /* Output a double value (represented as a C double) as an immediate operand.
307 This macro is a 68k-specific macro. */
308 #undef ASM_OUTPUT_DOUBLE_OPERAND
309 #define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE) \
310 do { char dstr[30]; \
311 REAL_VALUE_TO_DECIMAL (VALUE, "%.20g", dstr); \
312 asm_fprintf (FILE, "%I%s", dstr); \
313 } while (0)
314
315 /* Note, long double immediate operands are not actually
316 generated by m68k.md. */
317 #undef ASM_OUTPUT_LONG_DOUBLE_OPERAND
318 #define ASM_OUTPUT_LONG_DOUBLE_OPERAND(FILE,VALUE) \
319 do { char dstr[30]; \
320 REAL_VALUE_TO_DECIMAL (VALUE, "%.20g", dstr); \
321 asm_fprintf (FILE, "%I%s", dstr); \
322 } while (0)
323
324 #undef ASM_OUTPUT_COMMON
325 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
326 ( fputs ("\t.comm ", (FILE)), \
327 assemble_name ((FILE), (NAME)), \
328 fprintf ((FILE), ",%u\n", (ROUNDED)))
329
330 #undef ASM_OUTPUT_LOCAL
331 #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
332 do { \
333 int align = exact_log2 (ROUNDED); \
334 /*fprintf ((FILE), "\tsection 14\n"); */ \
335 data_section (); \
336 ASM_OUTPUT_ALIGN ((FILE), align) \
337 ASM_OUTPUT_LABEL ((FILE), (NAME)); \
338 fprintf ((FILE), "\tdcb.b %u,0\n", (ROUNDED)); \
339 /* fprintf ((FILE), "\tsection 10\n"); */ \
340 } while (0)
341
342 #undef PRINT_OPERAND_ADDRESS
343 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
344 { register rtx reg1, reg2, breg, ireg; \
345 register rtx addr = ADDR; \
346 rtx offset; \
347 switch (GET_CODE (addr)) \
348 { \
349 case REG: \
350 fprintf (FILE, "(%s)", reg_names[REGNO (addr)]); \
351 break; \
352 case PRE_DEC: \
353 fprintf (FILE, "-(%s)", reg_names[REGNO (XEXP (addr, 0))]); \
354 break; \
355 case POST_INC: \
356 fprintf (FILE, "(%s)+", reg_names[REGNO (XEXP (addr, 0))]); \
357 break; \
358 case PLUS: \
359 reg1 = 0; reg2 = 0; \
360 ireg = 0; breg = 0; \
361 offset = 0; \
362 if (CONSTANT_ADDRESS_P (XEXP (addr, 0))) \
363 { \
364 offset = XEXP (addr, 0); \
365 addr = XEXP (addr, 1); \
366 } \
367 else if (CONSTANT_ADDRESS_P (XEXP (addr, 1))) \
368 { \
369 offset = XEXP (addr, 1); \
370 addr = XEXP (addr, 0); \
371 } \
372 if (GET_CODE (addr) != PLUS) ; \
373 else if (GET_CODE (XEXP (addr, 0)) == SIGN_EXTEND) \
374 { \
375 reg1 = XEXP (addr, 0); \
376 addr = XEXP (addr, 1); \
377 } \
378 else if (GET_CODE (XEXP (addr, 1)) == SIGN_EXTEND) \
379 { \
380 reg1 = XEXP (addr, 1); \
381 addr = XEXP (addr, 0); \
382 } \
383 else if (GET_CODE (XEXP (addr, 0)) == MULT) \
384 { \
385 reg1 = XEXP (addr, 0); \
386 addr = XEXP (addr, 1); \
387 } \
388 else if (GET_CODE (XEXP (addr, 1)) == MULT) \
389 { \
390 reg1 = XEXP (addr, 1); \
391 addr = XEXP (addr, 0); \
392 } \
393 else if (GET_CODE (XEXP (addr, 0)) == REG) \
394 { \
395 reg1 = XEXP (addr, 0); \
396 addr = XEXP (addr, 1); \
397 } \
398 else if (GET_CODE (XEXP (addr, 1)) == REG) \
399 { \
400 reg1 = XEXP (addr, 1); \
401 addr = XEXP (addr, 0); \
402 } \
403 if (GET_CODE (addr) == REG || GET_CODE (addr) == MULT \
404 || GET_CODE (addr) == SIGN_EXTEND) \
405 { if (reg1 == 0) reg1 = addr; else reg2 = addr; addr = 0; } \
406 /* for OLD_INDEXING \
407 else if (GET_CODE (addr) == PLUS) \
408 { \
409 if (GET_CODE (XEXP (addr, 0)) == REG) \
410 { \
411 reg2 = XEXP (addr, 0); \
412 addr = XEXP (addr, 1); \
413 } \
414 else if (GET_CODE (XEXP (addr, 1)) == REG) \
415 { \
416 reg2 = XEXP (addr, 1); \
417 addr = XEXP (addr, 0); \
418 } \
419 } \
420 */ \
421 if (offset != 0) { if (addr != 0) abort (); addr = offset; } \
422 if ((reg1 && (GET_CODE (reg1) == SIGN_EXTEND \
423 || GET_CODE (reg1) == MULT)) \
424 || (reg2 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg2)))) \
425 { breg = reg2; ireg = reg1; } \
426 else if (reg1 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg1))) \
427 { breg = reg1; ireg = reg2; } \
428 if (ireg != 0 && breg == 0 && GET_CODE (addr) == LABEL_REF) \
429 { int scale = 1; \
430 if (GET_CODE (ireg) == MULT) \
431 { scale = INTVAL (XEXP (ireg, 1)); \
432 ireg = XEXP (ireg, 0); } \
433 if (GET_CODE (ireg) == SIGN_EXTEND) \
434 fprintf (FILE, "(.L%d,pc,%s.w", \
435 CODE_LABEL_NUMBER (XEXP (addr, 0)), \
436 reg_names[REGNO (XEXP (ireg, 0))]); \
437 else \
438 fprintf (FILE, "(.L%d,pc,%s.l", \
439 CODE_LABEL_NUMBER (XEXP (addr, 0)), \
440 reg_names[REGNO (ireg)]); \
441 if (scale != 1) fprintf (FILE, "*%d", scale); \
442 putc (')', FILE); \
443 break; } \
444 if (breg != 0 && ireg == 0 && GET_CODE (addr) == LABEL_REF \
445 && ! (flag_pic && breg == pic_offset_table_rtx)) \
446 { \
447 fprintf (FILE, "(.L%d,pc,%s.l", \
448 CODE_LABEL_NUMBER (XEXP (addr, 0)), \
449 reg_names[REGNO (breg)]); \
450 putc (')', FILE); \
451 break; } \
452 if (ireg != 0 || breg != 0) \
453 { int scale = 1; \
454 if (breg == 0) \
455 abort (); \
456 putc ('(', FILE); \
457 if (addr != 0) \
458 { \
459 output_addr_const (FILE, addr); \
460 putc (',', FILE); \
461 } \
462 fprintf (FILE, "%s", reg_names[REGNO (breg)]); \
463 if (ireg != 0) \
464 putc (',', FILE); \
465 if (ireg != 0 && GET_CODE (ireg) == MULT) \
466 { scale = INTVAL (XEXP (ireg, 1)); \
467 ireg = XEXP (ireg, 0); } \
468 if (ireg != 0 && GET_CODE (ireg) == SIGN_EXTEND) \
469 fprintf (FILE, "%s.w", reg_names[REGNO (XEXP (ireg, 0))]); \
470 else if (ireg != 0) \
471 fprintf (FILE, "%s.l", reg_names[REGNO (ireg)]); \
472 if (scale != 1) fprintf (FILE, "*%d", scale); \
473 putc (')', FILE); \
474 break; \
475 } \
476 else if (reg1 != 0 && GET_CODE (addr) == LABEL_REF) \
477 { fprintf (FILE, "(.L%d,pc,%s.w)", \
478 CODE_LABEL_NUMBER (XEXP (addr, 0)), \
479 reg_names[REGNO (reg1)]); \
480 break; } \
481 default: \
482 if (GET_CODE (addr) == CONST_INT \
483 && INTVAL (addr) < 0x8000 \
484 && INTVAL (addr) >= -0x8000) \
485 fprintf (FILE, "%d.w", INTVAL (addr)); \
486 else \
487 output_addr_const (FILE, addr); \
488 }}
489
490
491 #endif /* ! use gas */