1 |
38 |
julius |
/* Definitions of target machine for GNU compiler, for MMIX.
|
2 |
|
|
Copyright (C) 2000, 2001, 2002, 2004, 2005, 2007 Free Software Foundation, Inc.
|
3 |
|
|
Contributed by Hans-Peter Nilsson (hp@bitrange.com)
|
4 |
|
|
|
5 |
|
|
This file is part of GCC.
|
6 |
|
|
|
7 |
|
|
GCC is free software; you can redistribute it and/or modify
|
8 |
|
|
it under the terms of the GNU General Public License as published by
|
9 |
|
|
the Free Software Foundation; either version 3, or (at your option)
|
10 |
|
|
any later version.
|
11 |
|
|
|
12 |
|
|
GCC is distributed in the hope that it will be useful,
|
13 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15 |
|
|
GNU General Public License for more details.
|
16 |
|
|
|
17 |
|
|
You should have received a copy of the GNU General Public License
|
18 |
|
|
along with GCC; see the file COPYING3. If not see
|
19 |
|
|
<http://www.gnu.org/licenses/>. */
|
20 |
|
|
|
21 |
|
|
#ifndef GCC_MMIX_H
|
22 |
|
|
#define GCC_MMIX_H
|
23 |
|
|
|
24 |
|
|
/* First, some local helper macros. Note that the "default" value of
|
25 |
|
|
FIXED_REGISTERS, CALL_USED_REGISTERS, REG_ALLOC_ORDER and
|
26 |
|
|
REG_CLASS_CONTENTS depend on these values. */
|
27 |
|
|
#define MMIX_RESERVED_GNU_ARG_0_REGNUM 231
|
28 |
|
|
#define MMIX_FIRST_ARG_REGNUM \
|
29 |
|
|
(TARGET_ABI_GNU ? MMIX_RESERVED_GNU_ARG_0_REGNUM : 16)
|
30 |
|
|
#define MMIX_FIRST_INCOMING_ARG_REGNUM \
|
31 |
|
|
(TARGET_ABI_GNU ? MMIX_RESERVED_GNU_ARG_0_REGNUM : 0)
|
32 |
|
|
#define MMIX_MAX_ARGS_IN_REGS 16
|
33 |
|
|
|
34 |
|
|
/* FIXME: This one isn't fully implemented yet. Return values larger than
|
35 |
|
|
one register are passed by reference in MMIX_STRUCT_VALUE_REGNUM by the
|
36 |
|
|
caller, except for return values of type "complex". */
|
37 |
|
|
#define MMIX_MAX_REGS_FOR_VALUE 16
|
38 |
|
|
#define MMIX_RETURN_VALUE_REGNUM \
|
39 |
|
|
(TARGET_ABI_GNU ? MMIX_RESERVED_GNU_ARG_0_REGNUM : 15)
|
40 |
|
|
#define MMIX_OUTGOING_RETURN_VALUE_REGNUM \
|
41 |
|
|
(TARGET_ABI_GNU ? MMIX_RESERVED_GNU_ARG_0_REGNUM : 0)
|
42 |
|
|
#define MMIX_STRUCT_VALUE_REGNUM 251
|
43 |
|
|
#define MMIX_STATIC_CHAIN_REGNUM 252
|
44 |
|
|
#define MMIX_FRAME_POINTER_REGNUM 253
|
45 |
|
|
#define MMIX_STACK_POINTER_REGNUM 254
|
46 |
|
|
#define MMIX_LAST_GENERAL_REGISTER 255
|
47 |
|
|
#define MMIX_INCOMING_RETURN_ADDRESS_REGNUM MMIX_rJ_REGNUM
|
48 |
|
|
#define MMIX_HIMULT_REGNUM 258
|
49 |
|
|
#define MMIX_REMAINDER_REGNUM MMIX_rR_REGNUM
|
50 |
|
|
#define MMIX_ARG_POINTER_REGNUM 261
|
51 |
|
|
#define MMIX_rO_REGNUM 262
|
52 |
|
|
#define MMIX_LAST_STACK_REGISTER_REGNUM 31
|
53 |
|
|
|
54 |
|
|
/* Four registers; "ideally, these registers should be call-clobbered", so
|
55 |
|
|
just grab a bunch of the common clobbered registers. FIXME: Last
|
56 |
|
|
registers of return-value should be used, with an error if there's a
|
57 |
|
|
return-value (that collides in size). */
|
58 |
|
|
#define MMIX_EH_RETURN_DATA_REGNO_START (MMIX_STRUCT_VALUE_REGNUM - 4)
|
59 |
|
|
|
60 |
|
|
/* Try to keep the definitions from running away on their own. */
|
61 |
|
|
#if (MMIX_EH_RETURN_DATA_REGNO_START \
|
62 |
|
|
!= MMIX_RESERVED_GNU_ARG_0_REGNUM + MMIX_MAX_ARGS_IN_REGS)
|
63 |
|
|
#error MMIX register definition inconsistency
|
64 |
|
|
#endif
|
65 |
|
|
|
66 |
|
|
#if (MMIX_MAX_REGS_FOR_VALUE + MMIX_MAX_ARGS_IN_REGS > 32)
|
67 |
|
|
#error MMIX parameters and return values bad, more than 32 registers
|
68 |
|
|
#endif
|
69 |
|
|
|
70 |
|
|
/* This chosen as "a call-clobbered hard register that is otherwise
|
71 |
|
|
untouched by the epilogue". */
|
72 |
|
|
#define MMIX_EH_RETURN_STACKADJ_REGNUM MMIX_STATIC_CHAIN_REGNUM
|
73 |
|
|
|
74 |
|
|
#ifdef REG_OK_STRICT
|
75 |
|
|
# define MMIX_REG_OK_STRICT 1
|
76 |
|
|
#else
|
77 |
|
|
# define MMIX_REG_OK_STRICT 0
|
78 |
|
|
#endif
|
79 |
|
|
|
80 |
|
|
#define MMIX_FUNCTION_ARG_SIZE(MODE, TYPE) \
|
81 |
|
|
((MODE) != BLKmode ? GET_MODE_SIZE (MODE) : int_size_in_bytes (TYPE))
|
82 |
|
|
|
83 |
|
|
/* Declarations for helper variables that are not tied to a particular
|
84 |
|
|
target macro. */
|
85 |
|
|
extern GTY(()) rtx mmix_compare_op0;
|
86 |
|
|
extern GTY(()) rtx mmix_compare_op1;
|
87 |
|
|
|
88 |
|
|
/* Per-function machine data. This is normally an opaque type just
|
89 |
|
|
defined and used in the tm.c file, but we need to see the definition in
|
90 |
|
|
mmix.md too. */
|
91 |
|
|
struct machine_function GTY(())
|
92 |
|
|
{
|
93 |
|
|
int has_landing_pad;
|
94 |
|
|
int highest_saved_stack_register;
|
95 |
|
|
int in_prologue;
|
96 |
|
|
};
|
97 |
|
|
|
98 |
|
|
/* For these target macros, there is no generic documentation here. You
|
99 |
|
|
should read `Using and Porting GCC' for that. Only comments specific
|
100 |
|
|
to the MMIX target are here.
|
101 |
|
|
|
102 |
|
|
There are however references to the specific texinfo node (comments
|
103 |
|
|
with "Node:"), so there should be little or nothing amiss. Probably
|
104 |
|
|
the opposite, since we don't have to care about old littering and
|
105 |
|
|
soon outdated generic comments. */
|
106 |
|
|
|
107 |
|
|
/* Node: Driver */
|
108 |
|
|
|
109 |
|
|
/* User symbols are in the same name-space as built-in symbols, but we
|
110 |
|
|
don't need the built-in symbols, so remove those and instead apply
|
111 |
|
|
stricter operand checking. Don't warn when expanding insns. */
|
112 |
|
|
#define ASM_SPEC "-no-predefined-syms -x"
|
113 |
|
|
|
114 |
|
|
/* Pass on -mset-program-start=N and -mset-data-start=M to the linker.
|
115 |
|
|
Provide default program start 0x100 unless -mno-set-program-start.
|
116 |
|
|
Don't do this if linking relocatably, with -r. For a final link,
|
117 |
|
|
produce mmo, unless ELF is requested or when linking relocatably. */
|
118 |
|
|
#define LINK_SPEC \
|
119 |
|
|
"%{mset-program-start=*:--defsym __.MMIX.start..text=%*}\
|
120 |
|
|
%{mset-data-start=*:--defsym __.MMIX.start..data=%*}\
|
121 |
|
|
%{!mset-program-start=*:\
|
122 |
|
|
%{!mno-set-program-start:\
|
123 |
|
|
%{!r:--defsym __.MMIX.start..text=0x100}}}\
|
124 |
|
|
%{!melf:%{!r:-m mmo}}%{melf|r:-m elf64mmix}"
|
125 |
|
|
|
126 |
|
|
/* FIXME: There's no provision for profiling here. */
|
127 |
|
|
#define STARTFILE_SPEC \
|
128 |
|
|
"crti%O%s crtbegin%O%s"
|
129 |
|
|
|
130 |
|
|
#define ENDFILE_SPEC "crtend%O%s crtn%O%s"
|
131 |
|
|
|
132 |
|
|
/* Node: Run-time Target */
|
133 |
|
|
|
134 |
|
|
/* Define __LONG_MAX__, since we're advised not to change glimits.h. */
|
135 |
|
|
#define TARGET_CPU_CPP_BUILTINS() \
|
136 |
|
|
do \
|
137 |
|
|
{ \
|
138 |
|
|
builtin_define ("__mmix__"); \
|
139 |
|
|
builtin_define ("__MMIX__"); \
|
140 |
|
|
if (TARGET_ABI_GNU) \
|
141 |
|
|
builtin_define ("__MMIX_ABI_GNU__"); \
|
142 |
|
|
else \
|
143 |
|
|
builtin_define ("__MMIX_ABI_MMIXWARE__"); \
|
144 |
|
|
} \
|
145 |
|
|
while (0)
|
146 |
|
|
|
147 |
|
|
extern int target_flags;
|
148 |
|
|
|
149 |
|
|
#define TARGET_DEFAULT \
|
150 |
|
|
(MASK_BRANCH_PREDICT | MASK_BASE_ADDRESSES | MASK_USE_RETURN_INSN)
|
151 |
|
|
|
152 |
|
|
/* Unfortunately, this must not reference anything in "mmix.c". */
|
153 |
|
|
#define TARGET_VERSION \
|
154 |
|
|
fprintf (stderr, " (MMIX)")
|
155 |
|
|
|
156 |
|
|
#define OVERRIDE_OPTIONS mmix_override_options ()
|
157 |
|
|
|
158 |
|
|
#define OPTIMIZATION_OPTIONS(LEVEL, SIZE) \
|
159 |
|
|
do \
|
160 |
|
|
{ \
|
161 |
|
|
if (LEVEL >= 1) \
|
162 |
|
|
flag_regmove = TRUE; \
|
163 |
|
|
\
|
164 |
|
|
if (SIZE || LEVEL > 1) \
|
165 |
|
|
{ \
|
166 |
|
|
flag_omit_frame_pointer = TRUE; \
|
167 |
|
|
} \
|
168 |
|
|
} \
|
169 |
|
|
while (0)
|
170 |
|
|
|
171 |
|
|
/* This one will have to wait a little bit; right now we can't debug
|
172 |
|
|
neither with or without a frame-pointer. */
|
173 |
|
|
/* #define CAN_DEBUG_WITHOUT_FP */
|
174 |
|
|
|
175 |
|
|
|
176 |
|
|
/* Node: Per-Function Data */
|
177 |
|
|
#define INIT_EXPANDERS mmix_init_expanders ()
|
178 |
|
|
|
179 |
|
|
|
180 |
|
|
/* Node: Storage Layout */
|
181 |
|
|
/* I see no bit-field instructions. Anyway, the common order is from low
|
182 |
|
|
to high, as the power of two, hence little-endian. */
|
183 |
|
|
#define BITS_BIG_ENDIAN 0
|
184 |
|
|
#define BYTES_BIG_ENDIAN 1
|
185 |
|
|
#define WORDS_BIG_ENDIAN 1
|
186 |
|
|
#define FLOAT_WORDS_BIG_ENDIAN 1
|
187 |
|
|
#define UNITS_PER_WORD 8
|
188 |
|
|
|
189 |
|
|
/* FIXME: Promotion of modes currently generates slow code, extending
|
190 |
|
|
before every operation. */
|
191 |
|
|
/* I'm a little bit undecided about this one. It might be beneficial to
|
192 |
|
|
promote all operations. */
|
193 |
|
|
|
194 |
|
|
#define PROMOTE_FUNCTION_MODE(MODE, UNSIGNEDP, TYPE) \
|
195 |
|
|
do { \
|
196 |
|
|
if (GET_MODE_CLASS (MODE) == MODE_INT \
|
197 |
|
|
&& GET_MODE_SIZE (MODE) < 8) \
|
198 |
|
|
{ \
|
199 |
|
|
(MODE) = DImode; \
|
200 |
|
|
/* Do the following some time later, \
|
201 |
|
|
scrutinizing differences. */ \
|
202 |
|
|
if (0) (UNSIGNEDP) = 0; \
|
203 |
|
|
} \
|
204 |
|
|
} while (0)
|
205 |
|
|
|
206 |
|
|
/* We need to align everything to 64 bits that can affect the alignment
|
207 |
|
|
of other types. Since address N is interpreted in MMIX as (N modulo
|
208 |
|
|
access_size), we must align. */
|
209 |
|
|
#define PARM_BOUNDARY 64
|
210 |
|
|
#define STACK_BOUNDARY 64
|
211 |
|
|
#define FUNCTION_BOUNDARY 32
|
212 |
|
|
#define BIGGEST_ALIGNMENT 64
|
213 |
|
|
|
214 |
|
|
/* This one is only used in the ADA front end. */
|
215 |
|
|
#define MINIMUM_ATOMIC_ALIGNMENT 8
|
216 |
|
|
|
217 |
|
|
/* Copied from elfos.h. */
|
218 |
|
|
#define MAX_OFILE_ALIGNMENT (32768 * 8)
|
219 |
|
|
|
220 |
|
|
#define DATA_ALIGNMENT(TYPE, BASIC_ALIGN) \
|
221 |
|
|
mmix_data_alignment (TYPE, BASIC_ALIGN)
|
222 |
|
|
|
223 |
|
|
#define CONSTANT_ALIGNMENT(CONSTANT, BASIC_ALIGN) \
|
224 |
|
|
mmix_constant_alignment (CONSTANT, BASIC_ALIGN)
|
225 |
|
|
|
226 |
|
|
#define LOCAL_ALIGNMENT(TYPE, BASIC_ALIGN) \
|
227 |
|
|
mmix_local_alignment (TYPE, BASIC_ALIGN)
|
228 |
|
|
|
229 |
|
|
/* Following other ports, this seems to most commonly be the word-size,
|
230 |
|
|
so let's do that here too. */
|
231 |
|
|
#define EMPTY_FIELD_BOUNDARY 64
|
232 |
|
|
|
233 |
|
|
/* We chose to have this low solely for similarity with the alpha. It has
|
234 |
|
|
nothing to do with passing the tests dg/c99-scope-2 and
|
235 |
|
|
execute/align-1.c. Nothing. Though the tests seem wrong. Padding of
|
236 |
|
|
the structure is automatically added to get alignment when needed if we
|
237 |
|
|
set this to just byte-boundary. */
|
238 |
|
|
#define STRUCTURE_SIZE_BOUNDARY 8
|
239 |
|
|
|
240 |
|
|
/* The lower bits are ignored. */
|
241 |
|
|
#define STRICT_ALIGNMENT 1
|
242 |
|
|
|
243 |
|
|
|
244 |
|
|
/* Node: Type Layout */
|
245 |
|
|
|
246 |
|
|
/* It might seem more natural to have 64-bit ints on a 64-bit machine,
|
247 |
|
|
but then an occasional MMIX programmer needs to know how to put a lot
|
248 |
|
|
of __attribute__ stuff to get to the 8, 16 and 32-bit modes rather
|
249 |
|
|
than the "intuitive" char, short and int types. */
|
250 |
|
|
#define INT_TYPE_SIZE 32
|
251 |
|
|
#define SHORT_TYPE_SIZE 16
|
252 |
|
|
#define LONG_LONG_TYPE_SIZE 64
|
253 |
|
|
|
254 |
|
|
#define FLOAT_TYPE_SIZE 32
|
255 |
|
|
#define DOUBLE_TYPE_SIZE 64
|
256 |
|
|
#define LONG_DOUBLE_TYPE_SIZE 64
|
257 |
|
|
|
258 |
|
|
#define DEFAULT_SIGNED_CHAR 1
|
259 |
|
|
|
260 |
|
|
|
261 |
|
|
/* Node: Register Basics */
|
262 |
|
|
/* We tell GCC about all 256 general registers, and we also include
|
263 |
|
|
rD, rE, rH, rJ, rR and rO (in that order) so we can describe what insns
|
264 |
|
|
clobber them. We use a faked register for the argument pointer. It is
|
265 |
|
|
always eliminated towards the frame-pointer or the stack-pointer, never
|
266 |
|
|
output in assembly. Any fixed register would do for this, like $255,
|
267 |
|
|
but future debugging is easier when using a separate register. It
|
268 |
|
|
counts as a global register for pseudorandom reasons. */
|
269 |
|
|
#define FIRST_PSEUDO_REGISTER 263
|
270 |
|
|
|
271 |
|
|
/* We treat general registers with no assigned purpose as fixed. The
|
272 |
|
|
stack pointer, $254, is also fixed. Register $255 is referred to as a
|
273 |
|
|
temporary register in the MMIX papers, and used as such in mmixal, so
|
274 |
|
|
it should not be used as a stack pointer. We set it to fixed, and use
|
275 |
|
|
it "manually" at times of despair. */
|
276 |
|
|
#define FIXED_REGISTERS \
|
277 |
|
|
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
|
278 |
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
|
279 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
|
280 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
|
281 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
|
282 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
|
283 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
|
284 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
|
285 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
|
286 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
|
287 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
|
288 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
|
289 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
|
290 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
|
291 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
|
292 |
|
|
1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, \
|
293 |
|
|
1, 1, 0, 0, 0, 1, 1 \
|
294 |
|
|
}
|
295 |
|
|
|
296 |
|
|
/* General registers are fixed and therefore "historically" marked
|
297 |
|
|
call-used. (FIXME: This has changed). Registers $15..$31 are
|
298 |
|
|
call-clobbered; we'll put arguments in $16 and up, and we need $15 for
|
299 |
|
|
the MMIX register-stack "hole". */
|
300 |
|
|
#define CALL_USED_REGISTERS \
|
301 |
|
|
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, \
|
302 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
|
303 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
|
304 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
|
305 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
|
306 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
|
307 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
|
308 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
|
309 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
|
310 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
|
311 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
|
312 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
|
313 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
|
314 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
|
315 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
|
316 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, \
|
317 |
|
|
1, 1, 1, 1, 1, 1, 1 \
|
318 |
|
|
}
|
319 |
|
|
|
320 |
|
|
#define CONDITIONAL_REGISTER_USAGE mmix_conditional_register_usage ()
|
321 |
|
|
|
322 |
|
|
/* No INCOMING_REGNO or OUTGOING_REGNO, since those macros are not usable
|
323 |
|
|
for MMIX: it doesn't have a fixed register window size. FIXME: Perhaps
|
324 |
|
|
we should say something about $0..$15 may sometimes be the incoming
|
325 |
|
|
$16..$31. Those macros need better documentation; it looks like
|
326 |
|
|
they're just bogus and that FUNCTION_INCOMING_ARG_REGNO_P and
|
327 |
|
|
FUNCTION_OUTGOING_VALUE should be used where they're used. For the
|
328 |
|
|
moment, do nothing; things seem to work anyway. */
|
329 |
|
|
|
330 |
|
|
/* Defining LOCAL_REGNO is necessary in presence of prologue/epilogue,
|
331 |
|
|
else GCC will be confused that those registers aren't saved and
|
332 |
|
|
restored. */
|
333 |
|
|
#define LOCAL_REGNO(REGNO) mmix_local_regno (REGNO)
|
334 |
|
|
|
335 |
|
|
/* Node: Allocation Order */
|
336 |
|
|
|
337 |
|
|
/* We should allocate registers from 0 to 31 by increasing number, because
|
338 |
|
|
I think that's what people expect. Beyond that, just use
|
339 |
|
|
call-clobbered global registers first, then call-clobbered special
|
340 |
|
|
registers. Last, the fixed registers. */
|
341 |
|
|
#define MMIX_MMIXWARE_ABI_REG_ALLOC_ORDER \
|
342 |
|
|
{ 0, 1, 2, 3, 4, 5, 6, 7, \
|
343 |
|
|
8, 9, 10, 11, 12, 13, 14, 15, \
|
344 |
|
|
16, 17, 18, 19, 20, 21, 22, 23, \
|
345 |
|
|
24, 25, 26, 27, 28, 29, 30, 31, \
|
346 |
|
|
\
|
347 |
|
|
252, 251, 250, 249, 248, 247, \
|
348 |
|
|
\
|
349 |
|
|
253, \
|
350 |
|
|
\
|
351 |
|
|
258, 260, 259, \
|
352 |
|
|
\
|
353 |
|
|
32, 33, 34, 35, 36, 37, 38, 39, \
|
354 |
|
|
40, 41, 42, 43, 44, 45, 46, 47, \
|
355 |
|
|
48, 49, 50, 51, 52, 53, 54, 55, \
|
356 |
|
|
56, 57, 58, 59, 60, 61, 62, 63, \
|
357 |
|
|
64, 65, 66, 67, 68, 69, 70, 71, \
|
358 |
|
|
72, 73, 74, 75, 76, 77, 78, 79, \
|
359 |
|
|
80, 81, 82, 83, 84, 85, 86, 87, \
|
360 |
|
|
88, 89, 90, 91, 92, 93, 94, 95, \
|
361 |
|
|
96, 97, 98, 99, 100, 101, 102, 103, \
|
362 |
|
|
104, 105, 106, 107, 108, 109, 110, 111, \
|
363 |
|
|
112, 113, 114, 115, 116, 117, 118, 119, \
|
364 |
|
|
120, 121, 122, 123, 124, 125, 126, 127, \
|
365 |
|
|
128, 129, 130, 131, 132, 133, 134, 135, \
|
366 |
|
|
136, 137, 138, 139, 140, 141, 142, 143, \
|
367 |
|
|
144, 145, 146, 147, 148, 149, 150, 151, \
|
368 |
|
|
152, 153, 154, 155, 156, 157, 158, 159, \
|
369 |
|
|
160, 161, 162, 163, 164, 165, 166, 167, \
|
370 |
|
|
168, 169, 170, 171, 172, 173, 174, 175, \
|
371 |
|
|
176, 177, 178, 179, 180, 181, 182, 183, \
|
372 |
|
|
184, 185, 186, 187, 188, 189, 190, 191, \
|
373 |
|
|
192, 193, 194, 195, 196, 197, 198, 199, \
|
374 |
|
|
200, 201, 202, 203, 204, 205, 206, 207, \
|
375 |
|
|
208, 209, 210, 211, 212, 213, 214, 215, \
|
376 |
|
|
216, 217, 218, 219, 220, 221, 222, 223, \
|
377 |
|
|
224, 225, 226, 227, 228, 229, 230, 231, \
|
378 |
|
|
232, 233, 234, 235, 236, 237, 238, 239, \
|
379 |
|
|
240, 241, 242, 243, 244, 245, 246, \
|
380 |
|
|
\
|
381 |
|
|
254, 255, 256, 257, 261, 262 \
|
382 |
|
|
}
|
383 |
|
|
|
384 |
|
|
/* As a convenience, we put this nearby, for ease of comparison.
|
385 |
|
|
First, call-clobbered registers in reverse order of assignment as
|
386 |
|
|
parameters (also the top ones; not because they're parameters, but
|
387 |
|
|
for continuity).
|
388 |
|
|
|
389 |
|
|
Second, saved registers that go on the register-stack.
|
390 |
|
|
|
391 |
|
|
Third, special registers rH, rR and rJ. They should not normally be
|
392 |
|
|
allocated, but since they're call-clobbered, it is cheaper to use one
|
393 |
|
|
of them than using a call-saved register for a call-clobbered use,
|
394 |
|
|
assuming it is referenced a very limited number of times. Other global
|
395 |
|
|
and fixed registers come next; they are never allocated. */
|
396 |
|
|
#define MMIX_GNU_ABI_REG_ALLOC_ORDER \
|
397 |
|
|
{ 252, 251, 250, 249, 248, 247, 246, \
|
398 |
|
|
245, 244, 243, 242, 241, 240, 239, 238, \
|
399 |
|
|
237, 236, 235, 234, 233, 232, 231, \
|
400 |
|
|
\
|
401 |
|
|
0, 1, 2, 3, 4, 5, 6, 7, \
|
402 |
|
|
8, 9, 10, 11, 12, 13, 14, 15, \
|
403 |
|
|
16, 17, 18, 19, 20, 21, 22, 23, \
|
404 |
|
|
24, 25, 26, 27, 28, 29, 30, 31, \
|
405 |
|
|
\
|
406 |
|
|
253, \
|
407 |
|
|
\
|
408 |
|
|
258, 260, 259, \
|
409 |
|
|
\
|
410 |
|
|
32, 33, 34, 35, 36, 37, 38, 39, \
|
411 |
|
|
40, 41, 42, 43, 44, 45, 46, 47, \
|
412 |
|
|
48, 49, 50, 51, 52, 53, 54, 55, \
|
413 |
|
|
56, 57, 58, 59, 60, 61, 62, 63, \
|
414 |
|
|
64, 65, 66, 67, 68, 69, 70, 71, \
|
415 |
|
|
72, 73, 74, 75, 76, 77, 78, 79, \
|
416 |
|
|
80, 81, 82, 83, 84, 85, 86, 87, \
|
417 |
|
|
88, 89, 90, 91, 92, 93, 94, 95, \
|
418 |
|
|
96, 97, 98, 99, 100, 101, 102, 103, \
|
419 |
|
|
104, 105, 106, 107, 108, 109, 110, 111, \
|
420 |
|
|
112, 113, 114, 115, 116, 117, 118, 119, \
|
421 |
|
|
120, 121, 122, 123, 124, 125, 126, 127, \
|
422 |
|
|
128, 129, 130, 131, 132, 133, 134, 135, \
|
423 |
|
|
136, 137, 138, 139, 140, 141, 142, 143, \
|
424 |
|
|
144, 145, 146, 147, 148, 149, 150, 151, \
|
425 |
|
|
152, 153, 154, 155, 156, 157, 158, 159, \
|
426 |
|
|
160, 161, 162, 163, 164, 165, 166, 167, \
|
427 |
|
|
168, 169, 170, 171, 172, 173, 174, 175, \
|
428 |
|
|
176, 177, 178, 179, 180, 181, 182, 183, \
|
429 |
|
|
184, 185, 186, 187, 188, 189, 190, 191, \
|
430 |
|
|
192, 193, 194, 195, 196, 197, 198, 199, \
|
431 |
|
|
200, 201, 202, 203, 204, 205, 206, 207, \
|
432 |
|
|
208, 209, 210, 211, 212, 213, 214, 215, \
|
433 |
|
|
216, 217, 218, 219, 220, 221, 222, 223, \
|
434 |
|
|
224, 225, 226, 227, 228, 229, 230, \
|
435 |
|
|
\
|
436 |
|
|
254, 255, 256, 257, 261, 262 \
|
437 |
|
|
}
|
438 |
|
|
|
439 |
|
|
/* The default one. */
|
440 |
|
|
#define REG_ALLOC_ORDER MMIX_MMIXWARE_ABI_REG_ALLOC_ORDER
|
441 |
|
|
|
442 |
|
|
/* Node: Values in Registers */
|
443 |
|
|
|
444 |
|
|
#define HARD_REGNO_NREGS(REGNO, MODE) \
|
445 |
|
|
((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) \
|
446 |
|
|
/ UNITS_PER_WORD)
|
447 |
|
|
|
448 |
|
|
#define HARD_REGNO_MODE_OK(REGNO, MODE) 1
|
449 |
|
|
|
450 |
|
|
/* Note that no register can really be accessed in single-float mode, so
|
451 |
|
|
we *can* say 1 here. FIXME: Will TRT happen for single-float, or do
|
452 |
|
|
we have to punt to libgcc1.asm? */
|
453 |
|
|
#define MODES_TIEABLE_P(MODE1, MODE2) 1
|
454 |
|
|
|
455 |
|
|
|
456 |
|
|
/* Node: Leaf Functions */
|
457 |
|
|
/* (empty) */
|
458 |
|
|
|
459 |
|
|
|
460 |
|
|
/* Node: Register Classes */
|
461 |
|
|
|
462 |
|
|
enum reg_class
|
463 |
|
|
{
|
464 |
|
|
NO_REGS, GENERAL_REGS, REMAINDER_REG, HIMULT_REG,
|
465 |
|
|
SYSTEM_REGS, ALL_REGS, LIM_REG_CLASSES
|
466 |
|
|
};
|
467 |
|
|
|
468 |
|
|
#define N_REG_CLASSES (int) LIM_REG_CLASSES
|
469 |
|
|
|
470 |
|
|
#define REG_CLASS_NAMES \
|
471 |
|
|
{"NO_REGS", "GENERAL_REGS", "REMAINDER_REG", "HIMULT_REG", \
|
472 |
|
|
"SYSTEM_REGS", "ALL_REGS"}
|
473 |
|
|
|
474 |
|
|
/* Note that the contents of each item is always 32 bits. */
|
475 |
|
|
#define REG_CLASS_CONTENTS \
|
476 |
|
|
{{0, 0, 0, 0, 0, 0, 0, 0, 0}, \
|
477 |
|
|
{~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, 0x20}, \
|
478 |
|
|
{0, 0, 0, 0, 0, 0, 0, 0, 0x10}, \
|
479 |
|
|
{0, 0, 0, 0, 0, 0, 0, 0, 4}, \
|
480 |
|
|
{0, 0, 0, 0, 0, 0, 0, 0, 0x7f}, \
|
481 |
|
|
{~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, 0x7f}}
|
482 |
|
|
|
483 |
|
|
#define REGNO_REG_CLASS(REGNO) \
|
484 |
|
|
((REGNO) <= MMIX_LAST_GENERAL_REGISTER \
|
485 |
|
|
|| (REGNO) == MMIX_ARG_POINTER_REGNUM \
|
486 |
|
|
? GENERAL_REGS \
|
487 |
|
|
: (REGNO) == MMIX_REMAINDER_REGNUM ? REMAINDER_REG \
|
488 |
|
|
: (REGNO) == MMIX_HIMULT_REGNUM ? HIMULT_REG : SYSTEM_REGS)
|
489 |
|
|
|
490 |
|
|
#define BASE_REG_CLASS GENERAL_REGS
|
491 |
|
|
|
492 |
|
|
#define INDEX_REG_CLASS GENERAL_REGS
|
493 |
|
|
|
494 |
|
|
#define REG_CLASS_FROM_LETTER(CHAR) \
|
495 |
|
|
((CHAR) == 'x' ? SYSTEM_REGS \
|
496 |
|
|
: (CHAR) == 'y' ? REMAINDER_REG \
|
497 |
|
|
: (CHAR) == 'z' ? HIMULT_REG : NO_REGS)
|
498 |
|
|
|
499 |
|
|
#define REGNO_OK_FOR_BASE_P(REGNO) \
|
500 |
|
|
((REGNO) <= MMIX_LAST_GENERAL_REGISTER \
|
501 |
|
|
|| (REGNO) == MMIX_ARG_POINTER_REGNUM \
|
502 |
|
|
|| (reg_renumber[REGNO] > 0 \
|
503 |
|
|
&& reg_renumber[REGNO] <= MMIX_LAST_GENERAL_REGISTER))
|
504 |
|
|
|
505 |
|
|
#define REGNO_OK_FOR_INDEX_P(REGNO) REGNO_OK_FOR_BASE_P (REGNO)
|
506 |
|
|
|
507 |
|
|
#define PREFERRED_RELOAD_CLASS(X, CLASS) \
|
508 |
|
|
mmix_preferred_reload_class (X, CLASS)
|
509 |
|
|
|
510 |
|
|
#define PREFERRED_OUTPUT_RELOAD_CLASS(X, CLASS) \
|
511 |
|
|
mmix_preferred_output_reload_class (X, CLASS)
|
512 |
|
|
|
513 |
|
|
#define SECONDARY_INPUT_RELOAD_CLASS(CLASS, MODE, X) \
|
514 |
|
|
mmix_secondary_reload_class (CLASS, MODE, X, 1)
|
515 |
|
|
|
516 |
|
|
#define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS, MODE, X) \
|
517 |
|
|
mmix_secondary_reload_class (CLASS, MODE, X, 0)
|
518 |
|
|
|
519 |
|
|
#define CLASS_MAX_NREGS(CLASS, MODE) HARD_REGNO_NREGS (CLASS, MODE)
|
520 |
|
|
|
521 |
|
|
#define CONST_OK_FOR_LETTER_P(VALUE, C) \
|
522 |
|
|
mmix_const_ok_for_letter_p (VALUE, C)
|
523 |
|
|
|
524 |
|
|
#define EXTRA_CONSTRAINT(VALUE, C) \
|
525 |
|
|
mmix_extra_constraint (VALUE, C, MMIX_REG_OK_STRICT)
|
526 |
|
|
|
527 |
|
|
/* Do we need anything serious here? Yes, any FLOT constant. */
|
528 |
|
|
#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
|
529 |
|
|
mmix_const_double_ok_for_letter_p (VALUE, C)
|
530 |
|
|
|
531 |
|
|
|
532 |
|
|
/* Node: Frame Layout */
|
533 |
|
|
|
534 |
|
|
#define STACK_GROWS_DOWNWARD
|
535 |
|
|
#define FRAME_GROWS_DOWNWARD 1
|
536 |
|
|
|
537 |
|
|
#define STARTING_FRAME_OFFSET \
|
538 |
|
|
mmix_starting_frame_offset ()
|
539 |
|
|
|
540 |
|
|
#define FIRST_PARM_OFFSET(FUNDECL) 0
|
541 |
|
|
|
542 |
|
|
#define DYNAMIC_CHAIN_ADDRESS(FRAMEADDR) \
|
543 |
|
|
mmix_dynamic_chain_address (FRAMEADDR)
|
544 |
|
|
|
545 |
|
|
/* FIXME: It seems RETURN_ADDR_OFFSET is undocumented. */
|
546 |
|
|
|
547 |
|
|
#define SETUP_FRAME_ADDRESSES() \
|
548 |
|
|
mmix_setup_frame_addresses ()
|
549 |
|
|
|
550 |
|
|
#define RETURN_ADDR_RTX(COUNT, FRAME) \
|
551 |
|
|
mmix_return_addr_rtx (COUNT, FRAME)
|
552 |
|
|
|
553 |
|
|
/* It's in rJ before we store it somewhere. */
|
554 |
|
|
#define INCOMING_RETURN_ADDR_RTX \
|
555 |
|
|
gen_rtx_REG (Pmode, MMIX_INCOMING_RETURN_ADDRESS_REGNUM)
|
556 |
|
|
|
557 |
|
|
/* FIXME: This does not seem properly documented or cross-indexed.
|
558 |
|
|
Nowhere except in the code does it say it *has* to be in the range
|
559 |
|
|
0..255, or else it will be truncated. That goes for the default too. */
|
560 |
|
|
#define DWARF_FRAME_RETURN_COLUMN \
|
561 |
|
|
DWARF_FRAME_REGNUM (MMIX_INCOMING_RETURN_ADDRESS_REGNUM)
|
562 |
|
|
|
563 |
|
|
/* No return address is stored there. */
|
564 |
|
|
#define INCOMING_FRAME_SP_OFFSET 0
|
565 |
|
|
|
566 |
|
|
/* Node: Stack Checking */
|
567 |
|
|
/* (empty) */
|
568 |
|
|
|
569 |
|
|
|
570 |
|
|
/* Node: Exception Handling */
|
571 |
|
|
|
572 |
|
|
#define EH_RETURN_DATA_REGNO(N) \
|
573 |
|
|
mmix_eh_return_data_regno (N)
|
574 |
|
|
|
575 |
|
|
#define EH_RETURN_STACKADJ_RTX \
|
576 |
|
|
mmix_eh_return_stackadj_rtx ()
|
577 |
|
|
|
578 |
|
|
#define EH_RETURN_HANDLER_RTX \
|
579 |
|
|
mmix_eh_return_handler_rtx ()
|
580 |
|
|
|
581 |
|
|
#define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \
|
582 |
|
|
mmix_asm_preferred_eh_data_format (CODE, GLOBAL)
|
583 |
|
|
|
584 |
|
|
/* Node: Frame Registers */
|
585 |
|
|
#define STACK_POINTER_REGNUM MMIX_STACK_POINTER_REGNUM
|
586 |
|
|
|
587 |
|
|
/* Perhaps we can use HARD_FRAME_POINTER_REGNUM and decide later on
|
588 |
|
|
what register we want to use. */
|
589 |
|
|
#define FRAME_POINTER_REGNUM MMIX_FRAME_POINTER_REGNUM
|
590 |
|
|
#define ARG_POINTER_REGNUM MMIX_ARG_POINTER_REGNUM
|
591 |
|
|
|
592 |
|
|
#define STATIC_CHAIN_REGNUM MMIX_STATIC_CHAIN_REGNUM
|
593 |
|
|
|
594 |
|
|
|
595 |
|
|
/* Node: Elimination */
|
596 |
|
|
/* FIXME: Is this requirement built-in? Anyway, we should try to get rid
|
597 |
|
|
of it; we can deduce the value. */
|
598 |
|
|
#define FRAME_POINTER_REQUIRED current_function_has_nonlocal_label
|
599 |
|
|
|
600 |
|
|
/* The frame-pointer is stored in a location that either counts to the
|
601 |
|
|
offset of incoming parameters, or that counts to the offset of the
|
602 |
|
|
frame, so we can't use a single offset. We therefore eliminate those
|
603 |
|
|
two separately. */
|
604 |
|
|
#define ELIMINABLE_REGS \
|
605 |
|
|
{{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
|
606 |
|
|
{ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
|
607 |
|
|
{FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
|
608 |
|
|
|
609 |
|
|
/* We need not worry about when the frame-pointer is required for other
|
610 |
|
|
reasons; GCC takes care of those cases. */
|
611 |
|
|
#define CAN_ELIMINATE(FROM, TO) 1
|
612 |
|
|
|
613 |
|
|
#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
|
614 |
|
|
(OFFSET) = mmix_initial_elimination_offset (FROM, TO)
|
615 |
|
|
|
616 |
|
|
|
617 |
|
|
/* Node: Stack Arguments */
|
618 |
|
|
|
619 |
|
|
#define ACCUMULATE_OUTGOING_ARGS 1
|
620 |
|
|
|
621 |
|
|
#define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, STACKSIZE) 0
|
622 |
|
|
|
623 |
|
|
|
624 |
|
|
/* Node: Register Arguments */
|
625 |
|
|
#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
|
626 |
|
|
mmix_function_arg (&(CUM), MODE, TYPE, NAMED, 0)
|
627 |
|
|
|
628 |
|
|
#define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) \
|
629 |
|
|
mmix_function_arg (&(CUM), MODE, TYPE, NAMED, 1)
|
630 |
|
|
|
631 |
|
|
typedef struct { int regs; int lib; } CUMULATIVE_ARGS;
|
632 |
|
|
|
633 |
|
|
#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \
|
634 |
|
|
((CUM).regs = 0, (CUM).lib = ((LIBNAME) != 0))
|
635 |
|
|
|
636 |
|
|
#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
|
637 |
|
|
((CUM).regs \
|
638 |
|
|
= ((targetm.calls.must_pass_in_stack (MODE, TYPE)) \
|
639 |
|
|
|| (MMIX_FUNCTION_ARG_SIZE (MODE, TYPE) > 8 \
|
640 |
|
|
&& !TARGET_LIBFUNC && !(CUM).lib)) \
|
641 |
|
|
? (MMIX_MAX_ARGS_IN_REGS) + 1 \
|
642 |
|
|
: (CUM).regs + (7 + (MMIX_FUNCTION_ARG_SIZE (MODE, TYPE))) / 8)
|
643 |
|
|
|
644 |
|
|
#define FUNCTION_ARG_REGNO_P(REGNO) \
|
645 |
|
|
mmix_function_arg_regno_p (REGNO, 0)
|
646 |
|
|
|
647 |
|
|
#define FUNCTION_INCOMING_ARG_REGNO_P(REGNO) \
|
648 |
|
|
mmix_function_arg_regno_p (REGNO, 1)
|
649 |
|
|
|
650 |
|
|
|
651 |
|
|
/* Node: Register Arguments */
|
652 |
|
|
|
653 |
|
|
#define FUNCTION_VALUE(VALTYPE, FUNC) \
|
654 |
|
|
gen_rtx_REG (TYPE_MODE (VALTYPE), MMIX_RETURN_VALUE_REGNUM)
|
655 |
|
|
|
656 |
|
|
/* This needs to take care of the register hole for complex return values. */
|
657 |
|
|
#define FUNCTION_OUTGOING_VALUE(VALTYPE, FUNC) \
|
658 |
|
|
mmix_function_outgoing_value (VALTYPE, FUNC)
|
659 |
|
|
|
660 |
|
|
#define LIBCALL_VALUE(MODE) \
|
661 |
|
|
gen_rtx_REG (MODE, MMIX_RETURN_VALUE_REGNUM)
|
662 |
|
|
|
663 |
|
|
#define FUNCTION_VALUE_REGNO_P(REGNO) \
|
664 |
|
|
mmix_function_value_regno_p (REGNO)
|
665 |
|
|
|
666 |
|
|
|
667 |
|
|
/* Node: Caller Saves */
|
668 |
|
|
/* (empty) */
|
669 |
|
|
|
670 |
|
|
|
671 |
|
|
/* Node: Function Entry */
|
672 |
|
|
|
673 |
|
|
/* See mmix.c for TARGET_ASM_FUNCTION_PROLOGUE and
|
674 |
|
|
TARGET_ASM_FUNCTION_EPILOGUE. */
|
675 |
|
|
|
676 |
|
|
/* We need to say that the epilogue uses the return address, so the
|
677 |
|
|
initial-value machinery restores it. FIXME: Some targets
|
678 |
|
|
conditionalize on "reload_completed &&". Investigate difference.
|
679 |
|
|
FIXME: Not needed if nonlocal_goto_stack_level. */
|
680 |
|
|
#define EPILOGUE_USES(REGNO) \
|
681 |
|
|
((REGNO) == MMIX_INCOMING_RETURN_ADDRESS_REGNUM)
|
682 |
|
|
|
683 |
|
|
/* Node: Profiling */
|
684 |
|
|
#define FUNCTION_PROFILER(FILE, LABELNO) \
|
685 |
|
|
mmix_function_profiler (FILE, LABELNO)
|
686 |
|
|
|
687 |
|
|
/* Node: Trampolines */
|
688 |
|
|
|
689 |
|
|
#define TRAMPOLINE_TEMPLATE(FILE) \
|
690 |
|
|
mmix_trampoline_template (FILE)
|
691 |
|
|
|
692 |
|
|
#define TRAMPOLINE_SIZE mmix_trampoline_size
|
693 |
|
|
#define INITIALIZE_TRAMPOLINE(ADDR, FNADDR, STATIC_CHAIN) \
|
694 |
|
|
mmix_initialize_trampoline (ADDR, FNADDR, STATIC_CHAIN)
|
695 |
|
|
|
696 |
|
|
|
697 |
|
|
/* Node: Addressing Modes */
|
698 |
|
|
|
699 |
|
|
#define CONSTANT_ADDRESS_P(X) \
|
700 |
|
|
mmix_constant_address_p (X)
|
701 |
|
|
|
702 |
|
|
#define MAX_REGS_PER_ADDRESS 2
|
703 |
|
|
|
704 |
|
|
#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) \
|
705 |
|
|
if (mmix_legitimate_address (MODE, X, MMIX_REG_OK_STRICT)) \
|
706 |
|
|
goto LABEL
|
707 |
|
|
|
708 |
|
|
#ifndef REG_OK_STRICT
|
709 |
|
|
# define REG_OK_FOR_BASE_P(X) \
|
710 |
|
|
(REGNO (X) <= MMIX_LAST_GENERAL_REGISTER \
|
711 |
|
|
|| REGNO (X) == MMIX_ARG_POINTER_REGNUM \
|
712 |
|
|
|| REGNO (X) >= FIRST_PSEUDO_REGISTER)
|
713 |
|
|
#else
|
714 |
|
|
# define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
|
715 |
|
|
#endif /* REG_OK_STRICT */
|
716 |
|
|
|
717 |
|
|
#define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_BASE_P (X)
|
718 |
|
|
|
719 |
|
|
#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL)
|
720 |
|
|
|
721 |
|
|
#define LEGITIMATE_CONSTANT_P(X) \
|
722 |
|
|
mmix_legitimate_constant_p (X)
|
723 |
|
|
|
724 |
|
|
|
725 |
|
|
/* Node: Condition Code */
|
726 |
|
|
|
727 |
|
|
#define SELECT_CC_MODE(OP, X, Y) \
|
728 |
|
|
mmix_select_cc_mode (OP, X, Y)
|
729 |
|
|
|
730 |
|
|
/* A definition of CANONICALIZE_COMPARISON that changed LE and GT
|
731 |
|
|
comparisons with -1 to LT and GE respectively, and LT, LTU, GE or GEU
|
732 |
|
|
comparisons with 256 to 255 and LE, LEU, GT and GTU has been
|
733 |
|
|
ineffective; the code path for performing the changes did not trig for
|
734 |
|
|
neither the GCC testsuite nor ghostscript-6.52 nor Knuth's mmix.tar.gz
|
735 |
|
|
itself (core GCC functionality supposedly handling it) with sources
|
736 |
|
|
from 2002-06-06. */
|
737 |
|
|
|
738 |
|
|
#define REVERSIBLE_CC_MODE(MODE) \
|
739 |
|
|
mmix_reversible_cc_mode (MODE)
|
740 |
|
|
|
741 |
|
|
|
742 |
|
|
/* Node: Costs */
|
743 |
|
|
|
744 |
|
|
/* The special registers can only move to and from general regs, and we
|
745 |
|
|
need to check that their constraints match, so say 3 for them. */
|
746 |
|
|
/* WARNING: gcc-2.7.2.2 i686-pc-linux-gnulibc1 (as shipped with RH 4.2)
|
747 |
|
|
miscompiles reload1.c:reload_cse_simplify_set; a call to
|
748 |
|
|
reload_cse_regno_equal_p is missing when checking if a substitution of
|
749 |
|
|
a register setting is valid if this is defined to just the expression
|
750 |
|
|
in mmix_register_move_cost.
|
751 |
|
|
|
752 |
|
|
Symptom: a (all?) register setting is optimized away for e.g.
|
753 |
|
|
"char *p1(char *p) { return p+1; }" and the value of register zero ($0)
|
754 |
|
|
is returned.
|
755 |
|
|
|
756 |
|
|
We can workaround by making this a function call - unknown if this
|
757 |
|
|
causes dire speed effects. */
|
758 |
|
|
#define REGISTER_MOVE_COST(MODE, FROM, TO) \
|
759 |
|
|
mmix_register_move_cost (MODE, FROM, TO)
|
760 |
|
|
|
761 |
|
|
#define SLOW_BYTE_ACCESS 0
|
762 |
|
|
|
763 |
|
|
|
764 |
|
|
/* Node: Sections */
|
765 |
|
|
|
766 |
|
|
/* This must be a constant string, since it's used in crtstuff.c. */
|
767 |
|
|
#define TEXT_SECTION_ASM_OP \
|
768 |
|
|
"\t.text ! mmixal:= 9H LOC 8B"
|
769 |
|
|
|
770 |
|
|
/* FIXME: Not documented. */
|
771 |
|
|
#define DATA_SECTION_ASM_OP \
|
772 |
|
|
mmix_data_section_asm_op ()
|
773 |
|
|
|
774 |
|
|
#define READONLY_DATA_SECTION_ASM_OP "\t.section\t.rodata"
|
775 |
|
|
|
776 |
|
|
/* Node: PIC */
|
777 |
|
|
/* (empty) */
|
778 |
|
|
|
779 |
|
|
|
780 |
|
|
/* Node: File Framework */
|
781 |
|
|
|
782 |
|
|
/* While any other punctuation character but ";" would do, we prefer "%"
|
783 |
|
|
or "!"; "!" is an unary operator and so will not be mistakenly included
|
784 |
|
|
in correctly formed expressions. The hash character adds mass; catches
|
785 |
|
|
the eye. We can't have it as a comment char by itself, since it's a
|
786 |
|
|
hex-number prefix. */
|
787 |
|
|
#define ASM_COMMENT_START "!#"
|
788 |
|
|
|
789 |
|
|
/* These aren't currently functional. We just keep them as markers. */
|
790 |
|
|
#define ASM_APP_ON "%APP\n"
|
791 |
|
|
#define ASM_APP_OFF "%NO_APP\n"
|
792 |
|
|
|
793 |
|
|
#define ASM_OUTPUT_SOURCE_FILENAME(STREAM, NAME) \
|
794 |
|
|
mmix_asm_output_source_filename (STREAM, NAME)
|
795 |
|
|
|
796 |
|
|
#define OUTPUT_QUOTED_STRING(STREAM, STRING) \
|
797 |
|
|
mmix_output_quoted_string (STREAM, STRING, strlen (STRING))
|
798 |
|
|
|
799 |
|
|
#define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
|
800 |
|
|
|
801 |
|
|
/* Node: Data Output */
|
802 |
|
|
|
803 |
|
|
#define ASM_OUTPUT_ASCII(STREAM, PTR, LEN) \
|
804 |
|
|
mmix_asm_output_ascii (STREAM, PTR, LEN)
|
805 |
|
|
|
806 |
|
|
/* Node: Uninitialized Data */
|
807 |
|
|
|
808 |
|
|
#define ASM_OUTPUT_ALIGNED_COMMON(ST, N, S, A) \
|
809 |
|
|
mmix_asm_output_aligned_common (ST, N, S, A)
|
810 |
|
|
|
811 |
|
|
#define ASM_OUTPUT_ALIGNED_LOCAL(ST, N, S, A) \
|
812 |
|
|
mmix_asm_output_aligned_local (ST, N, S, A)
|
813 |
|
|
|
814 |
|
|
|
815 |
|
|
/* Node: Label Output */
|
816 |
|
|
|
817 |
|
|
#define ASM_OUTPUT_LABEL(STREAM, NAME) \
|
818 |
|
|
mmix_asm_output_label (STREAM, NAME)
|
819 |
|
|
|
820 |
|
|
#define ASM_OUTPUT_INTERNAL_LABEL(STREAM, NAME) \
|
821 |
|
|
mmix_asm_output_internal_label (STREAM, NAME)
|
822 |
|
|
|
823 |
|
|
#define ASM_DECLARE_REGISTER_GLOBAL(STREAM, DECL, REGNO, NAME) \
|
824 |
|
|
mmix_asm_declare_register_global (STREAM, DECL, REGNO, NAME)
|
825 |
|
|
|
826 |
|
|
#define GLOBAL_ASM_OP "\t.global "
|
827 |
|
|
|
828 |
|
|
#define ASM_WEAKEN_LABEL(STREAM, NAME) \
|
829 |
|
|
mmix_asm_weaken_label (STREAM, NAME)
|
830 |
|
|
|
831 |
|
|
#define MAKE_DECL_ONE_ONLY(DECL) \
|
832 |
|
|
mmix_make_decl_one_only (DECL)
|
833 |
|
|
|
834 |
|
|
#define ASM_OUTPUT_LABELREF(STREAM, NAME) \
|
835 |
|
|
mmix_asm_output_labelref (STREAM, NAME)
|
836 |
|
|
|
837 |
|
|
/* We insert a ":" to disambiguate against user symbols like L5. */
|
838 |
|
|
#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
|
839 |
|
|
sprintf (LABEL, "*%s:%ld", PREFIX, (long)(NUM))
|
840 |
|
|
|
841 |
|
|
/* Insert "::"; these are rarer than internal labels. FIXME: Make sure no
|
842 |
|
|
":" is seen in the object file; we don't really want that mmixal
|
843 |
|
|
feature visible there. We don't want the default, which uses a dot;
|
844 |
|
|
that'd be incompatible with mmixal. */
|
845 |
|
|
#define ASM_PN_FORMAT "%s::%lu"
|
846 |
|
|
|
847 |
|
|
#define ASM_OUTPUT_DEF(STREAM, NAME, VALUE) \
|
848 |
|
|
mmix_asm_output_def (STREAM, NAME, VALUE)
|
849 |
|
|
|
850 |
|
|
/* Node: Macros for Initialization */
|
851 |
|
|
/* We're compiling to ELF and linking to MMO; fundamental ELF features
|
852 |
|
|
that GCC depend on are there. */
|
853 |
|
|
|
854 |
|
|
/* These must be constant strings, since they're used in crtstuff.c. */
|
855 |
|
|
#define INIT_SECTION_ASM_OP "\t.section .init,\"ax\" ! mmixal-incompatible"
|
856 |
|
|
|
857 |
|
|
#define FINI_SECTION_ASM_OP "\t.section .fini,\"ax\" ! mmixal-incompatible"
|
858 |
|
|
|
859 |
|
|
#define OBJECT_FORMAT_ELF
|
860 |
|
|
|
861 |
|
|
|
862 |
|
|
/* Node: Instruction Output */
|
863 |
|
|
|
864 |
|
|
/* The non-$ register names must be prefixed with ":", since they're
|
865 |
|
|
affected by PREFIX. We provide the non-colon names as additional
|
866 |
|
|
names. */
|
867 |
|
|
#define REGISTER_NAMES \
|
868 |
|
|
{"$0", "$1", "$2", "$3", "$4", "$5", "$6", "$7", \
|
869 |
|
|
"$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", \
|
870 |
|
|
"$16", "$17", "$18", "$19", "$20", "$21", "$22", "$23", \
|
871 |
|
|
"$24", "$25", "$26", "$27", "$28", "$29", "$30", "$31", \
|
872 |
|
|
"$32", "$33", "$34", "$35", "$36", "$37", "$38", "$39", \
|
873 |
|
|
"$40", "$41", "$42", "$43", "$44", "$45", "$46", "$47", \
|
874 |
|
|
"$48", "$49", "$50", "$51", "$52", "$53", "$54", "$55", \
|
875 |
|
|
"$56", "$57", "$58", "$59", "$60", "$61", "$62", "$63", \
|
876 |
|
|
"$64", "$65", "$66", "$67", "$68", "$69", "$70", "$71", \
|
877 |
|
|
"$72", "$73", "$74", "$75", "$76", "$77", "$78", "$79", \
|
878 |
|
|
"$80", "$81", "$82", "$83", "$84", "$85", "$86", "$87", \
|
879 |
|
|
"$88", "$89", "$90", "$91", "$92", "$93", "$94", "$95", \
|
880 |
|
|
"$96", "$97", "$98", "$99", "$100", "$101", "$102", "$103", \
|
881 |
|
|
"$104", "$105", "$106", "$107", "$108", "$109", "$110", "$111", \
|
882 |
|
|
"$112", "$113", "$114", "$115", "$116", "$117", "$118", "$119", \
|
883 |
|
|
"$120", "$121", "$122", "$123", "$124", "$125", "$126", "$127", \
|
884 |
|
|
"$128", "$129", "$130", "$131", "$132", "$133", "$134", "$135", \
|
885 |
|
|
"$136", "$137", "$138", "$139", "$140", "$141", "$142", "$143", \
|
886 |
|
|
"$144", "$145", "$146", "$147", "$148", "$149", "$150", "$151", \
|
887 |
|
|
"$152", "$153", "$154", "$155", "$156", "$157", "$158", "$159", \
|
888 |
|
|
"$160", "$161", "$162", "$163", "$164", "$165", "$166", "$167", \
|
889 |
|
|
"$168", "$169", "$170", "$171", "$172", "$173", "$174", "$175", \
|
890 |
|
|
"$176", "$177", "$178", "$179", "$180", "$181", "$182", "$183", \
|
891 |
|
|
"$184", "$185", "$186", "$187", "$188", "$189", "$190", "$191", \
|
892 |
|
|
"$192", "$193", "$194", "$195", "$196", "$197", "$198", "$199", \
|
893 |
|
|
"$200", "$201", "$202", "$203", "$204", "$205", "$206", "$207", \
|
894 |
|
|
"$208", "$209", "$210", "$211", "$212", "$213", "$214", "$215", \
|
895 |
|
|
"$216", "$217", "$218", "$219", "$220", "$221", "$222", "$223", \
|
896 |
|
|
"$224", "$225", "$226", "$227", "$228", "$229", "$230", "$231", \
|
897 |
|
|
"$232", "$233", "$234", "$235", "$236", "$237", "$238", "$239", \
|
898 |
|
|
"$240", "$241", "$242", "$243", "$244", "$245", "$246", "$247", \
|
899 |
|
|
"$248", "$249", "$250", "$251", "$252", "$253", "$254", "$255", \
|
900 |
|
|
":rD", ":rE", ":rH", ":rJ", ":rR", "ap_!BAD!", ":rO"}
|
901 |
|
|
|
902 |
|
|
#define ADDITIONAL_REGISTER_NAMES \
|
903 |
|
|
{{"sp", 254}, {":sp", 254}, {"rD", 256}, {"rE", 257}, \
|
904 |
|
|
{"rH", 258}, {"rJ", MMIX_rJ_REGNUM}, {"rO", MMIX_rO_REGNUM}}
|
905 |
|
|
|
906 |
|
|
#define PRINT_OPERAND(STREAM, X, CODE) \
|
907 |
|
|
mmix_print_operand (STREAM, X, CODE)
|
908 |
|
|
|
909 |
|
|
#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
|
910 |
|
|
mmix_print_operand_punct_valid_p (CODE)
|
911 |
|
|
|
912 |
|
|
#define PRINT_OPERAND_ADDRESS(STREAM, X) \
|
913 |
|
|
mmix_print_operand_address (STREAM, X)
|
914 |
|
|
|
915 |
|
|
#define ASM_OUTPUT_REG_PUSH(STREAM, REGNO) \
|
916 |
|
|
mmix_asm_output_reg_push (STREAM, REGNO)
|
917 |
|
|
|
918 |
|
|
#define ASM_OUTPUT_REG_POP(STREAM, REGNO) \
|
919 |
|
|
mmix_asm_output_reg_pop (STREAM, REGNO)
|
920 |
|
|
|
921 |
|
|
|
922 |
|
|
/* Node: Dispatch Tables */
|
923 |
|
|
|
924 |
|
|
/* We define both types, since SImode is the better, but DImode the only
|
925 |
|
|
possible for mmixal so that's the one actually used. */
|
926 |
|
|
#define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM, BODY, VALUE, REL) \
|
927 |
|
|
mmix_asm_output_addr_diff_elt (STREAM, BODY, VALUE, REL)
|
928 |
|
|
|
929 |
|
|
#define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \
|
930 |
|
|
mmix_asm_output_addr_vec_elt (STREAM, VALUE)
|
931 |
|
|
|
932 |
|
|
|
933 |
|
|
/* Node: Exception Region Output */
|
934 |
|
|
/* (empty) */
|
935 |
|
|
|
936 |
|
|
/* Node: Alignment Output */
|
937 |
|
|
|
938 |
|
|
#define ASM_OUTPUT_SKIP(STREAM, NBYTES) \
|
939 |
|
|
mmix_asm_output_skip (STREAM, NBYTES)
|
940 |
|
|
|
941 |
|
|
#define ASM_OUTPUT_ALIGN(STREAM, POWER) \
|
942 |
|
|
mmix_asm_output_align (STREAM, POWER)
|
943 |
|
|
|
944 |
|
|
|
945 |
|
|
/* Node: All Debuggers */
|
946 |
|
|
|
947 |
|
|
#define DBX_REGISTER_NUMBER(REGNO) \
|
948 |
|
|
mmix_dbx_register_number (REGNO)
|
949 |
|
|
|
950 |
|
|
|
951 |
|
|
/* Node: DBX Options */
|
952 |
|
|
/* (empty) */
|
953 |
|
|
/* Node: DBX Hooks */
|
954 |
|
|
/* (empty) */
|
955 |
|
|
/* Node: File Names and DBX */
|
956 |
|
|
/* (empty) */
|
957 |
|
|
|
958 |
|
|
|
959 |
|
|
/* Node: SDB and DWARF */
|
960 |
|
|
#define DWARF2_DEBUGGING_INFO 1
|
961 |
|
|
#define DWARF2_ASM_LINE_DEBUG_INFO 1
|
962 |
|
|
|
963 |
|
|
/* Node: Misc */
|
964 |
|
|
|
965 |
|
|
/* There's no way to get a PC-relative offset into tables for SImode, so
|
966 |
|
|
for the moment we have absolute entries in DImode.
|
967 |
|
|
When we're going ELF, these should be SImode and 1. */
|
968 |
|
|
#define CASE_VECTOR_MODE DImode
|
969 |
|
|
#define CASE_VECTOR_PC_RELATIVE 0
|
970 |
|
|
|
971 |
|
|
#define WORD_REGISTER_OPERATIONS
|
972 |
|
|
|
973 |
|
|
/* We have a choice, which makes this yet another parameter to tweak. The
|
974 |
|
|
gut feeling is currently that SIGN_EXTEND wins; "int" is more frequent
|
975 |
|
|
than "unsigned int", and we have signed characters. FIXME: measure. */
|
976 |
|
|
#define LOAD_EXTEND_OP(MODE) (TARGET_ZERO_EXTEND ? ZERO_EXTEND : SIGN_EXTEND)
|
977 |
|
|
|
978 |
|
|
#define MOVE_MAX 8
|
979 |
|
|
|
980 |
|
|
#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
|
981 |
|
|
|
982 |
|
|
/* ??? MMIX allows a choice of STORE_FLAG_VALUE. Revisit later,
|
983 |
|
|
we don't have scc expanders yet. */
|
984 |
|
|
|
985 |
|
|
#define Pmode DImode
|
986 |
|
|
|
987 |
|
|
#define FUNCTION_MODE QImode
|
988 |
|
|
|
989 |
|
|
#define NO_IMPLICIT_EXTERN_C
|
990 |
|
|
|
991 |
|
|
#define HANDLE_SYSV_PRAGMA 1
|
992 |
|
|
|
993 |
|
|
/* These are checked. */
|
994 |
|
|
#define DOLLARS_IN_IDENTIFIERS 0
|
995 |
|
|
#define NO_DOLLAR_IN_LABEL
|
996 |
|
|
#define NO_DOT_IN_LABEL
|
997 |
|
|
|
998 |
|
|
#endif /* GCC_MMIX_H */
|
999 |
|
|
/*
|
1000 |
|
|
* Local variables:
|
1001 |
|
|
* eval: (c-set-style "gnu")
|
1002 |
|
|
* indent-tabs-mode: t
|
1003 |
|
|
* End:
|
1004 |
|
|
*/
|