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

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