Import final gcc2 snapshot (990109)
[official-gcc.git] / gcc / config / ns32k / tek6000.h
blob5b84bcb76400b676ceea10752b48328ea8b48e9f
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.
9 This file is part of GNU CC.
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.
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.
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. */
26 /* Generate syntax for the UTek assembler. */
27 #ifndef UTEK_ASM
28 #define UTEK_ASM
29 #endif
31 /* Two flags to control how addresses are printed in assembler insns. */
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.
36 #define ABSOLUTE_PREFIX 0
37 #define IMMEDIATE_PREFIX '$'
39 #include "ns32k/ns32k.h"
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.
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 '%'
52 /* Used in ns32k.c to control syntax. */
53 #define NO_ABSOLUTE_PREFIX_IF_SYMBOLIC
54 #define NO_IMMEDIATE_PREFIX_IF_SYMBOLIC
56 /* Used in ns32k.md to specify syntax of bsr/jsr operand. */
57 #define CALL_MEMREF_IMPLICIT
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.
64 /* ------------ Debugging Support ----------------------------- */
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.
69 #define DBX_DEBUGGING_INFO
70 /* #define SDB_DEBUGGING_INFO */
72 /* Act the same as the UTek complier: -g for dbx, -go for sdb.
73 * This is used in toplev.c.
75 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
77 #define CC1_SPEC "{go:-gcoff}"
78 #define CC1PLUS_SPEC "{go:-gcoff}"
80 /* Sequent has some changes in the format of DBX symbols. */
81 #define DBX_NO_XREFS 1
83 /* Don't split DBX symbols into continuations. */
84 #define DBX_CONTIN_LENGTH 0
86 /* ------------------------------------------- */
88 #define TARGET_DEFAULT 1
90 /* These control the C++ compiler somehow. */
91 #define FASCIST_ASSEMBLER
92 #define USE_COLLECT
94 /* Print subsidiary information on the compiler version in use. */
95 #undef TARGET_VERSION
96 #define TARGET_VERSION fprintf (stderr, " (ns32k, UTek syntax)");
98 /* The tek6100.h and tek6200.h files add stratos or merlin respectively. */
100 #define CPP_PREDEFINES_Tek6000 \
101 "-Dns16000 -Dns32000 -Dns32k -Dns32016 -DUTek -DUTEK -Dbsd -DBSD \
102 -Asystem(unix) -Asystem(bsd) -Acpu(ns32k) -Amachine(ns32k)"
103 #undef CPP_PREDEFINES
104 #define CPP_PREDEFINES CPP_PREDEFINES_Tek6000
106 /* This is how to align the code that follows an unconditional branch.
107 Don't define it, since it confuses the assembler (we hear). */
109 #undef ASM_OUTPUT_ALIGN_CODE
111 /* Assembler pseudo-op for shared data segment. */
112 #define SHARED_SECTION_ASM_OP ".shdata"
114 #ifdef UTEK_ASM
115 #undef FUNCTION_PROLOGUE
117 /* This differs from the one in ns32k.h in printing a bitmask
118 rather than a register list in the enter or save instruction. */
120 #define FUNCTION_PROLOGUE(FILE, SIZE) \
121 { register int regno, g_regs_used = 0; \
122 int used_regs_buf[8], *bufp = used_regs_buf; \
123 int used_fregs_buf[8], *fbufp = used_fregs_buf; \
124 extern char call_used_regs[]; \
125 MAIN_FUNCTION_PROLOGUE; \
126 for (regno = 0; regno < 8; regno++) \
127 if (regs_ever_live[regno] \
128 && ! call_used_regs[regno]) \
130 *bufp++ = regno; g_regs_used++; \
132 *bufp = -1; \
133 for (; regno < 16; regno++) \
134 if (regs_ever_live[regno] && !call_used_regs[regno]) { \
135 *fbufp++ = regno; \
137 *fbufp = -1; \
138 bufp = used_regs_buf; \
139 if (frame_pointer_needed) \
140 fprintf (FILE, "\tenter "); \
141 else if (g_regs_used) \
142 fprintf (FILE, "\tsave "); \
143 if (frame_pointer_needed || g_regs_used) \
145 char mask = 0; \
146 while (*bufp >= 0) \
147 mask |= 1 << *bufp++; \
148 fprintf (FILE, "$0x%x", (int) mask & 0xff); \
150 if (frame_pointer_needed) \
151 fprintf (FILE, ",$%d\n", SIZE); \
152 else if (g_regs_used) \
153 fprintf (FILE, "\n"); \
154 fbufp = used_fregs_buf; \
155 while (*fbufp >= 0) \
157 if ((*fbufp & 1) || (fbufp[0] != fbufp[1] - 1)) \
158 fprintf (FILE, "\tmovf f%d,tos\n", *fbufp++ - 8); \
159 else \
161 fprintf (FILE, "\tmovl f%d,tos\n", fbufp[0] - 8); \
162 fbufp += 2; \
167 #undef FUNCTION_EPILOGUE
169 /* This differs from the one in ns32k.h in printing a bitmask
170 rather than a register list in the exit or restore instruction. */
172 #define FUNCTION_EPILOGUE(FILE, SIZE) \
173 { register int regno, g_regs_used = 0, f_regs_used = 0; \
174 int used_regs_buf[8], *bufp = used_regs_buf; \
175 int used_fregs_buf[8], *fbufp = used_fregs_buf; \
176 extern char call_used_regs[]; \
177 *fbufp++ = -2; \
178 for (regno = 8; regno < 16; regno++) \
179 if (regs_ever_live[regno] && !call_used_regs[regno]) { \
180 *fbufp++ = regno; f_regs_used++; \
182 fbufp--; \
183 for (regno = 0; regno < 8; regno++) \
184 if (regs_ever_live[regno] \
185 && ! call_used_regs[regno]) \
187 *bufp++ = regno; g_regs_used++; \
189 while (fbufp > used_fregs_buf) \
191 if ((*fbufp & 1) && fbufp[0] == fbufp[-1] + 1) \
193 fprintf (FILE, "\tmovl tos,f%d\n", fbufp[-1] - 8); \
194 fbufp -= 2; \
196 else fprintf (FILE, "\tmovf tos,f%d\n", *fbufp-- - 8); \
198 if (frame_pointer_needed) \
199 fprintf (FILE, "\texit "); \
200 else if (g_regs_used) \
201 fprintf (FILE, "\trestore "); \
202 if (g_regs_used || frame_pointer_needed) \
204 char mask = 0; \
206 while (bufp > used_regs_buf) \
208 /* Utek assembler takes care of reversing this */ \
209 mask |= 1 << *--bufp; \
211 fprintf (FILE, "$0x%x\n", (int) mask & 0xff); \
213 if (current_function_pops_args) \
214 fprintf (FILE, "\tret $%d\n", current_function_pops_args); \
215 else fprintf (FILE, "\tret $0\n"); }
217 /* UTek assembler needs "ret $0", not "ret 0". */
218 #undef TRANSFER_FROM_TRAMPOLINE
219 #define TRANSFER_FROM_TRAMPOLINE \
220 void \
221 __transfer_from_trampoline () \
223 asm ("___trampoline:"); \
224 asm ("movd 16(r2),tos"); \
225 asm ("movd 12(r2),r2"); \
226 asm ("ret $0"); \
229 #endif /* UTEK_ASM */
231 #undef PRINT_OPERAND_ADDRESS
232 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address(FILE, ADDR)
234 /* The UTek library supplies bcopy() and friends, not memcpy(). */
235 #ifdef TARGET_MEM_FUNCTIONS
236 #undef TARGET_MEM_FUNCTIONS
237 #endif