|
|
1.1 root 1: /* Definitions of target machine for GNU compiler.
2: SysV68 Motorola 3300 Delta Series
3:
4: Written by Abramo and Roberto Bagnara
5: after Alex Crain's 3B1 definitions.
6:
7: Bug reports to [email protected]
8:
9: Copyright (C) 1987 Free Software Foundation, Inc.
10:
11: This file is part of GNU CC.
12:
13: GNU CC is free software; you can redistribute it and/or modify
14: it under the terms of the GNU General Public License as published by
15: the Free Software Foundation; either version 2, or (at your option)
16: any later version.
17:
18: GNU CC is distributed in the hope that it will be useful,
19: but WITHOUT ANY WARRANTY; without even the implied warranty of
20: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21: GNU General Public License for more details.
22:
23: You should have received a copy of the GNU General Public License
24: along with GNU CC; see the file COPYING. If not, write to
25: the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
26:
27: #define MOTOROLA /* Use Motorola syntax rather than "MIT" */
28: #define SGS /* Uses SGS assembler */
29: #define SGS_CMP_ORDER /* Takes cmp operands in reverse order */
30: #define SGS_SWAP_W /* Use swap.w rather than just plain swap */
31: #define SGS_SWITCH_TABLES /* Different switch table handling */
32:
33: #define NO_DOLLAR_IN_LABEL
34: #define NO_DOT_IN_LABEL
35:
36: #include "m68k/m68k.h"
37:
38: /* See m68k.h. 7 means 68020 with 68881. */
39:
40: #ifndef TARGET_DEFAULT
41: #define TARGET_DEFAULT 7
42: #endif
43:
44: /* NYI: FP= is equivalent to -msoft-float */
45:
46: /* We use /lib/libp/lib* when profiling. */
47:
48: /* NYI: if FP=M68881U library is -lc881u */
49: /* NYI: if FP= library is -lc. */
50: /* Default for us: FP=M68881 library is -lc881 */
51: #undef LIB_SPEC
52: #define LIB_SPEC "%{!shlib:%{p:-L/usr/lib/libp} %{pg:-L/usr/lib/libp} -lc881}"
53:
54: #define CPP_SPEC "%{!msoft-float:-D__HAVE_68881__}"
55:
56: /* Shared libraries need to use crt0s.o */
57:
58: #undef STARTFILE_SPEC
59: #define STARTFILE_SPEC \
60: "%{!shlib:%{pg:mcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}\
61: %{shlib:crt0s.o%s shlib.ifile%s} "
62:
63: /* Generate calls to memcpy, memcmp and memset. */
64:
65: #define TARGET_MEM_FUNCTIONS
66:
67: /* size_t is unsigned int. */
68:
69: #define SIZE_TYPE "unsigned int"
70:
71: /* Every structure or union's size must be a multiple of 2 bytes. */
72:
73: #define STRUCTURE_SIZE_BOUNDARY 16
74:
75: /* Allocation boundary (in *bits*) for storing arguments in argument list. */
76: /* Be compatible with native compiler. */
77: #undef PARM_BOUNDARY
78: #define PARM_BOUNDARY 16
79:
80: /* cpp has to support a #sccs directive for the /usr/include files */
81:
82: #define SCCS_DIRECTIVE
83:
84: /* Make output for SDB. */
85:
86: #define SDB_DEBUGGING_INFO
87:
88: #undef REGISTER_PREFIX
89: #define REGISTER_PREFIX "%"
90:
91: #undef IMMEDIATE_PREFIX
92: #define IMMEDIATE_PREFIX "&"
93:
94: #undef REGISTER_NAMES
95: #define REGISTER_NAMES \
96: {"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", \
97: "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%fp", "%sp", \
98: "%fp0", "%fp1", "%fp2", "%fp3", "%fp4", "%fp5", "%fp6", "%fp7"}
99:
100: #if 0 /* [email protected] says the standard ones work. */
101: #undef FUNCTION_PROLOGUE
102: #define FUNCTION_PROLOGUE(FILE, SIZE) \
103: { register int regno; \
104: register int mask = 0; \
105: extern char call_used_regs[]; \
106: int fsize = (SIZE); \
107: if (frame_pointer_needed) \
108: { if (fsize < 0x8000) \
109: fprintf (FILE, "\tlink.w %%fp,&%d\n", -fsize); \
110: else if (TARGET_68020) \
111: fprintf (FILE, "\tlink.l %%fp,&%d\n", -fsize); \
112: else \
113: fprintf (FILE, "\tlink.w %%fp,&0\n\tsub.l &%d,%%sp\n", fsize); } \
114: for (regno = 16; regno < FIRST_PSEUDO_REGISTER; regno++) \
115: if (regs_ever_live[regno] && ! call_used_regs[regno]) \
116: mask |= 1 << (regno - 16); \
117: if (mask != 0) \
118: fprintf (FILE, "\tfmovem &0x%x,-(%%sp)\n", mask & 0xff); \
119: mask = 0; \
120: for (regno = 0; regno < 16; regno++) \
121: if (regs_ever_live[regno] && ! call_used_regs[regno]) \
122: mask |= 1 << (15 - regno); \
123: if (frame_pointer_needed) \
124: mask &= ~ (1 << (15-FRAME_POINTER_REGNUM)); \
125: if (exact_log2 (mask) >= 0) \
126: fprintf (FILE, "\tmov.l %s,-(%%sp)\n", reg_names[15 - exact_log2 (mask)]); \
127: else if (mask) fprintf (FILE, "\tmovm.l &0x%x,-(%%sp)\n", mask); }
128: #endif /* 0 */
129:
130: #undef FUNCTION_PROFILER
131: #define FUNCTION_PROFILER(FILE, LABEL_NO) \
132: fprintf (FILE, "\tmov.l &LP%%%d,%%a0\n\tjsr mcount%%\n", (LABEL_NO))
133:
134: #if 0 /* [email protected] says the standard ones work. */
135: #undef FUNCTION_EPILOGUE
136: #define FUNCTION_EPILOGUE(FILE, SIZE) \
137: { register int regno; \
138: register int mask, fmask; \
139: register int nregs; \
140: int offset, foffset; \
141: extern char call_used_regs[]; \
142: int fsize = (SIZE); \
143: int big = 0; \
144: nregs = 0; fmask = 0; \
145: for (regno = 16; regno < FIRST_PSEUDO_REGISTER; regno++) \
146: if (regs_ever_live[regno] && ! call_used_regs[regno]) \
147: { nregs++; fmask |= 1 << (23 - regno); } \
148: foffset = nregs * 12; \
149: nregs = 0; mask = 0; \
150: if (frame_pointer_needed) regs_ever_live[FRAME_POINTER_REGNUM] = 0; \
151: for (regno = 0; regno < 16; regno++) \
152: if (regs_ever_live[regno] && ! call_used_regs[regno]) \
153: { nregs++; mask |= 1 << regno; } \
154: offset = foffset + nregs * 4; \
155: if (offset + fsize >= 0x8000 && frame_pointer_needed) \
156: { fprintf (FILE, "\tmov.l &%d,%%a0\n", -fsize); \
157: fsize = 0, big = 1; } \
158: if (exact_log2 (mask) >= 0) { \
159: if (big) \
160: fprintf (FILE, "\tmov.l -%d(%%fp,%%a0.l),%s\n", \
161: offset + fsize, reg_names[exact_log2 (mask)]); \
162: else if (! frame_pointer_needed) \
163: fprintf (FILE, "\tmov.l (%%sp)+,%s\n", \
164: reg_names[exact_log2 (mask)]); \
165: else \
166: fprintf (FILE, "\tmov.l -%d(%%fp),%s\n", \
167: offset + fsize, reg_names[exact_log2 (mask)]); } \
168: else if (mask) { \
169: if (big) \
170: fprintf (FILE, "\tmovm.l -%d(%%fp,%%a0.l),&0x%x\n", \
171: offset + fsize, mask); \
172: else if (! frame_pointer_needed) \
173: fprintf (FILE, "\tmovm.l (%%sp)+,&0x%x\n", mask); \
174: else \
175: fprintf (FILE, "\tmovm.l -%d(%%fp),&0x%x\n", \
176: offset + fsize, mask); } \
177: if (fmask) { \
178: if (big) \
179: fprintf (FILE, "\tfmovem -%d(%%fp,%%a0.l),&0x%x\n", \
180: foffset + fsize, fmask); \
181: else if (! frame_pointer_needed) \
182: fprintf (FILE, "\tfmovem (%%sp)+,&0x%x\n", fmask); \
183: else \
184: fprintf (FILE, "\tfmovem -%d(%%fp),&0x%x\n", \
185: foffset + fsize, fmask); } \
186: if (frame_pointer_needed) \
187: fprintf (FILE, "\tunlk %%fp\n"); \
188: if (current_function_pops_args) \
189: fprintf (FILE, "\trtd &%d\n", current_function_pops_args); \
190: else fprintf (FILE, "\trts\n"); }
191: #endif /* 0 */
192:
193: /* This is how to output an insn to push a register on the stack.
194: It need not be very fast code. */
195:
196: #undef ASM_OUTPUT_REG_PUSH
197: #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
198: fprintf (FILE, "\tmov.l %s,-(%%sp)\n", reg_names[REGNO])
199:
200: /* This is how to output an insn to pop a register from the stack.
201: It need not be very fast code. */
202:
203: #undef ASM_OUTPUT_REG_POP
204: #define ASM_OUTPUT_REG_POP(FILE,REGNO) \
205: fprintf (FILE, "\tmov.l (%%sp)+,%s\n", reg_names[REGNO])
206:
207: #undef ASM_APP_ON
208: #define ASM_APP_ON ""
209:
210: #undef ASM_APP_OFF
211: #define ASM_APP_OFF ""
212:
213: #undef TEXT_SECTION_ASM_OP
214: #define TEXT_SECTION_ASM_OP "text"
215: #undef DATA_SECTION_ASM_OP
216: #define DATA_SECTION_ASM_OP "data"
217: #undef ASCII_DATA_ASM_OP
218: #define ASCII_DATA_ASM_OP "byte"
219:
220: /* The file command should always begin the output. */
221:
222: #undef ASM_FILE_START
223: #define ASM_FILE_START(FILE) \
224: output_file_directive ((FILE), main_input_filename)
225:
226: /* Don't try to define `gcc_compiled.' since the assembler might not
227: accept symbols with periods and GDB doesn't run on this machine anyway. */
228:
229: #define ASM_IDENTIFY_GCC(FILE)
230:
231: /* Names to predefine in the preprocessor for this target machine. */
232: /* [email protected] says mc68000 and m68k should not be here,
233: on the other hand I don't care what he says. */
234:
235: #undef CPP_PREDEFINES
236: #define CPP_PREDEFINES "-Dm68k -Dunix -DsysV68 -D__motorola__ -Asystem(unix) -Asystem(svr3) -Acpu(m68k) -Amachine(m68k)"
237:
238: #if 0 /* [email protected] says the right way is with PARM_BOUNDARY. */
239: /* Specify how to pad function arguments.
240: Value should be `upward', `downward' or `none'.
241: Same as the default, except no padding for large or variable-size args. */
242:
243: #define FUNCTION_ARG_PADDING(MODE, TYPE) \
244: (((MODE) == BLKmode \
245: ? ((TYPE) && TREE_CODE (TYPE_SIZE (TYPE)) == INTEGER_CST \
246: && int_size_in_bytes (TYPE) < PARM_BOUNDARY / BITS_PER_UNIT) \
247: : GET_MODE_BITSIZE (MODE) < PARM_BOUNDARY) \
248: ? downward : none)
249: #endif /* 0 */
250:
251: /* Override part of the obstack macros. */
252:
253: #define __PTR_TO_INT(P) ((int)(P))
254: #define __INT_TO_PTR(P) ((char *)(P))
255:
256: #undef TARGET_VERSION
257: #define TARGET_VERSION fprintf (stderr, " (68k, SGS/AT&T sysV68 syntax)");
258:
259: /* Function calls save all but a0, a1, d0, d1, fp0, fp1. */
260:
261: #undef CALL_USED_REGISTERS
262: #define CALL_USED_REGISTERS \
263: {1, 1, 0, 0, 0, 0, 0, 0, \
264: 1, 1, 0, 0, 0, 0, 0, 1, \
265: 1, 1, 0, 0, 0, 0, 0, 0}
266:
267: /* If TARGET_68881, return SF and DF values in fp0 instead of d0. */
268: /* NYI: If FP=M68881U return SF and DF values in d0. */
269: /* NYI: If -mold return pointer in a0 and d0 */
270:
271: #undef FUNCTION_VALUE
272: #define FUNCTION_VALUE(VALTYPE,FUNC) LIBCALL_VALUE (TYPE_MODE (VALTYPE))
273:
274: /* sysV68 (brain damaged) cc convention support. */
275: /* Commented out until we find a safe way to make it optional. */
276: #if 0
277: #define FUNCTION_VALUE(VALTYPE,FUNC) \
278: (TREE_CODE (VALTYPE) == REAL_TYPE && TARGET_68881 \
279: ? gen_rtx (REG, TYPE_MODE (VALTYPE), 16) \
280: : (TREE_CODE (VALTYPE) == POINTER_TYPE \
281: ? gen_rtx (REG, TYPE_MODE (VALTYPE), 8) \
282: : gen_rtx (REG, TYPE_MODE (VALTYPE), 0)))
283: #endif
284:
285: /* If TARGET_68881, SF and DF values are returned in fp0 instead of d0. */
286:
287: #undef LIBCALL_VALUE
288: #define LIBCALL_VALUE(MODE) \
289: gen_rtx (REG, (MODE), \
290: ((TARGET_68881 \
291: && ((MODE) == SFmode || (MODE) == DFmode || (MODE) == XFmode)) \
292: ? 16 : 0))
293:
294: /* 1 if N is a possible register number for a function value.
295: d0 may be used, and fp0 as well if -msoft-float is not specified. */
296:
297: #undef FUNCTION_VALUE_REGNO_P
298: #define FUNCTION_VALUE_REGNO_P(N) \
299: ((N) == 0 || (TARGET_68881 && (N) == 16))
300:
301: /* sysV68 (brain damaged) cc convention support. */
302: /* Commented out until we find a safe way to make it optional. */
303: #if 0
304: #define FUNCTION_VALUE_REGNO_P(N) \
305: ((N) == 0 || (N) == 8 || (TARGET_68881 && (N) == 16))
306: #endif
307:
308: /* Define this to be true when FUNCTION_VALUE_REGNO_P is true for
309: more than one register. */
310:
311: #undef NEEDS_UNTYPED_CALL
312: #define NEEDS_UNTYPED_CALL 1
313:
314: /* This is the command to make the user-level label named NAME
315: defined for reference from other files. */
316:
317: #undef GLOBAL_ASM_OP
318: #define GLOBAL_ASM_OP "global"
319:
320: /* Store in OUTPUT a string (made with alloca) containing
321: an assembler-name for a local static variable named NAME.
322: LABELNO is an integer which is different for each call. */
323:
324: #undef ASM_FORMAT_PRIVATE_NAME
325: #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
326: ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 12), \
327: sprintf ((OUTPUT), "%s_%%%d", (NAME), (LABELNO)))
328:
329: /* The sysV68 as doesn't know about double's and float's. */
330: /* This is how to output an assembler line defining a `double' constant. */
331:
332: #undef ASM_OUTPUT_DOUBLE
333: #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
334: do { long l[2]; \
335: REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l); \
336: fprintf (FILE, "\tlong 0x%x,0x%x\n", l[0], l[1]); \
337: } while (0)
338:
339: #undef ASM_OUTPUT_LONG_DOUBLE
340: #define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE) \
341: do { long l[3]; \
342: REAL_VALUE_TO_TARGET_LONG_DOUBLE (VALUE, l); \
343: fprintf (FILE, "\tlong 0x%x,0x%x,0x%x\n", l[0], l[1], l[2]); \
344: } while (0)
345:
346: /* This is how to output an assembler line defining a `float' constant. */
347:
348: #undef ASM_OUTPUT_FLOAT
349: #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
350: do { long l; \
351: REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
352: fprintf ((FILE), "\tlong 0x%x\n", l); \
353: } while (0)
354:
355: /* This is how to output an assembler line defining an `int' constant. */
356:
357: #undef ASM_OUTPUT_INT
358: #define ASM_OUTPUT_INT(FILE,VALUE) \
359: ( fprintf (FILE, "\tlong "), \
360: output_addr_const (FILE, (VALUE)), \
361: fprintf (FILE, "\n"))
362:
363: /* Likewise for `char' and `short' constants. */
364:
365: #undef ASM_OUTPUT_SHORT
366: #define ASM_OUTPUT_SHORT(FILE,VALUE) \
367: ( fprintf (FILE, "\tshort "), \
368: output_addr_const (FILE, (VALUE)), \
369: fprintf (FILE, "\n"))
370:
371: #undef ASM_OUTPUT_CHAR
372: #define ASM_OUTPUT_CHAR(FILE,VALUE) \
373: ( fprintf (FILE, "\tbyte "), \
374: output_addr_const (FILE, (VALUE)), \
375: fprintf (FILE, "\n"))
376:
377: /* This is how to output an assembler line for a numeric constant byte. */
378:
379: #undef ASM_OUTPUT_BYTE
380: #define ASM_OUTPUT_BYTE(FILE,VALUE) \
381: fprintf (FILE, "\tbyte 0x%x\n", (VALUE))
382:
383: /* This is how to output an assembler line
384: that says to advance the location counter
385: to a multiple of 2**LOG bytes. */
386:
387: #undef ASM_OUTPUT_ALIGN
388: #define ASM_OUTPUT_ALIGN(FILE,LOG) \
389: if ((LOG) == 1) \
390: fprintf (FILE, "\teven\n"); \
391: else if ((LOG) != 0) \
392: abort ();
393:
394: #undef ASM_OUTPUT_SKIP
395: #define ASM_OUTPUT_SKIP(FILE,SIZE) \
396: fprintf (FILE, "\tspace %u\n", (SIZE))
397:
398: /* Can't use ASM_OUTPUT_SKIP in text section. */
399:
400: #define ASM_NO_SKIP_IN_TEXT 1
401:
402: /* The beginnings of sdb support... */
403:
404: #undef ASM_OUTPUT_SOURCE_FILENAME
405: #define ASM_OUTPUT_SOURCE_FILENAME(FILE, FILENAME) \
406: do { fprintf (FILE, "\tfile\t"); \
407: output_quoted_string (FILE, FILENAME); \
408: fprintf (FILE, "\n"); \
409: } while (0)
410:
411: #undef ASM_OUTPUT_SOURCE_LINE
412: #define ASM_OUTPUT_SOURCE_LINE(FILE, LINENO) \
413: fprintf (FILE, "\tln\t%d\n", \
414: (sdb_begin_function_line \
415: ? last_linenum - sdb_begin_function_line : 1))
416:
417: /* Yet another null terminated string format. */
418:
419: #undef ASM_OUTPUT_ASCII
420: #define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \
421: { register int sp = 0, lp = 0; \
422: fprintf ((FILE), "\tbyte\t"); \
423: loop: \
424: if ((PTR)[sp] > ' ' && ! ((PTR)[sp] & 0x80) && (PTR)[sp] != '\\') \
425: { lp += 3; \
426: fprintf ((FILE), "'%c", (PTR)[sp]); } \
427: else \
428: { lp += 5; \
429: fprintf ((FILE), "0x%x", (PTR)[sp]); } \
430: if (++sp < (LEN)) \
431: { if (lp > 60) \
432: { lp = 0; \
433: fprintf ((FILE), "\n\t%s ", ASCII_DATA_ASM_OP); } \
434: else \
435: putc (',', (FILE)); \
436: goto loop; } \
437: putc ('\n', (FILE)); }
438:
439: /* Print operand X (an rtx) in assembler syntax to file FILE.
440: CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
441: For `%' followed by punctuation, CODE is the punctuation and X is null.
442:
443: On the 68000, we use several CODE characters:
444: '.' for dot needed in Motorola-style opcode names.
445: '-' for an operand pushing on the stack:
446: sp@-, -(sp) or -(%sp) depending on the style of syntax.
447: '+' for an operand pushing on the stack:
448: sp@+, (sp)+ or (%sp)+ depending on the style of syntax.
449: '@' for a reference to the top word on the stack:
450: sp@, (sp) or (%sp) depending on the style of syntax.
451: '#' for an immediate operand prefix (# in MIT and Motorola syntax
452: but & in SGS syntax).
453: '!' for the fpcr register (used in some float-to-fixed conversions).
454: '$' for the letter `s' in an op code, but only on the 68040.
455: '&' for the letter `d' in an op code, but only on the 68040.
456:
457: 'b' for byte insn (no effect, on the Sun; this is for the ISI).
458: 'd' to force memory addressing to be absolute, not relative.
459: 'f' for float insn (print a CONST_DOUBLE as a float rather than in hex)
460: 'w' for FPA insn (print a CONST_DOUBLE as a SunFPA constant rather
461: than directly). Second part of 'y' below.
462: 'x' for float insn (print a CONST_DOUBLE as a float rather than in hex),
463: or print pair of registers as rx:ry.
464: 'y' for a FPA insn (print pair of registers as rx:ry). This also outputs
465: CONST_DOUBLE's as SunFPA constant RAM registers if
466: possible, so it should not be used except for the SunFPA. */
467:
468: #undef PRINT_OPERAND
469: #define PRINT_OPERAND(FILE, X, CODE) \
470: { if (CODE == '.') fprintf (FILE, "."); \
471: else if (CODE == '#') fprintf (FILE, "&"); \
472: else if (CODE == '-') fprintf (FILE, "-(%%sp)"); \
473: else if (CODE == '+') fprintf (FILE, "(%%sp)+"); \
474: else if (CODE == '@') fprintf (FILE, "(%%sp)"); \
475: else if (CODE == '!') fprintf (FILE, "%%fpcr"); \
476: else if (CODE == '$') { if (TARGET_68040_ONLY) fprintf (FILE, "s"); } \
477: else if (CODE == '&') { if (TARGET_68040_ONLY) fprintf (FILE, "d"); } \
478: else if (CODE == '/') \
479: fprintf (FILE, "%%"); \
480: else if (GET_CODE (X) == REG) \
481: fprintf (FILE, "%s", reg_names[REGNO (X)]); \
482: else if (GET_CODE (X) == MEM) \
483: output_address (XEXP (X, 0)); \
484: else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == SFmode) \
485: { REAL_VALUE_TYPE r; long l; \
486: REAL_VALUE_FROM_CONST_DOUBLE (r, X); \
487: REAL_VALUE_TO_TARGET_SINGLE (r, l); \
488: /* Use hex representation even if CODE is f. as needs it. */ \
489: fprintf (FILE, "&0x%x", l); } \
490: else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == DFmode) \
491: { REAL_VALUE_TYPE r; int i[2]; \
492: REAL_VALUE_FROM_CONST_DOUBLE (r, X); \
493: REAL_VALUE_TO_TARGET_DOUBLE (r, i); \
494: fprintf (FILE, "&0x%08x%08x", i[0], i[1]); } \
495: else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == XFmode) \
496: { REAL_VALUE_TYPE r; \
497: REAL_VALUE_FROM_CONST_DOUBLE (r, X); \
498: ASM_OUTPUT_LONG_DOUBLE_OPERAND (FILE, r); } \
499: else { putc ('&', FILE); output_addr_const (FILE, X); }}
500:
501: #undef PRINT_OPERAND_ADDRESS
502: #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
503: { register rtx reg1, reg2, breg, ireg; \
504: register rtx addr = ADDR; \
505: rtx offset; \
506: switch (GET_CODE (addr)) \
507: { \
508: case REG: \
509: fprintf (FILE, "(%s)", reg_names[REGNO (addr)]); \
510: break; \
511: case PRE_DEC: \
512: fprintf (FILE, "-(%s)", reg_names[REGNO (XEXP (addr, 0))]); \
513: break; \
514: case POST_INC: \
515: fprintf (FILE, "(%s)+", reg_names[REGNO (XEXP (addr, 0))]); \
516: break; \
517: case PLUS: \
518: reg1 = 0; reg2 = 0; \
519: ireg = 0; breg = 0; \
520: offset = 0; \
521: if (CONSTANT_ADDRESS_P (XEXP (addr, 0))) \
522: { \
523: offset = XEXP (addr, 0); \
524: addr = XEXP (addr, 1); \
525: } \
526: else if (CONSTANT_ADDRESS_P (XEXP (addr, 1))) \
527: { \
528: offset = XEXP (addr, 1); \
529: addr = XEXP (addr, 0); \
530: } \
531: if (GET_CODE (addr) != PLUS) ; \
532: else if (GET_CODE (XEXP (addr, 0)) == SIGN_EXTEND) \
533: { \
534: reg1 = XEXP (addr, 0); \
535: addr = XEXP (addr, 1); \
536: } \
537: else if (GET_CODE (XEXP (addr, 1)) == SIGN_EXTEND) \
538: { \
539: reg1 = XEXP (addr, 1); \
540: addr = XEXP (addr, 0); \
541: } \
542: else if (GET_CODE (XEXP (addr, 0)) == MULT) \
543: { \
544: reg1 = XEXP (addr, 0); \
545: addr = XEXP (addr, 1); \
546: } \
547: else if (GET_CODE (XEXP (addr, 1)) == MULT) \
548: { \
549: reg1 = XEXP (addr, 1); \
550: addr = XEXP (addr, 0); \
551: } \
552: else if (GET_CODE (XEXP (addr, 0)) == REG) \
553: { \
554: reg1 = XEXP (addr, 0); \
555: addr = XEXP (addr, 1); \
556: } \
557: else if (GET_CODE (XEXP (addr, 1)) == REG) \
558: { \
559: reg1 = XEXP (addr, 1); \
560: addr = XEXP (addr, 0); \
561: } \
562: if (GET_CODE (addr) == REG || GET_CODE (addr) == MULT \
563: || GET_CODE (addr) == SIGN_EXTEND) \
564: { if (reg1 == 0) reg1 = addr; else reg2 = addr; addr = 0; } \
565: /* for OLD_INDEXING \
566: else if (GET_CODE (addr) == PLUS) \
567: { \
568: if (GET_CODE (XEXP (addr, 0)) == REG) \
569: { \
570: reg2 = XEXP (addr, 0); \
571: addr = XEXP (addr, 1); \
572: } \
573: else if (GET_CODE (XEXP (addr, 1)) == REG) \
574: { \
575: reg2 = XEXP (addr, 1); \
576: addr = XEXP (addr, 0); \
577: } \
578: } \
579: */ \
580: if (offset != 0) { if (addr != 0) abort (); addr = offset; } \
581: if ((reg1 && (GET_CODE (reg1) == SIGN_EXTEND \
582: || GET_CODE (reg1) == MULT)) \
583: || (reg2 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg2)))) \
584: { breg = reg2; ireg = reg1; } \
585: else if (reg1 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg1))) \
586: { breg = reg1; ireg = reg2; } \
587: if (ireg != 0 && breg == 0 && GET_CODE (addr) == LABEL_REF) \
588: { int scale = 1; \
589: if (GET_CODE (ireg) == MULT) \
590: { scale = INTVAL (XEXP (ireg, 1)); \
591: ireg = XEXP (ireg, 0); } \
592: if (GET_CODE (ireg) == SIGN_EXTEND) \
593: fprintf (FILE, "12(%%pc,%s.w", \
594: reg_names[REGNO (XEXP (ireg, 0))]); \
595: else \
596: fprintf (FILE, "12(%%pc,%s.l", \
597: reg_names[REGNO (ireg)]); \
598: if (scale != 1) fprintf (FILE, "*%d", scale); \
599: fprintf (FILE, ")"); \
600: break; } \
601: if (breg != 0 && ireg == 0 && GET_CODE (addr) == LABEL_REF) \
602: { fprintf (FILE, "12(%%pc,%s.l", \
603: reg_names[REGNO (breg)]); \
604: putc (')', FILE); \
605: break; } \
606: if (ireg != 0 || breg != 0) \
607: { int scale = 1; \
608: if (breg == 0) \
609: abort (); \
610: if (addr != 0) \
611: output_addr_const (FILE, addr); \
612: fprintf (FILE, "(%s", reg_names[REGNO (breg)]); \
613: if (ireg != 0) \
614: putc (',', FILE); \
615: if (ireg != 0 && GET_CODE (ireg) == MULT) \
616: { scale = INTVAL (XEXP (ireg, 1)); \
617: ireg = XEXP (ireg, 0); } \
618: if (ireg != 0 && GET_CODE (ireg) == SIGN_EXTEND) \
619: fprintf (FILE, "%s.w", reg_names[REGNO (XEXP (ireg, 0))]); \
620: else if (ireg != 0) \
621: fprintf (FILE, "%s.l", reg_names[REGNO (ireg)]); \
622: if (scale != 1) fprintf (FILE, "*%d", scale); \
623: putc (')', FILE); \
624: break; \
625: } \
626: else if (reg1 != 0 && GET_CODE (addr) == LABEL_REF) \
627: { fprintf (FILE, "12(%%pc,%s.w)", \
628: reg_names[REGNO (reg1)]); \
629: break; } \
630: default: \
631: if (GET_CODE (addr) == CONST_INT \
632: && INTVAL (addr) < 0x8000 \
633: && INTVAL (addr) >= -0x8000) \
634: fprintf (FILE, "%d", INTVAL (addr)); \
635: else \
636: output_addr_const (FILE, addr); \
637: }}
638:
639: /* This is how to store into the string LABEL
640: the symbol_ref name of an internal numbered label where
641: PREFIX is the class of label and NUM is the number within the class.
642: This is suitable for output with `assemble_name'. */
643:
644: #undef ASM_GENERATE_INTERNAL_LABEL
645: #define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
646: sprintf ((LABEL), "%s%%%d", (PREFIX), (NUM))
647:
648: /* This is how to output an internal numbered label where
649: PREFIX is the class of label and NUM is the number within the class. */
650:
651: #undef ASM_OUTPUT_INTERNAL_LABEL
652: #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
653: fprintf (FILE, "%s%%%d:\n", PREFIX, NUM)
654:
655: /* This is how to output a reference to a user-level label named NAME.
656: `assemble_name' uses this. */
657:
658: #undef ASM_OUTPUT_LABELREF
659: #define ASM_OUTPUT_LABELREF(FILE,NAME) \
660: fprintf (FILE, "%s", NAME)
661:
662: /* This is how to output an element of a case-vector that is absolute.
663: (The 68000 does not use such vectors,
664: but we must define this macro anyway.) */
665:
666: #undef ASM_OUTPUT_ADDR_VEC_ELT
667: #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
668: fprintf (FILE, "\tlong L%%%d\n", (VALUE))
669:
670: /* This is how to output an element of a case-vector that is relative. */
671:
672: #undef ASM_OUTPUT_ADDR_DIFF_ELT
673: #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
674: fprintf (FILE, "\tshort L%%%d-L%%%d\n", (VALUE), (REL))
675:
676: #define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \
677: fprintf (FILE, "\tswbeg &%d\n%s%%%d:\n", \
678: XVECLEN (PATTERN (TABLE), 1), (PREFIX), (NUM))
679:
680: #if 0
681: /* At end of a switch table, define LD%n iff the symbol LI%n was defined. */
682: #define ASM_OUTPUT_CASE_END(FILE,NUM,TABLE) \
683: { if (switch_table_difference_label_flag) \
684: asm_fprintf (FILE, "\t%s %LLD%d,%LL%d-%LLI%d-2.b\n",\
685: SET_ASM_OP, (NUM), (NUM), (NUM)) \
686: switch_table_difference_label_flag = 0; }
687: #endif
688:
689: /* We have to define this to avoid errors. */
690: int switch_table_difference_label_flag;
691:
692: /* Translate some opcodes to fit the sysV68 assembler syntax. */
693: /* The opcodes fdmov and fsmov are guesses. */
694:
695: #define SWITCH_JUMP_MATCH "jmp 6(%%pc,"
696:
697: /* [email protected] says no need for .w suffix on jumps. */
698: #undef ASM_OUTPUT_OPCODE
699: #define ASM_OUTPUT_OPCODE(FILE, PTR) \
700: { if ((PTR)[0] == 'j' && (PTR)[1] == 'b') \
701: { ++(PTR); \
702: while (*(PTR) != ' ') \
703: { putc (*(PTR), (FILE)); ++(PTR); } \
704: } \
705: else if ((PTR)[0] == 's') \
706: { \
707: if (!strncmp ((PTR), "swap", 4)) \
708: { fprintf ((FILE), "swap.w"); (PTR) += 4; } \
709: } \
710: else if ((PTR)[0] == 'f') \
711: { \
712: if (!strncmp ((PTR), "fmove", 5)) \
713: { fprintf ((FILE), "fmov"); (PTR) += 5; } \
714: else if (!strncmp ((PTR), "f%$move", 7)) \
715: { if (TARGET_68040_ONLY) \
716: { fprintf ((FILE), "fsmov"); (PTR) += 7; } \
717: else \
718: { fprintf ((FILE), "fmov"); (PTR) += 7; } } \
719: else if (!strncmp ((PTR), "f%&move", 7)) \
720: { if (TARGET_68040_ONLY) \
721: { fprintf ((FILE), "fdmov"); (PTR) += 7; } \
722: else \
723: { fprintf ((FILE), "fmov"); (PTR) += 7; } } \
724: else if (!strncmp ((PTR), "ftst", 4)) \
725: { fprintf ((FILE), "ftest"); (PTR) += 4; } \
726: else if (!strncmp ((PTR), "fbne", 4)) \
727: { fprintf ((FILE), "fbneq"); (PTR) += 4; } \
728: else if (!strncmp ((PTR), "fsne", 4)) \
729: { fprintf ((FILE), "fsneq"); (PTR) += 4; } \
730: } \
731: /* MOVE, MOVEA, MOVEQ, MOVEC ==> MOV */ \
732: else if ((PTR)[0] == 'm' && (PTR)[1] == 'o' \
733: && (PTR)[2] == 'v' && (PTR)[3] == 'e') \
734: { fprintf ((FILE), "mov"); (PTR) += 4; \
735: if ((PTR)[0] == 'q' || (PTR)[0] == 'a' \
736: || (PTR)[0] == 'c') (PTR)++; } \
737: /* SUB, SUBQ, SUBA, SUBI ==> SUB */ \
738: else if ((PTR)[0] == 's' && (PTR)[1] == 'u' \
739: && (PTR)[2] == 'b') \
740: { fprintf ((FILE), "sub"); (PTR) += 3; \
741: if ((PTR)[0] == 'q' || (PTR)[0] == 'i' \
742: || (PTR)[0] == 'a') (PTR)++; } \
743: /* CMP, CMPA, CMPI, CMPM ==> CMP */ \
744: else if ((PTR)[0] == 'c' && (PTR)[1] == 'm' \
745: && (PTR)[2] == 'p') \
746: { fprintf ((FILE), "cmp"); (PTR) += 3; \
747: if ((PTR)[0] == 'a' || (PTR)[0] == 'i' \
748: || (PTR)[0] == 'm') (PTR)++; } \
749: /* JMP to switch label */ \
750: else if (!strncmp((PTR), (SWITCH_JUMP_MATCH), sizeof(SWITCH_JUMP_MATCH) - 1)) \
751: { while (*(PTR)++ != '('); \
752: fprintf ((FILE), "jmp 8("); } \
753: }
754:
755: /* [email protected] says to pass SIZE, not ROUNDED. */
756:
757: /* This says how to output an assembler line
758: to define a global common symbol. */
759:
760: #undef ASM_OUTPUT_COMMON
761: #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
762: ( fputs ("\tcomm ", (FILE)), \
763: assemble_name ((FILE), (NAME)), \
764: fprintf ((FILE), ",%u\n", (SIZE)))
765:
766: /* This says how to output an assembler line
767: to define a local common symbol. */
768:
769: #undef ASM_OUTPUT_LOCAL
770: #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
771: ( fputs ("\tlcomm ", (FILE)), \
772: assemble_name ((FILE), (NAME)), \
773: fprintf ((FILE), ",%u\n", (SIZE)))
774:
775:
776: /* Override usual definitions of SDB output macros.
777: These definitions differ only in the absence of the period
778: at the beginning of the name of the directive
779: and in the use of `~' as the symbol for the current location. */
780:
781: #define PUT_SDB_SCL(a) fprintf(asm_out_file, "\tscl\t%d;", (a))
782: #define PUT_SDB_INT_VAL(a) fprintf (asm_out_file, "\tval\t%d;", (a))
783: #define PUT_SDB_VAL(a) \
784: ( fputs ("\tval\t", asm_out_file), \
785: output_addr_const (asm_out_file, (a)), \
786: fputc (';', asm_out_file))
787:
788: #define PUT_SDB_DEF(a) \
789: do { fprintf (asm_out_file, "\tdef\t"); \
790: ASM_OUTPUT_LABELREF (asm_out_file, a); \
791: fprintf (asm_out_file, ";"); } while (0)
792:
793: #define PUT_SDB_PLAIN_DEF(a) fprintf(asm_out_file,"\tdef\t~%s;",a)
794: #define PUT_SDB_ENDEF fputs("\tendef\n", asm_out_file)
795: #define PUT_SDB_TYPE(a) fprintf(asm_out_file, "\ttype\t0%o;", a)
796: #define PUT_SDB_SIZE(a) fprintf(asm_out_file, "\tsize\t%d;", a)
797: #define PUT_SDB_START_DIM fprintf(asm_out_file, "\tdim\t")
798: #define PUT_SDB_NEXT_DIM(a) fprintf(asm_out_file, "%d,", a)
799: #define PUT_SDB_LAST_DIM(a) fprintf(asm_out_file, "%d;", a)
800:
801: #define PUT_SDB_TAG(a) \
802: do { fprintf (asm_out_file, "\ttag\t"); \
803: ASM_OUTPUT_LABELREF (asm_out_file, a); \
804: fprintf (asm_out_file, ";"); } while (0)
805:
806: #define PUT_SDB_BLOCK_START(LINE) \
807: fprintf (asm_out_file, \
808: "\tdef\t~bb;\tval\t~;\tscl\t100;\tline\t%d;\tendef\n", \
809: (LINE))
810:
811: #define PUT_SDB_BLOCK_END(LINE) \
812: fprintf (asm_out_file, \
813: "\tdef\t~eb;\tval\t~;\tscl\t100;\tline\t%d;\tendef\n", \
814: (LINE))
815:
816: #define PUT_SDB_FUNCTION_START(LINE) \
817: fprintf (asm_out_file, \
818: "\tdef\t~bf;\tval\t~;\tscl\t101;\tline\t%d;\tendef\n", \
819: (LINE))
820:
821: #define PUT_SDB_FUNCTION_END(LINE) \
822: fprintf (asm_out_file, \
823: "\tdef\t~ef;\tval\t~;\tscl\t101;\tline\t%d;\tendef\n", \
824: (LINE))
825:
826: #define PUT_SDB_EPILOGUE_END(NAME) \
827: fprintf (asm_out_file, \
828: "\tdef\t%s;\tval\t~;\tscl\t-1;\tendef\n", \
829: (NAME))
830:
831: #define SDB_GENERATE_FAKE(BUFFER, NUMBER) \
832: sprintf ((BUFFER), "~%dfake", (NUMBER));
833:
834: /* Define subroutines to call to handle multiply, divide, and remainder.
835: Use the subroutines that the 3b1's library provides.
836: The `*' prevents an underscore from being prepended by the compiler. */
837:
838: #define DIVSI3_LIBCALL "*ldiv"
839: #define UDIVSI3_LIBCALL "*uldiv"
840: #define MODSI3_LIBCALL "*lrem"
841: #define UMODSI3_LIBCALL "*ulrem"
842: #define MULSI3_LIBCALL "*lmul"
843: #define UMULSI3_LIBCALL "*ulmul"
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.