|
|
1.1 ! root 1: /* Definitions of target machine for GNU compiler. ! 2: Copyright (C) 1990, 1993 Free Software Foundation, Inc. ! 3: ! 4: Written by Robert Andersson, International Systems, Oslo, Norway. ! 5: Send bug reports, questions and improvements to [email protected]. ! 6: ! 7: For NCR Tower 32/4x0 and 32/6x0 running System V Release 3. ! 8: This file outputs assembler source suitable for the native Tower as ! 9: and with sdb debugging symbols. See tower.h for more comments. ! 10: ! 11: This file was based on m68k.h, hp320.h and 3b1.h ! 12: as of the 1.37.1 version. ! 13: ! 14: ! 15: This file is part of GNU CC. ! 16: ! 17: GNU CC is free software; you can redistribute it and/or modify ! 18: it under the terms of the GNU General Public License as published by ! 19: the Free Software Foundation; either version 2, or (at your option) ! 20: any later version. ! 21: ! 22: GNU CC is distributed in the hope that it will be useful, ! 23: but WITHOUT ANY WARRANTY; without even the implied warranty of ! 24: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! 25: GNU General Public License for more details. ! 26: ! 27: You should have received a copy of the GNU General Public License ! 28: along with GNU CC; see the file COPYING. If not, write to ! 29: the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ ! 30: ! 31: ! 32: #include "m68k/tower.h" ! 33: #undef SELECT_RTX_SECTION ! 34: ! 35: /* Use default settings for system V.3. */ ! 36: ! 37: #include "svr3.h" ! 38: ! 39: /* Names to predefine in the preprocessor for this target machine. */ ! 40: ! 41: #define CPP_PREDEFINES "-Dunix -Dtower32 -Dtower32_600" ! 42: ! 43: /* Define __HAVE_68881 in preprocessor only if -m68881 is specified. ! 44: This will control the use of inline 68881 insns in certain macros. ! 45: Also, define special define used to identify the Tower assembler. */ ! 46: ! 47: #define CPP_SPEC "-D__TOWER_ASM__ %{m68881:-D__HAVE_68881__}" ! 48: ! 49: /* We don't want local labels to start with period. ! 50: See ASM_OUTPUT_INTERNAL_LABEL. */ ! 51: #undef LOCAL_LABEL_PREFIX ! 52: #define LOCAL_LABEL_PREFIX "" ! 53: ! 54: /* These four macros control how m68k.md is expanded. */ ! 55: ! 56: #define MOTOROLA /* Use Motorola syntax rather than "MIT" */ ! 57: #define SGS /* Uses SGS assembler */ ! 58: #define SGS_CMP_ORDER /* Takes cmp operands in reverse order */ ! 59: #define SGS_NO_LI /* Suppress jump table label usage */ ! 60: ! 61: /* Turn on SDB debugging info. */ ! 62: ! 63: #define SDB_DEBUGGING_INFO ! 64: ! 65: /* This is only useful if gdb is changed, but doesn't harm anyway. */ ! 66: ! 67: #define ASM_IDENTIFY_GCC(FILE) \ ! 68: fprintf (FILE, "gcc2_compiled%%:\n") ! 69: ! 70: /* All the ASM_OUTPUT macros need to conform to the Tower as syntax. */ ! 71: ! 72: #define ASM_OUTPUT_SOURCE_FILENAME(FILE, FILENAME) \ ! 73: do { \ ! 74: fprintf (FILE, "\tfile\t\"%s\"\n", FILENAME); \ ! 75: fprintf (FILE, "section ~init,\"x\"\n"); \ ! 76: fprintf (FILE, "section ~fini,\"x\"\n"); \ ! 77: fprintf (FILE, "section ~rodata,\"x\"\n"); \ ! 78: fprintf (FILE, "text\n"); \ ! 79: } while (0) ! 80: ! 81: #define ASM_OUTPUT_SOURCE_LINE(FILE, LINENO) \ ! 82: fprintf (FILE, "\tln\t%d\n", \ ! 83: (sdb_begin_function_line \ ! 84: ? last_linenum - sdb_begin_function_line : 1)) ! 85: ! 86: #undef ASM_OUTPUT_IDENT ! 87: #define ASM_OUTPUT_IDENT(FILE, NAME) \ ! 88: fprintf (FILE, "\tident\t\"%s\" \n", NAME) ! 89: ! 90: #define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \ ! 91: { register int sp = 0, lp = 0; \ ! 92: fprintf ((FILE), "\tbyte\t"); \ ! 93: loop: \ ! 94: if ((PTR)[sp] > ' ' && ! ((PTR)[sp] & 0x80) && (PTR)[sp] != '\\') \ ! 95: { lp += 3; \ ! 96: fprintf ((FILE), "'%c", (PTR)[sp]); } \ ! 97: else \ ! 98: { lp += 5; \ ! 99: fprintf ((FILE), "0x%x", (PTR)[sp]); } \ ! 100: if (++sp < (LEN)) \ ! 101: { if (lp > 60) \ ! 102: { lp = 0; \ ! 103: fprintf ((FILE), "\n\tbyte\t"); } \ ! 104: else \ ! 105: putc (',', (FILE)); \ ! 106: goto loop; } \ ! 107: putc ('\n', (FILE)); } ! 108: ! 109: /* Translate Motorola opcodes such as `jbeq' ! 110: into SGS/Tower opcodes such as `beq.w'. ! 111: Change `move' to `mov'. ! 112: Change `cmpm' to `cmp'. ! 113: Change `divsl' to `tdivs'. ! 114: Change `divul' to `tdivu'. ! 115: Change `ftst' to `ftest'. ! 116: Change `fmove' to `fmov'. */ ! 117: ! 118: #define ASM_OUTPUT_OPCODE(FILE, PTR) \ ! 119: { if ((PTR)[0] == 'j' && (PTR)[1] == 'b') \ ! 120: { ++(PTR); \ ! 121: while (*(PTR) != ' ') \ ! 122: { putc (*(PTR), (FILE)); ++(PTR); } \ ! 123: fprintf ((FILE), ".w"); } \ ! 124: else if ((PTR)[0] == 'm' && (PTR)[1] == 'o' \ ! 125: && (PTR)[2] == 'v' && (PTR)[3] == 'e') \ ! 126: { fprintf ((FILE), "mov"); (PTR) += 4; } \ ! 127: else if ((PTR)[0] == 'c' && (PTR)[1] == 'm' \ ! 128: && (PTR)[2] == 'p' && (PTR)[3] == 'm') \ ! 129: { fprintf ((FILE), "cmp"); (PTR) += 4; } \ ! 130: else if ((PTR)[0] == 'd' && (PTR)[1] == 'i' \ ! 131: && (PTR)[2] == 'v' && (PTR)[3] == 's' \ ! 132: && (PTR)[4] == 'l') \ ! 133: { fprintf ((FILE), "tdivs"); (PTR) += 5; } \ ! 134: else if ((PTR)[0] == 'd' && (PTR)[1] == 'i' \ ! 135: && (PTR)[2] == 'v' && (PTR)[3] == 'u' \ ! 136: && (PTR)[4] == 'l') \ ! 137: { fprintf ((FILE), "tdivu"); (PTR) += 5; } \ ! 138: else if ((PTR)[0] == 'f' && (PTR)[1] == 't' \ ! 139: && (PTR)[2] == 's' && (PTR)[3] == 't') \ ! 140: { fprintf ((FILE), "ftest"); (PTR) += 4; } \ ! 141: else if ((PTR)[0] == 'f' && (PTR)[1] == 'm' \ ! 142: && (PTR)[2] == 'o' && (PTR)[3] == 'v' \ ! 143: && (PTR)[4] == 'e') \ ! 144: { fprintf ((FILE), "fmov"); (PTR) += 5; } \ ! 145: } ! 146: ! 147: ! 148: ! 149: /* Override parts of m68k.h to fit the Tower assembler. ! 150: This section needs to track changes done to m68k.h in the future. */ ! 151: ! 152: #undef TARGET_VERSION ! 153: #define TARGET_VERSION fprintf (stderr, " (68k, Motorola/SGS/Tower32 syntax)"); ! 154: ! 155: #undef FUNCTION_BLOCK_PROFILER ! 156: #define FUNCTION_BLOCK_PROFILER(FILE, LABELNO) \ ! 157: do { \ ! 158: char label1[20], label2[20]; \ ! 159: ASM_GENERATE_INTERNAL_LABEL (label1, "LPBX", 0); \ ! 160: ASM_GENERATE_INTERNAL_LABEL (label2, "LPI", LABELNO); \ ! 161: fprintf (FILE, "\ttst.l %s\n\tbne %s\n\tpea %s\n\tjsr __bb_init_func\n\taddq.l &4,%%sp\n", \ ! 162: label1, label2, label1); \ ! 163: ASM_OUTPUT_INTERNAL_LABEL (FILE, "LPI", LABELNO); \ ! 164: putc ('\n', FILE); \ ! 165: } while (0) ! 166: ! 167: #undef BLOCK_PROFILER ! 168: #define BLOCK_PROFILER(FILE, BLOCKNO) \ ! 169: do { \ ! 170: char label[20]; \ ! 171: ASM_GENERATE_INTERNAL_LABEL (label, "LPBX", 2); \ ! 172: fprintf (FILE, "\taddq.l &1,%s+%d\n", label, 4 * BLOCKNO); \ ! 173: } while (0) ! 174: ! 175: #undef FUNCTION_PROFILER ! 176: #define FUNCTION_PROFILER(FILE, LABEL_NO) \ ! 177: fprintf (FILE, "\tmov.l &LP%%%d,%%a0\n\tjsr mcount%%\n", (LABEL_NO)) ! 178: ! 179: /* The prologue is identical to the one in m68k.h except that the ! 180: assembler syntax is different. */ ! 181: ! 182: #undef FUNCTION_PROLOGUE ! 183: #define FUNCTION_PROLOGUE(FILE, SIZE) \ ! 184: { register int regno; \ ! 185: register int mask = 0; \ ! 186: extern char call_used_regs[]; \ ! 187: int fsize = ((SIZE) + 3) & -4; \ ! 188: if (frame_pointer_needed) \ ! 189: { if (TARGET_68020 || fsize < 0x8000) \ ! 190: fprintf (FILE, "\tlink %%a6,&%d\n", -fsize); \ ! 191: else \ ! 192: fprintf (FILE, "\tlink %%a6,&0\n\tsub.l &%d,%%sp\n", fsize); } \ ! 193: for (regno = 16; regno < 24; regno++) \ ! 194: if (regs_ever_live[regno] && ! call_used_regs[regno]) \ ! 195: mask |= 1 << (regno - 16); \ ! 196: if ((mask & 0xff) != 0) \ ! 197: fprintf (FILE, "\tfmovm &0x%x,-(%%sp)\n", mask & 0xff); \ ! 198: mask = 0; \ ! 199: for (regno = 0; regno < 16; regno++) \ ! 200: if (regs_ever_live[regno] && ! call_used_regs[regno]) \ ! 201: mask |= 1 << (15 - regno); \ ! 202: if (frame_pointer_needed) \ ! 203: mask &= ~ (1 << (15-FRAME_POINTER_REGNUM)); \ ! 204: if (exact_log2 (mask) >= 0) \ ! 205: fprintf (FILE, "\tmov.l %s,-(%%sp)\n", reg_names[15 - exact_log2 (mask)]); \ ! 206: else if (mask) fprintf (FILE, "\tmovm.l &0x%x,-(%%sp)\n", mask); } ! 207: ! 208: /* The epilogue is identical to the one in m68k.h except that: ! 209: a) The assembler syntax is different. ! 210: b) Pointers are returned both in %d0 and %a0. ! 211: c) FUNCTION_EXTRA_EPILOGUE is not needed. */ ! 212: ! 213: #undef FUNCTION_EPILOGUE ! 214: #define FUNCTION_EPILOGUE(FILE, SIZE) \ ! 215: { register int regno; \ ! 216: register int mask, fmask; \ ! 217: register int nregs; \ ! 218: int offset, foffset; \ ! 219: extern char call_used_regs[]; \ ! 220: int fsize = ((SIZE) + 3) & -4; \ ! 221: int big = 0; \ ! 222: nregs = 0; fmask = 0; \ ! 223: for (regno = 16; regno < 24; regno++) \ ! 224: if (regs_ever_live[regno] && ! call_used_regs[regno]) \ ! 225: { nregs++; fmask |= 1 << (23 - regno); } \ ! 226: foffset = nregs * 12; \ ! 227: nregs = 0; mask = 0; \ ! 228: if (frame_pointer_needed) regs_ever_live[FRAME_POINTER_REGNUM] = 0; \ ! 229: for (regno = 0; regno < 16; regno++) \ ! 230: if (regs_ever_live[regno] && ! call_used_regs[regno]) \ ! 231: { nregs++; mask |= 1 << regno; } \ ! 232: offset = foffset + nregs * 4; \ ! 233: if (offset + fsize >= 0x8000 \ ! 234: && frame_pointer_needed \ ! 235: && (mask || fmask)) \ ! 236: { fprintf (FILE, "\tmov.l &%d,%%a0\n", -fsize); \ ! 237: fsize = 0, big = 1; } \ ! 238: if (exact_log2 (mask) >= 0) { \ ! 239: if (big) \ ! 240: fprintf (FILE, "\tmov.l -%d(%%a6,%%a0.l),%s\n", \ ! 241: offset + fsize, reg_names[exact_log2 (mask)]); \ ! 242: else if (! frame_pointer_needed) \ ! 243: fprintf (FILE, "\tmov.l (%%sp)+,%s\n", \ ! 244: reg_names[exact_log2 (mask)]); \ ! 245: else \ ! 246: fprintf (FILE, "\tmov.l -%d(%%a6),%s\n", \ ! 247: offset + fsize, reg_names[exact_log2 (mask)]); } \ ! 248: else if (mask) { \ ! 249: if (big) \ ! 250: fprintf (FILE, "\tmovm.l -%d(%%a6,%%a0.l),&0x%x\n", \ ! 251: offset + fsize, mask); \ ! 252: else if (! frame_pointer_needed) \ ! 253: fprintf (FILE, "\tmovm.l (%%sp)+,&0x%x\n", mask); \ ! 254: else \ ! 255: fprintf (FILE, "\tmovm.l -%d(%%a6),&0x%x\n", \ ! 256: offset + fsize, mask); } \ ! 257: if (fmask) { \ ! 258: if (big) \ ! 259: fprintf (FILE, "\tfmovm -%d(%%a6,%%a0.l),&0x%x\n", \ ! 260: foffset + fsize, fmask); \ ! 261: else if (! frame_pointer_needed) \ ! 262: fprintf (FILE, "\tfmovm (%%sp)+,&0x%x\n", fmask); \ ! 263: else \ ! 264: fprintf (FILE, "\tfmovm -%d(%%a6),&0x%x\n", \ ! 265: foffset + fsize, fmask); } \ ! 266: if (current_function_returns_pointer) \ ! 267: fprintf (FILE, "\tmov.l %%d0,%%a0\n"); \ ! 268: if (frame_pointer_needed) \ ! 269: fprintf (FILE, "\tunlk %%a6\n"); \ ! 270: if (current_function_pops_args) \ ! 271: fprintf (FILE, "\trtd &%d\n", current_function_pops_args); \ ! 272: else fprintf (FILE, "\trts\n"); } ! 273: ! 274: /* This is how to output an insn to push a register on the stack. ! 275: It need not be very fast code. */ ! 276: ! 277: #undef ASM_OUTPUT_REG_PUSH ! 278: #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \ ! 279: fprintf (FILE, "\tmov.l %s,-(%%sp)\n", reg_names[REGNO]) ! 280: ! 281: /* This is how to output an insn to pop a register from the stack. ! 282: It need not be very fast code. */ ! 283: ! 284: #undef ASM_OUTPUT_REG_POP ! 285: #define ASM_OUTPUT_REG_POP(FILE,REGNO) \ ! 286: fprintf (FILE, "\tmov.l (%%sp)+,%s\n", reg_names[REGNO]) ! 287: ! 288: #undef ASM_FILE_START ! 289: #define ASM_FILE_START(FILE) \ ! 290: ( fprintf (FILE, "#NO_APP\n"), \ ! 291: output_file_directive ((FILE), main_input_filename)) ! 292: ! 293: #undef TEXT_SECTION_ASM_OP ! 294: #define TEXT_SECTION_ASM_OP "text" ! 295: ! 296: #undef DATA_SECTION_ASM_OP ! 297: #define DATA_SECTION_ASM_OP "data" ! 298: ! 299: /* This says how to output an assembler line to define a global common symbol. ! 300: We use SIZE rather than ROUNDED, as this is what the native cc does. */ ! 301: ! 302: #undef ASM_OUTPUT_COMMON ! 303: #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \ ! 304: ( fputs ("\tcomm ", (FILE)), \ ! 305: assemble_name ((FILE), (NAME)), \ ! 306: fprintf ((FILE), ",%d\n", ((SIZE) == 0) ? (ROUNDED) : (SIZE))) ! 307: ! 308: /* This says how to output an assembler line to define a local common symbol. ! 309: We use SIZE rather than ROUNDED, as this is what the native cc does. */ ! 310: ! 311: #undef ASM_OUTPUT_LOCAL ! 312: #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \ ! 313: ( fputs ("\tlcomm ", (FILE)), \ ! 314: assemble_name ((FILE), (NAME)), \ ! 315: fprintf ((FILE), ",%d\n", ((SIZE) == 0) ? (ROUNDED) : (SIZE))) ! 316: ! 317: /* Store in OUTPUT a string (made with alloca) containing ! 318: an assembler-name for a local static variable named NAME. ! 319: LABELNO is an integer which is different for each call. */ ! 320: ! 321: #undef ASM_FORMAT_PRIVATE_NAME ! 322: #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \ ! 323: ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 11), \ ! 324: sprintf ((OUTPUT), "%s%%%%%d", (NAME), (LABELNO))) ! 325: ! 326: /* This is the command to make the user-level label named NAME ! 327: defined for reference from other files. */ ! 328: ! 329: #undef GLOBAL_ASM_OP ! 330: #define GLOBAL_ASM_OP "global" ! 331: ! 332: #undef ASM_GENERATE_INTERNAL_LABEL ! 333: #define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \ ! 334: sprintf ((LABEL), "%s%%%d", (PREFIX), (NUM)) ! 335: ! 336: #undef ASM_OUTPUT_INTERNAL_LABEL ! 337: #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \ ! 338: fprintf ((FILE), "%s%%%d:\n", (PREFIX), (NUM)) ! 339: ! 340: #undef ASM_OUTPUT_CASE_LABEL ! 341: #define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \ ! 342: fprintf (FILE, "\tswbeg &%d\n%s%%%d:\n", \ ! 343: XVECLEN (PATTERN (TABLE), 1), (PREFIX), (NUM)); \ ! 344: ! 345: #undef ASM_OUTPUT_DOUBLE ! 346: #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \ ! 347: do { long l[2]; \ ! 348: REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l); \ ! 349: fprintf (FILE, "\tlong 0x%x,0x%x\n", l[0], l[1]); \ ! 350: } while (0) ! 351: ! 352: #undef ASM_OUTPUT_LONG_DOUBLE ! 353: #define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE) \ ! 354: do { long l[3]; \ ! 355: REAL_VALUE_TO_TARGET_LONG_DOUBLE (VALUE, l); \ ! 356: fprintf (FILE, "\tlong 0x%x,0x%x,0x%x\n", l[0], l[1], l[2]); \ ! 357: } while (0) ! 358: ! 359: #undef ASM_OUTPUT_FLOAT ! 360: #define ASM_OUTPUT_FLOAT(FILE,VALUE) \ ! 361: do { long l; \ ! 362: REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \ ! 363: fprintf ((FILE), "\tlong 0x%x\n", l); \ ! 364: } while (0) ! 365: ! 366: /* This is how to output an assembler line defining an `int' constant. */ ! 367: ! 368: #undef ASM_OUTPUT_INT ! 369: #define ASM_OUTPUT_INT(FILE,VALUE) \ ! 370: ( fprintf (FILE, "\tlong "), \ ! 371: output_addr_const (FILE, (VALUE)), \ ! 372: fprintf (FILE, "\n")) ! 373: ! 374: /* Likewise for `char' and `short' constants. */ ! 375: ! 376: #undef ASM_OUTPUT_SHORT ! 377: #define ASM_OUTPUT_SHORT(FILE,VALUE) \ ! 378: ( fprintf (FILE, "\tshort "), \ ! 379: output_addr_const (FILE, (VALUE)), \ ! 380: fprintf (FILE, "\n")) ! 381: ! 382: #undef ASM_OUTPUT_CHAR ! 383: #define ASM_OUTPUT_CHAR(FILE,VALUE) \ ! 384: ( fprintf (FILE, "\tbyte "), \ ! 385: output_addr_const (FILE, (VALUE)), \ ! 386: fprintf (FILE, "\n")) ! 387: ! 388: /* This is how to output an assembler line for a numeric constant byte. */ ! 389: ! 390: #undef ASM_OUTPUT_BYTE ! 391: #define ASM_OUTPUT_BYTE(FILE,VALUE) \ ! 392: fprintf (FILE, "\tbyte 0x%x\n", (VALUE)) ! 393: ! 394: #undef ASM_OUTPUT_ADDR_VEC_ELT ! 395: #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ ! 396: fprintf (FILE, "\tlong L%%%d\n", (VALUE)) ! 397: ! 398: #undef ASM_OUTPUT_ADDR_DIFF_ELT ! 399: #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \ ! 400: fprintf (FILE, "\tshort L%%%d-L%%%d\n", (VALUE), (REL)) ! 401: ! 402: #undef ASM_OUTPUT_ALIGN ! 403: #define ASM_OUTPUT_ALIGN(FILE,LOG) \ ! 404: if ((LOG) == 1) \ ! 405: fprintf (FILE, "\teven\n"); \ ! 406: else if ((LOG) != 0) \ ! 407: abort (); ! 408: ! 409: #undef ASM_OUTPUT_SKIP ! 410: #define ASM_OUTPUT_SKIP(FILE,SIZE) \ ! 411: fprintf (FILE, "\tspace %d\n", (SIZE)) ! 412: ! 413: #undef PRINT_OPERAND ! 414: #define PRINT_OPERAND(FILE, X, CODE) \ ! 415: { if (CODE == '.') fprintf (FILE, "."); \ ! 416: else if (CODE == '#') fprintf (FILE, "&"); \ ! 417: else if (CODE == '-') fprintf (FILE, "-(%%sp)"); \ ! 418: else if (CODE == '+') fprintf (FILE, "(%%sp)+"); \ ! 419: else if (CODE == '@') fprintf (FILE, "(%%sp)"); \ ! 420: else if (CODE == '!') fprintf (FILE, "%%fpcr"); \ ! 421: else if (CODE == '/') \ ! 422: fprintf (FILE, "%%"); \ ! 423: else if (CODE == '$') { if (TARGET_68040_ONLY) fprintf (FILE, "s"); } \ ! 424: else if (CODE == '&') { if (TARGET_68040_ONLY) fprintf (FILE, "d"); } \ ! 425: else if (GET_CODE (X) == REG) \ ! 426: fprintf (FILE, "%s", reg_names[REGNO (X)]); \ ! 427: else if (GET_CODE (X) == MEM) \ ! 428: output_address (XEXP (X, 0)); \ ! 429: else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == SFmode) \ ! 430: { REAL_VALUE_TYPE r; long l; \ ! 431: REAL_VALUE_FROM_CONST_DOUBLE (r, X); \ ! 432: REAL_VALUE_TO_TARGET_SINGLE (r, l); \ ! 433: fprintf (FILE, "&0x%x", l); } \ ! 434: else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == DFmode) \ ! 435: { REAL_VALUE_TYPE r; int i[2]; \ ! 436: REAL_VALUE_FROM_CONST_DOUBLE (r, X); \ ! 437: REAL_VALUE_TO_TARGET_DOUBLE (r, i); \ ! 438: fprintf (FILE, "&0x%x%08x", i[0], i[1]); } \ ! 439: else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == XFmode) \ ! 440: { REAL_VALUE_TYPE r; \ ! 441: REAL_VALUE_FROM_CONST_DOUBLE (r, X); \ ! 442: ASM_OUTPUT_LONG_DOUBLE_OPERAND (FILE, r); } \ ! 443: else { putc ('&', FILE); output_addr_const (FILE, X); }} ! 444: ! 445: /* Note that this contains a kludge that knows that the only reason ! 446: we have an address (plus (label_ref...) (reg...)) ! 447: is in the insn before a tablejump, and we know that the table is ! 448: exactly 10 bytes away. */ ! 449: ! 450: #undef PRINT_OPERAND_ADDRESS ! 451: #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \ ! 452: { register rtx reg1, reg2, breg, ireg; \ ! 453: register rtx addr = ADDR; \ ! 454: rtx offset; \ ! 455: switch (GET_CODE (addr)) \ ! 456: { \ ! 457: case REG: \ ! 458: fprintf (FILE, "(%s)", reg_names[REGNO (addr)]); \ ! 459: break; \ ! 460: case PRE_DEC: \ ! 461: fprintf (FILE, "-(%s)", reg_names[REGNO (XEXP (addr, 0))]); \ ! 462: break; \ ! 463: case POST_INC: \ ! 464: fprintf (FILE, "(%s)+", reg_names[REGNO (XEXP (addr, 0))]); \ ! 465: break; \ ! 466: case PLUS: \ ! 467: reg1 = 0; reg2 = 0; \ ! 468: ireg = 0; breg = 0; \ ! 469: offset = 0; \ ! 470: if (CONSTANT_ADDRESS_P (XEXP (addr, 0))) \ ! 471: { \ ! 472: offset = XEXP (addr, 0); \ ! 473: addr = XEXP (addr, 1); \ ! 474: } \ ! 475: else if (CONSTANT_ADDRESS_P (XEXP (addr, 1))) \ ! 476: { \ ! 477: offset = XEXP (addr, 1); \ ! 478: addr = XEXP (addr, 0); \ ! 479: } \ ! 480: if (GET_CODE (addr) != PLUS) ; \ ! 481: else if (GET_CODE (XEXP (addr, 0)) == SIGN_EXTEND) \ ! 482: { \ ! 483: reg1 = XEXP (addr, 0); \ ! 484: addr = XEXP (addr, 1); \ ! 485: } \ ! 486: else if (GET_CODE (XEXP (addr, 1)) == SIGN_EXTEND) \ ! 487: { \ ! 488: reg1 = XEXP (addr, 1); \ ! 489: addr = XEXP (addr, 0); \ ! 490: } \ ! 491: else if (GET_CODE (XEXP (addr, 0)) == MULT) \ ! 492: { \ ! 493: reg1 = XEXP (addr, 0); \ ! 494: addr = XEXP (addr, 1); \ ! 495: } \ ! 496: else if (GET_CODE (XEXP (addr, 1)) == MULT) \ ! 497: { \ ! 498: reg1 = XEXP (addr, 1); \ ! 499: addr = XEXP (addr, 0); \ ! 500: } \ ! 501: else if (GET_CODE (XEXP (addr, 0)) == REG) \ ! 502: { \ ! 503: reg1 = XEXP (addr, 0); \ ! 504: addr = XEXP (addr, 1); \ ! 505: } \ ! 506: else if (GET_CODE (XEXP (addr, 1)) == REG) \ ! 507: { \ ! 508: reg1 = XEXP (addr, 1); \ ! 509: addr = XEXP (addr, 0); \ ! 510: } \ ! 511: if (GET_CODE (addr) == REG || GET_CODE (addr) == MULT \ ! 512: || GET_CODE (addr) == SIGN_EXTEND) \ ! 513: { if (reg1 == 0) reg1 = addr; else reg2 = addr; addr = 0; } \ ! 514: /* for OLD_INDEXING \ ! 515: else if (GET_CODE (addr) == PLUS) \ ! 516: { \ ! 517: if (GET_CODE (XEXP (addr, 0)) == REG) \ ! 518: { \ ! 519: reg2 = XEXP (addr, 0); \ ! 520: addr = XEXP (addr, 1); \ ! 521: } \ ! 522: else if (GET_CODE (XEXP (addr, 1)) == REG) \ ! 523: { \ ! 524: reg2 = XEXP (addr, 1); \ ! 525: addr = XEXP (addr, 0); \ ! 526: } \ ! 527: } \ ! 528: */ \ ! 529: if (offset != 0) { if (addr != 0) abort (); addr = offset; } \ ! 530: if ((reg1 && (GET_CODE (reg1) == SIGN_EXTEND \ ! 531: || GET_CODE (reg1) == MULT)) \ ! 532: || (reg2 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg2)))) \ ! 533: { breg = reg2; ireg = reg1; } \ ! 534: else if (reg1 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg1))) \ ! 535: { breg = reg1; ireg = reg2; } \ ! 536: if (ireg != 0 && breg == 0 && GET_CODE (addr) == LABEL_REF) \ ! 537: { int scale = 1; \ ! 538: if (GET_CODE (ireg) == MULT) \ ! 539: { scale = INTVAL (XEXP (ireg, 1)); \ ! 540: ireg = XEXP (ireg, 0); } \ ! 541: if (GET_CODE (ireg) == SIGN_EXTEND) \ ! 542: fprintf (FILE, "10(%%pc,%s.w", \ ! 543: reg_names[REGNO (XEXP (ireg, 0))]); \ ! 544: else \ ! 545: fprintf (FILE, "10(%%pc,%s.l", \ ! 546: reg_names[REGNO (ireg)]); \ ! 547: if (scale != 1) fprintf (FILE, "*%d", scale); \ ! 548: putc (')', FILE); \ ! 549: break; } \ ! 550: if (ireg != 0 || breg != 0) \ ! 551: { int scale = 1; \ ! 552: if (breg == 0) \ ! 553: abort (); \ ! 554: if (addr != 0) \ ! 555: output_addr_const (FILE, addr); \ ! 556: fprintf (FILE, "(%s", reg_names[REGNO (breg)]); \ ! 557: if (ireg != 0) \ ! 558: putc (',', FILE); \ ! 559: if (ireg != 0 && GET_CODE (ireg) == MULT) \ ! 560: { scale = INTVAL (XEXP (ireg, 1)); \ ! 561: ireg = XEXP (ireg, 0); } \ ! 562: if (ireg != 0 && GET_CODE (ireg) == SIGN_EXTEND) \ ! 563: fprintf (FILE, "%s.w", reg_names[REGNO (XEXP (ireg, 0))]); \ ! 564: else if (ireg != 0) \ ! 565: fprintf (FILE, "%s.l", reg_names[REGNO (ireg)]); \ ! 566: if (scale != 1) fprintf (FILE, "*%d", scale); \ ! 567: putc (')', FILE); \ ! 568: break; \ ! 569: } \ ! 570: else if (reg1 != 0 && GET_CODE (addr) == LABEL_REF) \ ! 571: { fprintf (FILE, "10(%%pc,%s.w)", \ ! 572: reg_names[REGNO (reg1)]); \ ! 573: break; } \ ! 574: default: \ ! 575: output_addr_const (FILE, addr); \ ! 576: }} ! 577: ! 578: ! 579: ! 580: /* Override usual definitions of SDB output macros. ! 581: These definitions differ only in the absence of the period ! 582: at the beginning of the name of the directive ! 583: and in the use of `~' as the symbol for the current location. */ ! 584: ! 585: #define PUT_SDB_SCL(a) fprintf(asm_out_file, "\tscl\t%d;", (a)) ! 586: #define PUT_SDB_INT_VAL(a) fprintf (asm_out_file, "\tval\t%d;", (a)) ! 587: #define PUT_SDB_VAL(a) \ ! 588: ( fputs ("\tval\t", asm_out_file), \ ! 589: output_addr_const (asm_out_file, (a)), \ ! 590: fputc (';', asm_out_file)) ! 591: ! 592: #define PUT_SDB_DEF(a) \ ! 593: do { fprintf (asm_out_file, "\tdef\t"); \ ! 594: ASM_OUTPUT_LABELREF (asm_out_file, a); \ ! 595: fprintf (asm_out_file, ";"); } while (0) ! 596: ! 597: #define PUT_SDB_PLAIN_DEF(a) fprintf(asm_out_file,"\tdef\t~%s;",a) ! 598: #define PUT_SDB_ENDEF fputs("\tendef\n", asm_out_file) ! 599: #define PUT_SDB_TYPE(a) fprintf(asm_out_file, "\ttype\t0%o;", a) ! 600: #define PUT_SDB_SIZE(a) fprintf(asm_out_file, "\tsize\t%d;", a) ! 601: #define PUT_SDB_START_DIM fprintf(asm_out_file, "\tdim\t") ! 602: #define PUT_SDB_NEXT_DIM(a) fprintf(asm_out_file, "%d,", a) ! 603: #define PUT_SDB_LAST_DIM(a) fprintf(asm_out_file, "%d;", a) ! 604: ! 605: #define PUT_SDB_TAG(a) \ ! 606: do { fprintf (asm_out_file, "\ttag\t"); \ ! 607: ASM_OUTPUT_LABELREF (asm_out_file, a); \ ! 608: fprintf (asm_out_file, ";"); } while (0) ! 609: ! 610: #define PUT_SDB_BLOCK_START(LINE) \ ! 611: fprintf (asm_out_file, \ ! 612: "\tdef\t~bb;\tval\t~;\tscl\t100;\tline\t%d;\tendef\n", \ ! 613: (LINE)) ! 614: ! 615: #define PUT_SDB_BLOCK_END(LINE) \ ! 616: fprintf (asm_out_file, \ ! 617: "\tdef\t~eb;\tval\t~;\tscl\t100;\tline\t%d;\tendef\n", \ ! 618: (LINE)) ! 619: ! 620: #define PUT_SDB_FUNCTION_START(LINE) \ ! 621: fprintf (asm_out_file, \ ! 622: "\tdef\t~bf;\tval\t~;\tscl\t101;\tline\t%d;\tendef\n", \ ! 623: (LINE)) ! 624: ! 625: #define PUT_SDB_FUNCTION_END(LINE) \ ! 626: fprintf (asm_out_file, \ ! 627: "\tdef\t~ef;\tval\t~;\tscl\t101;\tline\t%d;\tendef\n", \ ! 628: (LINE)) ! 629: ! 630: #define PUT_SDB_EPILOGUE_END(NAME) \ ! 631: fprintf (asm_out_file, \ ! 632: "\tdef\t%s;\tval\t~;\tscl\t-1;\tendef\n", \ ! 633: (NAME)) ! 634: ! 635: #define SDB_GENERATE_FAKE(BUFFER, NUMBER) \ ! 636: sprintf ((BUFFER), "~%dfake", (NUMBER)); ! 637: ! 638: #define NO_DOLLAR_IN_LABEL ! 639: #define NO_DOT_IN_LABEL ! 640: ! 641: /* The usual definitions don't work because neither $ nor . is allowed. */ ! 642: #define CONSTRUCTOR_NAME_FORMAT "_GLOBAL_%%I\%%%s" ! 643: ! 644: /* Define a few machine-specific details ! 645: of the implementation of constructors. ! 646: ! 647: The __CTORS_LIST__ goes in the .init section. Define CTOR_LIST_BEGIN ! 648: and CTOR_LIST_END to contribute to the .init section an instruction to ! 649: push a word containing 0 (or some equivalent of that). ! 650: ! 651: ASM_OUTPUT_CONSTRUCTOR should be defined ! 652: to push the address of the constructor. */ ! 653: ! 654: #define ASM_LONG "\tlong" ! 655: #undef INIT_SECTION_ASM_OP ! 656: #define INIT_SECTION_ASM_OP "section\t~init" ! 657: #undef FINI_SECTION_ASM_OP ! 658: #define FINI_SECTION_ASM_OP "section\t~fini" ! 659: #undef CONST_SECTION_ASM_OP ! 660: #define CONST_SECTION_ASM_OP "section\t~rodata" ! 661: ! 662: #define CTOR_LIST_BEGIN \ ! 663: asm (INIT_SECTION_ASM_OP); \ ! 664: asm ("clr.l -(%sp)") ! 665: #define CTOR_LIST_END CTOR_LIST_BEGIN ! 666: ! 667: #define BSS_SECTION_ASM_OP "section\t~bss" ! 668: ! 669: #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \ ! 670: do { \ ! 671: init_section (); \ ! 672: fprintf (FILE, "\tmov.l &"); \ ! 673: assemble_name (FILE, NAME); \ ! 674: fprintf (FILE, ",-(%%sp)\n"); \ ! 675: } while (0) ! 676: ! 677: /* We do not want leading underscores. */ ! 678: ! 679: #undef ASM_OUTPUT_LABELREF ! 680: #define ASM_OUTPUT_LABELREF(FILE,NAME) \ ! 681: fprintf (FILE, "%s", NAME)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.