OSDN Git Service

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