Annotation of GNUtools/cc/config/ns32k/tek6000.h, revision 1.1.1.1

1.1       root        1: /* Definitions of target machine for GNU compiler.
                      2:    Generic Tektronix 6000 series NS32000 version.
                      3:    See ns32k/tek6100.h and ns32k/tek6200.h, which include this file.
                      4:    Copyright (C) 1990 Free Software Foundation, Inc.
                      5:    Created by Snoopy  (sopwith.uucp!snoopy).
                      6:    Based on work by Mark Mason ([email protected],
                      7:    [email protected]) and Keith Packard.
                      8: 
                      9: This file is part of GNU CC.
                     10: 
                     11: GNU CC is free software; you can redistribute it and/or modify
                     12: it under the terms of the GNU General Public License as published by
                     13: the Free Software Foundation; either version 2, or (at your option)
                     14: any later version.
                     15: 
                     16: GNU CC is distributed in the hope that it will be useful,
                     17: but WITHOUT ANY WARRANTY; without even the implied warranty of
                     18: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     19: GNU General Public License for more details.
                     20: 
                     21: You should have received a copy of the GNU General Public License
                     22: along with GNU CC; see the file COPYING.  If not, write to
                     23: the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
                     24: 
                     25: /* Generate syntax for the UTek assembler. */
                     26: #ifndef UTEK_ASM
                     27: #define UTEK_ASM
                     28: #endif
                     29: 
                     30: /* Two flags to control how addresses are printed in assembler insns.  */
                     31: 
                     32: /* The way PUT_ABSOLUTE_PREFIX in ns32k.h works, setting it to 0 will
                     33:  * turn it off.  Define ABSOLUTE_PREFIX before including ns32k.h.
                     34:  */
                     35: #define ABSOLUTE_PREFIX                0
                     36: #define IMMEDIATE_PREFIX       '$'
                     37: 
                     38: #include "ns32k/ns32k.h"
                     39: 
                     40: /* Define these after ns32k.c so we will notice if gcc tries to
                     41:  * output external mode addressing.  UTek's as and ld do not support
                     42:  * external mode addressing, according to Daryl McDaniel (illian.uucp!darylm).
                     43:  * Hopefully the UTek assembler will complain if gcc feeds it this stuff.
                     44:  * They don't seem to do anything, I think that gcc is not actually
                     45:  * trying to generate external mode operands.
                     46:  */
                     47: #undef PUT_EXTERNAL_PREFIX
                     48: #define PUT_EXTERNAL_PREFIX(arg)  fprintf(arg, "  Should not be using external mode under UTek.  ")
                     49: #define EXTERNAL_PREFIX '%'
                     50: 
                     51: /* Used in ns32k.c to control syntax. */
                     52: #define NO_ABSOLUTE_PREFIX_IF_SYMBOLIC
                     53: #define NO_IMMEDIATE_PREFIX_IF_SYMBOLIC
                     54: 
                     55: /* Used in ns32k.md to specify syntax of bsr/jsr operand. */
                     56: #define CALL_MEMREF_IMPLICIT
                     57: 
                     58: /* #define PC_RELATIVE */      /* Seems to break things. */
                     59: #define BASE_REG_NEEDED                /* Seems to fix problem where external mode
                     60:                                 * syntax was being generated.
                     61:                                 */
                     62: 
                     63: /*  ------------   Debugging Support   ----------------------------- */
                     64: 
                     65: /* The sdb support does not yet work with UTek.  Need to teach gcc
                     66:  * how to create sdb type stabs as well as dbx style stabs.
                     67:  */
                     68: #define DBX_DEBUGGING_INFO
                     69: /* #define SDB_DEBUGGING_INFO */
                     70: 
                     71: /* Act the same as the UTek complier: -g for dbx, -go for sdb.
                     72:  * This is used in toplev.c.
                     73:  */
                     74: #define PREFERRED_DEBUGGING_TYPE \
                     75:        ((len > 1 && !strncmp(str, "go", len)) ? SDB_DEBUG : DBX_DEBUG )
                     76: 
                     77: /* Sequent has some changes in the format of DBX symbols.  */
                     78: #define DBX_NO_XREFS 1
                     79: 
                     80: /* Don't split DBX symbols into continuations.  */
                     81: #define DBX_CONTIN_LENGTH 0
                     82: 
                     83: /* ------------------------------------------- */
                     84: 
                     85: #define TARGET_DEFAULT 1
                     86: 
                     87: /* These control the C++ compiler somehow.  */
                     88: #define FASCIST_ASSEMBLER
                     89: #define USE_COLLECT
                     90: 
                     91: /* Print subsidiary information on the compiler version in use.  */
                     92: #undef TARGET_VERSION
                     93: #define TARGET_VERSION fprintf (stderr, " (ns32k, UTek syntax)");
                     94: 
                     95: /* The tek6100.h and tek6200.h files add stratos or merlin respectively. */
                     96: 
                     97: #define CPP_PREDEFINES_Tek6000 \
                     98:   "-Dns16000 -Dns32000 -Dns32k -Dns32016 -DUTek -DUTEK -Dbsd -DBSD \
                     99:    -Asystem(unix) -Asystem(bsd) -Acpu(ns32k) -Amachine(ns32k)"
                    100: #undef CPP_PREDEFINES
                    101: #define CPP_PREDEFINES CPP_PREDEFINES_Tek6000
                    102: 
                    103: /* This is how to align the code that follows an unconditional branch.
                    104:    Don't define it, since it confuses the assembler (we hear).  */
                    105: 
                    106: #undef ASM_OUTPUT_ALIGN_CODE
                    107: 
                    108: /* Assembler pseudo-op for shared data segment. */
                    109: #define SHARED_SECTION_ASM_OP ".shdata"
                    110: 
                    111: #ifdef UTEK_ASM
                    112: #undef  FUNCTION_PROLOGUE
                    113: 
                    114: /* This differs from the one in ns32k.h in printing a bitmask
                    115:    rather than a register list in the enter or save instruction.  */
                    116: 
                    117: #define FUNCTION_PROLOGUE(FILE, SIZE)     \
                    118: { register int regno, g_regs_used = 0;                         \
                    119:   int used_regs_buf[8], *bufp = used_regs_buf;                 \
                    120:   int used_fregs_buf[8], *fbufp = used_fregs_buf;              \
                    121:   extern char call_used_regs[];                                        \
                    122:   MAIN_FUNCTION_PROLOGUE;                                      \
                    123:   for (regno = 0; regno < 8; regno++)                          \
                    124:     if (regs_ever_live[regno]                                  \
                    125:        && ! call_used_regs[regno])                             \
                    126:     {                                                          \
                    127:       *bufp++ = regno; g_regs_used++;                          \
                    128:     }                                                          \
                    129:   *bufp = -1;                                                  \
                    130:   for (; regno < 16; regno++)                                  \
                    131:     if (regs_ever_live[regno] && !call_used_regs[regno]) {     \
                    132:       *fbufp++ = regno;                                                \
                    133:     }                                                          \
                    134:   *fbufp = -1;                                                 \
                    135:   bufp = used_regs_buf;                                                \
                    136:   if (frame_pointer_needed)                                    \
                    137:     fprintf (FILE, "\tenter ");                                        \
                    138:   else if (g_regs_used)                                                \
                    139:     fprintf (FILE, "\tsave ");                                 \
                    140:   if (frame_pointer_needed || g_regs_used)                     \
                    141:     {                                                          \
                    142:       char mask = 0;                                           \
                    143:       while (*bufp >= 0)                                       \
                    144:        mask |= 1 << *bufp++;                                   \
                    145:       fprintf (FILE, "$0x%x", (int) mask & 0xff);              \
                    146:     }                                                          \
                    147:   if (frame_pointer_needed)                                    \
                    148:     fprintf (FILE, ",$%d\n", SIZE);                            \
                    149:   else if (g_regs_used)                                                \
                    150:     fprintf (FILE, "\n");                                      \
                    151:   fbufp = used_fregs_buf;                                      \
                    152:   while (*fbufp >= 0)                                          \
                    153:     {                                                          \
                    154:       if ((*fbufp & 1) || (fbufp[0] != fbufp[1] - 1))          \
                    155:        fprintf (FILE, "\tmovf f%d,tos\n", *fbufp++ - 8);       \
                    156:       else                                                     \
                    157:        {                                                       \
                    158:          fprintf (FILE, "\tmovl f%d,tos\n", fbufp[0] - 8);     \
                    159:          fbufp += 2;                                           \
                    160:        }                                                       \
                    161:     }                                                          \
                    162: }
                    163: 
                    164: #undef  FUNCTION_EPILOGUE
                    165: 
                    166: /* This differs from the one in ns32k.h in printing a bitmask
                    167:    rather than a register list in the exit or restore instruction.  */
                    168: 
                    169: #define FUNCTION_EPILOGUE(FILE, SIZE) \
                    170: { register int regno, g_regs_used = 0, f_regs_used = 0;                \
                    171:   int used_regs_buf[8], *bufp = used_regs_buf;                 \
                    172:   int used_fregs_buf[8], *fbufp = used_fregs_buf;              \
                    173:   extern char call_used_regs[];                                        \
                    174:   *fbufp++ = -2;                                               \
                    175:   for (regno = 8; regno < 16; regno++)                         \
                    176:     if (regs_ever_live[regno] && !call_used_regs[regno]) {     \
                    177:        *fbufp++ = regno; f_regs_used++;                                \
                    178:     }                                                          \
                    179:   fbufp--;                                                     \
                    180:   for (regno = 0; regno < 8; regno++)                          \
                    181:     if (regs_ever_live[regno]                                  \
                    182:        && ! call_used_regs[regno])                             \
                    183:     {                                                          \
                    184:       *bufp++ = regno; g_regs_used++;                          \
                    185:     }                                                          \
                    186:   while (fbufp > used_fregs_buf)                               \
                    187:     {                                                          \
                    188:       if ((*fbufp & 1) && fbufp[0] == fbufp[-1] + 1)           \
                    189:        {                                                       \
                    190:          fprintf (FILE, "\tmovl tos,f%d\n", fbufp[-1] - 8);    \
                    191:          fbufp -= 2;                                           \
                    192:        }                                                       \
                    193:       else fprintf (FILE, "\tmovf tos,f%d\n", *fbufp-- - 8);   \
                    194:     }                                                          \
                    195:   if (frame_pointer_needed)                                    \
                    196:     fprintf (FILE, "\texit ");                                 \
                    197:   else if (g_regs_used)                                                \
                    198:     fprintf (FILE, "\trestore ");                              \
                    199:   if (g_regs_used || frame_pointer_needed)                     \
                    200:     {                                                          \
                    201:       char mask = 0;                                           \
                    202:                                                                \
                    203:       while (bufp > used_regs_buf)                             \
                    204:        {                                                       \
                    205:          /* Utek assembler takes care of reversing this */     \
                    206:          mask |= 1 << *--bufp;                                 \
                    207:        }                                                       \
                    208:       fprintf (FILE, "$0x%x\n", (int) mask & 0xff);            \
                    209:     }                                                          \
                    210:   if (current_function_pops_args)                              \
                    211:     fprintf (FILE, "\tret $%d\n", current_function_pops_args); \
                    212:   else fprintf (FILE, "\tret $0\n"); }
                    213: 
                    214: /* UTek assembler needs "ret $0", not "ret 0". */
                    215: #undef  TRANSFER_FROM_TRAMPOLINE
                    216: #define TRANSFER_FROM_TRAMPOLINE       \
                    217: void                                   \
                    218: __transfer_from_trampoline ()          \
                    219: {                                      \
                    220:   asm ("___trampoline:");              \
                    221:   asm ("movd 16(r2),tos");             \
                    222:   asm ("movd 12(r2),r2");              \
                    223:   asm ("ret $0");                      \
                    224: }
                    225: 
                    226: #endif /* UTEK_ASM */
                    227: 
                    228: #undef PRINT_OPERAND_ADDRESS
                    229: #define PRINT_OPERAND_ADDRESS(FILE, ADDR)  print_operand_address(FILE, ADDR)
                    230: 
                    231: /* The UTek library supplies bcopy() and friends, not memcpy(). */
                    232: #ifdef TARGET_MEM_FUNCTIONS
                    233: #undef TARGET_MEM_FUNCTIONS
                    234: #endif

unix.superglobalmegacorp.com

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