Annotation of gcc/config/tower-as.h, revision 1.1.1.3

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.