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