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)
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. */
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 \
76 ((len > 1 && !strncmp(str, "go", len)) ? SDB_DEBUG : DBX_DEBUG )
78 /* Sequent has some changes in the format of DBX symbols. */
79 #define DBX_NO_XREFS 1
81 /* Don't split DBX symbols into continuations. */
82 #define DBX_CONTIN_LENGTH 0
84 /* ------------------------------------------- */
86 #define TARGET_DEFAULT 1
88 /* These control the C++ compiler somehow. */
89 #define FASCIST_ASSEMBLER
92 /* Print subsidiary information on the compiler version in use. */
94 #define TARGET_VERSION fprintf (stderr, " (ns32k, UTek syntax)");
96 /* The tek6100.h and tek6200.h files add stratos or merlin respectively. */
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
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). */
107 #undef ASM_OUTPUT_ALIGN_CODE
109 /* Assembler pseudo-op for shared data segment. */
110 #define SHARED_SECTION_ASM_OP ".shdata"
113 #undef FUNCTION_PROLOGUE
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. */
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]) \
128 *bufp++ = regno; g_regs_used++; \
131 for (; regno < 16; regno++) \
132 if (regs_ever_live[regno] && !call_used_regs[regno]) { \
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) \
145 mask |= 1 << *bufp++; \
146 fprintf (FILE, "$0x%x", (int) mask & 0xff); \
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) \
155 if ((*fbufp & 1) || (fbufp[0] != fbufp[1] - 1)) \
156 fprintf (FILE, "\tmovf f%d,tos\n", *fbufp++ - 8); \
159 fprintf (FILE, "\tmovl f%d,tos\n", fbufp[0] - 8); \
165 #undef FUNCTION_EPILOGUE
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. */
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[]; \
176 for (regno = 8; regno < 16; regno++) \
177 if (regs_ever_live[regno] && !call_used_regs[regno]) { \
178 *fbufp++ = regno; f_regs_used++; \
181 for (regno = 0; regno < 8; regno++) \
182 if (regs_ever_live[regno] \
183 && ! call_used_regs[regno]) \
185 *bufp++ = regno; g_regs_used++; \
187 while (fbufp > used_fregs_buf) \
189 if ((*fbufp & 1) && fbufp[0] == fbufp[-1] + 1) \
191 fprintf (FILE, "\tmovl tos,f%d\n", fbufp[-1] - 8); \
194 else fprintf (FILE, "\tmovf tos,f%d\n", *fbufp-- - 8); \
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) \
204 while (bufp > used_regs_buf) \
206 /* Utek assembler takes care of reversing this */ \
207 mask |= 1 << *--bufp; \
209 fprintf (FILE, "$0x%x\n", (int) mask & 0xff); \
211 if (current_function_pops_args) \
212 fprintf (FILE, "\tret $%d\n", current_function_pops_args); \
213 else fprintf (FILE, "\tret $0\n"); }
215 /* UTek assembler needs "ret $0", not "ret 0". */
216 #undef TRANSFER_FROM_TRAMPOLINE
217 #define TRANSFER_FROM_TRAMPOLINE \
219 __transfer_from_trampoline () \
221 asm ("___trampoline:"); \
222 asm ("movd 16(r2),tos"); \
223 asm ("movd 12(r2),r2"); \
227 #endif /* UTEK_ASM */
229 #undef PRINT_OPERAND_ADDRESS
230 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address(FILE, ADDR)
232 /* The UTek library supplies bcopy() and friends, not memcpy(). */
233 #ifdef TARGET_MEM_FUNCTIONS
234 #undef TARGET_MEM_FUNCTIONS