Annotation of GNUtools/cc/config/m68k/tower-as.h, revision 1.1.1.1

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