|
|
1.1.1.3 root 1: /* Definitions of target machine for GNU compiler;
2: Charles River Data Systems UNiverse/32.
3: Copyright (C) 1987, 1993, 1994 Free Software Foundation, Inc.
4: Contributed by Gary E. Miller ([email protected])
1.1 root 5:
6: This file is part of GNU CC.
7:
8: GNU CC is free software; you can redistribute it and/or modify
9: it under the terms of the GNU General Public License as published by
10: the Free Software Foundation; either version 2, or (at your option)
11: any later version.
12:
13: GNU CC is distributed in the hope that it will be useful,
14: but WITHOUT ANY WARRANTY; without even the implied warranty of
15: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16: GNU General Public License for more details.
17:
18: You should have received a copy of the GNU General Public License
19: along with GNU CC; see the file COPYING. If not, write to
1.1.1.4 ! root 20: the Free Software Foundation, 59 Temple Place - Suite 330,
! 21: Boston, MA 02111-1307, USA. */
1.1 root 22:
23: #define MOTOROLA /* Use Motorola syntax rather than "MIT" */
24: #define SGS /* Uses SGS assembler */
25: #define SGS_SWITCH_TABLES /* Different switch table handling */
26: #define CRDS /* Charles River Data Systems assembler */
27:
28: #include "m68k/m68k.h"
29:
30: /* Without STRUCTURE_SIZE_BOUNDARY, we can't ensure that structures are
31: aligned such that we can correctly extract bitfields from them.
32: Someone should check whether the usual compiler on the crds machine
33: provides the equivalent behavior of STRUCTURE_SIZE_BOUNDARY. */
1.1.1.2 root 34: #error This does not define STRUCTURE_SIZE_BOUNDARY
1.1 root 35:
36: /* See m68k.h. 0 means 680[01]0 with no 68881. */
37:
38: #undef TARGET_DEFAULT
39: #define TARGET_DEFAULT 0
40:
41: /* Don't try using XFmode. */
42: #undef LONG_DOUBLE_TYPE_SIZE
43: #define LONG_DOUBLE_TYPE_SIZE 64
44:
45: /* special flags to the unos assembler. */
46:
47: #undef ASM_SPEC
48: #define ASM_SPEC "-g"
49:
50: #undef LIB_SPEC
51: #define LIB_SPEC "%{!p:%{!pg:-lunos}}%{p:-lc_p}%{pg:-lc_p}"
52:
53: #undef STARTFILE_SPEC
54: #define STARTFILE_SPEC \
55: "%{pg:gcrt0.o%s}%{!pg:%{p:mc68rt0.o%s}%{!p:c68rt0.o%s}}"
56:
57: /* CC1 spec */
58: #if 0
59: /* c.sac only used in _s_call_r() in libunos.a and malloc() in libmalloc.a */
60: /* so we do not need to bother ! */
61: #define CC1_SPEC "-fpcc-struct-return"
62: #endif
63:
64: /* -O2 for MAX optimization */
65: #undef CC1_SPEC
66: #define CC1_SPEC "%{O2:-fstrength-reduce}"
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 UNOS casm has no debugging :-( */
75:
76: /* UNOS need stack probe :-( */
77:
78: #define HAVE_probe 1
79: #define gen_probe() gen_rtx(ASM_INPUT, VOIDmode, "tstb -2048(sp)\t;probe\n")
80:
81: /* use memcpy, memset instead of bcopy, etc. */
82:
83: #define TARGET_MEM_FUNCTIONS
84:
85: /* Don't try to define `gcc_compiled.' since the assembler might not
86: accept symbols with periods and GDB doesn't run on this machine anyway. */
87: #define ASM_IDENTIFY_GCC(FILE)
88:
89: /* Define __HAVE_68881__ in preprocessor if -m68881 is specified.
90: This will control the use of inline 68881 insns in certain macros. */
91:
92: #undef CPP_SPEC
93: #define CPP_SPEC "%{m68881:-D__HAVE_68881__}"
94:
95: /* Names to predefine in the preprocessor for this target machine. */
96:
97: #undef CPP_PREDEFINES
1.1.1.2 root 98: #define CPP_PREDEFINES "-Dmc68k -DM68000 -Dmc68000 -Dunos -Dunix -D__motorola__ -Asystem(unix) -Acpu(m68k) -Amachine(m68k)"
1.1 root 99:
100: /* Register in which address to store a structure value
101: is passed to a function. */
102: /* unos uses ".comm c.sac" returns &c.sac in d0 */
103: /* make pointer to c.sac ?
104: #undef STRUCT_VALUE_REGNUM
105: #define STRUCT_VALUE gen_rtx(MEM, Pmode, gen_rtx( , , ) )
106: */
107:
108: #define EXTRA_SECTIONS in_bss
109:
110: #define EXTRA_SECTION_FUNCTIONS \
111: void \
112: bss_section () \
113: { \
114: if (in_section != in_bss) \
115: { \
116: fprintf (asm_out_file, ".bss\n"); \
117: in_section = in_bss; \
118: } \
119: }
120:
121: /* Specify how to pad function arguments.
122: Value should be `upward', `downward' or `none'.
123: Same as the default, except no padding for large or variable-size args. */
124:
125: #define FUNCTION_ARG_PADDING(MODE, TYPE) \
126: (((MODE) == BLKmode \
127: ? ((TYPE) && TREE_CODE (TYPE_SIZE (TYPE)) == INTEGER_CST \
128: && int_size_in_bytes (TYPE) < PARM_BOUNDARY / BITS_PER_UNIT) \
129: : GET_MODE_BITSIZE (MODE) < PARM_BOUNDARY) \
130: ? downward : none)
131:
132: /* Override parts of m68k.h to fit the CRuDS assembler. */
133:
134: #undef TARGET_VERSION
135: #define TARGET_VERSION fprintf (stderr, " (68k, CRDS/UNOS)");
136:
137: /* Specify extra dir to search for include files. */
138: #define SYSTEM_INCLUDE_DIR "/include"
139:
140: /* Control the assembler format that we output. */
141:
142: /* Output at beginning of assembler file. */
143:
144: #undef ASM_FILE_START
145: #define ASM_FILE_START(FILE) \
146: fprintf (FILE, ";#NO_APP\n");
147:
148: /* Output to assembler file text saying following lines
149: may contain character constants, extra white space, comments, etc. */
150:
151: #undef ASM_APP_ON
152: #define ASM_APP_ON ";#APP\n"
153:
154: /* Output to assembler file text saying following lines
155: no longer contain unusual constructs. */
156:
157: #undef ASM_APP_OFF
158: #define ASM_APP_OFF ";#NO_APP\n"
159:
160: /* This is how to output an assembler line defining a `double' constant. */
161:
162: #undef ASM_OUTPUT_DOUBLE
163: #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
164: do { long l[2]; \
165: REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l); \
166: fprintf (FILE, "\t.long 0x%x, 0x%x\n", l[0], l[1]); \
167: } while (0)
168:
169: /*unos has no .skip :-( */
170: #undef ASM_OUTPUT_SKIP
171: #define ASM_OUTPUT_SKIP(FILE,SIZE) \
172: fprintf (FILE, "\t. = . + %u\n", (SIZE));
173:
174: /* This says how to output an assembler line
175: to define a local common symbol. */
176: /* should use bss_section instead of data_section but this makes casm die ? */
177:
178: #undef ASM_OUTPUT_LOCAL
179: #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
180: { data_section (); \
181: if ((SIZE) > 1) fprintf (FILE, "\t.even\n"); \
182: assemble_name ((FILE), (NAME)); \
183: fprintf ((FILE), ":\t. = . + %u\n", (ROUNDED));}
184:
185: /* This is how to output an insn to push a register on the stack.
186: It need not be very fast code. */
187:
188: #undef ASM_OUTPUT_REG_PUSH
189: #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
190: fprintf (FILE, "\tmovel %s,-(sp)\n", reg_names[REGNO])
191:
192: /* This is how to output an insn to pop a register from the stack.
193: It need not be very fast code. */
194:
195: #undef ASM_OUTPUT_REG_POP
196: #define ASM_OUTPUT_REG_POP(FILE,REGNO) \
197: fprintf (FILE, "\tmovel (sp)+,%s\n", reg_names[REGNO])
198:
199: #undef ASM_OUTPUT_ASCII
200: #define ASM_OUTPUT_ASCII(FILE, P , SIZE) \
1.1.1.3 root 201: do { int i; \
1.1 root 202: fprintf ((FILE), "\t.ascii \""); \
203: for (i = 0; i < (SIZE); i++) \
204: { \
205: register int c = (P)[i]; \
206: if (i != 0 && (i / 200) * 200 == i) \
207: fprintf ((FILE), "\"\n\t.ascii \""); \
208: if (c >= ' ' && c < 0177) { \
209: if (c != '\"' && c != '\\') { \
210: putc (c, (FILE)); \
211: continue; \
212: } \
213: } \
1.1.1.3 root 214: /* brain dead asm doesn't understand char escapes */ \
1.1 root 215: fprintf ((FILE), "\"\n\t.byte\t%d\n\t.ascii \"", c); \
216: } \
217: fprintf ((FILE), "\"\n"); \
1.1.1.3 root 218: } while (0)
1.1 root 219:
220:
221: /* Change all JBxx to Bxx. Also change all DBRA to DBF.
222: Also change divs.l, etc., to divs, etc. But don't change divsl.l. */
223:
224: #define ASM_OUTPUT_OPCODE(FILE, PTR) \
225: { if ((PTR)[0] == 'j' && (PTR)[1] == 'b') \
226: { ++(PTR); } \
227: else if ((PTR)[0] == 'd') \
228: { \
229: if (!strncmp ((PTR), "dbra", 4)) \
230: { fprintf ((FILE), "dbf"); (PTR) += 4; } \
231: else if (!strncmp ((PTR), "div", 3) && (PTR)[5] == ' ') \
232: { fprintf ((FILE), "div%c", (PTR)[3]); (PTR) += 6; } \
233: } \
234: }
235:
236:
237: /* Print operand X (an rtx) in assembler syntax to file FILE.
238: CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
239: For `%' followed by punctuation, CODE is the punctuation and X is null.
240:
241: On the 68000, we use several CODE characters:
242: '.' for dot needed in Motorola-style opcode names.
243: '-' for an operand pushing on the stack:
244: sp@-, -(sp) or -(%sp) depending on the style of syntax.
245: '+' for an operand pushing on the stack:
246: sp@+, (sp)+ or (%sp)+ depending on the style of syntax.
247: '@' for a reference to the top word on the stack:
248: sp@, (sp) or (%sp) depending on the style of syntax.
249: '#' for an immediate operand prefix (# in MIT and Motorola syntax
250: but & in SGS syntax, $ in unos syntax).
251: '!' for the fpcr register (used in some float-to-fixed conversions).
252:
253: 'b' for byte insn (no effect, on the Sun; this is for the ISI).
254: 'd' to force memory addressing to be absolute, not relative.
255: 'f' for float insn (print a CONST_DOUBLE as a float rather than in hex)
256: 'w' for FPA insn (print a CONST_DOUBLE as a SunFPA constant rather
257: than directly). Second part of 'y' below.
258: 'x' for float insn (print a CONST_DOUBLE as a float rather than in hex),
259: or print pair of registers as rx:ry.
260: 'y' for a FPA insn (print pair of registers as rx:ry). This also outputs
261: CONST_DOUBLE's as SunFPA constant RAM registers if
262: possible, so it should not be used except for the SunFPA. */
263:
264: #undef PRINT_OPERAND_PUNCT_VALID_P
265: #define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
266: ((CODE) == '.' || (CODE) == '#' || (CODE) == '-' \
267: || (CODE) == '+' || (CODE) == '@' || (CODE) == '!')
268:
269: #undef PRINT_OPERAND
270: #define PRINT_OPERAND(FILE, X, CODE) \
271: { int i; \
272: if (CODE == '.') ; \
273: else if (CODE == '#') fprintf (FILE, "$"); \
274: else if (CODE == '-') fprintf (FILE, "-(sp)"); \
275: else if (CODE == '+') fprintf (FILE, "(sp)+"); \
276: else if (CODE == '@') fprintf (FILE, "(sp)"); \
277: else if (CODE == '!') fprintf (FILE, "fpcr"); \
278: else if (CODE == '/') \
279: ; \
280: else if (GET_CODE (X) == REG) \
281: { if (REGNO (X) < 16 && (CODE == 'y' || CODE == 'x') && GET_MODE (X) == DFmode) \
282: fprintf (FILE, "%s:%s", reg_names[REGNO (X)], reg_names[REGNO (X)+1]); \
283: else \
284: fprintf (FILE, "%s", reg_names[REGNO (X)]); \
285: } \
286: else if (GET_CODE (X) == MEM) \
287: { \
288: output_address (XEXP (X, 0)); \
289: if (CODE == 'd' && ! TARGET_68020 \
290: && CONSTANT_ADDRESS_P (XEXP (X, 0))) \
291: /* fprintf (FILE, ".l") */; \
292: } \
293: else if ((CODE == 'y' || CODE == 'w') \
294: && GET_CODE(X) == CONST_DOUBLE \
295: && (i = standard_sun_fpa_constant_p (X))) \
296: fprintf (FILE, "%%%d", i & 0x1ff); \
297: else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == SFmode) \
298: { REAL_VALUE_TYPE r; long l; \
299: REAL_VALUE_FROM_CONST_DOUBLE (r, X); \
300: if (CODE == 'f') \
301: ASM_OUTPUT_FLOAT_OPERAND (CODE, FILE, r); \
302: else \
303: { REAL_VALUE_TO_TARGET_SINGLE (r, l); \
304: fprintf (FILE, "$0x%x", l); } } \
1.1.1.3 root 305: else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == DFmode) \
1.1 root 306: { REAL_VALUE_TYPE r; \
307: REAL_VALUE_FROM_CONST_DOUBLE (r, X); \
1.1.1.3 root 308: ASM_OUTPUT_DOUBLE_OPERAND (FILE, r); } \
309: else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == XFmode) \
1.1 root 310: { REAL_VALUE_TYPE r; \
311: REAL_VALUE_FROM_CONST_DOUBLE (r, X); \
1.1.1.3 root 312: ASM_OUTPUT_LONG_DOUBLE_OPERAND (FILE, r); } \
1.1 root 313: else { putc ('$', FILE); output_addr_const (FILE, X); }}
314:
315: /* Note that this contains a kludge that knows that the only reason
316: we have an address (plus (label_ref...) (reg...))
317: is in the insn before a tablejump, and we know that m68k.md
318: generates a label LInnn: on such an insn. */
319: #undef PRINT_OPERAND_ADDRESS
320: #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
321: { register rtx reg1, reg2, breg, ireg; \
322: register rtx addr = ADDR; \
323: rtx offset; \
324: switch (GET_CODE (addr)) \
325: { \
326: case REG: \
327: fprintf (FILE, "(%s)", reg_names[REGNO (addr)]); \
328: break; \
329: case PRE_DEC: \
330: fprintf (FILE, "-(%s)", reg_names[REGNO (XEXP (addr, 0))]); \
331: break; \
332: case POST_INC: \
333: fprintf (FILE, "(%s)+", reg_names[REGNO (XEXP (addr, 0))]); \
334: break; \
335: case PLUS: \
336: reg1 = 0; reg2 = 0; \
337: ireg = 0; breg = 0; \
338: offset = 0; \
339: if (CONSTANT_ADDRESS_P (XEXP (addr, 0))) \
340: { \
341: offset = XEXP (addr, 0); \
342: addr = XEXP (addr, 1); \
343: } \
344: else if (CONSTANT_ADDRESS_P (XEXP (addr, 1))) \
345: { \
346: offset = XEXP (addr, 1); \
347: addr = XEXP (addr, 0); \
348: } \
349: if (GET_CODE (addr) != PLUS) ; \
350: else if (GET_CODE (XEXP (addr, 0)) == SIGN_EXTEND) \
351: { \
352: reg1 = XEXP (addr, 0); \
353: addr = XEXP (addr, 1); \
354: } \
355: else if (GET_CODE (XEXP (addr, 1)) == SIGN_EXTEND) \
356: { \
357: reg1 = XEXP (addr, 1); \
358: addr = XEXP (addr, 0); \
359: } \
360: else if (GET_CODE (XEXP (addr, 0)) == MULT) \
361: { \
362: reg1 = XEXP (addr, 0); \
363: addr = XEXP (addr, 1); \
364: } \
365: else if (GET_CODE (XEXP (addr, 1)) == MULT) \
366: { \
367: reg1 = XEXP (addr, 1); \
368: addr = XEXP (addr, 0); \
369: } \
370: else if (GET_CODE (XEXP (addr, 0)) == REG) \
371: { \
372: reg1 = XEXP (addr, 0); \
373: addr = XEXP (addr, 1); \
374: } \
375: else if (GET_CODE (XEXP (addr, 1)) == REG) \
376: { \
377: reg1 = XEXP (addr, 1); \
378: addr = XEXP (addr, 0); \
379: } \
380: if (GET_CODE (addr) == REG || GET_CODE (addr) == MULT \
381: || GET_CODE (addr) == SIGN_EXTEND) \
382: { if (reg1 == 0) reg1 = addr; else reg2 = addr; addr = 0; } \
383: if (offset != 0) { if (addr != 0) abort (); addr = offset; } \
384: if ((reg1 && (GET_CODE (reg1) == SIGN_EXTEND \
385: || GET_CODE (reg1) == MULT)) \
386: || (reg2 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg2)))) \
387: { breg = reg2; ireg = reg1; } \
388: else if (reg1 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg1))) \
389: { breg = reg1; ireg = reg2; } \
390: if (ireg != 0 && breg == 0 && GET_CODE (addr) == LABEL_REF) \
391: { int scale = 1; \
392: if (GET_CODE (ireg) == MULT) \
393: { scale = INTVAL (XEXP (ireg, 1)); \
394: ireg = XEXP (ireg, 0); } \
395: if (GET_CODE (ireg) == SIGN_EXTEND) \
396: fprintf (FILE, "L%d-LI%d-2(pc,%s.w", \
397: CODE_LABEL_NUMBER (XEXP (addr, 0)), \
398: CODE_LABEL_NUMBER (XEXP (addr, 0)), \
399: reg_names[REGNO (XEXP (ireg, 0))]); \
400: else \
401: fprintf (FILE, "L%d-LI%d-2(pc,%s.l", \
402: CODE_LABEL_NUMBER (XEXP (addr, 0)), \
403: CODE_LABEL_NUMBER (XEXP (addr, 0)), \
404: reg_names[REGNO (ireg)]); \
405: if (scale != 1) fprintf (FILE, ":%d", scale); \
406: putc (')', FILE); \
407: break; } \
408: if (breg != 0 && ireg == 0 && GET_CODE (addr) == LABEL_REF) \
409: { fprintf (FILE, "L%d-LI%d-2(pc,%s.l", \
410: CODE_LABEL_NUMBER (XEXP (addr, 0)), \
411: CODE_LABEL_NUMBER (XEXP (addr, 0)), \
412: reg_names[REGNO (breg)]); \
413: putc (')', FILE); \
414: break; } \
415: if (ireg != 0 || breg != 0) \
416: { int scale = 1; \
417: if (breg == 0) \
418: abort (); \
419: if (addr && GET_CODE (addr) == LABEL_REF) abort (); \
420: if (addr != 0) \
421: output_addr_const (FILE, addr); \
422: fprintf (FILE, "(%s", reg_names[REGNO (breg)]); \
423: if (breg != 0 && ireg != 0) \
424: putc (',', FILE); \
425: if (ireg != 0 && GET_CODE (ireg) == MULT) \
426: { scale = INTVAL (XEXP (ireg, 1)); \
427: ireg = XEXP (ireg, 0); } \
428: if (ireg != 0 && GET_CODE (ireg) == SIGN_EXTEND) \
429: fprintf (FILE, "%s.w", reg_names[REGNO (XEXP (ireg, 0))]); \
430: else if (ireg != 0) \
431: fprintf (FILE, "%s.l", reg_names[REGNO (ireg)]); \
432: if (scale != 1) fprintf (FILE, ":%d", scale); \
433: putc (')', FILE); \
434: break; \
435: } \
436: else if (reg1 != 0 && GET_CODE (addr) == LABEL_REF) \
437: { fprintf (FILE, "L%d-LI%d-2(pc,%s.l)", \
438: CODE_LABEL_NUMBER (XEXP (addr, 0)), \
439: CODE_LABEL_NUMBER (XEXP (addr, 0)), \
440: reg_names[REGNO (reg1)]); \
441: break; } \
442: default: \
443: if (GET_CODE (addr) == CONST_INT \
444: && INTVAL (addr) < 0x8000 \
445: && INTVAL (addr) >= -0x8000) \
446: fprintf (FILE, "%d", INTVAL (addr)); \
447: else \
448: output_addr_const (FILE, addr); \
449: }}
450:
451: #define ASM_OUTPUT_SOURCE_FILENAME(FILE, FILENAME) \
1.1.1.2 root 452: do { fprintf (FILE, "\t; file\t"); \
453: output_quoted_string (FILE, FILENAME); \
454: fprintf (FILE, "\n"); \
455: } while (0)
1.1 root 456:
457: #define ASM_OUTPUT_SOURCE_LINE(FILE, LINENO) \
458: fprintf (FILE, "\t; ln\t%d\n", \
459: (sdb_begin_function_line \
460: ? last_linenum - sdb_begin_function_line : 1))
461:
462: /* This macro generates the assembly code for function entry.
463: FILE is a stdio stream to output the code to.
464: SIZE is an int: how many units of temporary storage to allocate.
465: Refer to the array `regs_ever_live' to determine which registers
466: to save; `regs_ever_live[I]' is nonzero if register number I
467: is ever used in the function. This macro is responsible for
468: knowing which registers should not be saved even if used. */
469:
470: /* Note that the order of the bit mask for fmovem is the opposite
471: of the order for movem! */
472:
473: #undef FUNCTION_PROLOGUE
474: #define FUNCTION_PROLOGUE(FILE, SIZE) \
475: { register int regno; \
476: register int mask = 0; \
477: extern char call_used_regs[]; \
478: int fsize = ((SIZE) + 3) & -4; \
479: /* unos stack probe */ \
480: if ( fsize > 30000 ) { \
481: fprintf (FILE, "\tmovel sp,a0\n"); \
482: fprintf (FILE, "\taddl $-%d,a0\n", 2048 + fsize); \
483: fprintf (FILE, "\ttstb (a0)\n"); \
484: } else { \
485: fprintf (FILE, "\ttstb -%d(sp)\n", 2048 + fsize); \
486: } \
487: if (frame_pointer_needed) \
488: { if (TARGET_68020 || fsize < 0x8000) \
489: fprintf (FILE, "\tlink a6,$%d\n", -fsize); \
490: else \
491: fprintf (FILE, "\tlink a6,$0\n\tsubl $%d,sp\n", fsize); } \
1.1.1.3 root 492: else if (fsize) \
493: { \
494: /* Adding negative number is faster on the 68040. */ \
495: if (fsize + 4 < 0x8000) \
496: { \
497: fprintf (FILE, "\tadd.w #%d,sp\n", - (fsize + 4)); \
498: } \
499: else \
500: { \
501: fprintf (FILE, "\tadd.l #%d,sp\n", - (fsize + 4)); \
502: } \
503: } \
1.1 root 504: for (regno = 24; regno < 56; regno++) \
505: if (regs_ever_live[regno] && ! call_used_regs[regno]) \
506: fprintf(FILE, "\tfpmoved %s, sp@-\n", \
507: reg_names[regno]); \
508: for (regno = 16; regno < 24; regno++) \
509: if (regs_ever_live[regno] && ! call_used_regs[regno]) \
510: mask |= 1 << (regno - 16); \
511: if ((mask & 0xff) != 0) \
512: fprintf (FILE, "\tfmovem $0x%x,-(sp)\n", mask & 0xff); \
513: mask = 0; \
514: for (regno = 0; regno < 16; regno++) \
515: if (regs_ever_live[regno] && ! call_used_regs[regno]) \
516: mask |= 1 << (15 - regno); \
517: if (frame_pointer_needed) \
518: mask &= ~ (1 << (15-FRAME_POINTER_REGNUM)); \
519: if (exact_log2 (mask) >= 0) \
520: fprintf (FILE, "\tmovel %s,-(sp)\n", reg_names[15 - exact_log2 (mask)]); \
521: else if (mask) fprintf (FILE, "\tmovem $0x%x,-(sp)\n", mask); }
522:
523: /* Must put address in %a0 , not %d0 . -- LGM, 7/15/88 */
524: /* UNOS ?? */
525: #undef FUNCTION_PROFILER
526: #define FUNCTION_PROFILER(FILE, LABEL_NO) \
527: fprintf (FILE, "\tmovl &LP%%%d,%%a0\n\tjsr mcount\n", (LABEL_NO))
528:
529: /* This macro generates the assembly code for function exit,
530: on machines that need it. If FUNCTION_EPILOGUE is not defined
531: then individual return instructions are generated for each
532: return statement. Args are same as for FUNCTION_PROLOGUE.
533:
534: The function epilogue should not depend on the current stack pointer!
535: It should use the frame pointer only. This is mandatory because
536: of alloca; we also take advantage of it to omit stack adjustments
537: before returning. */
538:
539: #undef FUNCTION_EPILOGUE
540: #define FUNCTION_EPILOGUE(FILE, SIZE) \
541: { register int regno; \
542: register int mask, fmask; \
543: register int nregs; \
544: int offset, foffset, fpoffset; \
545: extern char call_used_regs[]; \
546: int fsize = ((SIZE) + 3) & -4; \
547: int big = 0; \
548: nregs = 0; fmask = 0; fpoffset = 0; \
549: for (regno = 24 ; regno < 56 ; regno++) \
550: if (regs_ever_live[regno] && ! call_used_regs[regno]) \
551: nregs++; \
552: fpoffset = nregs*8; \
553: nregs = 0; \
554: for (regno = 16; regno < 24; regno++) \
555: if (regs_ever_live[regno] && ! call_used_regs[regno]) \
556: { nregs++; fmask |= 1 << (23 - regno); } \
557: foffset = fpoffset + nregs * 12; \
558: nregs = 0; mask = 0; \
559: if (frame_pointer_needed) regs_ever_live[FRAME_POINTER_REGNUM] = 0; \
560: for (regno = 0; regno < 16; regno++) \
561: if (regs_ever_live[regno] && ! call_used_regs[regno]) \
562: { nregs++; mask |= 1 << regno; } \
563: offset = foffset + nregs * 4; \
564: if (offset + fsize >= 0x8000 \
565: && frame_pointer_needed \
566: && (mask || fmask || fpoffset)) \
567: { fprintf (FILE, "\tmovel $%d,a0\n", -fsize); \
568: fsize = 0, big = 1; } \
569: if (exact_log2 (mask) >= 0) { \
570: if (big) \
571: fprintf (FILE, "\tmovel -%d(a6,a0.l),%s\n", \
572: offset + fsize, reg_names[exact_log2 (mask)]); \
573: else if (! frame_pointer_needed) \
574: fprintf (FILE, "\tmovel (sp)+,%s\n", \
575: reg_names[exact_log2 (mask)]); \
576: else \
577: fprintf (FILE, "\tmovel -%d(a6),%s\n", \
578: offset + fsize, reg_names[exact_log2 (mask)]); } \
579: else if (mask) { \
580: if (big) \
581: fprintf (FILE, "\tmovem -%d(a6,a0.l),$0x%x\n", \
582: offset + fsize, mask); \
583: else if (! frame_pointer_needed) \
584: fprintf (FILE, "\tmovem (sp)+,$0x%x\n", mask); \
585: else \
586: fprintf (FILE, "\tmovem -%d(a6),$0x%x\n", \
587: offset + fsize, mask); } \
588: if (fmask) { \
589: if (big) \
590: fprintf (FILE, "\tfmovem -%d(a6,a0.l),$0x%x\n", \
591: foffset + fsize, fmask); \
592: else if (! frame_pointer_needed) \
593: fprintf (FILE, "\tfmovem (sp)+,$0x%x\n", fmask); \
594: else \
595: fprintf (FILE, "\tfmovem -%d(a6),$0x%x\n", \
596: foffset + fsize, fmask); } \
597: if (fpoffset != 0) \
598: for (regno = 55; regno >= 24; regno--) \
599: if (regs_ever_live[regno] && ! call_used_regs[regno]) { \
600: if (big) \
601: fprintf(FILE, "\tfpmoved -%d(a6,a0.l), %s\n", \
602: fpoffset + fsize, reg_names[regno]); \
603: else if (! frame_pointer_needed) \
604: fprintf(FILE, "\tfpmoved (sp)+, %s\n", \
605: reg_names[regno]); \
606: else \
607: fprintf(FILE, "\tfpmoved -%d(a6), %s\n", \
608: fpoffset + fsize, reg_names[regno]); \
609: fpoffset -= 8; \
610: } \
611: if (frame_pointer_needed) \
612: fprintf (FILE, "\tunlk a6\n"); \
1.1.1.3 root 613: else if (fsize) \
614: { \
615: if (fsize + 4 < 0x8000) \
616: { \
617: fprintf (FILE, "\tadd.w #%d,sp\n", fsize + 4); \
618: } \
619: else \
620: { \
621: fprintf (FILE, "\tadd.l #%d,sp\n", fsize + 4); \
622: } \
623: } \
1.1 root 624: if (current_function_pops_args) \
625: fprintf (FILE, "\trtd $%d\n", current_function_pops_args); \
626: else fprintf (FILE, "\trts\n"); }
627:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.