Annotation of gcc/config/m68k/mot3300.h, revision 1.1.1.1

1.1       root        1: /* Definitions of target machine for GNU compiler.  
                      2:    SysV68 Motorola 3300 Delta Series
                      3: 
                      4:    Written by Abramo and Roberto Bagnara
                      5:    after Alex Crain's 3B1 definitions.
                      6: 
                      7:    Bug reports to [email protected]
                      8: 
                      9:    Copyright (C) 1987 Free Software Foundation, Inc.
                     10: 
                     11: This file is part of GNU CC.
                     12: 
                     13: GNU CC is free software; you can redistribute it and/or modify
                     14: it under the terms of the GNU General Public License as published by
                     15: the Free Software Foundation; either version 2, or (at your option)
                     16: any later version.
                     17: 
                     18: GNU CC is distributed in the hope that it will be useful,
                     19: but WITHOUT ANY WARRANTY; without even the implied warranty of
                     20: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     21: GNU General Public License for more details.
                     22: 
                     23: You should have received a copy of the GNU General Public License
                     24: along with GNU CC; see the file COPYING.  If not, write to
                     25: the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
                     26: 
                     27: #define MOTOROLA               /* Use Motorola syntax rather than "MIT" */
                     28: #define SGS                    /* Uses SGS assembler */
                     29: #define SGS_CMP_ORDER          /* Takes cmp operands in reverse order */
                     30: #define SGS_SWAP_W             /* Use swap.w rather than just plain swap */
                     31: #define SGS_SWITCH_TABLES      /* Different switch table handling */
                     32: 
                     33: #define NO_DOLLAR_IN_LABEL
                     34: #define NO_DOT_IN_LABEL
                     35: 
                     36: #include "m68k/m68k.h"
                     37: 
                     38: /* See m68k.h.  7 means 68020 with 68881.  */
                     39: 
                     40: #ifndef TARGET_DEFAULT
                     41: #define        TARGET_DEFAULT 7
                     42: #endif
                     43: 
                     44: /* NYI: FP= is equivalent to -msoft-float  */
                     45: 
                     46: /* We use /lib/libp/lib* when profiling.  */
                     47: 
                     48: /* NYI: if FP=M68881U library is -lc881u  */
                     49: /* NYI: if FP= library is -lc.  */
                     50: /* Default for us: FP=M68881 library is -lc881  */
                     51: #undef LIB_SPEC
                     52: #define LIB_SPEC "%{!shlib:%{p:-L/usr/lib/libp} %{pg:-L/usr/lib/libp} -lc881}"
                     53: 
                     54: #define CPP_SPEC "%{!msoft-float:-D__HAVE_68881__}"
                     55: 
                     56: /* Shared libraries need to use crt0s.o  */
                     57: 
                     58: #undef STARTFILE_SPEC
                     59: #define STARTFILE_SPEC \
                     60:   "%{!shlib:%{pg:mcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}\
                     61:    %{shlib:crt0s.o%s shlib.ifile%s} "
                     62: 
                     63: /* Generate calls to memcpy, memcmp and memset.  */
                     64: 
                     65: #define TARGET_MEM_FUNCTIONS
                     66: 
                     67: /* size_t is unsigned int.  */
                     68: 
                     69: #define SIZE_TYPE "unsigned int"
                     70: 
                     71: /* Every structure or union's size must be a multiple of 2 bytes.  */
                     72: 
                     73: #define STRUCTURE_SIZE_BOUNDARY 16
                     74: 
                     75: /* cpp has to support a #sccs directive for the /usr/include files */
                     76: 
                     77: #define SCCS_DIRECTIVE
                     78: 
                     79: /* Make output for SDB.  */
                     80: 
                     81: #define SDB_DEBUGGING_INFO
                     82: 
                     83: #undef REGISTER_NAMES
                     84: #define REGISTER_NAMES \
                     85: {"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7",       \
                     86:  "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%fp", "%sp",       \
                     87:  "%fp0", "%fp1", "%fp2", "%fp3", "%fp4", "%fp5", "%fp6", "%fp7"}
                     88: 
                     89: #undef FUNCTION_PROLOGUE
                     90: #define FUNCTION_PROLOGUE(FILE, SIZE)     \
                     91: { register int regno;                                          \
                     92:   register int mask = 0;                                       \
                     93:   extern char call_used_regs[];                                        \
                     94:   int fsize = (SIZE);                                          \
                     95:   if (frame_pointer_needed)                                    \
                     96:     { if (fsize < 0x8000)                                      \
                     97:         fprintf (FILE, "\tlink.w %%fp,&%d\n", -fsize);         \
                     98:       else if (TARGET_68020)                                   \
                     99:         fprintf (FILE, "\tlink.l %%fp,&%d\n", -fsize);         \
                    100:       else                                                     \
                    101:        fprintf (FILE, "\tlink.w %%fp,&0\n\tsub.l &%d,%%sp\n", fsize); }  \
                    102:   for (regno = 16; regno < FIRST_PSEUDO_REGISTER; regno++)     \
                    103:     if (regs_ever_live[regno] && ! call_used_regs[regno])      \
                    104:        mask |= 1 << (regno - 16);                              \
                    105:   if (mask != 0)                                               \
                    106:     fprintf (FILE, "\tfmovem &0x%x,-(%%sp)\n", mask & 0xff);   \
                    107:   mask = 0;                                                    \
                    108:   for (regno = 0; regno < 16; regno++)                         \
                    109:     if (regs_ever_live[regno] && ! call_used_regs[regno])      \
                    110:        mask |= 1 << (15 - regno);                              \
                    111:   if (frame_pointer_needed)                                    \
                    112:     mask &= ~ (1 << (15-FRAME_POINTER_REGNUM));                        \
                    113:   if (exact_log2 (mask) >= 0)                                  \
                    114:     fprintf (FILE, "\tmov.l %s,-(%%sp)\n", reg_names[15 - exact_log2 (mask)]);  \
                    115:   else if (mask) fprintf (FILE, "\tmovm.l &0x%x,-(%%sp)\n", mask); }
                    116: 
                    117: #undef FUNCTION_PROFILER
                    118: #define FUNCTION_PROFILER(FILE, LABEL_NO)      \
                    119:     fprintf (FILE, "\tmov.l &LP%%%d,%%a0\n\tjsr mcount%%\n", (LABEL_NO))
                    120: 
                    121: #undef FUNCTION_EPILOGUE
                    122: #define FUNCTION_EPILOGUE(FILE, SIZE) \
                    123: { register int regno;                                          \
                    124:   register int mask, fmask;                                    \
                    125:   register int nregs;                                          \
                    126:   int offset, foffset;                                         \
                    127:   extern char call_used_regs[];                                        \
                    128:   int fsize = (SIZE);                                          \
                    129:   int big = 0;                                                 \
                    130:   nregs = 0;  fmask = 0;                                       \
                    131:   for (regno = 16; regno < FIRST_PSEUDO_REGISTER; regno++)     \
                    132:     if (regs_ever_live[regno] && ! call_used_regs[regno])      \
                    133:       { nregs++; fmask |= 1 << (23 - regno); }                 \
                    134:   foffset = nregs * 12;                                                \
                    135:   nregs = 0;  mask = 0;                                                \
                    136:   if (frame_pointer_needed) regs_ever_live[FRAME_POINTER_REGNUM] = 0; \
                    137:   for (regno = 0; regno < 16; regno++)                         \
                    138:     if (regs_ever_live[regno] && ! call_used_regs[regno])      \
                    139:       { nregs++; mask |= 1 << regno; }                         \
                    140:   offset = foffset + nregs * 4;                                        \
                    141:   if (offset + fsize >= 0x8000 && frame_pointer_needed)                \
                    142:     { fprintf (FILE, "\tmov.l &%d,%%a0\n", -fsize);            \
                    143:       fsize = 0, big = 1; }                                    \
                    144:   if (exact_log2 (mask) >= 0) {                                        \
                    145:     if (big)                                                   \
                    146:       fprintf (FILE, "\tmov.l -%d(%%fp,%%a0.l),%s\n",          \
                    147:               offset + fsize, reg_names[exact_log2 (mask)]);   \
                    148:     else if (! frame_pointer_needed)                           \
                    149:       fprintf (FILE, "\tmov.l (%%sp)+,%s\n",                   \
                    150:               reg_names[exact_log2 (mask)]);                   \
                    151:     else                                                       \
                    152:       fprintf (FILE, "\tmov.l -%d(%%fp),%s\n",                 \
                    153:               offset + fsize, reg_names[exact_log2 (mask)]); } \
                    154:   else if (mask) {                                             \
                    155:     if (big)                                                   \
                    156:       fprintf (FILE, "\tmovm.l -%d(%%fp,%%a0.l),&0x%x\n",      \
                    157:               offset + fsize, mask);                           \
                    158:     else if (! frame_pointer_needed)                           \
                    159:       fprintf (FILE, "\tmovm.l (%%sp)+,&0x%x\n", mask);                \
                    160:     else                                                       \
                    161:       fprintf (FILE, "\tmovm.l -%d(%%fp),&0x%x\n",             \
                    162:               offset + fsize, mask); }                         \
                    163:   if (fmask) {                                                 \
                    164:     if (big)                                                   \
                    165:       fprintf (FILE, "\tfmovem -%d(%%fp,%%a0.l),&0x%x\n",      \
                    166:               foffset + fsize, fmask);                         \
                    167:     else if (! frame_pointer_needed)                           \
                    168:       fprintf (FILE, "\tfmovem (%%sp)+,&0x%x\n", fmask);       \
                    169:     else                                                       \
                    170:       fprintf (FILE, "\tfmovem -%d(%%fp),&0x%x\n",             \
                    171:               foffset + fsize, fmask); }                       \
                    172:   if (frame_pointer_needed)                                    \
                    173:     fprintf (FILE, "\tunlk %%fp\n");                           \
                    174:   if (current_function_pops_args)                              \
                    175:     fprintf (FILE, "\trtd &%d\n", current_function_pops_args); \
                    176:   else fprintf (FILE, "\trts\n"); }
                    177: 
                    178: /* This is how to output an insn to push a register on the stack.
                    179:    It need not be very fast code.  */
                    180: 
                    181: #undef ASM_OUTPUT_REG_PUSH
                    182: #define ASM_OUTPUT_REG_PUSH(FILE,REGNO)  \
                    183:   fprintf (FILE, "\tmov.l %s,-(%%sp)\n", reg_names[REGNO])
                    184: 
                    185: /* This is how to output an insn to pop a register from the stack.
                    186:    It need not be very fast code.  */
                    187: 
                    188: #undef ASM_OUTPUT_REG_POP
                    189: #define ASM_OUTPUT_REG_POP(FILE,REGNO)  \
                    190:   fprintf (FILE, "\tmov.l (%%sp)+,%s\n", reg_names[REGNO])
                    191: 
                    192: #undef ASM_APP_ON
                    193: #define ASM_APP_ON ""
                    194: 
                    195: #undef ASM_APP_OFF
                    196: #define ASM_APP_OFF ""
                    197: 
                    198: #undef TEXT_SECTION_ASM_OP
                    199: #define TEXT_SECTION_ASM_OP "text"
                    200: #undef DATA_SECTION_ASM_OP
                    201: #define DATA_SECTION_ASM_OP "data"
                    202: #undef ASCII_DATA_ASM_OP
                    203: #define        ASCII_DATA_ASM_OP "byte"
                    204: 
                    205: /* The file command should always begin the output.  */
                    206: 
                    207: #undef ASM_FILE_START
                    208: #define ASM_FILE_START(FILE) \
                    209: output_file_directive ((FILE), main_input_filename)
                    210: 
                    211: /* Don't try to define `gcc_compiled.' since the assembler might not
                    212:    accept symbols with periods and GDB doesn't run on this machine anyway.  */
                    213: 
                    214: #define ASM_IDENTIFY_GCC(FILE)
                    215: 
                    216: /* Names to predefine in the preprocessor for this target machine.  */
                    217: /* [email protected] says mc68000 and m68k should not be here,
                    218:    on the other hand I don't care what he says.  */
                    219: 
                    220: #undef CPP_PREDEFINES
                    221: #define CPP_PREDEFINES "-Dm68k -Dunix -DsysV68"
                    222: 
                    223: /* Specify how to pad function arguments.
                    224:    Value should be `upward', `downward' or `none'.
                    225:    Same as the default, except no padding for large or variable-size args.  */
                    226: 
                    227: #define FUNCTION_ARG_PADDING(MODE, TYPE)                               \
                    228:   (((MODE) == BLKmode                                                  \
                    229:     ? ((TYPE) && TREE_CODE (TYPE_SIZE (TYPE))  == INTEGER_CST          \
                    230:        && int_size_in_bytes (TYPE) < PARM_BOUNDARY / BITS_PER_UNIT)    \
                    231:     : GET_MODE_BITSIZE (MODE) < PARM_BOUNDARY)                         \
                    232:    ? downward : none)
                    233: 
                    234: /* Override part of the obstack macros.  */
                    235: 
                    236: #define __PTR_TO_INT(P) ((int)(P))
                    237: #define __INT_TO_PTR(P) ((char *)(P))
                    238: 
                    239: #undef TARGET_VERSION
                    240: #define TARGET_VERSION fprintf (stderr, " (68k, SGS/AT&T sysV68 syntax)");
                    241: 
                    242: /* Function calls save all but a0, a1, d0, d1, fp0, fp1.  */
                    243: 
                    244: #undef CALL_USED_REGISTERS
                    245: #define CALL_USED_REGISTERS                                            \
                    246:  {1, 1, 0, 0, 0, 0, 0, 0,                                              \
                    247:   1, 1, 0, 0, 0, 0, 0, 1,                                              \
                    248:   1, 1, 0, 0, 0, 0, 0, 0}
                    249: 
                    250: /* If TARGET_68881, return SF and DF values in fp0 instead of d0.  */
                    251: /* NYI: If FP=M68881U return SF and DF values in d0. */
                    252: /* NYI: If -mold return pointer in a0 and d0 */
                    253: 
                    254: #undef FUNCTION_VALUE
                    255: #define FUNCTION_VALUE(VALTYPE,FUNC) LIBCALL_VALUE (TYPE_MODE (VALTYPE))
                    256: 
                    257: /* sysV68 (brain damaged) cc convention support. */
                    258: /* Commented out until we find a safe way to make it optional.  */
                    259: #if 0
                    260: #define FUNCTION_VALUE(VALTYPE,FUNC) \
                    261:   (TREE_CODE (VALTYPE) == REAL_TYPE && TARGET_68881    \
                    262:    ? gen_rtx (REG, TYPE_MODE (VALTYPE), 16)            \
                    263:    : (TREE_CODE (VALTYPE) == POINTER_TYPE              \
                    264:       ? gen_rtx (REG, TYPE_MODE (VALTYPE), 8)          \
                    265:       : gen_rtx (REG, TYPE_MODE (VALTYPE), 0)))
                    266: #endif
                    267: 
                    268: /* If TARGET_68881, SF and DF values are returned in fp0 instead of d0.  */
                    269: 
                    270: #undef LIBCALL_VALUE
                    271: #define LIBCALL_VALUE(MODE)                                               \
                    272:  gen_rtx (REG, (MODE),                                                    \
                    273:          ((TARGET_68881                                                   \
                    274:            && ((MODE) == SFmode || (MODE) == DFmode || (MODE) == XFmode)) \
                    275:           ? 16 : 0))
                    276: 
                    277: /* 1 if N is a possible register number for a function value.
                    278:    d0 may be used, and fp0 as well if -msoft-float is not specified.  */
                    279: 
                    280: #undef FUNCTION_VALUE_REGNO_P
                    281: #define FUNCTION_VALUE_REGNO_P(N) \
                    282:  ((N) == 0 || (TARGET_68881 && (N) == 16))
                    283: 
                    284: /* sysV68 (brain damaged) cc convention support. */
                    285: /* Commented out until we find a safe way to make it optional.  */
                    286: #if 0
                    287: #define FUNCTION_VALUE_REGNO_P(N) \
                    288:  ((N) == 0 || (N) == 8 || (TARGET_68881 && (N) == 16))
                    289: #endif 
                    290: 
                    291: /* Define this to be true when FUNCTION_VALUE_REGNO_P is true for
                    292:    more than one register.  */
                    293: 
                    294: #undef NEEDS_UNTYPED_CALL
                    295: #define NEEDS_UNTYPED_CALL 1
                    296:  
                    297: /* This is the command to make the user-level label named NAME
                    298:    defined for reference from other files.  */
                    299: 
                    300: #undef GLOBAL_ASM_OP
                    301: #define GLOBAL_ASM_OP "global"
                    302: 
                    303: /* Store in OUTPUT a string (made with alloca) containing
                    304:    an assembler-name for a local static variable named NAME.
                    305:    LABELNO is an integer which is different for each call.  */
                    306: 
                    307: #undef ASM_FORMAT_PRIVATE_NAME
                    308: #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
                    309: ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 12),   \
                    310:   sprintf ((OUTPUT), "%s_%%%d", (NAME), (LABELNO)))
                    311: 
                    312: /* The sysV68 as doesn't know about double's and float's.  */
                    313: /* This is how to output an assembler line defining a `double' constant.  */
                    314: 
                    315: #undef ASM_OUTPUT_DOUBLE
                    316: #define ASM_OUTPUT_DOUBLE(FILE,VALUE)  \
                    317: do { long l[2];                                                \
                    318:      REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l);           \
                    319:      fprintf (FILE, "\tlong 0x%x,0x%x\n", l[0], l[1]); \
                    320:    } while (0)
                    321: 
                    322: #undef ASM_OUTPUT_LONG_DOUBLE
                    323: #define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE)                             \
                    324: do { long l[3];                                                                \
                    325:      REAL_VALUE_TO_TARGET_LONG_DOUBLE (VALUE, l);                      \
                    326:      fprintf (FILE, "\tlong 0x%x,0x%x,0x%x\n", l[0], l[1], l[2]);      \
                    327:    } while (0)
                    328: 
                    329: /* This is how to output an assembler line defining a `float' constant.  */
                    330: 
                    331: #undef ASM_OUTPUT_FLOAT
                    332: #define ASM_OUTPUT_FLOAT(FILE,VALUE)  \
                    333: do { long l;                                   \
                    334:      REAL_VALUE_TO_TARGET_SINGLE (VALUE, l);   \
                    335:      fprintf ((FILE), "\tlong 0x%x\n", l);     \
                    336:    } while (0)
                    337: 
                    338: /* This is how to output an assembler line defining an `int' constant.  */
                    339: 
                    340: #undef ASM_OUTPUT_INT
                    341: #define ASM_OUTPUT_INT(FILE,VALUE)  \
                    342: ( fprintf (FILE, "\tlong "),                   \
                    343:   output_addr_const (FILE, (VALUE)),           \
                    344:   fprintf (FILE, "\n"))
                    345: 
                    346: /* Likewise for `char' and `short' constants.  */
                    347: 
                    348: #undef ASM_OUTPUT_SHORT
                    349: #define ASM_OUTPUT_SHORT(FILE,VALUE)  \
                    350: ( fprintf (FILE, "\tshort "),                  \
                    351:   output_addr_const (FILE, (VALUE)),           \
                    352:   fprintf (FILE, "\n"))
                    353: 
                    354: #undef ASM_OUTPUT_CHAR
                    355: #define ASM_OUTPUT_CHAR(FILE,VALUE)  \
                    356: ( fprintf (FILE, "\tbyte "),                   \
                    357:   output_addr_const (FILE, (VALUE)),           \
                    358:   fprintf (FILE, "\n"))
                    359: 
                    360: /* This is how to output an assembler line for a numeric constant byte.  */
                    361: 
                    362: #undef ASM_OUTPUT_BYTE
                    363: #define ASM_OUTPUT_BYTE(FILE,VALUE)  \
                    364:   fprintf (FILE, "\tbyte 0x%x\n", (VALUE))
                    365: 
                    366: /* This is how to output an assembler line
                    367:    that says to advance the location counter
                    368:    to a multiple of 2**LOG bytes.  */
                    369: 
                    370: #undef ASM_OUTPUT_ALIGN
                    371: #define ASM_OUTPUT_ALIGN(FILE,LOG)     \
                    372:   if ((LOG) == 1)                      \
                    373:     fprintf (FILE, "\teven\n");                \
                    374:   else if ((LOG) != 0)                 \
                    375:     abort ();
                    376: 
                    377: #undef ASM_OUTPUT_SKIP
                    378: #define ASM_OUTPUT_SKIP(FILE,SIZE)  \
                    379:   fprintf (FILE, "\tspace %u\n", (SIZE))
                    380: 
                    381: /* Can't use ASM_OUTPUT_SKIP in text section.  */
                    382: 
                    383: #define ASM_NO_SKIP_IN_TEXT 1
                    384: 
                    385: /* The beginnings of sdb support...  */
                    386: 
                    387: #undef ASM_OUTPUT_SOURCE_FILENAME
                    388: #define ASM_OUTPUT_SOURCE_FILENAME(FILE, FILENAME) \
                    389:   fprintf (FILE, "\tfile\t\"%s\"\n", FILENAME)
                    390: 
                    391: #undef ASM_OUTPUT_SOURCE_LINE
                    392: #define ASM_OUTPUT_SOURCE_LINE(FILE, LINENO)   \
                    393:   fprintf (FILE, "\tln\t%d\n",                 \
                    394:           (sdb_begin_function_line             \
                    395:            ? last_linenum - sdb_begin_function_line : 1))
                    396: 
                    397: /* Yet another null terminated string format.  */
                    398: 
                    399: #undef ASM_OUTPUT_ASCII
                    400: #define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \
                    401:   { register int sp = 0, lp = 0;                               \
                    402:     fprintf ((FILE), "\tbyte\t");                              \
                    403:   loop:                                                                \
                    404:     if ((PTR)[sp] > ' ' && ! ((PTR)[sp] & 0x80) && (PTR)[sp] != '\\')  \
                    405:       { lp += 3;                                               \
                    406:        fprintf ((FILE), "'%c", (PTR)[sp]); }                   \
                    407:     else                                                       \
                    408:       { lp += 5;                                               \
                    409:        fprintf ((FILE), "0x%x", (PTR)[sp]); }                  \
                    410:     if (++sp < (LEN))                                          \
                    411:       {        if (lp > 60)                                            \
                    412:          { lp = 0;                                             \
                    413:            fprintf ((FILE), "\n\t%s ", ASCII_DATA_ASM_OP); }   \
                    414:        else                                                    \
                    415:          putc (',', (FILE));                                   \
                    416:        goto loop; }                                            \
                    417:     putc ('\n', (FILE)); }
                    418: 
                    419: /* Print operand X (an rtx) in assembler syntax to file FILE.
                    420:    CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
                    421:    For `%' followed by punctuation, CODE is the punctuation and X is null.
                    422: 
                    423:    On the 68000, we use several CODE characters:
                    424:    '.' for dot needed in Motorola-style opcode names.
                    425:    '-' for an operand pushing on the stack:
                    426:        sp@-, -(sp) or -(%sp) depending on the style of syntax.
                    427:    '+' for an operand pushing on the stack:
                    428:        sp@+, (sp)+ or (%sp)+ depending on the style of syntax.
                    429:    '@' for a reference to the top word on the stack:
                    430:        sp@, (sp) or (%sp) depending on the style of syntax.
                    431:    '#' for an immediate operand prefix (# in MIT and Motorola syntax
                    432:        but & in SGS syntax).
                    433:    '!' for the fpcr register (used in some float-to-fixed conversions).
                    434:    '$' for the letter `s' in an op code, but only on the 68040.
                    435:    '&' for the letter `d' in an op code, but only on the 68040.
                    436: 
                    437:    'b' for byte insn (no effect, on the Sun; this is for the ISI).
                    438:    'd' to force memory addressing to be absolute, not relative.
                    439:    'f' for float insn (print a CONST_DOUBLE as a float rather than in hex)
                    440:    'w' for FPA insn (print a CONST_DOUBLE as a SunFPA constant rather
                    441:        than directly).  Second part of 'y' below.
                    442:    'x' for float insn (print a CONST_DOUBLE as a float rather than in hex),
                    443:        or print pair of registers as rx:ry.
                    444:    'y' for a FPA insn (print pair of registers as rx:ry).  This also outputs
                    445:        CONST_DOUBLE's as SunFPA constant RAM registers if
                    446:        possible, so it should not be used except for the SunFPA.  */
                    447: 
                    448: #undef PRINT_OPERAND
                    449: #define PRINT_OPERAND(FILE, X, CODE)  \
                    450: { if (CODE == '.') fprintf (FILE, ".");                                        \
                    451:   else if (CODE == '#') fprintf (FILE, "&");                           \
                    452:   else if (CODE == '-') fprintf (FILE, "-(%%sp)");                     \
                    453:   else if (CODE == '+') fprintf (FILE, "(%%sp)+");                     \
                    454:   else if (CODE == '@') fprintf (FILE, "(%%sp)");                      \
                    455:   else if (CODE == '!') fprintf (FILE, "%%fpcr");                      \
                    456:   else if (CODE == '$') { if (TARGET_68040_ONLY) fprintf (FILE, "s"); }        \
                    457:   else if (CODE == '&') { if (TARGET_68040_ONLY) fprintf (FILE, "d"); }        \
                    458:   else if (CODE == '/')                                                        \
                    459:     fprintf (FILE, "%%");                                              \
                    460:   else if (GET_CODE (X) == REG)                                                \
                    461:     fprintf (FILE, "%s", reg_names[REGNO (X)]);                                \
                    462:   else if (GET_CODE (X) == MEM)                                                \
                    463:     output_address (XEXP (X, 0));                                      \
                    464:   else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == SFmode)     \
                    465:     { REAL_VALUE_TYPE r; long l;                                       \
                    466:       REAL_VALUE_FROM_CONST_DOUBLE (r, X);                             \
                    467:       REAL_VALUE_TO_TARGET_SINGLE (r, l);                              \
                    468:       /* Use hex representation even if CODE is f.  as needs it.  */   \
                    469:       fprintf (FILE, "&0x%x", l); }                                    \
                    470:   else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == DFmode)     \
                    471:     { REAL_VALUE_TYPE r; int i[2];                                     \
                    472:       REAL_VALUE_FROM_CONST_DOUBLE (r, X);                             \
                    473:       REAL_VALUE_TO_TARGET_DOUBLE (r, i);                              \
                    474:       fprintf (FILE, "&0x%08x%08x", i[0], i[1]); }                     \
                    475:   else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == XFmode)     \
                    476:     { REAL_VALUE_TYPE r;                                               \
                    477:       REAL_VALUE_FROM_CONST_DOUBLE (r, X);                             \
                    478:       ASM_OUTPUT_LONG_DOUBLE_OPERAND (FILE, r); }                      \
                    479:   else { putc ('&', FILE); output_addr_const (FILE, X); }}
                    480: 
                    481: #undef PRINT_OPERAND_ADDRESS
                    482: #define PRINT_OPERAND_ADDRESS(FILE, ADDR)  \
                    483: { register rtx reg1, reg2, breg, ireg;                                 \
                    484:   register rtx addr = ADDR;                                            \
                    485:   rtx offset;                                                          \
                    486:   switch (GET_CODE (addr))                                             \
                    487:     {                                                                  \
                    488:     case REG:                                                          \
                    489:       fprintf (FILE, "(%s)", reg_names[REGNO (addr)]);                 \
                    490:       break;                                                           \
                    491:     case PRE_DEC:                                                      \
                    492:       fprintf (FILE, "-(%s)", reg_names[REGNO (XEXP (addr, 0))]);      \
                    493:       break;                                                           \
                    494:     case POST_INC:                                                     \
                    495:       fprintf (FILE, "(%s)+", reg_names[REGNO (XEXP (addr, 0))]);      \
                    496:       break;                                                           \
                    497:     case PLUS:                                                         \
                    498:       reg1 = 0;        reg2 = 0;                                               \
                    499:       ireg = 0;        breg = 0;                                               \
                    500:       offset = 0;                                                      \
                    501:       if (CONSTANT_ADDRESS_P (XEXP (addr, 0)))                         \
                    502:        {                                                               \
                    503:          offset = XEXP (addr, 0);                                      \
                    504:          addr = XEXP (addr, 1);                                        \
                    505:        }                                                               \
                    506:       else if (CONSTANT_ADDRESS_P (XEXP (addr, 1)))                    \
                    507:        {                                                               \
                    508:          offset = XEXP (addr, 1);                                      \
                    509:          addr = XEXP (addr, 0);                                        \
                    510:        }                                                               \
                    511:       if (GET_CODE (addr) != PLUS) ;                                   \
                    512:       else if (GET_CODE (XEXP (addr, 0)) == SIGN_EXTEND)               \
                    513:        {                                                               \
                    514:          reg1 = XEXP (addr, 0);                                        \
                    515:          addr = XEXP (addr, 1);                                        \
                    516:        }                                                               \
                    517:       else if (GET_CODE (XEXP (addr, 1)) == SIGN_EXTEND)               \
                    518:        {                                                               \
                    519:          reg1 = XEXP (addr, 1);                                        \
                    520:          addr = XEXP (addr, 0);                                        \
                    521:        }                                                               \
                    522:       else if (GET_CODE (XEXP (addr, 0)) == MULT)                      \
                    523:        {                                                               \
                    524:          reg1 = XEXP (addr, 0);                                        \
                    525:          addr = XEXP (addr, 1);                                        \
                    526:        }                                                               \
                    527:       else if (GET_CODE (XEXP (addr, 1)) == MULT)                      \
                    528:        {                                                               \
                    529:          reg1 = XEXP (addr, 1);                                        \
                    530:          addr = XEXP (addr, 0);                                        \
                    531:        }                                                               \
                    532:       else if (GET_CODE (XEXP (addr, 0)) == REG)                       \
                    533:        {                                                               \
                    534:          reg1 = XEXP (addr, 0);                                        \
                    535:          addr = XEXP (addr, 1);                                        \
                    536:        }                                                               \
                    537:       else if (GET_CODE (XEXP (addr, 1)) == REG)                       \
                    538:        {                                                               \
                    539:          reg1 = XEXP (addr, 1);                                        \
                    540:          addr = XEXP (addr, 0);                                        \
                    541:        }                                                               \
                    542:       if (GET_CODE (addr) == REG || GET_CODE (addr) == MULT            \
                    543:          || GET_CODE (addr) == SIGN_EXTEND)                            \
                    544:        { if (reg1 == 0) reg1 = addr; else reg2 = addr; addr = 0; }     \
                    545: /*  for OLD_INDEXING                                                   \
                    546:       else if (GET_CODE (addr) == PLUS)                                        \
                    547:        {                                                               \
                    548:          if (GET_CODE (XEXP (addr, 0)) == REG)                         \
                    549:            {                                                           \
                    550:              reg2 = XEXP (addr, 0);                                    \
                    551:              addr = XEXP (addr, 1);                                    \
                    552:            }                                                           \
                    553:          else if (GET_CODE (XEXP (addr, 1)) == REG)                    \
                    554:            {                                                           \
                    555:              reg2 = XEXP (addr, 1);                                    \
                    556:              addr = XEXP (addr, 0);                                    \
                    557:            }                                                           \
                    558:        }                                                               \
                    559:   */                                                                   \
                    560:       if (offset != 0) { if (addr != 0) abort (); addr = offset; }     \
                    561:       if ((reg1 && (GET_CODE (reg1) == SIGN_EXTEND                     \
                    562:                    || GET_CODE (reg1) == MULT))                        \
                    563:          || (reg2 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg2))))         \
                    564:        { breg = reg2; ireg = reg1; }                                   \
                    565:       else if (reg1 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg1)))                \
                    566:        { breg = reg1; ireg = reg2; }                                   \
                    567:       if (ireg != 0 && breg == 0 && GET_CODE (addr) == LABEL_REF)      \
                    568:         { int scale = 1;                                               \
                    569:          if (GET_CODE (ireg) == MULT)                                  \
                    570:            { scale = INTVAL (XEXP (ireg, 1));                          \
                    571:              ireg = XEXP (ireg, 0); }                                  \
                    572:          if (GET_CODE (ireg) == SIGN_EXTEND)                           \
                    573:            fprintf (FILE, "12(%%pc,%s.w",                              \
                    574:                     reg_names[REGNO (XEXP (ireg, 0))]);                \
                    575:          else                                                          \
                    576:            fprintf (FILE, "12(%%pc,%s.l",                              \
                    577:                     reg_names[REGNO (ireg)]);                          \
                    578:          if (scale != 1) fprintf (FILE, "*%d", scale);                 \
                    579:          fprintf (FILE, ")");                                          \
                    580:          break; }                                                      \
                    581:       if (breg != 0 && ireg == 0 && GET_CODE (addr) == LABEL_REF)      \
                    582:         { fprintf (FILE, "12(%%pc,%s.l",                               \
                    583:                   reg_names[REGNO (breg)]);                            \
                    584:          putc (')', FILE);                                             \
                    585:          break; }                                                      \
                    586:       if (ireg != 0 || breg != 0)                                      \
                    587:        { int scale = 1;                                                \
                    588:          if (breg == 0)                                                \
                    589:            abort ();                                                   \
                    590:          if (addr != 0)                                                \
                    591:            output_addr_const (FILE, addr);                             \
                    592:          fprintf (FILE, "(%s", reg_names[REGNO (breg)]);               \
                    593:          if (ireg != 0)                                                \
                    594:            putc (',', FILE);                                           \
                    595:          if (ireg != 0 && GET_CODE (ireg) == MULT)                     \
                    596:            { scale = INTVAL (XEXP (ireg, 1));                          \
                    597:              ireg = XEXP (ireg, 0); }                                  \
                    598:          if (ireg != 0 && GET_CODE (ireg) == SIGN_EXTEND)              \
                    599:            fprintf (FILE, "%s.w", reg_names[REGNO (XEXP (ireg, 0))]);  \
                    600:          else if (ireg != 0)                                           \
                    601:            fprintf (FILE, "%s.l", reg_names[REGNO (ireg)]);            \
                    602:          if (scale != 1) fprintf (FILE, "*%d", scale);                 \
                    603:          putc (')', FILE);                                             \
                    604:          break;                                                        \
                    605:        }                                                               \
                    606:       else if (reg1 != 0 && GET_CODE (addr) == LABEL_REF)              \
                    607:        { fprintf (FILE, "12(%%pc,%s.w)",                               \
                    608:                   reg_names[REGNO (reg1)]);                            \
                    609:          break; }                                                      \
                    610:     default:                                                           \
                    611:       if (GET_CODE (addr) == CONST_INT                                 \
                    612:          && INTVAL (addr) < 0x8000                                     \
                    613:          && INTVAL (addr) >= -0x8000)                                  \
                    614:        fprintf (FILE, "%d", INTVAL (addr));                            \
                    615:       else                                                             \
                    616:         output_addr_const (FILE, addr);                                        \
                    617:     }}
                    618: 
                    619: /* This is how to store into the string LABEL
                    620:    the symbol_ref name of an internal numbered label where
                    621:    PREFIX is the class of label and NUM is the number within the class.
                    622:    This is suitable for output with `assemble_name'.  */
                    623: 
                    624: #undef ASM_GENERATE_INTERNAL_LABEL
                    625: #define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM)        \
                    626:   sprintf ((LABEL), "%s%%%d", (PREFIX), (NUM))
                    627: 
                    628: /* This is how to output an internal numbered label where
                    629:    PREFIX is the class of label and NUM is the number within the class.  */
                    630: 
                    631: #undef ASM_OUTPUT_INTERNAL_LABEL
                    632: #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM)     \
                    633:     fprintf (FILE, "%s%%%d:\n", PREFIX, NUM)
                    634: 
                    635: /* This is how to output a reference to a user-level label named NAME.
                    636:    `assemble_name' uses this.  */
                    637: 
                    638: #undef ASM_OUTPUT_LABELREF
                    639: #define ASM_OUTPUT_LABELREF(FILE,NAME) \
                    640:   fprintf (FILE, "%s", NAME)
                    641: 
                    642: /* This is how to output an element of a case-vector that is absolute.
                    643:    (The 68000 does not use such vectors,
                    644:    but we must define this macro anyway.)  */
                    645: 
                    646: #undef ASM_OUTPUT_ADDR_VEC_ELT
                    647: #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE)   \
                    648:     fprintf (FILE, "\tlong L%%%d\n", (VALUE))
                    649: 
                    650: /* This is how to output an element of a case-vector that is relative.  */
                    651: 
                    652: #undef ASM_OUTPUT_ADDR_DIFF_ELT
                    653: #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL)     \
                    654:     fprintf (FILE, "\tshort L%%%d-L%%%d\n", (VALUE), (REL))
                    655: 
                    656: #define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLE)                   \
                    657:     fprintf (FILE, "\tswbeg &%d\n%s%%%d:\n",                           \
                    658:             XVECLEN (PATTERN (TABLE), 1), (PREFIX), (NUM))
                    659:             
                    660: #if 0
                    661: /* At end of a switch table, define LD%n iff the symbol LI%n was defined.  */
                    662: #define ASM_OUTPUT_CASE_END(FILE,NUM,TABLE)            \
                    663: { if (switch_table_difference_label_flag)              \
                    664:     asm_fprintf (FILE, "\t%s %LLD%d,%LL%d-%LLI%d-2.b\n",\
                    665:                 SET_ASM_OP, (NUM), (NUM), (NUM))       \
                    666:   switch_table_difference_label_flag = 0; }
                    667: #endif
                    668: 
                    669: /* We have to define this to avoid errors.  */
                    670: int switch_table_difference_label_flag;
                    671: 
                    672: /* Translate some opcodes to fit the sysV68 assembler syntax.  */
                    673: /* The opcodes fdmov and fsmov are guesses.  */
                    674: 
                    675: #define SWITCH_JUMP_MATCH   "jmp 6(%%pc,"
                    676: 
                    677: #undef ASM_OUTPUT_OPCODE
                    678: #define ASM_OUTPUT_OPCODE(FILE, PTR)                   \
                    679: { if ((PTR)[0] == 'j' && (PTR)[1] == 'b')              \
                    680:     { ++(PTR);                                         \
                    681:       while (*(PTR) != ' ')                            \
                    682:        { putc (*(PTR), (FILE)); ++(PTR); }             \
                    683:       fprintf ((FILE), ".w"); }                                \
                    684:   else if ((PTR)[0] == 's')                            \
                    685:     {                                                  \
                    686:       if (!strncmp ((PTR), "swap", 4))                 \
                    687:        { fprintf ((FILE), "swap.w"); (PTR) += 4; }     \
                    688:     }                                                  \
                    689:   else if ((PTR)[0] == 'f')                            \
                    690:     {                                                  \
                    691:       if (!strncmp ((PTR), "fmove", 5))                        \
                    692:        { fprintf ((FILE), "fmov"); (PTR) += 5; }       \
                    693:       else if (!strncmp ((PTR), "f%$move", 7))         \
                    694:        { if (TARGET_68040_ONLY)                        \
                    695:            { fprintf ((FILE), "fsmov"); (PTR) += 7; }  \
                    696:          else                                          \
                    697:            { fprintf ((FILE), "fmov"); (PTR) += 7; } } \
                    698:       else if (!strncmp ((PTR), "f%&move", 7))         \
                    699:        { if (TARGET_68040_ONLY)                        \
                    700:            { fprintf ((FILE), "fdmov"); (PTR) += 7; }  \
                    701:          else                                          \
                    702:            { fprintf ((FILE), "fmov"); (PTR) += 7; } } \
                    703:       else if (!strncmp ((PTR), "ftst", 4))            \
                    704:        { fprintf ((FILE), "ftest"); (PTR) += 4; }      \
                    705:       else if (!strncmp ((PTR), "fbne", 4))            \
                    706:        { fprintf ((FILE), "fbneq"); (PTR) += 4; }      \
                    707:       else if (!strncmp ((PTR), "fsne", 4))            \
                    708:        { fprintf ((FILE), "fsneq"); (PTR) += 4; }      \
                    709:     }                                                  \
                    710: /* MOVE, MOVEA, MOVEQ, MOVEC ==> MOV   */              \
                    711:   else if ((PTR)[0] == 'm' && (PTR)[1] == 'o'          \
                    712:           && (PTR)[2] == 'v' && (PTR)[3] == 'e')       \
                    713:     { fprintf ((FILE), "mov"); (PTR) += 4;             \
                    714:        if ((PTR)[0] == 'q' || (PTR)[0] == 'a'          \
                    715:           || (PTR)[0] == 'c') (PTR)++; }               \
                    716: /* SUB, SUBQ, SUBA, SUBI ==> SUB */                    \
                    717:   else if ((PTR)[0] == 's' && (PTR)[1] == 'u'          \
                    718:           && (PTR)[2] == 'b')                          \
                    719:     { fprintf ((FILE), "sub"); (PTR) += 3;             \
                    720:        if ((PTR)[0] == 'q' || (PTR)[0] == 'i'          \
                    721:           || (PTR)[0] == 'a') (PTR)++; }               \
                    722: /* CMP, CMPA, CMPI, CMPM ==> CMP       */              \
                    723:   else if ((PTR)[0] == 'c' && (PTR)[1] == 'm'          \
                    724:           && (PTR)[2] == 'p')                          \
                    725:     { fprintf ((FILE), "cmp"); (PTR) += 3;             \
                    726:        if ((PTR)[0] == 'a' || (PTR)[0] == 'i'          \
                    727:           || (PTR)[0] == 'm') (PTR)++; }               \
                    728: /* JMP to switch label */                              \
                    729:   else if (!strncmp((PTR), (SWITCH_JUMP_MATCH), sizeof(SWITCH_JUMP_MATCH) - 1)) \
                    730:     { while (*(PTR)++ != '(');                         \
                    731:       fprintf ((FILE), "jmp 8("); }                    \
                    732: }
                    733: 
                    734: /* This says how to output an assembler line
                    735:    to define a global common symbol.  */
                    736: 
                    737: #undef ASM_OUTPUT_COMMON
                    738: #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED)  \
                    739: ( fputs ("\tcomm ", (FILE)),                   \
                    740:   assemble_name ((FILE), (NAME)),              \
                    741:   fprintf ((FILE), ",%u\n", (ROUNDED)))
                    742: 
                    743: /* This says how to output an assembler line
                    744:    to define a local common symbol.  */
                    745: 
                    746: #undef ASM_OUTPUT_LOCAL
                    747: #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED)  \
                    748: ( fputs ("\tlcomm ", (FILE)),                  \
                    749:   assemble_name ((FILE), (NAME)),              \
                    750:   fprintf ((FILE), ",%u\n", (ROUNDED)))
                    751: 
                    752: 
                    753: /* Override usual definitions of SDB output macros.
                    754:    These definitions differ only in the absence of the period
                    755:    at the beginning of the name of the directive
                    756:    and in the use of `~' as the symbol for the current location.  */
                    757: 
                    758: #define PUT_SDB_SCL(a) fprintf(asm_out_file, "\tscl\t%d;", (a))
                    759: #define PUT_SDB_INT_VAL(a) fprintf (asm_out_file, "\tval\t%d;", (a))
                    760: #define PUT_SDB_VAL(a)                         \
                    761: ( fputs ("\tval\t", asm_out_file),             \
                    762:   output_addr_const (asm_out_file, (a)),       \
                    763:   fputc (';', asm_out_file))
                    764: 
                    765: #define PUT_SDB_DEF(a)                         \
                    766: do { fprintf (asm_out_file, "\tdef\t");        \
                    767:      ASM_OUTPUT_LABELREF (asm_out_file, a);    \
                    768:      fprintf (asm_out_file, ";"); } while (0)
                    769: 
                    770: #define PUT_SDB_PLAIN_DEF(a) fprintf(asm_out_file,"\tdef\t~%s;",a)
                    771: #define PUT_SDB_ENDEF fputs("\tendef\n", asm_out_file)
                    772: #define PUT_SDB_TYPE(a) fprintf(asm_out_file, "\ttype\t0%o;", a)
                    773: #define PUT_SDB_SIZE(a) fprintf(asm_out_file, "\tsize\t%d;", a)
                    774: #define PUT_SDB_START_DIM fprintf(asm_out_file, "\tdim\t")
                    775: #define PUT_SDB_NEXT_DIM(a) fprintf(asm_out_file, "%d,", a)
                    776: #define PUT_SDB_LAST_DIM(a) fprintf(asm_out_file, "%d;", a)
                    777: 
                    778: #define PUT_SDB_TAG(a)                         \
                    779: do { fprintf (asm_out_file, "\ttag\t");        \
                    780:      ASM_OUTPUT_LABELREF (asm_out_file, a);    \
                    781:      fprintf (asm_out_file, ";"); } while (0)
                    782: 
                    783: #define PUT_SDB_BLOCK_START(LINE)              \
                    784:   fprintf (asm_out_file,                       \
                    785:           "\tdef\t~bb;\tval\t~;\tscl\t100;\tline\t%d;\tendef\n",       \
                    786:           (LINE))
                    787: 
                    788: #define PUT_SDB_BLOCK_END(LINE)                        \
                    789:   fprintf (asm_out_file,                       \
                    790:           "\tdef\t~eb;\tval\t~;\tscl\t100;\tline\t%d;\tendef\n",       \
                    791:           (LINE))
                    792: 
                    793: #define PUT_SDB_FUNCTION_START(LINE)           \
                    794:   fprintf (asm_out_file,                       \
                    795:           "\tdef\t~bf;\tval\t~;\tscl\t101;\tline\t%d;\tendef\n",       \
                    796:           (LINE))
                    797: 
                    798: #define PUT_SDB_FUNCTION_END(LINE)             \
                    799:   fprintf (asm_out_file,                       \
                    800:           "\tdef\t~ef;\tval\t~;\tscl\t101;\tline\t%d;\tendef\n",       \
                    801:           (LINE))
                    802: 
                    803: #define PUT_SDB_EPILOGUE_END(NAME)             \
                    804:   fprintf (asm_out_file,                       \
                    805:           "\tdef\t%s;\tval\t~;\tscl\t-1;\tendef\n",    \
                    806:           (NAME))
                    807: 
                    808: #define SDB_GENERATE_FAKE(BUFFER, NUMBER) \
                    809:   sprintf ((BUFFER), "~%dfake", (NUMBER));
                    810: 
                    811: /* Define subroutines to call to handle multiply, divide, and remainder.
                    812:    Use the subroutines that the 3b1's library provides.
                    813:    The `*' prevents an underscore from being prepended by the compiler.  */
                    814: 
                    815: #define DIVSI3_LIBCALL "*ldiv"
                    816: #define UDIVSI3_LIBCALL "*uldiv"
                    817: #define MODSI3_LIBCALL "*lrem"
                    818: #define UMODSI3_LIBCALL "*ulrem"
                    819: #define MULSI3_LIBCALL "*lmul"
                    820: #define UMULSI3_LIBCALL "*ulmul"

unix.superglobalmegacorp.com

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