|
|
1.1 root 1: /* Definitions of target machine for GNU compiler. MIPS version.
2: Contributed by A. Lichnewsky, [email protected]
1.1.1.3 root 3: Changes by Michael Meissner, [email protected]
4: Copyright (C) 1989, 1990 Free Software Foundation, Inc.
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 1, 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
20: the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
21:
22: /* ??? This file needs to be reformatted so that it looks like the
23: rest of GCC. ??? */
24:
25: /*----------------------------------------------------------------------
26:
27: SWITCHES:
28:
1.1.1.3 root 29: -O optimization. Implies -mgpOPT
30: -O1 Same as -O, mips compatibility
31: -O2 Implies -O -fomit-frame-pointer -fstrength-reduce
32: -O3 Implies -O2 + -finline-functions
1.1 root 33:
34: -mG0 -mG1 -mG2
35: Construct a size to be passed to GCC for Data / Sdata selection.
36:
37: Value is ( (i=G0 + 2 G1 + 4 G2) , (i < 6) ? ( 1<<i) :(1 <<(i+3)))
1.1.1.3 root 38: Same value should be passed to as + ld using -G. Use -G instead
39: since it is now supported.
1.1 root 40:
41: Default = -mG1 -mG0 (Value = 8).
42:
43: -G32 Implies -G 32 -mG2 -mnG1 -mG0.
44:
45:
46: -bestGnum
47: Pass -bestGnum flag to ld. This helps setting best value for
48: the -G parameter.
49:
1.1.1.4 ! root 50: -ZSYSV for RISC-OS: use the System V environment
! 51: -ZBSD43 for RISC-OS: use the BSD 4.3 environment
1.1 root 52: ----------------------------------------------------------------------*/
53:
1.1.1.3 root 54:
1.1 root 55:
1.1.1.3 root 56: /* Suppression of libg.a when debugging */
57: #define NO_LIBG
1.1 root 58:
59:
60: /* Switch Recognition by gcc.c */
61:
62: #ifdef SWITCH_TAKES_ARG
63: #undef SWITCH_TAKES_ARG
64: #endif
65:
66: #define SWITCH_TAKES_ARG(CHAR) \
67: ((CHAR) == 'D' || (CHAR) == 'U' || (CHAR) == 'o' \
68: || (CHAR) == 'e' || (CHAR) == 'T' || (CHAR) == 'u' \
69: || (CHAR) == 'I' || (CHAR) == 'Y' || (CHAR) == 'm' \
70: || (CHAR) == 'L' || (CHAR) == 'i' || (CHAR) == 'A' \
71: || (CHAR) == 'G')
72:
1.1.1.3 root 73: /* Process -mGxx switches */
74:
75: extern void overide_options ();
76:
77: #define OVERRIDE_OPTIONS overide_options ()
78:
79:
80: /* Names to predefine in the preprocessor for this target machine. */
81:
82: #ifndef CPP_PREDEFINES
83: #define CPP_PREDEFINES "-Dmips -Dunix -Dhost_mips -DMIPSEB -DR3000 -DLANGUAGE_C"
84: #endif
1.1 root 85:
86: /* Extra switches sometimes passed to the assembler. */
87:
1.1.1.3 root 88: #ifndef ASM_SPEC
89: #ifndef OSF_OS /* normal MIPS system */
90: #ifndef DECSTATION /* big endian MIPS (MIPS, SGI) */
91: #ifndef SGI_TARGET /* not Silicon Graphics (ie, MIPSco) */
92:
93: #define ASM_SPEC "%{!mrnames:-nocpp} \
94: %{!mgas: \
95: %{pipe: %e-pipe is not supported.} \
96: %{EB} %{!EB:-EB} \
97: %{EL: %e-EL not supported} \
98: %{O:-O2} %{O1:-O2} %{O2:-O2} %{O3:-O3} \
99: %{g} %{g1} %{g2} %{g3} %{g0}} \
100: %{G*} \
101: %{!G:%{!G32: %{mpic:-G 0} %{pic:-G 0} \
102: %{mgas:-G 0} \
103: %{!pic:%{!mpic:%{!mgas:-G 8}}}} \
104: %{G32: -G 32}} \
105: %{v} %{K}"
106:
107: #else /* Silicon Graphics */
108: #define ASM_SPEC "%{!mrnames:-nocpp} \
109: %{!mgas: \
110: %{pipe: %e-pipe is not supported.} \
111: %{O:-O2} %{O1:-O2} %{O2:-O2} %{O3:-O3} \
112: %{g} %{g1} %{g2} %{g3} %{g0}} \
113: %{G*} \
114: %{!G:%{!G32: %{mpic:-G 0} %{pic:-G 0} \
115: %{mgas:-G 0} \
116: %{!pic:%{!mpic:%{!mgas:-G 8}}}} \
117: %{G32: -G 32}} \
118: %{v} %{K}"
119:
120: #endif /* Silicon Graphics */
121: #else /* Ultrix Decstation (little endian) */
122: #define ASM_SPEC "%{!mrnames:-nocpp} \
123: %{!mgas: \
124: %{pipe:%e:-pipe not supported} \
125: %{EL} %{!EL:-EL} \
126: %{EB: %e-EB not supported} \
127: %{O:-O2} %{O1:-O2} %{O2:-O2} %{O3:-O3} \
128: %{g} %{g1} %{g2} %{g3} %{g0}} \
129: %{G*} \
130: %{!G:%{!G32: %{mpic:-G 0} %{pic:-G 0} \
131: %{mgas:-G 0} \
132: %{!pic:%{!mpic:%{!mgas:-G 8}}}} \
133: %{G32: -G 32}} \
134: %{v} %{K}"
135: #endif /* DECstation running Ultrix */
136: #else /* OSF/1 of some sort */
137: #ifndef DECSTATION
138: /* Big endian MIPS running OSF/1 */
139: #define ASM_SPEC "%{mmips-as: \
140: %{pipe:%e:-pipe not supported} \
141: %{EB} %{!EB:-EB} \
142: %{EL: %e-EL not supported} \
143: %{!mrnames:-nocpp} \
144: %{O:-O2} %{O1:-O2} %{O2:-O2} %{O3:-O3} \
145: %{g} %{g1} %{g2} %{g3} %{g0} \
146: %{v} %{K}} \
147: %{G*} \
148: %{!G:%{!G32: %{mpic:-G 0} %{pic:-G 0} \
149: %{!mmips-as:-G 0} \
150: %{!pic:%{!mpic:%{mmips-as:-G 8}}}} \
151: %{G32: -G 32}}"
152: #else
153: /* Little endian OSF/1 Decstation */
154: #define ASM_SPEC "%{mmips-as: \
155: %{pipe:%e:-pipe not supported} \
156: %{EL} %{!EL:-EL} \
157: %{EB: %e-EB not supported} \
158: %{!mrnames:-nocpp} \
159: %{O:-O2} %{O1:-O2} %{O2:-O2} %{O3:-O3} \
160: %{g} %{g1} %{g2} %{g3} %{g0} \
161: %{v} %{K}} \
162: %{G*} \
163: %{!G:%{!G32: %{mpic:-G 0} %{pic:-G 0} \
164: %{!mmips-as:-G 0} \
165: %{!pic:%{!mpic:%{mmips-as:-G 8}}}} \
166: %{G32: -G 32}}"
167:
168: #endif /* little endian OSF/1 DECstation */
169: #endif /* OSF/1 */
170: #endif /* ASM_SPEC */
171:
172: /* Redefinition of libraries used. Mips doesn't support normal
173: UNIX style profiling via calling _mcount. It does offer
174: profiling that samples the PC, so do what we can... */
1.1 root 175:
1.1.1.3 root 176: #ifndef LIB_SPEC
177: #define LIB_SPEC "%{pg:%e-pg is not supported on the MIPS}%{p:-lprof1} -lc"
178: #endif
1.1.1.2 root 179:
1.1.1.4 ! root 180: /* Inhibit use of -lg. */
! 181: #define LIBG_SPEC ""
! 182:
1.1 root 183: /* Extra switches sometimes passed to the loader. */
184:
185:
1.1.1.3 root 186: #ifndef LINK_SPEC
187: #ifdef MIPS_SYSV /* RISC-OS SYSTEM V */
1.1 root 188:
1.1.1.3 root 189: #ifndef STARTFILE_SPEC
1.1 root 190: #define STARTFILE_SPEC \
191: "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt1.o%s crtn.o%s}}"
1.1.1.3 root 192: #endif
1.1 root 193:
1.1.1.3 root 194: #define LINK_SPEC "%{G*} \
195: %{!G:%{!G32: %{mpic:-G 0} %{pic:-G 0} \
196: %{mgas:-G 0} \
197: %{!pic:%{!mpic:%{!mgas:-G 8}}}} \
198: %{G32:-G 32}} \
199: %{!G:%{!G32: \
200: %{mG0:%eYou should include ld/as option -G} \
201: %{mG1:%eYou should include ld/as option -G} \
202: %{mG2:%eYou should include ld/as option -G}}} \
203: %{bestGnum} \
204: %{!ZBSD43:-systype /sysv/}%{ZBSD43:-systype /bsd43/} \
205: %{EB} %{!EB:-EB} %{EL:%e-EL not supported}"
1.1 root 206:
1.1.1.3 root 207: #else /* RISC-OS SYSTEM V */
208: #ifdef MIPS_BSD43 /* RISC-OS BSD */
1.1 root 209:
1.1.1.3 root 210: #ifndef STARTFILE_SPEC
1.1 root 211: #define STARTFILE_SPEC \
212: "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt1.o%s crtn.o%s}}"
213: #endif
214:
1.1.1.3 root 215: #define LINK_SPEC "%{G*} \
216: %{!G:%{!G32: %{mpic:-G 0} %{pic:-G 0} \
217: %{mgas:-G 0} \
218: %{!pic:%{!mpic:%{!mgas:-G 8}}}} \
219: %{G32:-G 32}} \
220: %{!G:%{!G32: \
221: %{mG0:%eYou should include ld/as option -G} \
222: %{mG1:%eYou should include ld/as option -G} \
223: %{mG2:%eYou should include ld/as option -G}}} \
224: %{bestGnum} \
225: %{!ZSYSV:-systype /bsd43/}%{ZSYSV:-systype /sysv/} \
226: %{EB} %{!EB:-EB} %{EL:%e-EL not supported}"
227:
228: #else
229:
230: #ifndef DECSTATION /* Big endian BSD or OSF/1 system */
231: #ifndef OSF_OS /* Big endian BSD system */
232: #ifndef SGI_TARGET /* Big endian non Silicon Graphics system */
233:
234: #define LINK_SPEC "%{G*} \
235: %{!G:%{!G32: %{mpic:-G 0} %{pic:-G 0} \
236: %{mgas:-G 0} \
237: %{!pic:%{!mpic:%{!mgas:-G 8}}}} \
238: %{G32:-G 32}} \
239: %{!G:%{!G32: \
240: %{mG0:%eYou should include ld/as option -G} \
241: %{mG1:%eYou should include ld/as option -G} \
242: %{mG2:%eYou should include ld/as option -G}}} \
243: %{!mgas: %{EB} %{!EB:-EB} %{EL:%e-EL not supported} \
244: %{bestGnum}}"
245:
246: #else /* Silicon graphics system */
247: #define LINK_SPEC "%{G*} \
248: %{!G:%{!G32: %{mpic:-G 0} %{pic:-G 0} \
249: %{mgas:-G 0} \
250: %{!pic:%{!mpic:%{!mgas:-G 8}}}} \
251: %{G32:-G 32}} \
252: %{!G:%{!G32: \
253: %{mG0:%eYou should include ld/as option -G} \
254: %{mG1:%eYou should include ld/as option -G} \
255: %{mG2:%eYou should include ld/as option -G}}} \
256: %{!mgas: %{bestGnum}}"
257:
258: #endif /* Silicon Graphics system */
259: #else /* Big endian OSF/1 system */
260: #define LINK_SPEC "%{G*} \
261: %{!G:%{!G32: %{mpic:-G 0} %{pic:-G 0} \
262: %{!mmips-as:-G 0} \
263: %{!pic:%{!mpic:%{mmips-as:-G 8}}}} \
264: %{G32:-G 32}} \
265: %{!G:%{!G32: \
266: %{mG0:%eYou should include ld/as option -G} \
267: %{mG1:%eYou should include ld/as option -G} \
268: %{mG2:%eYou should include ld/as option -G}}} \
269: %{mmips-as: %{EB} %{!EB:-EB} %{EL:%e-EL not supported} \
270: %{bestGnum}} \
271: %{nostdlib}"
272: #endif /* Big endian BSD or OSF/1 system */
273:
274: #else /* Little endian Ultrix or OSF/1 */
275: #ifndef OSF_OS /* Little endian Ultrix system */
276: #define LINK_SPEC "%{G*} \
277: %{!G:%{!G32: %{mpic:-G 0} %{pic:-G 0} \
278: %{mgas:-G 0} \
279: %{!pic:%{!mpic:%{!mgas:-G 8}}}} \
280: %{G32:-G 32}} \
281: %{!G:%{!G32: \
282: %{mG0:%eYou should include ld/as option -G} \
283: %{mG1:%eYou should include ld/as option -G} \
284: %{mG2:%eYou should include ld/as option -G}}} \
285: %{!mgas: %{EL} %{!EL:-EL} %{EB:%e-EB not supported} \
286: %{bestGnum}}"
287:
288: #else /* Little endian OSF/1 system */
289: #define LINK_SPEC "%{G*} \
290: %{!G:%{!G32: %{mpic:-G 0} %{pic:-G 0} \
291: %{!mmips-as:-G 0} \
292: %{!pic:%{!mpic:%{mmips-as:-G 8}}}} \
293: %{G32:-G 32}} \
294: %{!G:%{!G32: \
295: %{mG0:%eYou should include ld/as option -G} \
296: %{mG1:%eYou should include ld/as option -G} \
297: %{mG2:%eYou should include ld/as option -G}}} \
298: %{mmips-as: %{EL} %{!EL:-EL} %{EB:%e-EB not supported} \
299: %{bestGnum}} \
300: %{nostdlib}"
301:
302: #endif /* Little endian OSF/1 system */
303: #endif /* Little endian BSD or OSF/1 system */
304: #endif /* RISC-OS BSD */
305: #endif /* RISC-OS SYSTEM V */
306: #endif /* LINK_SPEC defined */
307:
1.1 root 308: /* CC1 SPECS */
309:
1.1.1.3 root 310: #define CC1_SPEC "%{O: %{!mngpOPT:-mgpOPT}} \
311: %{O1:-O %{!mngpOPT:-mgpOPT}} \
312: %{O2:-O %{!fnostrength-reduce:-fstrength-reduce} \
313: %{!fnoomit-frame-pointer:-fomit-frame-pointer} \
314: %{!mngpOPT:-mgpOPT}} \
315: %{O3:-O %{!fnostrength-reduce:-fstrength-reduce} \
316: %{!fnoomit-frame-pointer:-fomit-frame-pointer} \
317: %{!fnoinline-functions:-finline-functions} \
318: %{!mngpOPT:-mgpOPT}} \
319: %{O4:%eGCC does not support -O4} \
320: %{!g: %{g1:-g} %{g2:-g} %{g3:-g}} \
321: %{G32: -mG2 -mnG1 }"
1.1 root 322:
323: /* CPP SPECS */
324:
1.1.1.2 root 325: #ifndef DECSTATION
326:
1.1.1.3 root 327: #ifdef SGI_TARGET /* Silicon Graphics */
328: #define CPP_SPEC " %{!ansi:-D__EXTENSIONS__} \
329: -D_MIPSEB -D_SYSTYPE_SYSV -D_LANGUAGE_C \
330: %{O1:-D__OPTIMIZE__} \
331: %{O2:-D__OPTIMIZE__} \
332: %{O3:-D__OPTIMIZE__}"
333:
334: #else
1.1 root 335: #if defined(MIPS_SYSV) || defined(MIPS_BSD43)
336: /* MIPS RISC-OS environments */
337:
338: #ifdef MIPS_SYSV
1.1.1.2 root 339: #define CPP_SPEC " %{!ansi:%{!ZBSD43:-DSYSTYPE_SYSV}%{ZBSD43:-DSYSTYPE_BSD43}}\
340: %{!ZBSD43:-D__SYSTYPE_SYSV__}%{ZBSD43:-D__SYSTYPE_BSD43__} \
1.1.1.3 root 341: %{O1:-D__OPTIMIZE__} \
342: %{O2:-D__OPTIMIZE__} \
343: %{O3:-D__OPTIMIZE__}"
1.1 root 344: #else /* not MIPS_SYSV */
1.1.1.4 ! root 345:
! 346: /* Use this instead of a conditional -I in CPP_SPEC
! 347: because -I adds the dir in the wrongplace in the search path. */
! 348: #define CC_INCLUDE_DIR "/bsd43/usr/include"
! 349:
1.1.1.2 root 350: #define CPP_SPEC " %{!ansi:%{!ZSYSV:-DSYSTYPE_BSD43}%{ZSYSV:-DSYSTYPE_SYSV}}\
351: %{!ZSYSV:-D__SYSTYPE_BSD43__}%{ZSYSV:-D__SYSTYPE_SYSV__}\
1.1.1.3 root 352: %{O1:-D__OPTIMIZE__} \
353: %{O2:-D__OPTIMIZE__} \
354: %{O3:-D__OPTIMIZE__}"
355:
1.1 root 356: #endif /* not MIPS_SYSV */
357:
358: #else /* not MIPS_SYSV and not MIPS_BSD43 */
359: /* default MIPS Bsd environment */
1.1.1.3 root 360: #define CPP_SPEC "%{!ansi:-DSYSTYPE_BSD} -D__SYSTYPE_BSD__ \
361: %{O1:-D__OPTIMIZE__} \
362: %{O2:-D__OPTIMIZE__} \
363: %{O3:-D__OPTIMIZE__}"
1.1 root 364:
365: #endif /* not MIPS_SYSV and not MIPS_BSD43 */
1.1.1.3 root 366: #endif /* not Silicon Graphics */
367:
368: #else /* DECSTATION */
369: #define CPP_SPEC "%{O1:-D__OPTIMIZE__} \
370: %{O2:-D__OPTIMIZE__} \
371: %{O3:-D__OPTIMIZE__}"
372:
1.1 root 373: #endif /* not DECSTATION */
374:
375: /* Print subsidiary information on the compiler version in use. */
376:
1.1.1.3 root 377: #ifndef __DATE__
378: #define __DATE__ "[unknown date]"
379: #endif
380:
381: #define MIPS_VERSION "AL-MIPS 1.1"
382:
1.1 root 383: #ifdef DECSTATION
1.1.1.3 root 384: #ifdef OSF_OS
385: #define MACHINE_TYPE "OSF/1 Dec Mips"
1.1 root 386: #else
1.1.1.3 root 387: #define MACHINE_TYPE "Ultrix Dec Mips"
1.1 root 388: #endif
389:
1.1.1.3 root 390: #else
391: #ifdef SGI_TARGET
392: #define MACHINE_TYPE "Sgi Mips"
1.1 root 393:
1.1.1.3 root 394: #else
395: #if defined(MIPS_SYSV) || defined(MIPS_BSD43)
396: /* MIPS RISC-OS environments */
397: #ifdef MIPS_SYSV
398: #define MACHINE_TYPE "RISC-OS System V Mips"
1.1 root 399:
1.1.1.3 root 400: #else /* not MIPS_SYSV */
401: #define MACHINE_TYPE "RISC-OS BSD Mips"
402:
403: #endif /* not MIPS_SYSV */
404: #else /* not MIPS_SYSV and not MIPS_BSD43 */
405: /* default MIPS Bsd environment */
406: #define MACHINE_TYPE "BSD Mips"
407: #endif /* not SGI iris */
408: #endif /* not MIPS_SYSV and not MIPS_BSD43 */
409: #endif /* not DECSTATION */
410:
411: #define TARGET_VERSION \
412: { \
413: fprintf (stderr, " %s %s %s", MIPS_VERSION, MACHINE_TYPE, __DATE__); \
414: }
415:
416:
417: #define SDB_DEBUGGING_INFO /* generate debug info inside of comments */
418: #define MIPS_DEBUGGING_INFO /* MIPS specific debugging info */
419:
420: /* On Sun 4, this limit is 2048. We use 1500 to be safe,
421: since the length can run past this up to a continuation point. */
422: #define DBX_CONTIN_LENGTH 1500
423:
424:
425: /* How to renumber registers for dbx and gdb.
426: MIPS needs no change in the numeration. */
427:
428: #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
429:
430:
431: /* Overides for the COFF debug format. */
432: #define PUT_SDB_SCL(a) \
433: do { \
434: extern FILE *asm_out_text_file; \
435: fprintf (asm_out_text_file, "\t.scl\t%d;", (a)); \
436: } while (0)
437:
438: #define PUT_SDB_INT_VAL(a) \
439: do { \
440: extern FILE *asm_out_text_file; \
441: fprintf (asm_out_text_file, "\t.val\t%d;", (a)); \
442: } while (0)
443:
444: #define PUT_SDB_VAL(a) \
445: do { \
446: extern FILE *asm_out_text_file; \
447: fputs ("\t.val\t", asm_out_text_file); \
448: output_addr_const (asm_out_text_file, (a)); \
449: fputc (';', asm_out_text_file); \
450: } while (0)
451:
452: #define PUT_SDB_DEF(a) \
453: do { \
454: extern FILE *asm_out_text_file; \
455: fprintf (asm_out_text_file, "\t#.def\t"); \
456: ASM_OUTPUT_LABELREF (asm_out_text_file, a); \
457: fputc (';', asm_out_text_file); \
458: } while (0)
459:
460: #define PUT_SDB_PLAIN_DEF(a) \
461: do { \
462: extern FILE *asm_out_text_file; \
463: fprintf (asm_out_text_file, "\t#.def\t.%s;", (a)); \
464: } while (0)
465:
466: #define PUT_SDB_ENDEF \
467: do { \
468: extern FILE *asm_out_text_file; \
469: fprintf (asm_out_text_file, "\t.endef\n"); \
470: } while (0)
471:
472: #define PUT_SDB_TYPE(a) \
473: do { \
474: extern FILE *asm_out_text_file; \
475: fprintf (asm_out_text_file, "\t.type\t0x%x;", (a)); \
476: } while (0)
477:
478: #define PUT_SDB_SIZE(a) \
479: do { \
480: extern FILE *asm_out_text_file; \
481: fprintf (asm_out_text_file, "\t.size\t%d;", (a)); \
482: } while (0)
483:
484: #define PUT_SDB_DIM(a) \
485: do { \
486: extern FILE *asm_out_text_file; \
487: fprintf (asm_out_text_file, "\t.dim\t%d;", (a)); \
488: } while (0)
489:
490: #ifndef PUT_SDB_START_DIM
491: #define PUT_SDB_START_DIM \
492: do { \
493: extern FILE *asm_out_text_file; \
494: fprintf (asm_out_text_file, "\t.dim\t"); \
495: } while (0)
496: #endif
497:
498: #ifndef PUT_SDB_NEXT_DIM
499: #define PUT_SDB_NEXT_DIM(a) \
500: do { \
501: extern FILE *asm_out_text_file; \
502: fprintf (asm_out_text_file, "%d,", a); \
503: } while (0)
504: #endif
505:
506: #ifndef PUT_SDB_LAST_DIM
507: #define PUT_SDB_LAST_DIM(a) \
508: do { \
509: extern FILE *asm_out_text_file; \
510: fprintf (asm_out_text_file, "%d;", a); \
511: } while (0)
512: #endif
513:
514: #define PUT_SDB_TAG(a) \
515: do { \
516: extern FILE *asm_out_text_file; \
517: fprintf (asm_out_text_file, "\t.tag\t"); \
518: ASM_OUTPUT_LABELREF (asm_out_text_file, a); \
519: fputc (';', asm_out_text_file); \
520: } while (0)
521:
522: /* For block start and end, we create labels, so that
523: later we can figure out where the correct offset is.
524: The normal .ent/.end serve well enough for functions,
525: so those are just commented out. */
526:
527: #define PUT_SDB_BLOCK_START(LINE) \
528: do { \
529: extern FILE *asm_out_text_file; \
530: fprintf (asm_out_text_file, \
531: "$Lb%d:\n\t#.begin\t$Lb%d\t%d\n", \
532: sdb_label_count, \
533: sdb_label_count, \
534: (LINE)); \
535: sdb_label_count++; \
536: } while (0)
537:
538: #define PUT_SDB_BLOCK_END(LINE) \
539: do { \
540: extern FILE *asm_out_text_file; \
541: fprintf (asm_out_text_file, \
542: "$Le%d:\n\t#.bend\t$Le%d\t%d\n", \
543: sdb_label_count, \
544: sdb_label_count, \
545: (LINE)); \
546: sdb_label_count++; \
547: } while (0)
548:
549: #define PUT_SDB_FUNCTION_START(LINE)
550:
551: #define PUT_SDB_FUNCTION_END(LINE)
552:
553: #define PUT_SDB_EPILOGUE_END(NAME)
554:
555: #define SDB_GENERATE_FAKE(BUFFER, NUMBER) \
556: sprintf ((BUFFER), ".%dfake", (NUMBER));
557:
558:
1.1 root 559: /* Run-time compilation parameters selecting different hardware subsets. */
560:
561: extern int target_flags;
562:
563: /* Macros used in the machine description to test the flags. */
564:
1.1.1.3 root 565: /* Mips vs. GNU assembler */
566: #define TARGET_UNIX_ASM (target_flags & 0x00000001)
567: #define TARGET_MIPS_AS TARGET_UNIX_ASM
568: #define TARGET_GAS (TARGET_UNIX_ASM == 0)
569:
570: /* Debug Mode */
571: #define TARGET_DEBUG_MODE (target_flags & 0x00000002)
572: #define TARGET_DEBUGA_MODE (target_flags & 0x00000004)
573: #define TARGET_DEBUGB_MODE (target_flags & 0x00000010)
574: #define TARGET_DEBUGC_MODE (target_flags & 0x00000020)
575: #define TARGET_DEBUGD_MODE (target_flags & 0x00000040)
576: #define TARGET_DEBUGE_MODE (target_flags & 0x00008000)
577:
578: /* Reg. Naming in .s ($21 vs. $a0) */
579: #define TARGET_NAME_REGS (target_flags & 0x00000008)
580:
581: /* addu/subbu vs. add/sub */
582: #define TARGET_NOFIXED_OVFL (target_flags & 0x00000080)
583:
584: /* Optimize for Sdata/Sbss */
585: #define TARGET_GP_OPT (target_flags & 0x00001000)
586: #define TARGET_GVALUE_MASK (target_flags & 0x00000f00)
587: #define TARGET_GVALUE (TARGET_GVALUE_MASK >> 8)
588:
589: /* Position independent code */
590: #define TARGET_PIC (target_flags & 0x00002000)
591: #define TARGET_PIC_LARGE_OBJECT (target_flags & 0x00004000)
1.1 root 592:
593:
594:
595: /* Macro to define tables used to set the flags.
596: This is a list in braces of pairs in braces,
597: each pair being { "NAME", VALUE }
598: where VALUE is the bits to set or minus the bits to clear.
599: An empty string NAME is used to identify the default VALUE. */
600:
601: #define TARGET_SWITCHES \
1.1.1.3 root 602: { {"mips-as", 0x00000001}, /* MIPS assembler */ \
603: {"gas", -0x00000001}, /* GNU assembler */ \
604: {"debug", 0x00000002}, /* Eliminate version in output*/ \
605: {"nodebug", -0x00000002}, \
606: {"debuga", 0x00000004}, /* don't fold SP pushes into frame */ \
607: {"nodebuga", -0x00000004}, \
608: {"debugb", 0x00000010}, /* GO_IF_LEGITIMATE_ADDRESS debug */ \
609: {"nodebugb", -0x00000010}, \
610: {"debugc", 0x00000020}, /* fix frame ptr debug */ \
611: {"nodebugc", -0x00000020}, \
612: {"debugd", 0x00000040}, /* branch/cc0 debug */ \
613: {"nodebugd", -0x00000040}, \
614: {"rnames", 0x00000008}, /* Register names like $a0 */ \
615: {"nornames", -0x00000008}, /* Register names like $21 */ \
616: {"nofixed-ovfl", 0x00000080}, /* Use addu and subu */ \
617: {"fixed-ovfl", -0x00000080}, /* Use add and sub */ \
618: {"G0", 0x00000100}, /* Bit 1 of sdata size */ \
619: {"nG0", -0x00000100}, \
620: {"noG0", -0x00000100}, \
621: {"G1", 0x00000200}, /* Bit 2 of sdata size */ \
622: {"nG1", -0x00000200}, \
623: {"noG1", -0x00000200}, \
624: {"G2", 0x00000400}, /* Bit 3 of sdata size */ \
625: {"nG2", -0x00000400}, \
626: {"noG2", -0x00000400}, \
627: {"gpOPT", 0x00001000}, /* Optimize for global ptr */ \
628: {"ngpOPT", -0x00001000}, \
629: {"nogpOPT", -0x00001000}, \
630: {"pic", 0x00002000}, /* Position independent code */ \
631: {"npic", -0x00002000}, \
632: {"nopic", -0x00002000}, \
633: {"pic-large-object", 0x00004000}, /* Don't opt pic local funcs */ \
634: {"nopic-large-object", -0x00004000}, \
635: {"debuge", 0x00008000}, /* FUNCTION_ARG debug */ \
636: {"nodebuge", -0x00008000}, \
637: {"", TARGET_DEFAULT}}
1.1 root 638:
1.1.1.3 root 639: /* Default target_flags if no switches specified (-mmips-as, -mnofixed-ovfl,
640: -G0, -G1 [same as -G 8]). OSF/1 does not set -mmips-as, and sets -G 0. */
1.1 root 641:
1.1.1.3 root 642: #ifndef OSF_OS
643: #define TARGET_DEFAULT 0x00000381
644: #else
645: #define TARGET_DEFAULT 0x00000080
646: #endif
1.1 root 647:
648: /* Default GVALUE (data item size threshold for selection of Sdata/data)
649: is computed : GVALUE == ( ((i=G0+2*G1+4*G2) < 6)
650: ? 1<<i
1.1.1.3 root 651: : 1<< (i+3))
1.1 root 652: */
653:
654: /* Target machine storage layout */
655:
656: /* Define this if most significant bit is lowest numbered
657: in instructions that operate on numbered bit-fields.
658: */
659: /* #define BITS_BIG_ENDIAN */
660:
1.1.1.3 root 661: /* Define this if most significant byte of a word is the lowest numbered. */
1.1 root 662: #ifndef DECSTATION
663: #define BYTES_BIG_ENDIAN
664: #endif
1.1.1.3 root 665:
666: /* Define this if most significant word of a multiword number is numbered. */
1.1 root 667: #ifndef DECSTATION
668: #define WORDS_BIG_ENDIAN
669: #endif
1.1.1.3 root 670:
671: /* Define macros to easily access the most and least significant words
672: without a lot of #ifdef's. */
673:
674: #ifdef WORDS_BIG_ENDIAN
675: #define MOST_SIGNIFICANT_WORD 0
676: #define LEAST_SIGNIFICANT_WORD 1
677:
678: #else
679: #define MOST_SIGNIFICANT_WORD 1
680: #define LEAST_SIGNIFICANT_WORD 0
681: #endif
682:
1.1 root 683: /* Number of bits in an addressible storage unit */
684: #define BITS_PER_UNIT 8
685:
686: /* Width in bits of a "word", which is the contents of a machine register.
687: Note that this is not necessarily the width of data type `int';
688: if using 16-bit ints on a 68000, this would still be 32.
689: But on a machine with 16-bit registers, this would be 16. */
690: #define BITS_PER_WORD 32
691:
692: /* Width of a word, in units (bytes). */
693: #define UNITS_PER_WORD 4
694:
695: /* Width in bits of a pointer.
696: See also the macro `Pmode' defined below. */
697: #define POINTER_SIZE 32
698:
699: /* Allocation boundary (in *bits*) for storing pointers in memory. */
700: #define POINTER_BOUNDARY 32
701:
702: /* Allocation boundary (in *bits*) for storing arguments in argument list. */
703: #define PARM_BOUNDARY 32
704:
705: /* Give parms extra alignment, up to this much, if their types want it. */
706: #define MAX_PARM_BOUNDARY 64
707:
708: /* Allocation boundary (in *bits*) for the code of a function. */
709: #define FUNCTION_BOUNDARY 32
710:
711: /* Alignment of field after `int : 0' in a structure. */
712: #define EMPTY_FIELD_BOUNDARY 32
713:
714: /* Every structure's size must be a multiple of this. */
1.1.1.3 root 715: #define STRUCTURE_SIZE_BOUNDARY 8
1.1 root 716:
717: /* There is no point aligning anything to a rounder boundary than this. */
718: #define BIGGEST_ALIGNMENT 64
719:
720: /* Define this if move instructions will actually fail to work
721: when given unaligned data. */
722: #define STRICT_ALIGNMENT
1.1.1.3 root 723:
724: /* Define this macro if an argument declared as `char' or `short' in a
725: prototype should actually be passed as an `int'. In addition to
726: avoiding errors in certain cases of mismatch, it also makes for
727: better code on certain machines. */
728: #define PROMOTE_PROTOTYPES
729:
1.1 root 730:
731: /* Standard register usage. */
732:
733: /* Number of actual hardware registers.
734: The hardware registers are assigned numbers for the compiler
735: from 0 to just below FIRST_PSEUDO_REGISTER.
736: All registers that the compiler knows about must be given numbers,
737: even those that are not normally considered general registers. */
738: #define FIRST_PSEUDO_REGISTER 64
739:
740: /* 1 for registers that have pervasive standard uses
741: and are not available for the register allocator.
742:
743: On the MIPS, see conventions, page D-2
744:
745: I have chosen not to take Multiply/Divide HI,LO or PC into
1.1.1.3 root 746: account. */
747:
1.1 root 748: #define FIXED_REGISTERS {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\
749: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1,\
1.1.1.3 root 750: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\
1.1 root 751: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 \
752: }
753:
754:
755: /* 1 for registers not available across function calls.
756: These must include the FIXED_REGISTERS and also any
757: registers that can be used without being saved.
758: The latter must include the registers where values are returned
759: and the register where structure-value addresses are passed.
760: Aside from that, you can include as many other registers as you like. */
1.1.1.3 root 761:
1.1 root 762: #define CALL_USED_REGISTERS {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\
763: 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1,\
764: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\
765: 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0\
766: }
767:
768:
1.1.1.3 root 769: /* Internal macros to classify a register number as to whether it's a
770: general purpose register or a floating point register. The macro
771: FP_CALL_REG_P also allows registers $4 and $6 as floating point
772: registers to pass floating point as per MIPS spec. */
773:
774: #define GP_REG_FIRST 0
775: #define GP_REG_LAST 31
776: #define GP_REG_NUM (GP_REG_LAST - GP_REG_FIRST + 1)
777:
778: #define FP_REG_FIRST 32
779: #define FP_REG_LAST 63
780: #define FP_REG_NUM (FP_REG_LAST - FP_REG_FIRST + 1)
781:
782: #define GP_REG_P(REGNO) ((unsigned) ((REGNO) - GP_REG_FIRST) < GP_REG_NUM)
783: #define FP_REG_P(REGNO) ((unsigned) ((REGNO) - FP_REG_FIRST) < FP_REG_NUM)
784:
785: #define FP_CALL_REG_P(REGNO) \
786: (FP_REG_P (REGNO) \
787: || (REGNO) == (4 + GP_REG_FIRST) \
788: || (REGNO) == (6 + GP_REG_FIRST))
789:
790:
1.1 root 791: /* Return number of consecutive hard regs needed starting at reg REGNO
792: to hold something of mode MODE.
793: This is ordinarily the length in words of a value of mode MODE
794: but can be less for certain modes in special long registers.
795:
796: On the MIPS, all general registers are one word long. I have chosen to
1.1.1.3 root 797: use Floating point register pairs. */
798:
1.1 root 799: #define HARD_REGNO_NREGS(REGNO, MODE) \
1.1.1.3 root 800: ((MODE == SFmode) ? 2 : \
1.1 root 801: ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
802:
803: /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
804: On the MIPS, all general registers can hold all modes, except
805: FLOATING POINT. */
806:
807: #define HARD_REGNO_MODE_OK(REGNO, MODE) \
1.1.1.3 root 808: ((GET_MODE_CLASS (MODE) == MODE_INT || MODE == VOIDmode) \
809: ? (GP_REG_P (REGNO)) \
810: : (GET_MODE_CLASS (MODE) == MODE_FLOAT) \
811: ? (((REGNO) & 1) == 0 && FP_CALL_REG_P (REGNO)) \
812: : 0) \
1.1 root 813:
814:
815: /* Value is 1 if it is a good idea to tie two pseudo registers
816: when one has mode MODE1 and one has mode MODE2.
817: If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
818: for any hard reg, then this must be 0 for correct output. */
819: #define MODES_TIEABLE_P(MODE1, MODE2) \
820: ( ((MODE1) == SFmode || (MODE1) == DFmode) \
821: == ((MODE2) == SFmode || (MODE2) == DFmode))
822:
823: /* MIPS pc is apparently not overloaded on a register. */
824: /* #define PC_REGNUM 15 */
825:
826: /* Register to use for pushing function arguments. */
827: #define STACK_POINTER_REGNUM 29
828:
1.1.1.3 root 829: /* Offset from the stack pointer to the first available location. */
830: #define STACK_POINTER_OFFSET 0
831:
1.1 root 832: /* Base register for access to local variables of the function. */
833: #define FRAME_POINTER_REGNUM 30
834:
835: /* Value should be nonzero if functions must have frame pointers.
836: Zero means the frame pointer need not be set up (and parms
837: may be accessed via the stack pointer) in functions that seem suitable.
1.1.1.3 root 838: This is computed in `reload', in reload1.c.
1.1 root 839:
1.1.1.3 root 840: At present this is required if we are not a leaf procedure. This
841: is because the .frame directive requires a register that does not
842: change throughout the procedure call, and until stack pushes are
843: folded into the initial stack allocation, we need an unvarying fp. */
844: #define FRAME_POINTER_REQUIRED (stack_args_pushed > 0)
1.1 root 845:
846: /* Base register for access to arguments of the function. */
847: #define ARG_POINTER_REGNUM FRAME_POINTER_REGNUM
848:
849: /* Register in which static-chain is passed to a function. */
850: #define STATIC_CHAIN_REGNUM 2
851:
852: /* Register in which address to store a structure value
853: is passed to a function. */
1.1.1.3 root 854: #define STRUCT_VALUE_REGNUM 4
855:
856: /* Mips registers used in prologue/epilogue code when the stack frame
857: is larger than 32K bytes. These registers must come from the
858: scratch register set, and not used for passing and returning
859: arguments and any other information used in the calling sequence
860: (such as pic). */
861: #define MIPS_TEMP1_REGNUM 8
862: #define MIPS_TEMP2_REGNUM 9
863:
864: /* Define NO_FUNCTION_CSE if it is as good or better to call a constant
865: function address than to call an address kept in a register. */
866: #define NO_FUNCTION_CSE
867:
1.1 root 868:
869: /* Define the classes of registers for register constraints in the
870: machine description. Also define ranges of constants.
871:
872: One of the classes must always be named ALL_REGS and include all hard regs.
873: If there is more than one class, another class must be named NO_REGS
874: and contain no registers.
875:
876: The name GENERAL_REGS must be the name of a class (or an alias for
877: another name such as ALL_REGS). This is the class of registers
878: that is allowed by "g" or "r" in a register constraint.
879: Also, registers outside this class are allocated only when
880: instructions express preferences for them.
881:
882: The classes must be numbered in nondecreasing order; that is,
883: a larger-numbered class must never be contained completely
884: in a smaller-numbered class.
885:
886: For any two classes, it is very desirable that there be another
887: class that represents their union. */
888:
1.1.1.3 root 889: /* The MIPS has general and floating point registers. */
1.1 root 890:
891:
892: enum reg_class { NO_REGS, GR_REGS, FP_REGS, ALL_REGS, LIM_REG_CLASSES } ;
893:
894: #define N_REG_CLASSES (int) LIM_REG_CLASSES
895:
896: #define GENERAL_REGS GR_REGS
897:
898: /* Give names of register classes as strings for dump file. */
899:
900: #define REG_CLASS_NAMES \
901: {"NO_REGS", "GR_REGS", "FP_REGS", "ALL_REGS" }
902:
903: /* Define which registers fit in which classes.
904: This is an initializer for a vector of HARD_REG_SET
905: of length N_REG_CLASSES. */
906:
907: #define REG_CLASS_CONTENTS {{0x00000000, 0x00000000}, \
908: {0xffffffff, 0x00000000}, \
909: {0x00000000, 0xffffffff}, \
910: {0xffffffff, 0xffffffff}}
911:
912:
913: /* The same information, inverted:
914: Return the class number of the smallest class containing
915: reg number REGNO. This could be a conditional expression
916: or could index an array. */
917:
1.1.1.3 root 918: #define REGNO_REG_CLASS(REGNO) ((FP_REG_P (REGNO)) ? FP_REGS : GR_REGS)
1.1 root 919:
920: /* Define a table that lets us find quickly all the reg classes
921: containing a given one. This is the initializer for an
922: N_REG_CLASSES x N_REG_CLASSES array of reg class codes.
923: Row N is a sequence containing all the class codes for
924: classes that contain all the regs in class N. Each row
925: contains no duplicates, and is terminated by LIM_REG_CLASSES. */
926:
927: /* We give just a dummy for the first element, which is for NO_REGS. */
928: /* #define REG_CLASS_SUPERCLASSES {{LIM_REG_CLASSES}, \
929: {GR_REGS,ALL_REGS,LIM_REG_CLASSES}, \
930: {FP_REGS,ALL_REGS,LIM_REG_CLASSES}, \
931: {ALL_REGS,LIM_REG_CLASSES} \
932: }
933: */
934: /* We give just a dummy for the first element, which is for NO_REGS. */
935: #define REG_CLASS_SUPERCLASSES {{LIM_REG_CLASSES}, \
936: {ALL_REGS,LIM_REG_CLASSES}, \
937: {ALL_REGS,LIM_REG_CLASSES}, \
938: {LIM_REG_CLASSES} \
939: }
940:
941: /* The inverse relationship:
942: for each class, a list of all reg classes contained in it. */
943: #define REG_CLASS_SUBCLASSES \
944: {{LIM_REG_CLASSES}, \
945: {GR_REGS,LIM_REG_CLASSES}, \
946: {FP_REGS,LIM_REG_CLASSES},\
947: {GR_REGS, FP_REGS, ALL_REGS, LIM_REG_CLASSES}\
948: }
949:
950: /* Define a table that lets us find quickly the class
951: for the subunion of any two classes.
952:
953: We say "subunion" because the result need not be exactly
954: the union; it may instead be a subclass of the union
955: (though the closer to the union, the better).
956: But if it contains anything beyond union of the two classes,
957: you will lose!
958:
959: This is an initializer for an N_REG_CLASSES x N_REG_CLASSES
960: array of reg class codes. The subunion of classes C1 and C2
961: is just element [C1, C2]. */
962:
1.1.1.3 root 963: #define REG_CLASS_SUBUNION \
964: {{NO_REGS, GR_REGS, FP_REGS, ALL_REGS}, \
1.1 root 965: {GR_REGS, GR_REGS, ALL_REGS, ALL_REGS}, \
966: {FP_REGS, ALL_REGS, FP_REGS, ALL_REGS}, \
967: {ALL_REGS, ALL_REGS, ALL_REGS, ALL_REGS}}
968:
969: /* The class value for index registers, and the one for base regs. */
970:
971: #define INDEX_REG_CLASS GR_REGS
972: #define BASE_REG_CLASS GR_REGS
973:
974:
975: /* REGISTER AND CONSTANT CLASSES
976: */
977:
978: /* Get reg_class from a letter such as appears in the machine
979: description. */
980: /* DEFINED REGISTER CLASSES:
981: **
982: ** 'f' : Floating point registers
983: ** 'y' : General register when used to
984: ** transfer chunks of Floating point
985: ** with mfc1 mtc1 insn
986: */
987:
988: #define REG_CLASS_FROM_LETTER(C) \
989: ((C) == 'f' ? FP_REGS: \
990: (C) == 'y' ? GR_REGS:NO_REGS)
991:
992: /* The letters I, J, K, L and M in a register constraint string
993: can be used to stand for particular ranges of immediate operands.
994: This macro defines what the ranges are.
995: C is the letter, and VALUE is a constant value.
996: Return 1 if VALUE is in the range specified by C. */
997:
1.1.1.2 root 998: /* For MIPS, `I' is used for the range of constants an arithmetic insn
1.1 root 999: can actually contain (16 bits signed integers).
1000: `J' is used for the range which is just zero (since that is
1001: available as $R0).
1.1.1.2 root 1002: `K' is used for the range of constants a logical insn
1003: can actually contain (16 bit zero-extended integers).
1.1 root 1004: */
1005:
1.1.1.2 root 1006: #define SMALL_INT(X) ((unsigned) (INTVAL (X) + 0x8000) < 0x10000)
1007: #define SMALL_INT_UNSIGNED(X) ((unsigned) (INTVAL (X)) < 0x10000)
1.1 root 1008:
1009: #define CONST_OK_FOR_LETTER_P(VALUE, C) \
1.1.1.2 root 1010: ((C) == 'I' ? (unsigned) ((VALUE) + 0x8000) < 0x10000 \
1.1 root 1011: : (C) == 'J' ? (VALUE) == 0 \
1.1.1.2 root 1012: : (C) == 'K' ? (unsigned) (VALUE) < 0x10000 \
1.1 root 1013: : 0)
1014:
1015: /* Similar, but for floating constants, and defining letters G and H.
1016: Here VALUE is the CONST_DOUBLE rtx itself. */
1017:
1018: /* DEFINED FLOATING CONSTANT CLASSES:
1019: **
1020: ** 'G' : Floating point 0
1021: */
1022: #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
1.1.1.4 ! root 1023: ((C) == 'G' && CONST_DOUBLE_LOW ((VALUE)) == 0 \
! 1024: && CONST_DOUBLE_HIGH ((VALUE)) == 0)
1.1 root 1025:
1026: /* Given an rtx X being reloaded into a reg required to be
1027: in class CLASS, return the class of reg to actually use.
1028: In general this is just CLASS; but on some machines
1029: in some cases it is preferable to use a more restrictive class. */
1030:
1031: #define PREFERRED_RELOAD_CLASS(X,CLASS) \
1032: (((GET_MODE(X) == SFmode) || (GET_MODE(X) == DFmode))? FP_REGS : \
1033: ((GET_MODE(X) == VOIDmode) ? GR_REGS :(CLASS)))
1034:
1035: /* Same but Mode has been extracted already
1036: */
1037:
1038: #define PREFERRED_RELOAD_CLASS_FM(X,CLASS) \
1039: ((((X) == SFmode) || ((X) == DFmode))? FP_REGS : \
1040: (((X) == VOIDmode) ? GR_REGS :(CLASS)))
1041:
1042: /* Return the maximum number of consecutive registers
1043: needed to represent mode MODE in a register of class CLASS. */
1044:
1045: #define CLASS_MAX_NREGS(CLASS, MODE) \
1046: ((((MODE) == DFmode) || ((MODE) == SFmode)) ? 2 \
1047: : ((MODE) == VOIDmode)? ((CLASS) == FP_REGS ? 2 :1) \
1048: : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
1049:
1050:
1051: /* Stack layout; function entry, exit and calling. */
1052:
1053: /* Define this if pushing a word on the stack
1054: makes the stack pointer a smaller address. */
1055: #define STACK_GROWS_DOWNWARD
1056:
1057: /* Define this if the nominal address of the stack frame
1058: is at the high-address end of the local variables;
1059: that is, each additional local variable allocated
1060: goes at a more negative offset in the frame. */
1061: #define FRAME_GROWS_DOWNWARD
1062:
1063: /* Offset within stack frame to start allocating local variables at.
1064: If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
1065: first local allocated. Otherwise, it is the offset to the BEGINNING
1066: of the first local allocated. */
1067: #define STARTING_FRAME_OFFSET -8
1068:
1069: /* If we generate an insn to push BYTES bytes,
1070: this says how many the stack pointer really advances by.
1071: On the vax, sp@- in a byte insn really pushes a word. */
1072:
1073: /* #define PUSH_ROUNDING(BYTES) 0 */
1074:
1075: /* Offset of first parameter from the argument pointer register value. */
1076: #define FIRST_PARM_OFFSET(FNDECL) 0
1077:
1078: /* Offset from top-of-stack address to location to store the
1079: function parameter if it can't go in a register.
1.1.1.3 root 1080: Addresses for following parameters are computed relative to this one.
1081:
1082: It also has the effect of counting register arguments in the total
1083: argument size. */
1.1 root 1084: #define FIRST_PARM_CALLER_OFFSET(FNDECL) 0
1085:
1086: /* When a parameter is passed in a register, stack space is still
1.1.1.3 root 1087: allocated for it. For the MIPS, stack space must be allocated, cf
1088: Asm Lang Prog Guide page 7-8.
1.1 root 1089:
1090: BEWARE that some space is also allocated for non existing arguments
1.1.1.3 root 1091: in register. In case an argument list is of form GF used registers
1092: are a0 (a2,a3), but we should push over a1... */
1.1 root 1093: #define REG_PARM_STACK_SPACE
1094:
1.1.1.3 root 1095: /* Align stack frames on 64 bits (Double Word ). */
1.1 root 1096: #define STACK_BOUNDARY 64
1.1.1.3 root 1097:
1.1 root 1098:
1.1.1.3 root 1099: /* Standard GCC stack related variables that we reference. */
1.1 root 1100:
1.1.1.3 root 1101: extern int optimize;
1102: extern int may_call_alloca;
1103: extern int current_function_calls_alloca;
1104: extern int frame_pointer_needed;
1105: extern int flag_omit_frame_pointer;
1106:
1107: /* MIPS external variables defined in out-mips.c. */
1108:
1109: extern char *reg_numchar[]; /* register names as $r2, etc. */
1110: extern char *current_function_name; /* current function being compiled */
1111: extern int num_source_filenames; /* current .file # */
1112: extern int inside_function; /* != 0 if inside of a function */
1113: extern int stack_args_pushed; /* max bytes pushed for calls */
1114: extern int stack_args_preallocated; /* # bytes for args preallocated */
1115: extern int sdb_label_count; /* block start/end next label # */
1116: extern int mips_section_threshold; /* # bytes of data/sdata cutoff */
1117: extern int sym_lineno; /* sgi next label # for each stmt */
1.1 root 1118:
1119:
1.1.1.3 root 1120: /* Make sure 16 bytes are always allocated on the stack. */
1121: #ifndef STACK_ARGS_ADJUST
1.1 root 1122: #define STACK_ARGS_ADJUST(SIZE) \
1123: { \
1.1.1.3 root 1124: if (SIZE.constant < 16) \
1.1 root 1125: SIZE.constant = 16; \
1126: }
1.1.1.3 root 1127: #endif
1.1 root 1128:
1129: /* Value is 1 if returning from a function call automatically
1130: pops the arguments described by the number-of-args field in the call.
1131: FUNTYPE is the data type of the function (as a tree),
1132: or for a library call it is an identifier node for the subroutine name. */
1133:
1134: #define RETURN_POPS_ARGS(FUNTYPE) 0
1135:
1136:
1.1.1.3 root 1137: /* Symbolic macros for the registers used to return integer and floating
1138: point values. */
1139:
1140: #define GP_RETURN 2
1141: #define FP_RETURN 32
1142:
1143: /* Symbolic macros for the first/last argument registers. */
1144:
1145: #define GP_ARG_FIRST 4
1146: #define GP_ARG_LAST 7
1147: #define FP_ARG_FIRST 44
1148: #define FP_ARG_LAST 47
1149:
1150: #define MAX_ARGS_IN_REGISTERS 4
1151:
1152: /* Define how to find the value returned by a library function
1153: assuming the value has mode MODE. */
1154:
1155: #define LIBCALL_VALUE(MODE) \
1156: gen_rtx (REG, MODE, \
1157: (GET_MODE_CLASS (MODE) == MODE_FLOAT) \
1158: ? FP_RETURN \
1159: : GP_RETURN)
1160:
1.1 root 1161: /* Define how to find the value returned by a function.
1162: VALTYPE is the data type of the value (as a tree).
1163: If the precise function being called is known, FUNC is its FUNCTION_DECL;
1164: otherwise, FUNC is 0. */
1165:
1.1.1.3 root 1166: #define FUNCTION_VALUE(VALTYPE, FUNC) LIBCALL_VALUE (TYPE_MODE (VALTYPE))
1.1 root 1167:
1168:
1.1.1.3 root 1169: /* 1 if N is a possible register number for a function value.
1170: On the MIPS, R2 R3 and F0 F2 are the only register thus used.
1171: Currently, R2 and F0 are only implemented here (C has no complex type) */
1.1 root 1172:
1.1.1.3 root 1173: #define FUNCTION_VALUE_REGNO_P(N) ((N) == GP_RETURN || (N) == FP_RETURN)
1.1 root 1174:
1.1.1.3 root 1175: /* 1 if N is a possible register number for function argument passing. */
1.1 root 1176:
1.1.1.3 root 1177: #define FUNCTION_ARG_REGNO_P(N) (((N) >= GP_ARG_FIRST && (N) <= GP_ARG_LAST) \
1178: || ((N) >= FP_ARG_FIRST && (N) <= FP_ARG_LAST \
1179: && (0 == (N) % 2)))
1180:
1181: /* A C expression which can inhibit the returning of certain function
1182: values in registers, based on the type of value. A nonzero value says
1183: to return the function value in memory, just as large structures are
1184: always returned. Here TYPE will be a C expression of type
1185: `tree', representing the data type of the value.
1186:
1187: Note that values of mode `BLKmode' are returned in memory
1188: regardless of this macro. Also, the option `-fpcc-struct-return'
1189: takes effect regardless of this macro. On most systems, it is
1190: possible to leave the macro undefined; this causes a default
1191: definition to be used, whose value is the constant 0.
1192:
1193: GCC normally converts 1 byte structures into chars, 2 byte
1194: structs into shorts, and 4 byte structs into ints, and returns
1195: them this way. Defining the following macro overides this,
1196: to give us MIPS cc compatibility. */
1.1 root 1197:
1.1.1.3 root 1198: #define RETURN_IN_MEMORY(TYPE) \
1199: ((TREE_CODE (TYPE) == RECORD_TYPE) || (TREE_CODE (TYPE) == UNION_TYPE))
1.1 root 1200:
1201:
1202: /* Define a data type for recording info about an argument list
1203: during the scan of that argument list. This data type should
1204: hold all necessary information about the function itself
1205: and about the args processed so far, enough to enable macros
1206: such as FUNCTION_ARG to determine where the next arg should go.
1207: */
1.1.1.3 root 1208:
1209: typedef struct mips_args {
1210: int gp_reg_found;
1211: int arg_number;
1212: int arg_words;
1213: } *CUMULATIVE_ARGS;
1.1 root 1214:
1215: /* Initialize a variable CUM of type CUMULATIVE_ARGS
1216: for a call to a function whose data type is FNTYPE.
1217: For a library call, FNTYPE is 0.
1218:
1219: */
1220:
1.1.1.3 root 1221: extern void init_cumulative_args ();
1222:
1223: #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE) \
1224: do { \
1225: CUM = (CUMULATIVE_ARGS) alloca (sizeof (*CUM)); \
1226: init_cumulative_args (CUM, FNTYPE); \
1227: } while (0)
1.1 root 1228:
1229: /* Update the data in CUM to advance over an argument
1230: of mode MODE and data type TYPE.
1231: (TYPE is null for libcalls where that information may not be available.) */
1232:
1233: #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
1.1.1.3 root 1234: (function_arg_advance(CUM, MODE, TYPE, NAMED))
1.1 root 1235:
1.1.1.3 root 1236: extern void function_arg_advance();
1.1 root 1237:
1238: /* Determine where to put an argument to a function.
1239: Value is zero to push the argument on the stack,
1240: or a hard register in which to store the argument.
1241:
1242: MODE is the argument's machine mode.
1243: TYPE is the data type of the argument (as a tree).
1244: This is null for libcalls where that information may
1245: not be available.
1246: CUM is a variable of type CUMULATIVE_ARGS which gives info about
1247: the preceding args and about the function being called.
1248: NAMED is nonzero if this argument is a named parameter
1249: (otherwise it is an extra parameter matching an ellipsis). */
1250:
1.1.1.3 root 1251: extern struct rtx_def *function_arg ();
1.1 root 1252:
1.1.1.3 root 1253: #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
1254: (function_arg(CUM, MODE, TYPE, NAMED))
1.1 root 1255:
1256: /* For an arg passed partly in registers and partly in memory,
1257: this is the number of registers used.
1258: For args passed entirely in registers or entirely in memory, zero.
1259: */
1260:
1.1.1.3 root 1261: extern int function_arg_partial_nregs ();
1262:
1263: #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
1264: (function_arg_partial_nregs (CUM, MODE, TYPE, NAMED))
1.1 root 1265:
1.1.1.3 root 1266:
1.1 root 1267: /* This macro generates the assembly code for function entry.
1268: FILE is a stdio stream to output the code to.
1269: SIZE is an int: how many units of temporary storage to allocate.
1270: Refer to the array `regs_ever_live' to determine which registers
1271: to save; `regs_ever_live[I]' is nonzero if register number I
1272: is ever used in the function. This macro is responsible for
1273: knowing which registers should not be saved even if used. */
1274:
1.1.1.3 root 1275: extern void function_prologue ();
1276:
1277: #define FUNCTION_PROLOGUE(FILE, SIZE) function_prologue(FILE, SIZE)
1278:
1279: /* This macro generates the assembly code for function exit,
1280: on machines that need it. If FUNCTION_EPILOGUE is not defined
1281: then individual return instructions are generated for each
1282: return statement. Args are same as for FUNCTION_PROLOGUE. */
1283:
1284: extern void function_epilogue ();
1285:
1286: #define FUNCTION_EPILOGUE(FILE, SIZE) function_epilogue(FILE, SIZE)
1287:
1288: /* Tell prologue and epilogue if Register containing return
1289: address should be saved / restored. */
1290:
1291: #define MUST_SAVE_REGISTER(regno) \
1292: ((regs_ever_live[regno] && !call_used_regs[regno]) || \
1293: (regno == FRAME_POINTER_REGNUM && frame_pointer_needed) || \
1294: (regno == 31 && regs_ever_live[31]))
1.1 root 1295:
1296: /* ALIGN FRAMES on double word boundaries */
1297:
1298: #define AL_ADJUST_ALIGN(LOC) (((LOC)+7) & 0xfffffff8)
1299:
1300:
1.1.1.3 root 1301: /* If the memory Address ADDR is relative to the frame pointer,
1302: correct it to be relative to the stack pointer. This is for
1303: when we don't use a frame pointer.
1304: ADDR should be a variable name. */
1.1 root 1305:
1.1.1.3 root 1306: #define FIX_FRAME_POINTER_ADDRESS(ADDR,DEPTH) \
1307: { ADDR = mips_fix_frame_pointer(ADDR, DEPTH); }
1.1 root 1308:
1.1.1.3 root 1309: extern struct rtx_def *mips_fix_frame_pointer ();
1.1 root 1310:
1311: /* Output assembler code to FILE to increment profiler label # LABELNO
1312: for profiling a function entry. */
1313:
1314: #define FUNCTION_PROFILER(FILE, LABELNO) \
1.1.1.3 root 1315: { \
1316: register char **reg_ptr = (TARGET_NAME_REGS) ? reg_names : reg_numchar; \
1317: \
1318: fprintf (FILE, "\t.set\tnoreorder\n"); \
1319: fprintf (FILE, "\t.set\tnoat\n"); \
1320: fprintf (FILE, "\tmove\t%s,%s\t\t# save current return address\n", \
1321: reg_ptr[1], reg_ptr[31]); \
1322: fprintf (FILE, "\tjal\t_mcount\n"); \
1323: fprintf (FILE, "\tsubu\t%s,%s,8\t\t# _mcount pops 2 words from stack\n", \
1324: reg_ptr[STACK_POINTER_REGNUM], reg_ptr[STACK_POINTER_REGNUM]); \
1325: fprintf (FILE, "\t.set\treorder\n"); \
1326: fprintf (FILE, "\t.set\tat\n"); \
1327: }
1.1 root 1328:
1329: /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
1330: the stack pointer does not matter. The value is tested only in
1331: functions that have frame pointers.
1332: No definition is equivalent to always zero. */
1333:
1.1.1.3 root 1334: #define EXIT_IGNORE_STACK 1
1.1 root 1335:
1336:
1337: /* Addressing modes, and classification of registers for them. */
1338:
1339: /* #define HAVE_POST_INCREMENT */
1340: /* #define HAVE_POST_DECREMENT */
1341:
1342: /* #define HAVE_PRE_DECREMENT */
1343: /* #define HAVE_PRE_INCREMENT */
1344:
1345: /* These assume that REGNO is a hard or pseudo reg number.
1346: They give nonzero only if REGNO is a hard reg of the suitable class
1347: or a pseudo reg currently allocated to a suitable hard reg.
1348: These definitions are NOT overridden anywhere. */
1349:
1350: #define REGNO_OK_FOR_INDEX_P(regno) \
1351: ((regno) < FIRST_PSEUDO_REGISTER || reg_renumber[regno] >= 0)
1.1.1.3 root 1352:
1.1 root 1353: #define REGNO_OK_FOR_BASE_P(regno) \
1354: ((regno) < FIRST_PSEUDO_REGISTER || reg_renumber[regno] >= 0)
1355:
1356: /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
1357: and check its validity for a certain class.
1358: We have two alternate definitions for each of them.
1359: The usual definition accepts all pseudo regs; the other rejects them all.
1360: The symbol REG_OK_STRICT causes the latter definition to be used.
1361:
1362: Most source files want to accept pseudo regs in the hope that
1363: they will get allocated to the class that the insn wants them to be in.
1364: Some source files that are used after register allocation
1365: need to be strict. */
1366:
1367: #ifndef REG_OK_STRICT
1368:
1.1.1.3 root 1369: #define REG_OK_FOR_INDEX_P(X) 1 /* ok if index or pseudo reg */
1370: #define REG_OK_FOR_BASE_P(X) 1 /* ok if base reg. of pseudo reg */
1.1 root 1371:
1372: #else
1373:
1374: #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
1.1.1.3 root 1375: #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
1.1 root 1376:
1377: #endif
1378:
1379:
1380: /* Maximum number of registers that can appear in a valid memory address. */
1381:
1382: #define MAX_REGS_PER_ADDRESS 1
1383:
1384: /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
1385: that is a valid memory address for an instruction.
1386: The MODE argument is the machine mode for the MEM expression
1387: that wants to use this address.
1388:
1389: The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS,
1390: except for CONSTANT_ADDRESS_P which is actually machine-independent. */
1391:
1392: /* 1 if X is an address that we could indirect through. */
1393: #define INDIRECTABLE_ADDRESS_P(X) \
1394: (CONSTANT_ADDRESS_P (X) \
1395: || (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) \
1396: || (GET_CODE (X) == PLUS \
1.1.1.3 root 1397: && ((xplus0 = XEXP (X, 0)), \
1398: (xplus1 = XEXP (X, 1)), \
1399: ((GET_CODE (xplus0) != REG && GET_CODE (xplus1) == REG) \
1400: ? ((xplus0 = XEXP (X, 1)), (xplus1 = XEXP (X, 0))) \
1401: : 0), \
1402: GET_CODE (xplus0) == REG) \
1403: && REG_OK_FOR_BASE_P (xplus0) \
1404: && ((GET_CODE (xplus1) == CONST_INT && SMALL_INT (xplus1)) \
1405: || (GET_CODE (xplus1) == LABEL_REF) \
1406: || (GET_CODE (xplus1) == SYMBOL_REF) \
1407: || (GET_CODE (xplus1) == CONST) \
1408: || (xplus0 == stack_pointer_rtx \
1409: && (GET_CODE (xplus1) == CONST || (GET_CODE (xplus1) == SYMBOL_REF))))))
1410:
1411:
1412: #if 1
1413: extern void trace ();
1414: #define GO_PRINTF(x) trace(x)
1415: #define GO_DEBUG_RTX(x) debug_rtx(x)
1.1 root 1416:
1.1.1.3 root 1417: #else
1418: #define GO_PRINTF(x)
1419: #define GO_DEBUG_RTX(x)
1420: #endif
1.1 root 1421:
1422: /* Go to ADDR if X is a valid address not using indexing.
1423: (This much is the easy part.) */
1424: #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
1.1.1.3 root 1425: { \
1426: register rtx xinsn = (X); \
1427: register rtx xplus0, xplus1; \
1428: \
1429: if (TARGET_DEBUGB_MODE) \
1430: { \
1431: GO_PRINTF ("\n==================== GO_IF_LEGITIMATE_ADDRESS\n"); \
1432: GO_DEBUG_RTX (xinsn); \
1433: } \
1434: \
1435: if (GET_CODE (xinsn) == REG) goto ADDR; \
1436: if (INDIRECTABLE_ADDRESS_P (xinsn)) goto ADDR; \
1437: \
1438: if (TARGET_DEBUGB_MODE) \
1439: GO_PRINTF ("Not a legitimate address\n"); \
1440: }
1.1 root 1441:
1442:
1.1.1.3 root 1443: #define CONSTANT_ADDRESS_P(X) CONSTANT_P (X)
1.1 root 1444:
1445:
1446: /* Nonzero if the constant value X is a legitimate general operand.
1447: It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE.
1448:
1.1.1.3 root 1449: At present, GAS doesn't understand li.[sd], so don't allow it
1450: to be generated at present. Also, the MIPS assembler does not
1451: grok li.d Infinity. */
1.1 root 1452:
1.1.1.3 root 1453: #define LEGITIMATE_CONSTANT_P(X) (GET_CODE (X) != CONST_DOUBLE)
1.1 root 1454:
1455: /* Try machine-dependent ways of modifying an illegitimate address
1456: to be legitimate. If we find one, return the new, valid address.
1457: This macro is used in only one place: `memory_address' in explow.c.
1458:
1459: OLDX is the address as it was before break_out_memory_refs was called.
1460: In some cases it is useful to look at this to decide what needs to be done.
1461:
1462: MODE and WIN are passed so that this macro can use
1463: GO_IF_LEGITIMATE_ADDRESS.
1464:
1465: It is always safe for this macro to do nothing. It exists to recognize
1466: opportunities to optimize the output.
1467:
1468: For the MIPS (so far ..), nothing needs to be done.
1469:
1470: ACHTUNG this is actually used by the FLOW analysis to get rid
1471: of statements....
1472:
1473: */
1474:
1.1.1.3 root 1475: #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) {}
1.1 root 1476:
1477: /* Go to LABEL if ADDR (a legitimate address expression)
1.1.1.3 root 1478: has an effect that depends on the machine mode it is used for. */
1.1 root 1479:
1.1.1.3 root 1480: #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) {}
1.1 root 1481:
1.1.1.3 root 1482:
1.1 root 1483: /* Specify the machine mode that this machine uses
1484: for the index in the tablejump instruction. */
1485: #define CASE_VECTOR_MODE SImode
1486:
1487: /* Define this if the tablejump instruction expects the table
1488: to contain offsets from the address of the table.
1489: Do not define this if the table should contain absolute addresses. */
1490: /* #define CASE_VECTOR_PC_RELATIVE */
1491:
1492: /* Specify the tree operation to be used to convert reals to integers. */
1493: #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
1494:
1495: /* This is the kind of divide that is easiest to do in the general case. */
1496: #define EASY_DIV_EXPR TRUNC_DIV_EXPR
1497:
1498: /* Define this as 1 if `char' should by default be signed; else as 0. */
1499: #define DEFAULT_SIGNED_CHAR 1
1500:
1501: /* Max number of bytes we can move from memory to memory
1502: in one reasonably fast instruction. */
1503: #define MOVE_MAX 4
1504:
1505: /* Nonzero if access to memory by bytes is slow and undesirable. */
1506: #define SLOW_BYTE_ACCESS 0
1507:
1508: /* We assume that the store-condition-codes instructions store 0 for false
1509: and some other value for true. This is the value stored for true. */
1510:
1511: #define STORE_FLAG_VALUE 1
1512:
1.1.1.3 root 1513: /* Declarations for condition code stuff. */
1514: extern void compare_collect ();
1515: extern void compare_restore ();
1516:
1.1 root 1517: /* Define this if zero-extension is slow (more than one real instruction). */
1518: #define SLOW_ZERO_EXTEND
1519:
1520: /* Define if shifts truncate the shift count
1521: which implies one can omit a sign-extension or zero-extension
1522: of a shift count.
1523:
1524: Only 5 bits are used in SLLV and SRLV
1525: */
1526: #define SHIFT_COUNT_TRUNCATED
1527:
1528:
1529: /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
1530: is done just by pretending it is already truncated. */
1531: #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
1532:
1533: /* Specify the machine mode that pointers have.
1534: After generation of rtl, the compiler makes no further distinction
1535: between pointers and any other objects of this machine mode. */
1536: #define Pmode SImode
1537:
1538: /* A function address in a call instruction
1539: is a word address (for indexing purposes)
1540: so give the MEM rtx a words's mode. */
1541:
1542: #define FUNCTION_MODE SImode
1543:
1.1.1.4 ! root 1544: /* Define TARGET_MEM_FUNCTIONS if we want to use calls to memcpy and
! 1545: memset, instead of the BSD functions bcopy and bzero. */
! 1546:
! 1547: #if defined(MIPS_SYSV) || defined(OSF_OS)
! 1548: #define TARGET_MEM_FUNCTIONS
! 1549: #endif
! 1550:
1.1 root 1551: /* Compute the cost of computing a constant rtl expression RTX
1552: whose rtx-code is CODE. The body of this macro is a portion
1553: of a switch statement. If the code is computed here,
1554: return it with a return statement. Otherwise, break from the switch. */
1555:
1556: #define CONST_COSTS(RTX,CODE) \
1557: case CONST_INT: \
1558: /* Constant zero is super cheap due to register 0. */ \
1559: if (RTX == const0_rtx) return 0; \
1560: if ((INTVAL (RTX) < 0x7fff) && (- INTVAL(RTX) < 0x7fff)) return 1; \
1561: case CONST: \
1562: case LABEL_REF: \
1563: case SYMBOL_REF: \
1564: return 3; \
1565: case CONST_DOUBLE: \
1566: return 5;
1.1.1.3 root 1567:
1568: /* Used in by the peephole code. */
1569: #define additive_op(op,mode) (GET_CODE (op) == PLUS || GET_CODE (op) == MINUS)
1570:
1.1 root 1571:
1572: /* Tell final.c how to eliminate redundant test instructions. */
1573:
1574: /* Here we define machine-dependent flags and fields in cc_status
1575: (see `conditions.h'). No extra ones are needed for the vax. */
1576: /* Tell final.c how to eliminate redundant test instructions. */
1577:
1578: /* Tell final.c how to eliminate redundant test instructions. */
1579:
1580: /* Here we define machine-dependent flags and fields in cc_status
1581: (see `conditions.h'). No extra ones are needed for the vax. */
1582:
1583: /* Store in cc_status the expressions
1584: that the condition codes will describe
1585: after execution of an instruction whose pattern is EXP.
1586: Do not alter them if the instruction would not alter the cc's. */
1587:
1588: #define NOTICE_UPDATE_CC(EXP, INSN) \
1589: CC_STATUS_INIT;
1590:
1591:
1592: /* Here we define machine-dependent flags and fields in cc_status
1593: (see `conditions.h'). */
1594:
1595:
1596: /* Control the assembler format that we output. */
1597:
1.1.1.3 root 1598: /* Output at beginning of assembler file.
1599: If we are optimizing to use the global pointer, create a temporary
1600: file to hold all of the text stuff, and write it out to the end.
1601: This is needed because the MIPS assembler is evidently one pass,
1602: and if it hasn't seen the relevant .comm/.lcomm/.extern/.sdata
1603: declaration when the code is processed, it generates a two
1604: instruction sequence. */
1.1 root 1605:
1.1.1.4 ! root 1606: extern void mips_asm_file_start ();
! 1607:
! 1608: #define ASM_FILE_START(STREAM) mips_asm_file_start (STREAM)
1.1 root 1609:
1610: /* Output to assembler file text saying following lines
1611: may contain character constants, extra white space, comments, etc. */
1612:
1613: #define ASM_APP_ON " #APP\n"
1614:
1615: /* Output to assembler file text saying following lines
1616: no longer contain unusual constructs. */
1617:
1618: #define ASM_APP_OFF " #NO_APP\n"
1619:
1620: /* How to refer to registers in assembler output.
1621: This sequence is indexed by compiler's hard-register-number (see above). */
1622:
1623: #define REGISTER_NAMES \
1624: {"$0", "at", "v0", "v1", "a0", "a1", "a2", "a3", "t0", \
1625: "t1", "t2", "t3", "t4", "t5", "t6", "t7","s0", \
1626: "s1","s2","s3","s4","s5","s6","s7","t8","t9", \
1627: "k0","k1","gp","sp","fp","ra", \
1628: "$f0","$f1","$f2","$f3","$f4","$f5","$f6","$f7","$f8","$f9", \
1629: "$f10","$f11","$f12","$f13","$f14","$f15","$f16","$f17","$f18","$f19", \
1630: "$f20","$f21","$f22","$f23","$f24","$f25","$f26","$f27","$f28","$f29", \
1631: "$f30","$f31" \
1632: }
1633: #define REGISTER_NUMCHAR \
1634: { \
1635: "$0","$1","$2","$3","$4","$5","$6","$7","$8","$9", \
1636: "$10","$11","$12","$13","$14","$15","$16","$17","$18","$19", \
1.1.1.3 root 1637: "$20","$21","$22","$23","$24","$25","$26","$27","$28","$sp", \
1638: "$fp","$31", \
1.1 root 1639: "$f0","$f1","$f2","$f3","$f4","$f5","$f6","$f7","$f8","$f9", \
1640: "$f10","$f11","$f12","$f13","$f14","$f15","$f16","$f17","$f18","$f19", \
1641: "$f20","$f21","$f22","$f23","$f24","$f25","$f26","$f27","$f28","$f29", \
1642: "$f30","$f31" \
1643: }
1644:
1.1.1.3 root 1645: #define REG_NAME(reg) (TARGET_NAME_REGS ? reg_names[reg] : reg_numchar[reg])
1.1 root 1646:
1647:
1648: /* Define results of standard character escape sequences. */
1649: #define TARGET_BELL 007
1650: #define TARGET_BS 010
1651: #define TARGET_TAB 011
1652: #define TARGET_NEWLINE 012
1653: #define TARGET_VT 013
1654: #define TARGET_FF 014
1655: #define TARGET_CR 015
1656:
1657:
1658: /* Print an instruction operand X on file FILE.
1659: CODE is the code from the %-spec that requested printing this operand;
1660: if `%z3' was used to print operand 3, then CODE is 'z'.
1661: CODE is used as follows:
1662:
1.1.1.3 root 1663: LIST OF PRINT OPERAND CODES:
1.1 root 1664:
1.1.1.3 root 1665: 'x' X is CONST_INT, prints 16 bits in hex format.
1666: 'd' output integer constant in decimal,
1667: ':' Prints an 'u' if flag -mnofixed-ovfl (for addu vs. add) */
1.1 root 1668:
1669: #define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
1670: ((CODE) == ':')
1671:
1672: #define PRINT_OPERAND(FILE, X, CODE) \
1.1.1.3 root 1673: { \
1674: if ((CODE) == ':') \
1675: { \
1676: if (TARGET_NOFIXED_OVFL) \
1677: fprintf(FILE,"u"); \
1678: } \
1679: \
1.1 root 1680: else if (GET_CODE (X) == REG) \
1.1.1.3 root 1681: { \
1682: int regnum = REGNO (X); \
1683: \
1684: if (CODE == 'M') \
1685: regnum += MOST_SIGNIFICANT_WORD; \
1686: else if (CODE == 'L') \
1687: regnum += LEAST_SIGNIFICANT_WORD; \
1688: else if (CODE == 'D') \
1689: regnum++; \
1690: \
1691: fprintf (FILE, "%s", \
1692: ((TARGET_NAME_REGS) ? reg_names : reg_numchar)[regnum]); \
1.1 root 1693: } \
1.1.1.3 root 1694: \
1695: else if (GET_CODE (X) == MEM) \
1696: output_address (XEXP (X, 0)); \
1697: \
1698: else if (GET_CODE (X) == CONST_DOUBLE) \
1.1 root 1699: { \
1.1.1.3 root 1700: union { double d; int i[2]; } u; \
1701: u.i[0] = CONST_DOUBLE_LOW (X); \
1702: u.i[1] = CONST_DOUBLE_HIGH (X); \
1703: if (GET_MODE (X) == SFmode) \
1704: { \
1705: float f; \
1706: f = u.d; \
1707: u.d = f; \
1708: } \
1709: fprintf (FILE, "%.20e", u.d); \
1710: } \
1711: \
1712: else if ((CODE == 'x') && (GET_CODE(X) == CONST_INT)) \
1713: fprintf(FILE,"0x%x", 0xffff & (INTVAL(X))); \
1714: \
1715: else if ((CODE == 'd') && (GET_CODE(X) == CONST_INT)) \
1716: fprintf(FILE,"%d", (INTVAL(X))); \
1717: \
1718: else if ((CODE) == 'd') \
1719: fatal ("Code d was found & insn was not CONST_INT"); \
1720: \
1721: else \
1722: output_addr_const (FILE, X); \
1723: }
1724:
1.1 root 1725:
1726: /* Print a memory operand whose address is X, on file FILE. */
1727:
1728: #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
1.1.1.3 root 1729: { \
1730: register rtx addr = ADDR; \
1731: register char **reg_ptr = (TARGET_NAME_REGS) ? reg_names : reg_numchar; \
1732: \
1.1 root 1733: switch (GET_CODE (addr)) \
1734: { \
1.1.1.3 root 1735: default: \
1736: abort_with_insn (addr, "PRINT_OPERAND_ADDRESS, illegal insn #1"); \
1.1 root 1737: break; \
1.1.1.3 root 1738: \
1739: case REG: \
1740: fprintf (FILE, "0(%s)", reg_ptr [REGNO (addr)]); \
1.1 root 1741: break; \
1.1.1.3 root 1742: \
1.1 root 1743: case PLUS: \
1.1.1.3 root 1744: { \
1745: register rtx reg = (rtx)0; \
1746: register rtx offset = (rtx)0; \
1747: register rtx arg0 = XEXP (addr, 0); \
1748: register rtx arg1 = XEXP (addr, 1); \
1749: \
1750: if (GET_CODE (arg0) == REG) \
1751: { \
1752: reg = arg0; \
1753: offset = arg1; \
1754: if (GET_CODE (offset) == REG) \
1755: abort_with_insn (addr, "PRINT_OPERAND_ADDRESS, 2 regs"); \
1756: } \
1757: else if (GET_CODE (arg1) == REG) \
1758: { \
1759: reg = arg1; \
1760: offset = arg0; \
1761: } \
1762: else if (CONSTANT_P (arg0) && CONSTANT_P (arg1)) \
1763: { \
1764: output_addr_const (FILE, addr); \
1765: break; \
1766: } \
1767: else \
1768: abort_with_insn (addr, "PRINT_OPERAND_ADDRESS, no regs"); \
1769: \
1770: if (!CONSTANT_P (offset)) \
1771: abort_with_insn (addr, "PRINT_OPERAND_ADDRESS, illegal insn #2"); \
1772: \
1773: output_addr_const (FILE, offset); \
1774: fprintf (FILE, "(%s)", reg_ptr [REGNO (reg)]); \
1775: } \
1.1 root 1776: break; \
1.1.1.3 root 1777: \
1778: case LABEL_REF: \
1779: case SYMBOL_REF: \
1780: case CONST_INT: \
1781: case CONST: \
1.1 root 1782: output_addr_const (FILE, addr); \
1.1.1.3 root 1783: break; \
1784: } \
1785: }
1786:
1.1 root 1787:
1.1.1.3 root 1788: /* How to tell the debugger about changes of source files. Note, the
1789: mips ECOFF format cannot deal with changes of files inside of
1790: functions, which means the output of parser generators like bison
1791: is generally not debuggable without using the -l switch. Lose,
1792: lose, lose. Silicon graphics seems to want all .file's hardwired
1793: to 1. */
1.1 root 1794:
1.1.1.3 root 1795: #ifndef SET_FILE_NUMBER
1796: #define SET_FILE_NUMBER() ++num_source_filenames
1797: #endif
1798:
1799: #define ASM_OUTPUT_SOURCE_FILENAME(STREAM, NAME) \
1800: { \
1801: SET_FILE_NUMBER (); \
1802: fprintf (STREAM, "\t%s.file\t%d \"%s\"\n", \
1803: (TARGET_GAS || !inside_function) ? "" : "#", \
1804: num_source_filenames, NAME); \
1805: }
1806:
1807: /* This is how to output a note the debugger telling it the line number
1.1 root 1808: to which the following sequence of instructions corresponds.
1.1.1.3 root 1809: Silicon graphics puts a label after each .loc. */
1810:
1811: #ifndef LABEL_AFTER_LOC
1812: #define LABEL_AFTER_LOC(STREAM)
1813: #endif
1.1 root 1814:
1.1.1.3 root 1815: #define ASM_OUTPUT_SOURCE_LINE(STREAM, LINE) \
1816: { \
1817: fprintf (STREAM, "\n\t.loc\t%d %d\n", num_source_filenames, LINE); \
1818: LABEL_AFTER_LOC (STREAM); \
1819: }
1820:
1821: /* The MIPS implementation uses some labels for it's own purposed. The
1822: following lists what labels are created, and are all formed by the
1823: pattern $L[a-z].*. The machine independent portion of GCC creates
1824: labels matching: $L[A-Z][0-9]+ and $L[0-9]+.
1825:
1826: LM[0-9]+ Sillicon graphics label before each stmt.
1827: $Lb[0-9]+ Begin blocks for MIPS debug support
1828: $Ldtable Beginning of the PIC data table
1829: $Le[0-9]+ End blocks for MIPS debug support
1830: $Ls[0-9]+ FP-SP difference if -fomit-frame-pointer */
1.1 root 1831:
1832: /* This is how to output the definition of a user-level label named NAME,
1.1.1.3 root 1833: such as the label on a static function or variable NAME.
1.1 root 1834:
1.1.1.3 root 1835: If we are optimizing the gp, remember that this label has been put
1836: out, so we know not to emit an .extern for it in mips_asm_file_end.
1837: We use one of the common bits in the IDENTIFIER tree node for this,
1838: since those bits seem to be unused, and we don't have any method
1839: of getting the decl nodes from the name. */
1840:
1841: #ifndef COLLECT
1842: #define ASM_OUTPUT_LABEL(STREAM,NAME) \
1843: do { \
1844: assemble_name (STREAM, NAME); \
1845: fputs (":\n", STREAM); \
1846: \
1847: if (TARGET_GP_OPT && mips_section_threshold != 0) \
1848: { \
1849: tree name_tree = get_identifier (NAME); \
1850: TREE_ADDRESSABLE (name_tree) = 1; \
1851: } \
1852: } while (0)
1853:
1854: #else
1855: #define ASM_OUTPUT_LABEL(STREAM,NAME) \
1856: do { \
1857: assemble_name (STREAM, NAME); \
1858: fputs (":\n", STREAM); \
1859: } while (0)
1860: #endif
1.1 root 1861:
1862: /* This is how to output a command to make the user-level label named NAME
1863: defined for reference from other files. */
1864:
1.1.1.3 root 1865: #define ASM_GLOBALIZE_LABEL(STREAM,NAME) \
1866: do { \
1867: fputs ("\t.globl\t", STREAM); \
1868: assemble_name (STREAM, NAME); \
1869: fputs ("\n", STREAM); \
1870: } while (0)
1871:
1872: /* This says how to output an assembler line
1873: to define a global common symbol. */
1874:
1875: #define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED) \
1876: do { \
1877: fputs ("\n\t.comm\t", (STREAM)); \
1878: assemble_name ((STREAM), (NAME)); \
1879: fprintf ((STREAM), ",%u\n", (ROUNDED)); \
1880: \
1881: if (TARGET_GP_OPT && mips_section_threshold != 0) \
1882: { \
1883: tree name_tree = get_identifier (NAME); \
1884: TREE_ADDRESSABLE (name_tree) = 1; \
1885: } \
1886: } while (0)
1887:
1888: /* This says how to output an assembler line
1889: to define a local common symbol. */
1890:
1891: #define ASM_OUTPUT_LOCAL(STREAM, NAME, SIZE, ROUNDED) \
1892: do { \
1893: fputs ("\n\t.lcomm\t", (STREAM)); \
1894: assemble_name ((STREAM), (NAME)); \
1895: fprintf ((STREAM), ",%u\n", (ROUNDED)); \
1896: \
1897: if (TARGET_GP_OPT && mips_section_threshold != 0) \
1898: { \
1899: tree name_tree = get_identifier (NAME); \
1900: TREE_ADDRESSABLE (name_tree) = 1; \
1901: } \
1902: } while (0)
1903:
1904:
1905: /* This says how to output an external. It would be possible not to
1906: output anything and let undefined symbol become external. However
1907: the assembler uses length information on externals to allocate in
1908: data/sdata bss/sbss, thereby saving exec time. */
1909:
1910: #define ASM_OUTPUT_EXTERNAL(STREAM,DECL,NAME) \
1911: mips_output_external(STREAM,DECL,NAME)
1912:
1913: /* This says what to print at the end of the assembly file */
1914: #define ASM_FILE_END(STREAM) mips_asm_file_end(STREAM)
1915:
1.1 root 1916:
1.1.1.3 root 1917: /* This is how to declare a function name. The actual work of
1918: emitting the label is moved to function_prologue, so that we can
1919: get the line number correctly emitted before the .ent directive,
1920: and after any .file directives.
1921:
1922: Also, switch files if we are optimizing the global pointer. */
1923:
1924: #define ASM_DECLARE_FUNCTION_NAME(STREAM,NAME,DECL) \
1925: { \
1926: extern FILE *asm_out_text_file; \
1927: if (TARGET_GP_OPT) \
1928: STREAM = asm_out_text_file; \
1929: \
1.1 root 1930: current_function_name = NAME; \
1.1.1.3 root 1931: }
1.1 root 1932:
1933: /* This is how to output a reference to a user-level label named NAME.
1934: `assemble_name' uses this. */
1935:
1.1.1.3 root 1936: #define ASM_OUTPUT_LABELREF(STREAM,NAME) \
1937: fprintf (STREAM, "%s", NAME)
1.1 root 1938:
1939: /* This is how to output an internal numbered label where
1940: PREFIX is the class of label and NUM is the number within the class. */
1941:
1.1.1.3 root 1942: #define ASM_OUTPUT_INTERNAL_LABEL(STREAM,PREFIX,NUM) \
1943: fprintf (STREAM, "$%s%d:\n", PREFIX, NUM)
1.1 root 1944:
1945: /* This is how to store into the string LABEL
1946: the symbol_ref name of an internal numbered label where
1947: PREFIX is the class of label and NUM is the number within the class.
1948: This is suitable for output with `assemble_name'. */
1949:
1950: #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
1.1.1.2 root 1951: sprintf (LABEL, "*$%s%d", PREFIX, NUM)
1.1 root 1952:
1953: /* This is how to output an assembler line defining a `double' constant. */
1954:
1.1.1.3 root 1955: #define ASM_OUTPUT_DOUBLE(STREAM,VALUE) \
1956: { \
1957: union { double d; long l[2]; } u2; \
1958: u2.d = VALUE; \
1959: fprintf (STREAM, "\t.word\t0x%08lx\t\t# %.20g\n\t.word\t0x%08lx\n", \
1960: u2.l[0], u2.d, u2.l[1]); \
1961: }
1.1 root 1962:
1963: /* This is how to output an assembler line defining a `float' constant. */
1964:
1.1.1.3 root 1965: #define ASM_OUTPUT_FLOAT(STREAM,VALUE) \
1966: { \
1967: union { float f; long l; } u2; \
1968: u2.f = VALUE; \
1969: fprintf (STREAM, "\t.word\t0x%08lx\t\t# %.12g\n", u2.l, u2.f); \
1970: }
1.1 root 1971:
1972: /* This is how to output an assembler line defining an `int' constant. */
1973:
1.1.1.3 root 1974: #define ASM_OUTPUT_INT(STREAM,VALUE) \
1975: { \
1976: fprintf (STREAM, "\t.word\t"); \
1977: output_addr_const (STREAM, (VALUE)); \
1978: fprintf (STREAM, "\n"); \
1979: }
1.1 root 1980:
1981: /* Likewise for `char' and `short' constants. */
1982:
1.1.1.3 root 1983: #define ASM_OUTPUT_SHORT(STREAM,VALUE) \
1984: { \
1985: fprintf (STREAM, "\t.half\t"); \
1986: output_addr_const (STREAM, (VALUE)); \
1987: fprintf (STREAM, "\n"); \
1988: }
1989:
1990: #define ASM_OUTPUT_CHAR(STREAM,VALUE) \
1991: { \
1992: fprintf (STREAM, "\t.byte\t"); \
1993: output_addr_const (STREAM, (VALUE)); \
1994: fprintf (STREAM, "\n"); \
1995: }
1996:
1997: /* This is how to output an assembler line defining an `int' constant,
1998: which is not in tree format (for collect.c). */
1999:
2000: #define ASM_OUTPUT_INT_CONST(STREAM,VALUE) \
2001: fprintf(STREAM, "\t.word\t%d\n", VALUE)
2002:
2003: /* This is how to output an assembler line defining an external/static
2004: address which is not in tree format (for collect.c). */
2005:
2006: #define ASM_OUTPUT_PTR_INT_SUM(STREAM, NAME, VALUE) \
2007: do { \
2008: fprintf (STREAM, "\t.word\t"); \
2009: ASM_OUTPUT_LABELREF (STREAM, NAME); \
2010: fprintf (STREAM, "+%d\n", VALUE); \
2011: } while (0)
2012:
2013: #define ASM_OUTPUT_LABELREF_AS_INT(STREAM, NAME) \
2014: do { \
2015: fprintf (STREAM, "\t.word\t"); \
2016: ASM_OUTPUT_LABELREF (STREAM, NAME); \
2017: fprintf (STREAM, "\n"); \
2018: } while (0)
1.1 root 2019:
2020: /* This is how to output an assembler line for a numeric constant byte. */
2021:
1.1.1.3 root 2022: #define ASM_OUTPUT_BYTE(STREAM,VALUE) \
2023: { \
2024: fprintf (STREAM, "\t.byte\t0x%x\n", (VALUE)); \
2025: }
1.1 root 2026:
2027: /* This is how to output an element of a case-vector that is absolute. */
2028:
1.1.1.3 root 2029: #define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \
2030: { \
2031: fprintf (STREAM, "\t.word\t$L%d\n", VALUE); \
2032: }
1.1 root 2033:
2034: /* This is how to output an element of a case-vector that is relative.
2035: (We do not use such vectors,
2036: but we must define this macro anyway.) */
2037:
1.1.1.3 root 2038: #define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM, VALUE, REL) \
2039: { \
2040: fprintf (STREAM, "\t.word\t$L%d-$L%d\n", VALUE, REL); \
2041: }
2042:
2043: /* This is how to emit the initial label for switch statements. We
2044: need to put the switch labels somewhere else from the text section,
2045: because the MIPS assembler gets real confused about line numbers if
2046: .word's appear in the text section. */
2047:
2048: #define ASM_OUTPUT_CASE_LABEL(STREAM, PREFIX, NUM, JUMPTABLE) \
2049: { \
2050: rdata_section (); \
2051: ASM_OUTPUT_ALIGN (STREAM, 2); \
2052: ASM_OUTPUT_INTERNAL_LABEL (STREAM, PREFIX, NUM); \
2053: }
2054:
2055: /* Output at the end of a switch's jump table. */
2056:
2057: #define ASM_OUTPUT_CASE_END(STREAM, NUM, INSN) \
2058: { \
2059: text_section (); \
2060: }
1.1 root 2061:
2062: /* This is how to output an assembler line
2063: that says to advance the location counter
2064: to a multiple of 2**LOG bytes. */
2065:
1.1.1.3 root 2066: #define ASM_OUTPUT_ALIGN(STREAM,LOG) \
2067: { \
2068: int mask = (1 << (LOG)) - 1; \
2069: fprintf (STREAM, "\t.align\t%d\n", (LOG)); \
2070: }
2071:
2072: /* This is how to output an assembler line to to advance the location
2073: counter by SIZE bytes. */
2074: #define ASM_OUTPUT_SKIP(STREAM,SIZE) \
2075: { \
2076: fprintf (STREAM, "\t.space\t%u\n", (SIZE)); \
2077: }
2078:
2079: /* This is how to output a string. */
2080: #define ASM_OUTPUT_ASCII(STREAM, STRING, LEN) \
2081: do { \
2082: register int i, c, len = LEN, cur_pos = 17; \
2083: register unsigned char *string = (unsigned char *)STRING; \
2084: fprintf (STREAM, "\t.ascii\t\""); \
2085: for (i = 0; i < len; i++) \
2086: { \
2087: register int c = string[i]; \
2088: \
2089: switch (c) \
2090: { \
2091: case '\"': \
2092: case '\\': \
2093: putc ('\\', STREAM); \
2094: putc (c, STREAM); \
2095: cur_pos += 2; \
2096: break; \
2097: \
2098: case TARGET_NEWLINE: \
2099: fputs ("\\n", STREAM); \
2100: if (i+1 < len \
2101: && (((c = string[i+1]) >= '\040' && c <= '~') \
2102: || c == TARGET_TAB)) \
2103: cur_pos = 32767; /* break right here */ \
2104: else \
2105: cur_pos += 2; \
2106: break; \
2107: \
2108: case TARGET_TAB: \
2109: fputs ("\\t", STREAM); \
2110: cur_pos += 2; \
2111: break; \
2112: \
2113: case TARGET_FF: \
2114: fputs ("\\f", STREAM); \
2115: cur_pos += 2; \
2116: break; \
2117: \
2118: case TARGET_BS: \
2119: fputs ("\\b", STREAM); \
2120: cur_pos += 2; \
2121: break; \
2122: \
2123: case TARGET_CR: \
2124: fputs ("\\r", STREAM); \
2125: cur_pos += 2; \
2126: break; \
2127: \
2128: default: \
2129: if (c >= ' ' && c < 0177) \
2130: { \
2131: putc (c, STREAM); \
2132: cur_pos++; \
2133: } \
2134: else \
2135: { \
2136: fprintf (STREAM, "\\%03o", c); \
2137: cur_pos += 4; \
2138: } \
2139: } \
2140: \
2141: if (cur_pos > 72 && i+1 < len) \
2142: { \
2143: cur_pos = 17; \
2144: fprintf (STREAM, "\"\n\t.ascii\t\""); \
2145: } \
2146: } \
2147: fprintf (STREAM, "\"\n"); \
2148: } while (0)
2149:
2150: /* Handle certain cpp directives used in header files on sysV. */
2151: #define SCCS_DIRECTIVE
1.1 root 2152:
1.1.1.3 root 2153: /* Output #ident as a in the read-only data section. */
2154: #define ASM_OUTPUT_IDENT(FILE, STRING) \
2155: { \
2156: char *p = STRING; \
2157: int size = strlen (p) + 1; \
2158: rdata_section (); \
2159: assemble_string (p, size); \
2160: }
1.1 root 2161:
2162:
1.1.1.3 root 2163: /* Output before read-only data. */
1.1 root 2164:
1.1.1.3 root 2165: #define TEXT_SECTION_ASM_OP "\t.text"
1.1 root 2166:
1.1.1.3 root 2167: /* Output before writable data. */
2168:
2169: #define DATA_SECTION_ASM_OP "\t.data"
2170:
2171: /* Output before writable short data. */
2172:
2173: #define SDATA_SECTION_ASM_OP "\t.sdata"
2174:
2175: /* Output before read-only data. */
2176:
2177: #define RDATA_SECTION_ASM_OP "\t.rdata"
2178:
2179: /* What other sections we support other than the normal .data/.text. */
2180:
2181: #define EXTRA_SECTIONS in_sdata, in_rdata, in_last_p1
1.1 root 2182:
2183: /* Define the additional functions to select our additional sections. */
2184:
1.1.1.3 root 2185: /* on the MIPS it is not a good idea to put constants in the text
2186: section, since this defeats the sdata/data mechanism. This is
2187: especially true when -O is used. In this case an effort is made to
2188: address with faster (gp) register relative addressing, which can
2189: only get at sdata and sbss items (there is no stext !!) However,
2190: if the constant is too large for sdata, and it's readonly, it
2191: will go into the .rdata section. */
2192:
1.1 root 2193: #define EXTRA_SECTION_FUNCTIONS \
2194: void \
2195: sdata_section () \
2196: { \
2197: if (in_section != in_sdata) \
2198: { \
2199: fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \
2200: in_section = in_sdata; \
1.1.1.3 root 2201: } \
2202: } \
2203: \
2204: void \
2205: rdata_section () \
2206: { \
2207: if (in_section != in_rdata) \
2208: { \
2209: fprintf (asm_out_file, "%s\n", RDATA_SECTION_ASM_OP); \
2210: in_section = in_rdata; \
2211: } \
1.1 root 2212: }
2213:
2214: /* Given a decl node or constant node, choose the section to output it in
2215: and select that section. */
2216:
2217: #define SELECT_SECTION_MODE(MODE,RTX) \
2218: { \
2219: extern int mips_section_threshold; \
1.1.1.3 root 2220: if ((GET_MODE_SIZE(MODE) / BITS_PER_UNIT) <= mips_section_threshold \
2221: && mips_section_threshold > 0) \
2222: sdata_section (); \
2223: else \
2224: rdata_section (); \
1.1 root 2225: } \
2226:
2227: #define SELECT_SECTION(DECL) \
2228: { \
2229: extern int mips_section_threshold; \
1.1.1.3 root 2230: if (int_size_in_bytes (TREE_TYPE (DECL)) <= mips_section_threshold \
2231: && mips_section_threshold > 0) \
2232: sdata_section (); \
2233: else if (TREE_CODE (DECL) == STRING_CST) \
2234: { \
2235: if (flag_writable_strings) \
2236: data_section (); \
2237: else \
2238: rdata_section (); \
2239: } \
2240: else if (TREE_CODE (DECL) != VAR_DECL) \
2241: rdata_section (); \
2242: else if (!TREE_READONLY (DECL) || TREE_VOLATILE (DECL)) \
2243: data_section (); \
2244: else \
2245: rdata_section (); \
1.1 root 2246: }
2247:
2248:
2249: /* Store in OUTPUT a string (made with alloca) containing
2250: an assembler-name for a local static variable named NAME.
2251: LABELNO is an integer which is different for each call. */
2252:
2253: #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
2254: ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
2255: sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
2256:
1.1.1.3 root 2257: #define ASM_OUTPUT_REG_POP(STREAM,REGNO) \
2258: do { \
2259: extern char *reg_numchar[]; \
2260: char **reg_name_ptr = (TARGET_NAME_REGS) ? reg_names : reg_numchar; \
2261: fprintf (STREAM, "\tsubu\t%s,%s,4\n\tsw\t%s,0(%s)\n", \
2262: reg_name_ptr[STACK_POINTER_REGNUM], \
2263: reg_name_ptr[STACK_POINTER_REGNUM], \
2264: reg_name_ptr[REGNO], \
2265: reg_name_ptr[STACK_POINTER_REGNUM]); \
2266: } while (0)
1.1 root 2267:
1.1.1.3 root 2268: #define ASM_OUTPUT_REG_PUSH(STREAM,REGNO) \
2269: do { \
2270: extern char *reg_numchar[]; \
2271: char **reg_name_ptr = (TARGET_NAME_REGS) ? reg_names : reg_numchar; \
2272: fprintf (STREAM, "\tlw\t%s,0(%s)\n\taddu\t%s,%s,4\n", \
2273: reg_name_ptr[REGNO], \
2274: reg_name_ptr[STACK_POINTER_REGNUM], \
2275: reg_name_ptr[STACK_POINTER_REGNUM], \
2276: reg_name_ptr[STACK_POINTER_REGNUM]); \
2277: } while (0)
1.1 root 2278:
2279:
2280: /* Define the parentheses used to group arithmetic operations
2281: in assembler code. */
2282:
2283: #define ASM_OPEN_PAREN "("
2284: #define ASM_CLOSE_PAREN ")"
2285:
1.1.1.3 root 2286:
2287: /* Tell G++'s collect that MIPS' based ports do not have leading
2288: underscores. */
2289:
2290: #ifndef NO_UNDERSCORES
2291: #define NO_UNDERSCORES
2292: #endif NO_UNDERSCORES
2293:
2294: /* Tell G++ that we need to run collect. */
2295:
2296: #ifndef USE_COLLECT
2297: #define USE_COLLECT
2298: #endif
2299:
2300: #ifndef EXTENDED_COFF
2301: #define EXTENDED_COFF
2302: #endif
2303:
2304: /* The following are for collect.c which has it's own idea of
2305: which macros should be used. */
1.1 root 2306:
2307: #define ASM_INT_OP ".word "
2308: #define ASM_SHORT_OP ".half "
2309: #define ASM_CHAR_OP ".byte "
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.