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