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