Annotation of researchv10dc/cmd/gcc/tm-3b1.h, revision 1.1.1.1

1.1       root        1: /* Definitions of target machine for GNU compiler.  
                      2:    AT&T UNIX PC version (pc7300, 3b1)
                      3: 
                      4:    Written by Alex Crain
                      5:    bug reports to [email protected]
                      6: 
                      7:    Copyright (C) 1987 Free Software Foundation, Inc.
                      8: 
                      9: This file is part of GNU CC.
                     10: 
                     11: GNU CC is distributed in the hope that it will be useful,
                     12: but WITHOUT ANY WARRANTY.  No author or distributor
                     13: accepts responsibility to anyone for the consequences of using it
                     14: or for whether it serves any particular purpose or works at all,
                     15: unless he says so in writing.  Refer to the GNU CC General Public
                     16: License for full details.
                     17: 
                     18: Everyone is granted permission to copy, modify and redistribute
                     19: GNU CC, but only under the conditions described in the
                     20: GNU CC General Public License.   A copy of this license is
                     21: supposed to have been given to you along with GNU CC so you
                     22: can know your rights and responsibilities.  It should be in a
                     23: file named COPYING.  Among other things, the copyright notice
                     24: and this notice must be preserved on all copies.  */
                     25: 
                     26: #define SGS_3B1
                     27: 
                     28: #include "tm-hp9k320.h"
                     29: 
                     30: /* See tm-m68k.h.  7 means 680[01]0 with no 68881.  */
                     31: 
                     32: #undef TARGET_DEFAULT
                     33: #define        TARGET_DEFAULT 0
                     34: 
                     35: /* -m68020 requires special flags to the assembler.  */
                     36: 
                     37: #undef ASM_SPEC
                     38: #define ASM_SPEC "%{m68020:-68020}%{!m68020:-68010}"
                     39: 
                     40: /* we use /lib/libp/lib*  when profiling */
                     41: 
                     42: #undef LIB_SPEC
                     43: #define LIB_SPEC "%{!shlib:%{p:-L/lib/libp} %{pg:-L/lib/libp} -lc}"
                     44: 
                     45: /* shared libraries need to use crt0s.o  */
                     46: 
                     47: #undef STARTFILE_SPEC
                     48: #define STARTFILE_SPEC \
                     49:   "%{!shlib:%{pg:mcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}\
                     50:    %{shlib:crt0s.o%s shlib.ifile%s} "
                     51: 
                     52: /* cpp has to support a #sccs directive for the /usr/include files */
                     53: 
                     54: #define SCCS_DIRECTIVE
                     55: 
                     56: /* Names to predefine in the preprocessor for this target machine.  */
                     57: 
                     58: #undef CPP_PREDEFINES
                     59: #define CPP_PREDEFINES "-Dmc68000 -Dmc68k -Dm68k -Dunix -Dunixpc"
                     60: 
                     61: /* Override parts of tm-m68k.h to fit the HPUX assembler.  */
                     62: 
                     63: #undef TARGET_VERSION
                     64: #undef ASM_OUTPUT_DOUBLE
                     65: #undef ASM_OUTPUT_FLOAT
                     66: #undef ASM_OUTPUT_ALIGN
                     67: #undef ASM_OUTPUT_SOURCE_FILENAME
                     68: #undef ASM_OUTPUT_SOURCE_LINE
                     69: #undef PRINT_OPERAND_ADDRESS
                     70: #undef ASM_OUTPUT_INTERNAL_LABEL
                     71: #undef ASM_OUTPUT_OPCODE
                     72: #undef ASM_OUTPUT_LOCAL
                     73: #undef ASM_OUTPUT_LABELREF
                     74: #undef ASM_OUTPUT_ASCII
                     75: 
                     76: #define TARGET_VERSION printf (" (68k, SGS/AT&T unixpc syntax)");
                     77: 
                     78: /* The unixpc doesn't know about double's and float's */
                     79: 
                     80: #define ASM_OUTPUT_DOUBLE(FILE,VALUE)  \
                     81: do { union { double d; long l[2]; } tem;               \
                     82:      tem.d = (VALUE);                                  \
                     83:      fprintf(FILE, "\tlong 0x%x,0x%x\n", tem.l[0], tem.l[1]); \
                     84:    } while (0)
                     85: 
                     86: #define ASM_OUTPUT_FLOAT(FILE,VALUE)  \
                     87: do { union { float f; long l;} tem;                    \
                     88:      tem.f = (VALUE);                                  \
                     89:      fprintf (FILE, "\tlong 0x%x\n", tem.l);   \
                     90:    } while (0)
                     91: 
                     92: #define ASM_OUTPUT_ALIGN(FILE,LOG)     \
                     93:   if ((LOG) == 1)                      \
                     94:     fprintf (FILE, "\teven\n");        \
                     95:   else if ((LOG) != 0)                 \
                     96:     abort ();
                     97: 
                     98: /* The beginnings of sdb support... */
                     99: 
                    100: #define ASM_OUTPUT_SOURCE_FILENAME(FILE, FILENAME) \
                    101:   fprintf (FILE, "\tfile\t\"%s\"\n", FILENAME);
                    102: 
                    103: #define ASM_OUTPUT_SOURCE_LINE(FILE, LINENO) \
                    104:   fprintf (FILE, "\tln\t%d\n", LINENO);
                    105: 
                    106: /* Yet another null terminated string format. */
                    107: 
                    108: #define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \
                    109:   { register int sp = 0, lp = 0; \
                    110:     fprintf (FILE, "\tbyte\t"); \
                    111:   loop: \
                    112:     if (PTR[sp] > ' ' && ! (PTR[sp] & 0x80) && PTR[sp] != '\\') \
                    113:       { lp += 3; \
                    114:        fprintf (FILE, "'%c", PTR[sp]); } \
                    115:     else \
                    116:       { lp += 5; \
                    117:        fprintf (FILE, "0x%x", PTR[sp]); } \
                    118:     if (++sp < LEN) \
                    119:       {        if (lp > 60) \
                    120:          { lp = 0; \
                    121:            fprintf (FILE, "\n%s ", ASCII_DATA_ASM_OP); }       \
                    122:        else \
                    123:          putc (',', FILE); \
                    124:        goto loop; } \
                    125:     putc ('\n', FILE); }
                    126: 
                    127: /* Note that in the case of the movhi which fetches an element of
                    128:    an ADDR_DIFF_VEC the offset output is too large by 2.
                    129:    This is because the 3b1 assembler refuses to subtract 2.
                    130:    ASM_OUTPUT_CASE_LABEL, below, compensates for this.  */
                    131: 
                    132: #define PRINT_OPERAND_ADDRESS(FILE, ADDR)  \
                    133: { register rtx reg1, reg2, breg, ireg;                                 \
                    134:   register rtx addr = ADDR;                                            \
                    135:   rtx offset;                                                          \
                    136:   switch (GET_CODE (addr))                                             \
                    137:     {                                                                  \
                    138:     case REG:                                                          \
                    139:       fprintf (FILE, "(%s)", reg_name [REGNO (addr)]);                 \
                    140:       break;                                                           \
                    141:     case PRE_DEC:                                                      \
                    142:       fprintf (FILE, "-(%s)", reg_name [REGNO (XEXP (addr, 0))]);      \
                    143:       break;                                                           \
                    144:     case POST_INC:                                                     \
                    145:       fprintf (FILE, "(%s)+", reg_name [REGNO (XEXP (addr, 0))]);      \
                    146:       break;                                                           \
                    147:     case PLUS:                                                         \
                    148:       reg1 = 0;        reg2 = 0;                                               \
                    149:       ireg = 0;        breg = 0;                                               \
                    150:       offset = 0;                                                      \
                    151:       if (CONSTANT_ADDRESS_P (XEXP (addr, 0)))                         \
                    152:        {                                                               \
                    153:          offset = XEXP (addr, 0);                                      \
                    154:          addr = XEXP (addr, 1);                                        \
                    155:        }                                                               \
                    156:       else if (CONSTANT_ADDRESS_P (XEXP (addr, 1)))                    \
                    157:        {                                                               \
                    158:          offset = XEXP (addr, 1);                                      \
                    159:          addr = XEXP (addr, 0);                                        \
                    160:        }                                                               \
                    161:       if (GET_CODE (addr) != PLUS) ;                                   \
                    162:       else if (GET_CODE (XEXP (addr, 0)) == SIGN_EXTEND)               \
                    163:        {                                                               \
                    164:          reg1 = XEXP (addr, 0);                                        \
                    165:          addr = XEXP (addr, 1);                                        \
                    166:        }                                                               \
                    167:       else if (GET_CODE (XEXP (addr, 1)) == SIGN_EXTEND)               \
                    168:        {                                                               \
                    169:          reg1 = XEXP (addr, 1);                                        \
                    170:          addr = XEXP (addr, 0);                                        \
                    171:        }                                                               \
                    172:       else if (GET_CODE (XEXP (addr, 0)) == MULT)                      \
                    173:        {                                                               \
                    174:          reg1 = XEXP (addr, 0);                                        \
                    175:          addr = XEXP (addr, 1);                                        \
                    176:        }                                                               \
                    177:       else if (GET_CODE (XEXP (addr, 1)) == MULT)                      \
                    178:        {                                                               \
                    179:          reg1 = XEXP (addr, 1);                                        \
                    180:          addr = XEXP (addr, 0);                                        \
                    181:        }                                                               \
                    182:       else if (GET_CODE (XEXP (addr, 0)) == REG)                       \
                    183:        {                                                               \
                    184:          reg1 = XEXP (addr, 0);                                        \
                    185:          addr = XEXP (addr, 1);                                        \
                    186:        }                                                               \
                    187:       else if (GET_CODE (XEXP (addr, 1)) == REG)                       \
                    188:        {                                                               \
                    189:          reg1 = XEXP (addr, 1);                                        \
                    190:          addr = XEXP (addr, 0);                                        \
                    191:        }                                                               \
                    192:       if (GET_CODE (addr) == REG || GET_CODE (addr) == MULT            \
                    193:          || GET_CODE (addr) == SIGN_EXTEND)                            \
                    194:        { if (reg1 == 0) reg1 = addr; else reg2 = addr; addr = 0; }     \
                    195: /*  for OLD_INDEXING                                                   \
                    196:       else if (GET_CODE (addr) == PLUS)                                        \
                    197:        {                                                               \
                    198:          if (GET_CODE (XEXP (addr, 0)) == REG)                         \
                    199:            {                                                           \
                    200:              reg2 = XEXP (addr, 0);                                    \
                    201:              addr = XEXP (addr, 1);                                    \
                    202:            }                                                           \
                    203:          else if (GET_CODE (XEXP (addr, 1)) == REG)                    \
                    204:            {                                                           \
                    205:              reg2 = XEXP (addr, 1);                                    \
                    206:              addr = XEXP (addr, 0);                                    \
                    207:            }                                                           \
                    208:        }                                                               \
                    209:   */                                                                   \
                    210:       if (offset != 0) { if (addr != 0) abort (); addr = offset; }     \
                    211:       if ((reg1 && (GET_CODE (reg1) == SIGN_EXTEND                     \
                    212:                    || GET_CODE (reg1) == MULT))                        \
                    213:          || (reg2 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg2))))         \
                    214:        { breg = reg2; ireg = reg1; }                                   \
                    215:       else if (reg1 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg1)))                \
                    216:        { breg = reg1; ireg = reg2; }                                   \
                    217:       if (ireg != 0 && breg == 0 && GET_CODE (addr) == LABEL_REF)      \
                    218:         { int scale = 1;                                               \
                    219:          if (GET_CODE (ireg) == MULT)                                  \
                    220:            { scale = INTVAL (XEXP (ireg, 1));                          \
                    221:              ireg = XEXP (ireg, 0); }                                  \
                    222:          if (GET_CODE (ireg) == SIGN_EXTEND)                           \
                    223:            fprintf (FILE, "L%d-LI%d(%%pc,%s.w",                        \
                    224:                     CODE_LABEL_NUMBER (XEXP (addr, 0)),                \
                    225:                     CODE_LABEL_NUMBER (XEXP (addr, 0)),                \
                    226:                     reg_name[REGNO (XEXP (ireg, 0))]);                 \
                    227:          else                                                          \
                    228:            fprintf (FILE, "L%d-LI%d(%%pc,%s.l",                        \
                    229:                     CODE_LABEL_NUMBER (XEXP (addr, 0)),                \
                    230:                     CODE_LABEL_NUMBER (XEXP (addr, 0)),                \
                    231:                     reg_name[REGNO (ireg)]);                           \
                    232:          if (scale != 1) fprintf (FILE, ":%d", scale);                 \
                    233:          fprintf (FILE, ")");                                          \
                    234:          break; }                                                      \
                    235:       if (ireg != 0 || breg != 0)                                      \
                    236:        { int scale = 1;                                                \
                    237:          if (breg == 0)                                                \
                    238:            abort ();                                                   \
                    239:          if (addr != 0)                                                \
                    240:            output_addr_const (FILE, addr);                             \
                    241:          fprintf (FILE, "(%s", reg_name[REGNO (breg)]);                \
                    242:          if (ireg != 0)                                                \
                    243:            putc (',', FILE);                                           \
                    244:          if (ireg != 0 && GET_CODE (ireg) == MULT)                     \
                    245:            { scale = INTVAL (XEXP (ireg, 1));                          \
                    246:              ireg = XEXP (ireg, 0); }                                  \
                    247:          if (ireg != 0 && GET_CODE (ireg) == SIGN_EXTEND)              \
                    248:            fprintf (FILE, "%s.w", reg_name[REGNO (XEXP (ireg, 0))]);   \
                    249:          else if (ireg != 0)                                           \
                    250:            fprintf (FILE, "%s.l", reg_name[REGNO (ireg)]);             \
                    251:          if (scale != 1) fprintf (FILE, ":%d", scale);                 \
                    252:          putc (')', FILE);                                             \
                    253:          break;                                                        \
                    254:        }                                                               \
                    255:       else if (reg1 != 0 && GET_CODE (addr) == LABEL_REF)              \
                    256:        { fprintf (FILE, "L%d-LI%d(%%pc,%s.w)",                         \
                    257:                   CODE_LABEL_NUMBER (XEXP (addr, 0)),                  \
                    258:                   CODE_LABEL_NUMBER (XEXP (addr, 0)),                  \
                    259:                   reg_name[REGNO (reg1)]);                             \
                    260:          break; }                                                      \
                    261:     default:                                                           \
                    262:       if (GET_CODE (addr) == CONST_INT                                 \
                    263:          && INTVAL (addr) < 0x8000                                     \
                    264:          && INTVAL (addr) >= -0x8000)                                  \
                    265:        fprintf (FILE, "%d", INTVAL (addr));                            \
                    266:       else                                                             \
                    267:         output_addr_const (FILE, addr);                                        \
                    268:     }}
                    269: 
                    270: #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM)     \
                    271:     fprintf (FILE, "%s%d:\n", PREFIX, NUM)
                    272: 
                    273: #define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLE)   \
                    274:     fprintf (FILE, "\tswbeg &%d\n%s%d:\n\tshort 0",    \
                    275:             XVECLEN (PATTERN (TABLE), 1) + 1, PREFIX, NUM)
                    276: 
                    277: #define ASM_OUTPUT_OPCODE(FILE, PTR)                   \
                    278: { if ((PTR)[0] == 'j' && (PTR)[1] == 'b')              \
                    279:     { ++(PTR);                                         \
                    280:       while (*(PTR) != ' ')                            \
                    281:        { putc (*(PTR), (FILE)); ++(PTR); }             \
                    282:       fprintf ((FILE), ".w"); }                                \
                    283:   else if ((PTR)[0] == 'f')                            \
                    284:     {                                                  \
                    285:       if (!strncmp ((PTR), "fmove", 5))                        \
                    286:        { fprintf ((FILE), "fmov"); (PTR) += 5; }       \
                    287:       else if (!strncmp ((PTR), "ftst", 4))            \
                    288:        { fprintf ((FILE), "ftest"); (PTR) += 4; }      \
                    289:     }                                                  \
                    290: /* MOVE, MOVEA, MOVEQ, MOVEC ==> MOV   */              \
                    291:   else if ((PTR)[0] == 'm' && (PTR)[1] == 'o'          \
                    292:           && (PTR)[2] == 'v' && (PTR)[3] == 'e')       \
                    293:     { fprintf ((FILE), "mov"); (PTR) += 4;             \
                    294:        if ((PTR)[0] == 'q' || (PTR)[0] == 'a' ||       \
                    295:           (PTR)[0] == 'c') (PTR)++; }                  \
                    296: /* SUB, SUBQ, SUBA, SUBI ==> SUB */                    \
                    297:   else if ((PTR)[0] == 's' && (PTR)[1] == 'u'          \
                    298:           && (PTR)[2] == 'b')                          \
                    299:     { fprintf ((FILE), "sub"); (PTR) += 3;             \
                    300:        if ((PTR)[0] == 'q' || (PTR)[0] == 'i' ||       \
                    301:           (PTR)[0] == 'a') (PTR)++; }                  \
                    302: /* CMP, CMPA, CMPI, CMPM ==> CMP       */              \
                    303:   else if ((PTR)[0] == 'c' && (PTR)[1] == 'm'          \
                    304:           && (PTR)[2] == 'p')                          \
                    305:     { fprintf ((FILE), "cmp"); (PTR) += 3;             \
                    306:        if ((PTR)[0] == 'a' || (PTR)[0] == 'i' ||       \
                    307:           (PTR)[0] == 'm') (PTR)++; }                  \
                    308: }
                    309: 
                    310: #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE)  \
                    311: ( fputs ("\tlcomm ", (FILE)),                  \
                    312:   assemble_name ((FILE), (NAME)),              \
                    313:   fprintf ((FILE), ",%d\n", (SIZE)))
                    314: 
                    315: #define ASM_OUTPUT_LABELREF(FILE,NAME) \
                    316:   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.