|
|
1.1 ! root 1: /* Definitions of target machine for GNU compiler. ! 2: Copyright (C) 1990 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 tm-tower.h for more comments. ! 10: ! 11: This file was based on tm-m68k.h, tm-hp9k320.h and tm-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 1, 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 "tm-tower.h" ! 33: ! 34: ! 35: /* Define __HAVE_68881 in preprocessor only if -m68881 is specified. ! 36: This will control the use of inline 68881 insns in certain macros. ! 37: Also, define special define used to identify the Tower assembler. */ ! 38: ! 39: #define CPP_SPEC "-D__TOWER_ASM__ %{m68881:-D__HAVE_68881__}" ! 40: ! 41: /* The startfiles and libraries depend on the -p and -m68881 options. ! 42: The Tower does not support the -pg option. */ ! 43: ! 44: #define STARTFILE_SPEC \ ! 45: "%{p:%{m68881:/usr/lib/fp/mcrt1.o}%{!m68881:/lib/mcrt1.o}} \ ! 46: %{!p:%{m68881:/usr/lib/fp/crt1.o}%{!m68881:/lib/crt1.o}}" ! 47: ! 48: /* These four macros control how m68k.md is expanded. */ ! 49: ! 50: #define MOTOROLA ! 51: #define SGS ! 52: #define SONY_ASM ! 53: #define HPUX_ASM ! 54: ! 55: /* Turn on SDB debugging info. */ ! 56: ! 57: #define SDB_DEBUGGING_INFO ! 58: ! 59: /* This is only useful if gdb is changed, but doesn't harm anyway. */ ! 60: ! 61: #define ASM_IDENTIFY_GCC(FILE) \ ! 62: fprintf (FILE, "gcc_compiled%%:\n") ! 63: ! 64: /* All the ASM_OUTPUT macros need to conform to the Tower as syntax. */ ! 65: ! 66: #define ASM_OUTPUT_SOURCE_FILENAME(FILE, FILENAME) \ ! 67: fprintf (FILE, "\tfile\t\"%s\"\n", FILENAME) ! 68: ! 69: #define ASM_OUTPUT_SOURCE_LINE(FILE, LINENO) \ ! 70: fprintf (FILE, "\tln\t%d\n", \ ! 71: (sdb_begin_function_line \ ! 72: ? last_linenum - sdb_begin_function_line : 1)) ! 73: ! 74: #define ASM_OUTPUT_IDENT(FILE, NAME) \ ! 75: fprintf (FILE, "\tident\t\"%s\" \n", NAME) ! 76: ! 77: #define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \ ! 78: { register int sp = 0, lp = 0; \ ! 79: fprintf (FILE, "\tbyte\t"); \ ! 80: loop: \ ! 81: if (PTR[sp] > ' ' && ! (PTR[sp] & 0x80) && PTR[sp] != '\\') \ ! 82: { lp += 3; \ ! 83: fprintf (FILE, "'%c", PTR[sp]); } \ ! 84: else \ ! 85: { lp += 5; \ ! 86: fprintf (FILE, "0x%x", PTR[sp]); } \ ! 87: if (++sp < LEN) \ ! 88: { if (lp > 60) \ ! 89: { lp = 0; \ ! 90: fprintf (FILE, "\n\tbyte\t"); } \ ! 91: else \ ! 92: putc (',', FILE); \ ! 93: goto loop; } \ ! 94: putc ('\n', FILE); } ! 95: ! 96: /* Translate Motorola opcodes such as `jbeq' ! 97: into SGS/Tower opcodes such as `beq.w'. ! 98: Change `move' to `mov'. ! 99: Change `cmpm' to `cmp'. ! 100: Change `divsl' to `tdivs'. ! 101: Change `divul' to `tdivu'. ! 102: Change `ftst' to `ftest'. ! 103: Change `fmove' to `fmov'. */ ! 104: ! 105: #define ASM_OUTPUT_OPCODE(FILE, PTR) \ ! 106: { if ((PTR)[0] == 'j' && (PTR)[1] == 'b') \ ! 107: { ++(PTR); \ ! 108: while (*(PTR) != ' ') \ ! 109: { putc (*(PTR), (FILE)); ++(PTR); } \ ! 110: fprintf ((FILE), ".w"); } \ ! 111: else if ((PTR)[0] == 'm' && (PTR)[1] == 'o' \ ! 112: && (PTR)[2] == 'v' && (PTR)[3] == 'e') \ ! 113: { fprintf ((FILE), "mov"); (PTR) += 4; } \ ! 114: else if ((PTR)[0] == 'c' && (PTR)[1] == 'm' \ ! 115: && (PTR)[2] == 'p' && (PTR)[3] == 'm') \ ! 116: { fprintf ((FILE), "cmp"); (PTR) += 4; } \ ! 117: else if ((PTR)[0] == 'd' && (PTR)[1] == 'i' \ ! 118: && (PTR)[2] == 'v' && (PTR)[3] == 's' \ ! 119: && (PTR)[4] == 'l') \ ! 120: { fprintf ((FILE), "tdivs"); (PTR) += 5; } \ ! 121: else if ((PTR)[0] == 'd' && (PTR)[1] == 'i' \ ! 122: && (PTR)[2] == 'v' && (PTR)[3] == 'u' \ ! 123: && (PTR)[4] == 'l') \ ! 124: { fprintf ((FILE), "tdivu"); (PTR) += 5; } \ ! 125: else if ((PTR)[0] == 'f' && (PTR)[1] == 't' \ ! 126: && (PTR)[2] == 's' && (PTR)[3] == 't') \ ! 127: { fprintf ((FILE), "ftest"); (PTR) += 4; } \ ! 128: else if ((PTR)[0] == 'f' && (PTR)[1] == 'm' \ ! 129: && (PTR)[2] == 'o' && (PTR)[3] == 'v' \ ! 130: && (PTR)[4] == 'e') \ ! 131: { fprintf ((FILE), "fmov"); (PTR) += 5; } \ ! 132: } ! 133: ! 134: ! 135: ! 136: /* Override parts of tm-m68k.h to fit the Tower assembler. ! 137: This section needs to track changes done to tm-m68k.h in the future. */ ! 138: ! 139: #undef TARGET_VERSION ! 140: #define TARGET_VERSION fprintf (stderr, " (68k, Motorola/SGS/Tower32 syntax)"); ! 141: ! 142: #undef BLOCK_PROFILER ! 143: #undef FUNCTION_BLOCK_PROFILER ! 144: #undef FUNCTION_PROFILER ! 145: #define FUNCTION_PROFILER(FILE, LABEL_NO) \ ! 146: fprintf (FILE, "\tmov.l &LP%%%d,%%a0\n\tjsr mcount%%\n", (LABEL_NO)) ! 147: ! 148: /* The prologue is identical to the one in tm-m68k.h except that the ! 149: assembler syntax is different. */ ! 150: ! 151: #undef FUNCTION_PROLOGUE ! 152: #define FUNCTION_PROLOGUE(FILE, SIZE) \ ! 153: { register int regno; \ ! 154: register int mask = 0; \ ! 155: extern char call_used_regs[]; \ ! 156: int fsize = ((SIZE) + 3) & -4; \ ! 157: if (frame_pointer_needed) \ ! 158: { if (TARGET_68020 || fsize < 0x8000) \ ! 159: fprintf (FILE, "\tlink %%a6,&%d\n", -fsize); \ ! 160: else \ ! 161: fprintf (FILE, "\tlink %%a6,&0\n\tsub.l &%d,%%sp\n", fsize); } \ ! 162: for (regno = 24; regno < 56; regno++) \ ! 163: if (regs_ever_live[regno] && ! call_used_regs[regno]) \ ! 164: fprintf(FILE, "\tfpmoved %s,-(%%sp)\n", \ ! 165: reg_names[regno]); \ ! 166: for (regno = 16; regno < 24; regno++) \ ! 167: if (regs_ever_live[regno] && ! call_used_regs[regno]) \ ! 168: mask |= 1 << (regno - 16); \ ! 169: if ((mask & 0xff) != 0) \ ! 170: fprintf (FILE, "\tfmovm &0x%x,-(%%sp)\n", mask & 0xff); \ ! 171: mask = 0; \ ! 172: for (regno = 0; regno < 16; regno++) \ ! 173: if (regs_ever_live[regno] && ! call_used_regs[regno]) \ ! 174: mask |= 1 << (15 - regno); \ ! 175: if (frame_pointer_needed) \ ! 176: mask &= ~ (1 << (15-FRAME_POINTER_REGNUM)); \ ! 177: if (exact_log2 (mask) >= 0) \ ! 178: fprintf (FILE, "\tmov.l %s,-(%%sp)\n", reg_names[15 - exact_log2 (mask)]); \ ! 179: else if (mask) fprintf (FILE, "\tmovm.l &0x%x,-(%%sp)\n", mask); } ! 180: ! 181: /* The epilogue is identical to the one in tm-m68k.h except that: ! 182: a) The assembler syntax is different. ! 183: b) Pointers are returned both in %d0 and %a0. ! 184: c) FUNCTION_EXTRA_EPILOGUE is not needed. */ ! 185: ! 186: #undef FUNCTION_EPILOGUE ! 187: #define FUNCTION_EPILOGUE(FILE, SIZE) \ ! 188: { register int regno; \ ! 189: register int mask, fmask; \ ! 190: register int nregs; \ ! 191: int offset, foffset, fpoffset; \ ! 192: extern char call_used_regs[]; \ ! 193: extern int current_function_pops_args; \ ! 194: extern int current_function_args_size; \ ! 195: extern int current_function_returns_pointer; \ ! 196: int fsize = ((SIZE) + 3) & -4; \ ! 197: int big = 0; \ ! 198: nregs = 0; fmask = 0; fpoffset = 0; \ ! 199: for (regno = 24 ; regno < 56 ; regno++) \ ! 200: if (regs_ever_live[regno] && ! call_used_regs[regno]) \ ! 201: nregs++; \ ! 202: fpoffset = nregs*8; \ ! 203: nregs = 0; \ ! 204: for (regno = 16; regno < 24; regno++) \ ! 205: if (regs_ever_live[regno] && ! call_used_regs[regno]) \ ! 206: { nregs++; fmask |= 1 << (23 - regno); } \ ! 207: foffset = fpoffset + nregs * 12; \ ! 208: nregs = 0; mask = 0; \ ! 209: if (frame_pointer_needed) regs_ever_live[FRAME_POINTER_REGNUM] = 0; \ ! 210: for (regno = 0; regno < 16; regno++) \ ! 211: if (regs_ever_live[regno] && ! call_used_regs[regno]) \ ! 212: { nregs++; mask |= 1 << regno; } \ ! 213: offset = foffset + nregs * 4; \ ! 214: if (offset + fsize >= 0x8000 \ ! 215: && frame_pointer_needed \ ! 216: && (mask || fmask || fpoffset)) \ ! 217: { fprintf (FILE, "\tmov.l &%d,%%a0\n", -fsize); \ ! 218: fsize = 0, big = 1; } \ ! 219: if (exact_log2 (mask) >= 0) { \ ! 220: if (big) \ ! 221: fprintf (FILE, "\tmov.l -%d(%%a6,%%a0.l),%s\n", \ ! 222: offset + fsize, reg_names[exact_log2 (mask)]); \ ! 223: else if (! frame_pointer_needed) \ ! 224: fprintf (FILE, "\tmov.l (%%sp)+,%s\n", \ ! 225: reg_names[exact_log2 (mask)]); \ ! 226: else \ ! 227: fprintf (FILE, "\tmov.l -%d(%%a6),%s\n", \ ! 228: offset + fsize, reg_names[exact_log2 (mask)]); } \ ! 229: else if (mask) { \ ! 230: if (big) \ ! 231: fprintf (FILE, "\tmovm.l -%d(%%a6,%%a0.l),&0x%x\n", \ ! 232: offset + fsize, mask); \ ! 233: else if (! frame_pointer_needed) \ ! 234: fprintf (FILE, "\tmovm.l (%%sp)+,&0x%x\n", mask); \ ! 235: else \ ! 236: fprintf (FILE, "\tmovm.l -%d(%%a6),&0x%x\n", \ ! 237: offset + fsize, mask); } \ ! 238: if (fmask) { \ ! 239: if (big) \ ! 240: fprintf (FILE, "\tfmovm -%d(%%a6,%%a0.l),&0x%x\n", \ ! 241: foffset + fsize, fmask); \ ! 242: else if (! frame_pointer_needed) \ ! 243: fprintf (FILE, "\tfmovm (%%sp)+,&0x%x\n", fmask); \ ! 244: else \ ! 245: fprintf (FILE, "\tfmovm -%d(%%a6),&0x%x\n", \ ! 246: foffset + fsize, fmask); } \ ! 247: if (fpoffset != 0) \ ! 248: for (regno = 55; regno >= 24; regno--) \ ! 249: if (regs_ever_live[regno] && ! call_used_regs[regno]) { \ ! 250: if (big) \ ! 251: fprintf(FILE, "\tfpmoved -%d(%%a6,%%a0.l),%s\n", \ ! 252: fpoffset + fsize, reg_names[regno]); \ ! 253: else if (! frame_pointer_needed) \ ! 254: fprintf(FILE, "\tfpmoved (%%sp)+,%s\n", \ ! 255: reg_names[regno]); \ ! 256: else \ ! 257: fprintf(FILE, "\tfpmoved -%d(%%a6),%s\n", \ ! 258: fpoffset + fsize, reg_names[regno]); \ ! 259: fpoffset -= 8; \ ! 260: } \ ! 261: if (current_function_returns_pointer) \ ! 262: fprintf (FILE, "\tmov.l %%d0,%%a0\n"); \ ! 263: if (frame_pointer_needed) \ ! 264: fprintf (FILE, "\tunlk %%a6\n"); \ ! 265: if (current_function_pops_args && current_function_args_size) \ ! 266: fprintf (FILE, "\trtd &%d\n", current_function_args_size); \ ! 267: else fprintf (FILE, "\trts\n"); } ! 268: ! 269: /* This is how to output an insn to push a register on the stack. ! 270: It need not be very fast code. */ ! 271: ! 272: #undef ASM_OUTPUT_REG_PUSH ! 273: #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \ ! 274: fprintf (FILE, "\tmov.l %s,-(%%sp)\n", reg_names[REGNO]) ! 275: ! 276: /* This is how to output an insn to pop a register from the stack. ! 277: It need not be very fast code. */ ! 278: ! 279: #undef ASM_OUTPUT_REG_POP ! 280: #define ASM_OUTPUT_REG_POP(FILE,REGNO) \ ! 281: fprintf (FILE, "\tmov.l (%%sp)+,%s\n", reg_names[REGNO]) ! 282: ! 283: #undef ASM_FILE_START ! 284: #define ASM_FILE_START(FILE) \ ! 285: ( fprintf (FILE, "#NO_APP\n"), \ ! 286: sdbout_filename ((FILE), main_input_filename)) ! 287: ! 288: #undef TEXT_SECTION_ASM_OP ! 289: #define TEXT_SECTION_ASM_OP "\ttext" ! 290: ! 291: #undef DATA_SECTION_ASM_OP ! 292: #define DATA_SECTION_ASM_OP "\tdata" ! 293: ! 294: /* This says how to output an assembler line to define a global common symbol. ! 295: We use SIZE rather than ROUNDED, as this is what the native cc does. */ ! 296: ! 297: #undef ASM_OUTPUT_COMMON ! 298: #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \ ! 299: ( fputs ("\tcomm ", (FILE)), \ ! 300: assemble_name ((FILE), (NAME)), \ ! 301: fprintf ((FILE), ",%d\n", ((SIZE) == 0) ? (ROUNDED) : (SIZE))) ! 302: ! 303: /* This says how to output an assembler line to define a local common symbol. ! 304: We use SIZE rather than ROUNDED, as this is what the native cc does. */ ! 305: ! 306: #undef ASM_OUTPUT_LOCAL ! 307: #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \ ! 308: ( fputs ("\tlcomm ", (FILE)), \ ! 309: assemble_name ((FILE), (NAME)), \ ! 310: fprintf ((FILE), ",%d\n", ((SIZE) == 0) ? (ROUNDED) : (SIZE))) ! 311: ! 312: /* Store in OUTPUT a string (made with alloca) containing ! 313: an assembler-name for a local static variable named NAME. ! 314: LABELNO is an integer which is different for each call. */ ! 315: ! 316: #undef ASM_FORMAT_PRIVATE_NAME ! 317: #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \ ! 318: ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 11), \ ! 319: sprintf ((OUTPUT), "%s%%%%%d", (NAME), (LABELNO))) ! 320: ! 321: /* This is how to output a command to make the user-level label named NAME ! 322: defined for reference from other files. */ ! 323: ! 324: #undef ASM_GLOBALIZE_LABEL ! 325: #define ASM_GLOBALIZE_LABEL(FILE,NAME) \ ! 326: do { fputs ("\tglobal ", FILE); \ ! 327: assemble_name (FILE, NAME); \ ! 328: fputs ("\n", FILE); \ ! 329: } while (0) ! 330: ! 331: #undef ASM_GENERATE_INTERNAL_LABEL ! 332: #define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \ ! 333: sprintf ((LABEL), "%s%%%d", (PREFIX), (NUM)) ! 334: ! 335: #undef ASM_OUTPUT_INTERNAL_LABEL ! 336: #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \ ! 337: fprintf ((FILE), "%s%%%d:\n", (PREFIX), (NUM)) ! 338: ! 339: #undef ASM_OUTPUT_CASE_LABEL ! 340: #define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \ ! 341: fprintf (FILE, "\tswbeg &%d\n%s%%%d:\n", \ ! 342: XVECLEN (PATTERN (TABLE), 1), (PREFIX), (NUM)); \ ! 343: ! 344: #undef ASM_OUTPUT_DOUBLE ! 345: #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \ ! 346: do { union { double d; long l[2]; } tem; \ ! 347: tem.d = (VALUE); \ ! 348: fprintf(FILE, "\tlong 0x%x,0x%x\n", tem.l[0], tem.l[1]); \ ! 349: } while (0) ! 350: ! 351: #undef ASM_OUTPUT_FLOAT ! 352: #define ASM_OUTPUT_FLOAT(FILE,VALUE) \ ! 353: do { union { float f; long l;} tem; \ ! 354: tem.f = (VALUE); \ ! 355: fprintf (FILE, "\tlong 0x%x\n", tem.l); \ ! 356: } while (0) ! 357: ! 358: /* This is how to output an assembler line defining an `int' constant. */ ! 359: ! 360: #undef ASM_OUTPUT_INT ! 361: #define ASM_OUTPUT_INT(FILE,VALUE) \ ! 362: ( fprintf (FILE, "\tlong "), \ ! 363: output_addr_const (FILE, (VALUE)), \ ! 364: fprintf (FILE, "\n")) ! 365: ! 366: /* Likewise for `char' and `short' constants. */ ! 367: ! 368: #undef ASM_OUTPUT_SHORT ! 369: #define ASM_OUTPUT_SHORT(FILE,VALUE) \ ! 370: ( fprintf (FILE, "\tshort "), \ ! 371: output_addr_const (FILE, (VALUE)), \ ! 372: fprintf (FILE, "\n")) ! 373: ! 374: #undef ASM_OUTPUT_CHAR ! 375: #define ASM_OUTPUT_CHAR(FILE,VALUE) \ ! 376: ( fprintf (FILE, "\tbyte "), \ ! 377: output_addr_const (FILE, (VALUE)), \ ! 378: fprintf (FILE, "\n")) ! 379: ! 380: /* This is how to output an assembler line for a numeric constant byte. */ ! 381: ! 382: #undef ASM_OUTPUT_BYTE ! 383: #define ASM_OUTPUT_BYTE(FILE,VALUE) \ ! 384: fprintf (FILE, "\tbyte 0x%x\n", (VALUE)) ! 385: ! 386: #undef ASM_OUTPUT_ADDR_VEC_ELT ! 387: #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ ! 388: fprintf (FILE, "\tlong L%%%d\n", (VALUE)) ! 389: ! 390: #undef ASM_OUTPUT_ADDR_DIFF_ELT ! 391: #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \ ! 392: fprintf (FILE, "\tshort L%%%d-L%%%d\n", (VALUE), (REL)) ! 393: ! 394: #undef ASM_OUTPUT_ALIGN ! 395: #define ASM_OUTPUT_ALIGN(FILE,LOG) \ ! 396: if ((LOG) == 1) \ ! 397: fprintf (FILE, "\teven\n"); \ ! 398: else if ((LOG) != 0) \ ! 399: abort (); ! 400: ! 401: #undef ASM_OUTPUT_SKIP ! 402: #define ASM_OUTPUT_SKIP(FILE,SIZE) \ ! 403: fprintf (FILE, "\tspace %d\n", (SIZE)) ! 404: ! 405: #undef PRINT_OPERAND ! 406: #define PRINT_OPERAND(FILE, X, CODE) \ ! 407: { if (CODE == '.') fprintf (FILE, "."); \ ! 408: else if (CODE == '#') fprintf (FILE, "&"); \ ! 409: else if (CODE == '-') fprintf (FILE, "-(%%sp)"); \ ! 410: else if (CODE == '+') fprintf (FILE, "(%%sp)+"); \ ! 411: else if (CODE == '@') fprintf (FILE, "(%%sp)"); \ ! 412: else if (CODE == '!') fprintf (FILE, "%%cc"); \ ! 413: else if (GET_CODE (X) == REG) \ ! 414: fprintf (FILE, "%s", reg_names[REGNO (X)]); \ ! 415: else if (GET_CODE (X) == MEM) \ ! 416: output_address (XEXP (X, 0)); \ ! 417: else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == SFmode) \ ! 418: { union { double d; int i[2]; } u; \ ! 419: union { float f; int i; } u1; \ ! 420: u.i[0] = CONST_DOUBLE_LOW (X); u.i[1] = CONST_DOUBLE_HIGH (X); \ ! 421: u1.f = u.d; \ ! 422: fprintf (FILE, "&0x%x", u1.i); } \ ! 423: else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == DFmode) \ ! 424: fprintf (FILE, "&0x%x%08x", CONST_DOUBLE_LOW (X), CONST_DOUBLE_HIGH (X));\ ! 425: else { putc ('&', FILE); output_addr_const (FILE, X); }} ! 426: ! 427: /* Note that this contains a kludge that knows that the only reason ! 428: we have an address (plus (label_ref...) (reg...)) ! 429: is in the insn before a tablejump, and we know that the table is ! 430: exactly 10 bytes away. */ ! 431: ! 432: #undef PRINT_OPERAND_ADDRESS ! 433: #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \ ! 434: { register rtx reg1, reg2, breg, ireg; \ ! 435: register rtx addr = ADDR; \ ! 436: rtx offset; \ ! 437: switch (GET_CODE (addr)) \ ! 438: { \ ! 439: case REG: \ ! 440: fprintf (FILE, "(%s)", reg_names[REGNO (addr)]); \ ! 441: break; \ ! 442: case PRE_DEC: \ ! 443: fprintf (FILE, "-(%s)", reg_names[REGNO (XEXP (addr, 0))]); \ ! 444: break; \ ! 445: case POST_INC: \ ! 446: fprintf (FILE, "(%s)+", reg_names[REGNO (XEXP (addr, 0))]); \ ! 447: break; \ ! 448: case PLUS: \ ! 449: reg1 = 0; reg2 = 0; \ ! 450: ireg = 0; breg = 0; \ ! 451: offset = 0; \ ! 452: if (CONSTANT_ADDRESS_P (XEXP (addr, 0))) \ ! 453: { \ ! 454: offset = XEXP (addr, 0); \ ! 455: addr = XEXP (addr, 1); \ ! 456: } \ ! 457: else if (CONSTANT_ADDRESS_P (XEXP (addr, 1))) \ ! 458: { \ ! 459: offset = XEXP (addr, 1); \ ! 460: addr = XEXP (addr, 0); \ ! 461: } \ ! 462: if (GET_CODE (addr) != PLUS) ; \ ! 463: else if (GET_CODE (XEXP (addr, 0)) == SIGN_EXTEND) \ ! 464: { \ ! 465: reg1 = XEXP (addr, 0); \ ! 466: addr = XEXP (addr, 1); \ ! 467: } \ ! 468: else if (GET_CODE (XEXP (addr, 1)) == SIGN_EXTEND) \ ! 469: { \ ! 470: reg1 = XEXP (addr, 1); \ ! 471: addr = XEXP (addr, 0); \ ! 472: } \ ! 473: else if (GET_CODE (XEXP (addr, 0)) == MULT) \ ! 474: { \ ! 475: reg1 = XEXP (addr, 0); \ ! 476: addr = XEXP (addr, 1); \ ! 477: } \ ! 478: else if (GET_CODE (XEXP (addr, 1)) == MULT) \ ! 479: { \ ! 480: reg1 = XEXP (addr, 1); \ ! 481: addr = XEXP (addr, 0); \ ! 482: } \ ! 483: else if (GET_CODE (XEXP (addr, 0)) == REG) \ ! 484: { \ ! 485: reg1 = XEXP (addr, 0); \ ! 486: addr = XEXP (addr, 1); \ ! 487: } \ ! 488: else if (GET_CODE (XEXP (addr, 1)) == REG) \ ! 489: { \ ! 490: reg1 = XEXP (addr, 1); \ ! 491: addr = XEXP (addr, 0); \ ! 492: } \ ! 493: if (GET_CODE (addr) == REG || GET_CODE (addr) == MULT \ ! 494: || GET_CODE (addr) == SIGN_EXTEND) \ ! 495: { if (reg1 == 0) reg1 = addr; else reg2 = addr; addr = 0; } \ ! 496: /* for OLD_INDEXING \ ! 497: else if (GET_CODE (addr) == PLUS) \ ! 498: { \ ! 499: if (GET_CODE (XEXP (addr, 0)) == REG) \ ! 500: { \ ! 501: reg2 = XEXP (addr, 0); \ ! 502: addr = XEXP (addr, 1); \ ! 503: } \ ! 504: else if (GET_CODE (XEXP (addr, 1)) == REG) \ ! 505: { \ ! 506: reg2 = XEXP (addr, 1); \ ! 507: addr = XEXP (addr, 0); \ ! 508: } \ ! 509: } \ ! 510: */ \ ! 511: if (offset != 0) { if (addr != 0) abort (); addr = offset; } \ ! 512: if ((reg1 && (GET_CODE (reg1) == SIGN_EXTEND \ ! 513: || GET_CODE (reg1) == MULT)) \ ! 514: || (reg2 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg2)))) \ ! 515: { breg = reg2; ireg = reg1; } \ ! 516: else if (reg1 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg1))) \ ! 517: { breg = reg1; ireg = reg2; } \ ! 518: if (ireg != 0 && breg == 0 && GET_CODE (addr) == LABEL_REF) \ ! 519: { int scale = 1; \ ! 520: if (GET_CODE (ireg) == MULT) \ ! 521: { scale = INTVAL (XEXP (ireg, 1)); \ ! 522: ireg = XEXP (ireg, 0); } \ ! 523: if (GET_CODE (ireg) == SIGN_EXTEND) \ ! 524: fprintf (FILE, "10(%%pc,%s.w", \ ! 525: reg_names[REGNO (XEXP (ireg, 0))]); \ ! 526: else \ ! 527: fprintf (FILE, "10(%%pc,%s.l", \ ! 528: reg_names[REGNO (ireg)]); \ ! 529: if (scale != 1) fprintf (FILE, "*%d", scale); \ ! 530: putc (')', FILE); \ ! 531: break; } \ ! 532: if (ireg != 0 || breg != 0) \ ! 533: { int scale = 1; \ ! 534: if (breg == 0) \ ! 535: abort (); \ ! 536: if (addr != 0) \ ! 537: output_addr_const (FILE, addr); \ ! 538: fprintf (FILE, "(%s", reg_names[REGNO (breg)]); \ ! 539: if (ireg != 0) \ ! 540: putc (',', FILE); \ ! 541: if (ireg != 0 && GET_CODE (ireg) == MULT) \ ! 542: { scale = INTVAL (XEXP (ireg, 1)); \ ! 543: ireg = XEXP (ireg, 0); } \ ! 544: if (ireg != 0 && GET_CODE (ireg) == SIGN_EXTEND) \ ! 545: fprintf (FILE, "%s.w", reg_names[REGNO (XEXP (ireg, 0))]); \ ! 546: else if (ireg != 0) \ ! 547: fprintf (FILE, "%s.l", reg_names[REGNO (ireg)]); \ ! 548: if (scale != 1) fprintf (FILE, "*%d", scale); \ ! 549: putc (')', FILE); \ ! 550: break; \ ! 551: } \ ! 552: else if (reg1 != 0 && GET_CODE (addr) == LABEL_REF) \ ! 553: { fprintf (FILE, "10(%%pc,%s.w)", \ ! 554: reg_names[REGNO (reg1)]); \ ! 555: break; } \ ! 556: default: \ ! 557: output_addr_const (FILE, addr); \ ! 558: }} ! 559: ! 560: ! 561: ! 562: /* Override usual definitions of SDB output macros. ! 563: These definitions differ only in the absence of the period ! 564: at the beginning of the name of the directive ! 565: and in the use of `~' as the symbol for the current location. */ ! 566: ! 567: #define PUT_SDB_SCL(a) fprintf(asm_out_file, "\tscl\t%d;", (a)) ! 568: #define PUT_SDB_INT_VAL(a) fprintf (asm_out_file, "\tval\t%d;", (a)) ! 569: #define PUT_SDB_VAL(a) \ ! 570: ( fputs ("\tval\t", asm_out_file), \ ! 571: output_addr_const (asm_out_file, (a)), \ ! 572: fputc (';', asm_out_file)) ! 573: ! 574: #define PUT_SDB_DEF(a) \ ! 575: do { fprintf (asm_out_file, "\tdef\t"); \ ! 576: ASM_OUTPUT_LABELREF (asm_out_file, a); \ ! 577: fprintf (asm_out_file, ";"); } while (0) ! 578: ! 579: #define PUT_SDB_PLAIN_DEF(a) fprintf(asm_out_file,"\tdef\t~%s;",a) ! 580: #define PUT_SDB_ENDEF fputs("\tendef\n", asm_out_file) ! 581: #define PUT_SDB_TYPE(a) fprintf(asm_out_file, "\ttype\t0%o;", a) ! 582: #define PUT_SDB_SIZE(a) fprintf(asm_out_file, "\tsize\t%d;", a) ! 583: #define PUT_SDB_DIM(a) fprintf(asm_out_file, "\tdim\t%d;", a) ! 584: ! 585: #define PUT_SDB_TAG(a) \ ! 586: do { fprintf (asm_out_file, "\ttag\t"); \ ! 587: ASM_OUTPUT_LABELREF (asm_out_file, a); \ ! 588: fprintf (asm_out_file, ";"); } while (0) ! 589: ! 590: #define PUT_SDB_BLOCK_START(LINE) \ ! 591: fprintf (asm_out_file, \ ! 592: "\tdef\t~bb;\tval\t~;\tscl\t100;\tline\t%d;\tendef\n", \ ! 593: (LINE)) ! 594: ! 595: #define PUT_SDB_BLOCK_END(LINE) \ ! 596: fprintf (asm_out_file, \ ! 597: "\tdef\t~eb;\tval\t~;\tscl\t100;\tline\t%d;\tendef\n", \ ! 598: (LINE)) ! 599: ! 600: #define PUT_SDB_FUNCTION_START(LINE) \ ! 601: fprintf (asm_out_file, \ ! 602: "\tdef\t~bf;\tval\t~;\tscl\t101;\tline\t%d;\tendef\n", \ ! 603: (LINE)) ! 604: ! 605: #define PUT_SDB_FUNCTION_END(LINE) \ ! 606: fprintf (asm_out_file, \ ! 607: "\tdef\t~ef;\tval\t~;\tscl\t101;\tline\t%d;\tendef\n", \ ! 608: (LINE)) ! 609: ! 610: #define PUT_SDB_EPILOGUE_END(NAME) \ ! 611: fprintf (asm_out_file, \ ! 612: "\tdef\t%s;\tval\t~;\tscl\t-1;\tendef\n", \ ! 613: (NAME)) ! 614: ! 615: #define SDB_GENERATE_FAKE(BUFFER, NUMBER) \ ! 616: sprintf ((BUFFER), "~%dfake", (NUMBER));
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.