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