|
|
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:
285: /* This is how to output a command to make the user-level label named NAME
286: defined for reference from other files. */
287:
288: #undef ASM_GLOBALIZE_LABEL
289: #define ASM_GLOBALIZE_LABEL(FILE,NAME) \
290: do { fputs ("\tglobal ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0)
291:
292: /* Store in OUTPUT a string (made with alloca) containing
293: an assembler-name for a local static variable named NAME.
294: LABELNO is an integer which is different for each call. */
295:
296: #undef ASM_FORMAT_PRIVATE_NAME
297: #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
298: ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 12), \
299: sprintf ((OUTPUT), "%s_%%%d", (NAME), (LABELNO)))
300:
301: /* The sysV68 as doesn't know about double's and float's. */
302:
303: #undef ASM_OUTPUT_DOUBLE
304: #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
305: do { union { double d; long l[2]; } tem; \
306: tem.d = (VALUE); \
307: fprintf(FILE, "\tlong 0x%x,0x%x\n", tem.l[0], tem.l[1]); \
308: } while (0)
309:
310: #undef ASM_OUTPUT_FLOAT
311: #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
312: do { union { float f; long l;} tem; \
313: tem.f = (VALUE); \
314: fprintf (FILE, "\tlong 0x%x\n", tem.l); \
315: } while (0)
316:
317: /* This is how to output an assembler line defining an `int' constant. */
318:
319: #undef ASM_OUTPUT_INT
320: #define ASM_OUTPUT_INT(FILE,VALUE) \
321: ( fprintf (FILE, "\tlong "), \
322: output_addr_const (FILE, (VALUE)), \
323: fprintf (FILE, "\n"))
324:
325: /* Likewise for `char' and `short' constants. */
326:
327: #undef ASM_OUTPUT_SHORT
328: #define ASM_OUTPUT_SHORT(FILE,VALUE) \
329: ( fprintf (FILE, "\tshort "), \
330: output_addr_const (FILE, (VALUE)), \
331: fprintf (FILE, "\n"))
332:
333: #undef ASM_OUTPUT_CHAR
334: #define ASM_OUTPUT_CHAR(FILE,VALUE) \
335: ( fprintf (FILE, "\tbyte "), \
336: output_addr_const (FILE, (VALUE)), \
337: fprintf (FILE, "\n"))
338:
339: /* This is how to output an assembler line for a numeric constant byte. */
340:
341: #undef ASM_OUTPUT_BYTE
342: #define ASM_OUTPUT_BYTE(FILE,VALUE) \
343: fprintf (FILE, "\tbyte 0x%x\n", (VALUE))
344:
345: /* This is how to output an assembler line
346: that says to advance the location counter
347: to a multiple of 2**LOG bytes. */
348:
349: #undef ASM_OUTPUT_ALIGN
350: #define ASM_OUTPUT_ALIGN(FILE,LOG) \
351: if ((LOG) == 1) \
352: fprintf (FILE, "\teven\n"); \
353: else if ((LOG) != 0) \
354: abort ();
355:
356: #undef ASM_OUTPUT_SKIP
357: #define ASM_OUTPUT_SKIP(FILE,SIZE) \
358: fprintf (FILE, "\tspace %u\n", (SIZE))
359:
360: /* Can't use ASM_OUTPUT_SKIP in text section. */
361:
362: #define ASM_NO_SKIP_IN_TEXT 1
363:
364: /* The beginnings of sdb support... */
365:
366: #undef ASM_OUTPUT_SOURCE_FILENAME
367: #define ASM_OUTPUT_SOURCE_FILENAME(FILE, FILENAME) \
368: fprintf (FILE, "\tfile\t\"%s\"\n", FILENAME)
369:
370: #undef ASM_OUTPUT_SOURCE_LINE
371: #define ASM_OUTPUT_SOURCE_LINE(FILE, LINENO) \
372: fprintf (FILE, "\tln\t%d\n", \
373: (sdb_begin_function_line \
374: ? last_linenum - sdb_begin_function_line : 1))
375:
376: /* Yet another null terminated string format. */
377:
378: #undef ASM_OUTPUT_ASCII
379: #define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \
380: { register int sp = 0, lp = 0; \
381: fprintf ((FILE), "\tbyte\t"); \
382: loop: \
383: if ((PTR)[sp] > ' ' && ! ((PTR)[sp] & 0x80) && (PTR)[sp] != '\\') \
384: { lp += 3; \
385: fprintf ((FILE), "'%c", (PTR)[sp]); } \
386: else \
387: { lp += 5; \
388: fprintf ((FILE), "0x%x", (PTR)[sp]); } \
389: if (++sp < (LEN)) \
390: { if (lp > 60) \
391: { lp = 0; \
1.1.1.2 ! root 392: fprintf ((FILE), "\n\t%s ", ASCII_DATA_ASM_OP); } \
1.1 root 393: else \
394: putc (',', (FILE)); \
395: goto loop; } \
396: putc ('\n', (FILE)); }
397:
398: /* Print operand X (an rtx) in assembler syntax to file FILE.
399: CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
400: For `%' followed by punctuation, CODE is the punctuation and X is null.
401:
402: On the 68000, we use several CODE characters:
403: '.' for dot needed in Motorola-style opcode names.
404: '-' for an operand pushing on the stack:
405: sp@-, -(sp) or -(%sp) depending on the style of syntax.
406: '+' for an operand pushing on the stack:
407: sp@+, (sp)+ or (%sp)+ depending on the style of syntax.
408: '@' for a reference to the top word on the stack:
409: sp@, (sp) or (%sp) depending on the style of syntax.
410: '#' for an immediate operand prefix (# in MIT and Motorola syntax
411: but & in SGS syntax).
1.1.1.2 ! root 412: '!' for the fpcr register (used in some float-to-fixed conversions).
1.1 root 413: '$' for the letter `s' in an op code, but only on the 68040.
414: '&' for the letter `d' in an op code, but only on the 68040.
415:
416: 'b' for byte insn (no effect, on the Sun; this is for the ISI).
417: 'd' to force memory addressing to be absolute, not relative.
418: 'f' for float insn (print a CONST_DOUBLE as a float rather than in hex)
419: 'w' for FPA insn (print a CONST_DOUBLE as a SunFPA constant rather
420: than directly). Second part of 'y' below.
421: 'x' for float insn (print a CONST_DOUBLE as a float rather than in hex),
422: or print pair of registers as rx:ry.
423: 'y' for a FPA insn (print pair of registers as rx:ry). This also outputs
424: CONST_DOUBLE's as SunFPA constant RAM registers if
425: possible, so it should not be used except for the SunFPA. */
426:
427: #undef PRINT_OPERAND
428: #define PRINT_OPERAND(FILE, X, CODE) \
429: { if (CODE == '.') fprintf (FILE, "."); \
430: else if (CODE == '#') fprintf (FILE, "&"); \
431: else if (CODE == '-') fprintf (FILE, "-(%%sp)"); \
432: else if (CODE == '+') fprintf (FILE, "(%%sp)+"); \
433: else if (CODE == '@') fprintf (FILE, "(%%sp)"); \
1.1.1.2 ! root 434: else if (CODE == '!') fprintf (FILE, "%%fpcr"); \
1.1 root 435: else if (CODE == '$') { if (TARGET_68040_ONLY) fprintf (FILE, "s"); } \
436: else if (CODE == '&') { if (TARGET_68040_ONLY) fprintf (FILE, "d"); } \
437: else if (GET_CODE (X) == REG) \
438: fprintf (FILE, "%s", reg_names[REGNO (X)]); \
439: else if (GET_CODE (X) == MEM) \
440: output_address (XEXP (X, 0)); \
441: else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == SFmode) \
442: { union { double d; int i[2]; } u; \
443: union { float f; int i; } u1; \
444: u.i[0] = CONST_DOUBLE_LOW (X); u.i[1] = CONST_DOUBLE_HIGH (X); \
445: u1.f = u.d; \
446: /* Use hex representation even if CODE is f. as needs it. */ \
447: if (CODE == 'f') \
448: fprintf (FILE, "&0x%x", u1.i); \
449: else \
450: fprintf (FILE, "&0x%x", u1.i); } \
451: else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == DFmode) \
452: { union { double d; int i[2]; } u; \
453: PRINT_OPERAND_EXTRACT_FLOAT (X); \
454: fprintf (FILE, "&0x%08x%08x", u.i[0], u.i[1]); } \
455: else { putc ('&', FILE); output_addr_const (FILE, X); }}
456:
457: #undef PRINT_OPERAND_ADDRESS
458: #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
459: { register rtx reg1, reg2, breg, ireg; \
460: register rtx addr = ADDR; \
461: rtx offset; \
462: switch (GET_CODE (addr)) \
463: { \
464: case REG: \
465: fprintf (FILE, "(%s)", reg_names[REGNO (addr)]); \
466: break; \
467: case PRE_DEC: \
468: fprintf (FILE, "-(%s)", reg_names[REGNO (XEXP (addr, 0))]); \
469: break; \
470: case POST_INC: \
471: fprintf (FILE, "(%s)+", reg_names[REGNO (XEXP (addr, 0))]); \
472: break; \
473: case PLUS: \
474: reg1 = 0; reg2 = 0; \
475: ireg = 0; breg = 0; \
476: offset = 0; \
477: if (CONSTANT_ADDRESS_P (XEXP (addr, 0))) \
478: { \
479: offset = XEXP (addr, 0); \
480: addr = XEXP (addr, 1); \
481: } \
482: else if (CONSTANT_ADDRESS_P (XEXP (addr, 1))) \
483: { \
484: offset = XEXP (addr, 1); \
485: addr = XEXP (addr, 0); \
486: } \
487: if (GET_CODE (addr) != PLUS) ; \
488: else if (GET_CODE (XEXP (addr, 0)) == SIGN_EXTEND) \
489: { \
490: reg1 = XEXP (addr, 0); \
491: addr = XEXP (addr, 1); \
492: } \
493: else if (GET_CODE (XEXP (addr, 1)) == SIGN_EXTEND) \
494: { \
495: reg1 = XEXP (addr, 1); \
496: addr = XEXP (addr, 0); \
497: } \
498: else if (GET_CODE (XEXP (addr, 0)) == MULT) \
499: { \
500: reg1 = XEXP (addr, 0); \
501: addr = XEXP (addr, 1); \
502: } \
503: else if (GET_CODE (XEXP (addr, 1)) == MULT) \
504: { \
505: reg1 = XEXP (addr, 1); \
506: addr = XEXP (addr, 0); \
507: } \
508: else if (GET_CODE (XEXP (addr, 0)) == REG) \
509: { \
510: reg1 = XEXP (addr, 0); \
511: addr = XEXP (addr, 1); \
512: } \
513: else if (GET_CODE (XEXP (addr, 1)) == REG) \
514: { \
515: reg1 = XEXP (addr, 1); \
516: addr = XEXP (addr, 0); \
517: } \
518: if (GET_CODE (addr) == REG || GET_CODE (addr) == MULT \
519: || GET_CODE (addr) == SIGN_EXTEND) \
520: { if (reg1 == 0) reg1 = addr; else reg2 = addr; addr = 0; } \
521: /* for OLD_INDEXING \
522: else if (GET_CODE (addr) == PLUS) \
523: { \
524: if (GET_CODE (XEXP (addr, 0)) == REG) \
525: { \
526: reg2 = XEXP (addr, 0); \
527: addr = XEXP (addr, 1); \
528: } \
529: else if (GET_CODE (XEXP (addr, 1)) == REG) \
530: { \
531: reg2 = XEXP (addr, 1); \
532: addr = XEXP (addr, 0); \
533: } \
534: } \
535: */ \
536: if (offset != 0) { if (addr != 0) abort (); addr = offset; } \
537: if ((reg1 && (GET_CODE (reg1) == SIGN_EXTEND \
538: || GET_CODE (reg1) == MULT)) \
539: || (reg2 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg2)))) \
540: { breg = reg2; ireg = reg1; } \
541: else if (reg1 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg1))) \
542: { breg = reg1; ireg = reg2; } \
543: if (ireg != 0 && breg == 0 && GET_CODE (addr) == LABEL_REF) \
544: { int scale = 1; \
545: if (GET_CODE (ireg) == MULT) \
546: { scale = INTVAL (XEXP (ireg, 1)); \
547: ireg = XEXP (ireg, 0); } \
548: if (GET_CODE (ireg) == SIGN_EXTEND) \
549: fprintf (FILE, "12(%%pc,%s.w", \
550: reg_names[REGNO (XEXP (ireg, 0))]); \
551: else \
552: fprintf (FILE, "12(%%pc,%s.l", \
553: reg_names[REGNO (ireg)]); \
554: if (scale != 1) fprintf (FILE, "*%d", scale); \
555: fprintf (FILE, ")"); \
556: break; } \
557: if (breg != 0 && ireg == 0 && GET_CODE (addr) == LABEL_REF) \
558: { fprintf (FILE, "12(%%pc,%s.l", \
559: reg_names[REGNO (breg)]); \
560: putc (')', FILE); \
561: break; } \
562: if (ireg != 0 || breg != 0) \
563: { int scale = 1; \
564: if (breg == 0) \
565: abort (); \
566: if (addr != 0) \
567: output_addr_const (FILE, addr); \
568: fprintf (FILE, "(%s", reg_names[REGNO (breg)]); \
569: if (ireg != 0) \
570: putc (',', FILE); \
571: if (ireg != 0 && GET_CODE (ireg) == MULT) \
572: { scale = INTVAL (XEXP (ireg, 1)); \
573: ireg = XEXP (ireg, 0); } \
574: if (ireg != 0 && GET_CODE (ireg) == SIGN_EXTEND) \
575: fprintf (FILE, "%s.w", reg_names[REGNO (XEXP (ireg, 0))]); \
576: else if (ireg != 0) \
577: fprintf (FILE, "%s.l", reg_names[REGNO (ireg)]); \
578: if (scale != 1) fprintf (FILE, "*%d", scale); \
579: putc (')', FILE); \
580: break; \
581: } \
582: else if (reg1 != 0 && GET_CODE (addr) == LABEL_REF) \
583: { fprintf (FILE, "12(%%pc,%s.w)", \
584: reg_names[REGNO (reg1)]); \
585: break; } \
586: default: \
587: if (GET_CODE (addr) == CONST_INT \
588: && INTVAL (addr) < 0x8000 \
589: && INTVAL (addr) >= -0x8000) \
590: fprintf (FILE, "%d", INTVAL (addr)); \
591: else \
592: output_addr_const (FILE, addr); \
593: }}
594:
595: /* This is how to store into the string LABEL
596: the symbol_ref name of an internal numbered label where
597: PREFIX is the class of label and NUM is the number within the class.
598: This is suitable for output with `assemble_name'. */
599:
600: #undef ASM_GENERATE_INTERNAL_LABEL
601: #define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
602: sprintf ((LABEL), "%s%%%d", (PREFIX), (NUM))
603:
604: /* This is how to output an internal numbered label where
605: PREFIX is the class of label and NUM is the number within the class. */
606:
607: #undef ASM_OUTPUT_INTERNAL_LABEL
608: #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
609: fprintf (FILE, "%s%%%d:\n", PREFIX, NUM)
610:
611: /* This is how to output a reference to a user-level label named NAME.
612: `assemble_name' uses this. */
613:
614: #undef ASM_OUTPUT_LABELREF
615: #define ASM_OUTPUT_LABELREF(FILE,NAME) \
616: fprintf (FILE, "%s", NAME)
617:
618: /* This is how to output an element of a case-vector that is absolute.
619: (The 68000 does not use such vectors,
620: but we must define this macro anyway.) */
621:
622: #undef ASM_OUTPUT_ADDR_VEC_ELT
623: #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
624: fprintf (FILE, "\tlong L%%%d\n", (VALUE))
625:
626: /* This is how to output an element of a case-vector that is relative. */
627:
628: #undef ASM_OUTPUT_ADDR_DIFF_ELT
629: #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
630: fprintf (FILE, "\tshort L%%%d-L%%%d\n", (VALUE), (REL))
631:
632: #define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \
633: fprintf (FILE, "\tswbeg &%d\n%s%%%d:\n", \
634: XVECLEN (PATTERN (TABLE), 1), (PREFIX), (NUM))
635:
636: /* Translate some opcodes to fit the sysV68 assembler syntax. */
637: /* The opcodes fdmov and fsmov are guesses. */
638:
639: #define SWITCH_JUMP_MATCH "jmp 6(%%pc,"
640:
641: #undef ASM_OUTPUT_OPCODE
642: #define ASM_OUTPUT_OPCODE(FILE, PTR) \
643: { if ((PTR)[0] == 'j' && (PTR)[1] == 'b') \
644: { ++(PTR); \
645: while (*(PTR) != ' ') \
646: { putc (*(PTR), (FILE)); ++(PTR); } \
647: fprintf ((FILE), ".w"); } \
1.1.1.2 ! root 648: else if ((PTR)[0] == 's') \
! 649: { \
! 650: if (!strncmp ((PTR), "swap", 4)) \
! 651: { fprintf ((FILE), "swap.w"); (PTR) += 4; } \
! 652: } \
1.1 root 653: else if ((PTR)[0] == 'f') \
654: { \
655: if (!strncmp ((PTR), "fmove", 5)) \
656: { fprintf ((FILE), "fmov"); (PTR) += 5; } \
657: else if (!strncmp ((PTR), "f%$move", 7)) \
658: { if (TARGET_68040_ONLY) \
659: { fprintf ((FILE), "fsmov"); (PTR) += 7; } \
660: else \
661: { fprintf ((FILE), "fmov"); (PTR) += 7; } } \
662: else if (!strncmp ((PTR), "f%&move", 7)) \
663: { if (TARGET_68040_ONLY) \
664: { fprintf ((FILE), "fdmov"); (PTR) += 7; } \
665: else \
666: { fprintf ((FILE), "fmov"); (PTR) += 7; } } \
667: else if (!strncmp ((PTR), "ftst", 4)) \
668: { fprintf ((FILE), "ftest"); (PTR) += 4; } \
669: else if (!strncmp ((PTR), "fbne", 4)) \
670: { fprintf ((FILE), "fbneq"); (PTR) += 4; } \
671: else if (!strncmp ((PTR), "fsne", 4)) \
672: { fprintf ((FILE), "fsneq"); (PTR) += 4; } \
673: } \
674: /* MOVE, MOVEA, MOVEQ, MOVEC ==> MOV */ \
675: else if ((PTR)[0] == 'm' && (PTR)[1] == 'o' \
676: && (PTR)[2] == 'v' && (PTR)[3] == 'e') \
677: { fprintf ((FILE), "mov"); (PTR) += 4; \
1.1.1.2 ! root 678: if ((PTR)[0] == 'q' || (PTR)[0] == 'a' \
! 679: || (PTR)[0] == 'c') (PTR)++; } \
1.1 root 680: /* SUB, SUBQ, SUBA, SUBI ==> SUB */ \
681: else if ((PTR)[0] == 's' && (PTR)[1] == 'u' \
682: && (PTR)[2] == 'b') \
683: { fprintf ((FILE), "sub"); (PTR) += 3; \
1.1.1.2 ! root 684: if ((PTR)[0] == 'q' || (PTR)[0] == 'i' \
! 685: || (PTR)[0] == 'a') (PTR)++; } \
1.1 root 686: /* CMP, CMPA, CMPI, CMPM ==> CMP */ \
687: else if ((PTR)[0] == 'c' && (PTR)[1] == 'm' \
688: && (PTR)[2] == 'p') \
689: { fprintf ((FILE), "cmp"); (PTR) += 3; \
1.1.1.2 ! root 690: if ((PTR)[0] == 'a' || (PTR)[0] == 'i' \
! 691: || (PTR)[0] == 'm') (PTR)++; } \
1.1 root 692: /* JMP to switch label */ \
693: else if (!strncmp((PTR), (SWITCH_JUMP_MATCH), sizeof(SWITCH_JUMP_MATCH) - 1)) \
694: { while (*(PTR)++ != '('); \
695: fprintf ((FILE), "jmp 8("); } \
696: }
697:
698: /* This says how to output an assembler line
699: to define a global common symbol. */
700:
701: #undef ASM_OUTPUT_COMMON
702: #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
703: ( fputs ("\tcomm ", (FILE)), \
704: assemble_name ((FILE), (NAME)), \
705: fprintf ((FILE), ",%u\n", (ROUNDED)))
706:
707: /* This says how to output an assembler line
708: to define a local common symbol. */
709:
710: #undef ASM_OUTPUT_LOCAL
711: #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
712: ( fputs ("\tlcomm ", (FILE)), \
713: assemble_name ((FILE), (NAME)), \
714: fprintf ((FILE), ",%u\n", (ROUNDED)))
715:
716:
717: /* Override usual definitions of SDB output macros.
718: These definitions differ only in the absence of the period
719: at the beginning of the name of the directive
720: and in the use of `~' as the symbol for the current location. */
721:
722: #define PUT_SDB_SCL(a) fprintf(asm_out_file, "\tscl\t%d;", (a))
723: #define PUT_SDB_INT_VAL(a) fprintf (asm_out_file, "\tval\t%d;", (a))
724: #define PUT_SDB_VAL(a) \
725: ( fputs ("\tval\t", asm_out_file), \
726: output_addr_const (asm_out_file, (a)), \
727: fputc (';', asm_out_file))
728:
729: #define PUT_SDB_DEF(a) \
730: do { fprintf (asm_out_file, "\tdef\t"); \
731: ASM_OUTPUT_LABELREF (asm_out_file, a); \
732: fprintf (asm_out_file, ";"); } while (0)
733:
734: #define PUT_SDB_PLAIN_DEF(a) fprintf(asm_out_file,"\tdef\t~%s;",a)
735: #define PUT_SDB_ENDEF fputs("\tendef\n", asm_out_file)
736: #define PUT_SDB_TYPE(a) fprintf(asm_out_file, "\ttype\t0%o;", a)
737: #define PUT_SDB_SIZE(a) fprintf(asm_out_file, "\tsize\t%d;", a)
738: #define PUT_SDB_START_DIM fprintf(asm_out_file, "\tdim\t")
739: #define PUT_SDB_NEXT_DIM(a) fprintf(asm_out_file, "%d,", a)
740: #define PUT_SDB_LAST_DIM(a) fprintf(asm_out_file, "%d;", a)
741:
742: #define PUT_SDB_TAG(a) \
743: do { fprintf (asm_out_file, "\ttag\t"); \
744: ASM_OUTPUT_LABELREF (asm_out_file, a); \
745: fprintf (asm_out_file, ";"); } while (0)
746:
747: #define PUT_SDB_BLOCK_START(LINE) \
748: fprintf (asm_out_file, \
749: "\tdef\t~bb;\tval\t~;\tscl\t100;\tline\t%d;\tendef\n", \
750: (LINE))
751:
752: #define PUT_SDB_BLOCK_END(LINE) \
753: fprintf (asm_out_file, \
754: "\tdef\t~eb;\tval\t~;\tscl\t100;\tline\t%d;\tendef\n", \
755: (LINE))
756:
757: #define PUT_SDB_FUNCTION_START(LINE) \
758: fprintf (asm_out_file, \
759: "\tdef\t~bf;\tval\t~;\tscl\t101;\tline\t%d;\tendef\n", \
760: (LINE))
761:
762: #define PUT_SDB_FUNCTION_END(LINE) \
763: fprintf (asm_out_file, \
764: "\tdef\t~ef;\tval\t~;\tscl\t101;\tline\t%d;\tendef\n", \
765: (LINE))
766:
767: #define PUT_SDB_EPILOGUE_END(NAME) \
768: fprintf (asm_out_file, \
769: "\tdef\t%s;\tval\t~;\tscl\t-1;\tendef\n", \
770: (NAME))
771:
772: #define SDB_GENERATE_FAKE(BUFFER, NUMBER) \
773: sprintf ((BUFFER), "~%dfake", (NUMBER));
774:
775: /* Define subroutines to call to handle multiply, divide, and remainder.
776: Use the subroutines that the 3b1's library provides.
777: The `*' prevents an underscore from being prepended by the compiler. */
778:
779: #define DIVSI3_LIBCALL "*ldiv"
780: #define UDIVSI3_LIBCALL "*uldiv"
781: #define MODSI3_LIBCALL "*lrem"
782: #define UMODSI3_LIBCALL "*ulrem"
783: #define MULSI3_LIBCALL "*lmul"
784: #define UMULSI3_LIBCALL "*ulmul"
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.