Remove workaround for register stack overwrite bug in mmix.
[gcc.git] / gcc / config / mmix / mmix.h
1 /* Definitions of target machine for GNU compiler, for MMIX.
2 Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
3 Contributed by Hans-Peter Nilsson (hp@bitrange.com)
4
5 This file is part of GNU CC.
6
7 GNU CC 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 2, or (at your option)
10 any later version.
11
12 GNU CC 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 GNU CC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
21
22 #ifndef GCC_MMIX_H
23 #define GCC_MMIX_H
24
25 /* First, some local helper macros. Note that the "default" value of
26 FIXED_REGISTERS, CALL_USED_REGISTERS, REG_ALLOC_ORDER and
27 REG_CLASS_CONTENTS depend on these values. */
28 #define MMIX_RESERVED_GNU_ARG_0_REGNUM 231
29 #define MMIX_FIRST_ARG_REGNUM \
30 (TARGET_ABI_GNU ? MMIX_RESERVED_GNU_ARG_0_REGNUM : 16)
31 #define MMIX_FIRST_INCOMING_ARG_REGNUM \
32 (TARGET_ABI_GNU ? MMIX_RESERVED_GNU_ARG_0_REGNUM : 0)
33 #define MMIX_MAX_ARGS_IN_REGS 16
34
35 /* FIXME: This one isn't fully implemented yet. Return values larger than
36 one register are passed by reference in MMIX_STRUCT_VALUE_REGNUM by the
37 caller, except for return values of type "complex". */
38 #define MMIX_MAX_REGS_FOR_VALUE 16
39 #define MMIX_RETURN_VALUE_REGNUM \
40 (TARGET_ABI_GNU ? MMIX_RESERVED_GNU_ARG_0_REGNUM : 15)
41 #define MMIX_OUTGOING_RETURN_VALUE_REGNUM \
42 (TARGET_ABI_GNU ? MMIX_RESERVED_GNU_ARG_0_REGNUM : 0)
43 #define MMIX_STRUCT_VALUE_REGNUM 251
44 #define MMIX_STATIC_CHAIN_REGNUM 252
45 #define MMIX_FRAME_POINTER_REGNUM 253
46 #define MMIX_STACK_POINTER_REGNUM 254
47 #define MMIX_LAST_GENERAL_REGISTER 255
48 #define MMIX_INCOMING_RETURN_ADDRESS_REGNUM MMIX_rJ_REGNUM
49 #define MMIX_HIMULT_REGNUM 258
50 #define MMIX_REMAINDER_REGNUM 260
51 #define MMIX_ARG_POINTER_REGNUM 261
52 #define MMIX_LAST_REGISTER_FILE_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 struct rtx_def *mmix_compare_op0;
86 extern struct rtx_def *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
92 {
93 int has_landing_pad;
94 };
95
96 /* For these target macros, there is no generic documentation here. You
97 should read `Using and Porting GCC' for that. Only comments specific
98 to the MMIX target are here.
99
100 There are however references to the specific texinfo node (comments
101 with "Node:"), so there should be little or nothing amiss. Probably
102 the opposite, since we don't have to care about old littering and
103 soon outdated generic comments. */
104
105 /* Node: Driver */
106
107 /* When both ABI:s work, this is how we tell them apart in code. The
108 GNU abi is implied the default. Also implied in TARGET_DEFAULT. */
109 #define CPP_SPEC \
110 "%{mabi=gnu:-D__MMIX_ABI_GNU__\
111 %{mabi=mmixware:\
112 %eoptions -mabi=mmixware and -mabi=gnu are mutually exclusive}}\
113 %{!mabi=gnu:-D__MMIX_ABI_MMIXWARE__}"
114
115 /* User symbols are in the same name-space as built-in symbols, but we
116 don't need the built-in symbols, so remove those and instead apply
117 stricter operand checking. Don't warn when expanding insns. */
118 #define ASM_SPEC "-no-predefined-syms -x"
119
120 /* Pass on -mset-program-start=N and -mset-data-start=M to the linker.
121 Provide default program start 0x100 unless -mno-set-program-start.
122 Link to ELF if requested. */
123 #define LINK_SPEC \
124 "%{mset-program-start=*:--defsym __.MMIX.start..text=%*}\
125 %{mset-data-start=*:--defsym __.MMIX.start..data=%*}\
126 %{!mset-program-start=*:\
127 %{!mno-set-program-start:--defsym __.MMIX.start..text=0x100}}\
128 %{!melf:-m mmo}%{melf:-m elf64mmix}"
129
130 /* Put unused option values here. */
131 extern const char *mmix_cc1_ignored_option;
132
133 #define TARGET_OPTIONS \
134 {{"set-program-start=", &mmix_cc1_ignored_option, \
135 N_("Set start-address of the program") }, \
136 {"set-data-start=", &mmix_cc1_ignored_option, \
137 N_("Set start-address of data")}}
138
139 /* FIXME: There's no provision for profiling here. */
140 #define STARTFILE_SPEC \
141 "crti%O%s crtbegin%O%s"
142
143 #define ENDFILE_SPEC "crtend%O%s crtn%O%s"
144
145 /* Node: Run-time Target */
146
147 /* Define __LONG_MAX__, since we're advised not to change glimits.h. */
148 #define CPP_PREDEFINES "-D__mmix__ -D__MMIX__ -D__LONG_MAX__=9223372036854775807L"
149
150 extern int target_flags;
151
152 #define TARGET_MASK_LIBFUNCS 1
153 #define TARGET_MASK_ABI_GNU 2
154 #define TARGET_MASK_FCMP_EPSILON 4
155 #define TARGET_MASK_ZERO_EXTEND 8
156 #define TARGET_MASK_KNUTH_DIVISION 16
157 #define TARGET_MASK_TOPLEVEL_SYMBOLS 32
158 #define TARGET_MASK_BRANCH_PREDICT 64
159
160 /* FIXME: Get rid of this one. */
161 #define TARGET_LIBFUNC (target_flags & TARGET_MASK_LIBFUNCS)
162 #define TARGET_ABI_GNU (target_flags & TARGET_MASK_ABI_GNU)
163 #define TARGET_FCMP_EPSILON (target_flags & TARGET_MASK_FCMP_EPSILON)
164 #define TARGET_ZERO_EXTEND (target_flags & TARGET_MASK_ZERO_EXTEND)
165 #define TARGET_KNUTH_DIVISION (target_flags & TARGET_MASK_KNUTH_DIVISION)
166 #define TARGET_TOPLEVEL_SYMBOLS (target_flags & TARGET_MASK_TOPLEVEL_SYMBOLS)
167 #define TARGET_BRANCH_PREDICT (target_flags & TARGET_MASK_BRANCH_PREDICT)
168
169 #define TARGET_DEFAULT \
170 (TARGET_MASK_BRANCH_PREDICT)
171
172 /* FIXME: Provide a way to *load* the epsilon register. */
173 #define TARGET_SWITCHES \
174 {{"libfuncs", TARGET_MASK_LIBFUNCS, \
175 N_("For intrinsics library: pass all parameters in registers")}, \
176 {"no-libfuncs", -TARGET_MASK_LIBFUNCS, ""}, \
177 {"abi=mmixware", -TARGET_MASK_ABI_GNU, \
178 N_("Use register stack for parameters and return value")}, \
179 {"abi=gnu", TARGET_MASK_ABI_GNU, \
180 N_("Use call-clobbered registers for parameters and return value")}, \
181 {"epsilon", TARGET_MASK_FCMP_EPSILON, \
182 N_("Use epsilon-respecting floating point compare instructions")}, \
183 {"no-epsilon", -TARGET_MASK_FCMP_EPSILON, ""}, \
184 {"zero-extend", TARGET_MASK_ZERO_EXTEND, \
185 N_("Use zero-extending memory loads, not sign-extending ones")}, \
186 {"no-zero-extend", -TARGET_MASK_ZERO_EXTEND, ""}, \
187 {"knuthdiv", TARGET_MASK_KNUTH_DIVISION, \
188 N_("Generate divide results with reminder having the same sign as the\
189 divisor (not the dividend)")}, \
190 {"no-knuthdiv", -TARGET_MASK_KNUTH_DIVISION, ""}, \
191 {"toplevel-symbols", TARGET_MASK_TOPLEVEL_SYMBOLS, \
192 N_("Prepend global symbols with \":\" (for use with PREFIX)")}, \
193 {"no-toplevel-symbols", -TARGET_MASK_TOPLEVEL_SYMBOLS, \
194 N_("Do not provide a default start-address 0x100 of the program")}, \
195 {"elf", 0, \
196 N_("Link to emit program in ELF format (rather than mmo)")}, \
197 {"branch-predict", TARGET_MASK_BRANCH_PREDICT, \
198 N_("Use P-mnemonics for branches statically predicted as taken")}, \
199 {"no-branch-predict", -TARGET_MASK_BRANCH_PREDICT, \
200 N_("Don't use P-mnemonics for branches")}, \
201 {"", TARGET_DEFAULT, ""}}
202
203 /* Unfortunately, this must not reference anything in "mmix.c". */
204 #define TARGET_VERSION \
205 fprintf (stderr, " (MMIX)")
206
207 #define OVERRIDE_OPTIONS mmix_override_options ()
208
209 #define OPTIMIZATION_OPTIONS(LEVEL, SIZE) \
210 do \
211 { \
212 if (LEVEL >= 1) \
213 flag_regmove = TRUE; \
214 \
215 if (SIZE || LEVEL > 1) \
216 { \
217 flag_omit_frame_pointer = TRUE; \
218 flag_strength_reduce = FALSE; \
219 } \
220 } \
221 while (0)
222
223 /* This one will have to wait a little bit; right now we can't debug
224 neither with or without a frame-pointer. */
225 /* #define CAN_DEBUG_WITHOUT_FP */
226
227
228 /* Node: Per-Function Data */
229 #define INIT_EXPANDERS mmix_init_expanders ()
230
231
232 /* Node: Storage Layout */
233 /* I see no bitfield instructions. Anyway, the common order is from low
234 to high, as the power of two, hence little-endian. */
235 #define BITS_BIG_ENDIAN 0
236 #define BYTES_BIG_ENDIAN 1
237 #define WORDS_BIG_ENDIAN 1
238 #define FLOAT_WORDS_BIG_ENDIAN 1
239 #define BITS_PER_UNIT 8
240 #define BITS_PER_WORD 64
241 #define UNITS_PER_WORD 8
242 #define POINTER_SIZE 64
243
244 /* FIXME: This macro is correlated to MAX_FIXED_MODE_SIZE in that
245 e.g. this macro must not be 8 (default, UNITS_PER_WORD) when
246 MAX_FIXED_MODE_SIZE is 64 (default, DImode), or really: this must be
247 set manually if MAX_FIXED_MODE_SIZE is not at least twice the register
248 size. By setting it to 4, we don't have to worry about TImode things
249 yet. Revisit, perhaps get TImode going or get some solution that does
250 not mandate TImode or lie in other ways. */
251 #define MIN_UNITS_PER_WORD 4
252
253 /* FIXME: Promotion of modes currently generates slow code, extending
254 before every operation. */
255
256 #define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \
257 do { \
258 if (GET_MODE_CLASS (MODE) == MODE_INT \
259 && GET_MODE_SIZE (MODE) < 8) \
260 { \
261 (MODE) = DImode; \
262 /* Do the following some time later, \
263 scrutinizing differences. */ \
264 if (0) (UNSIGNEDP) = 0; \
265 } \
266 } while (0)
267
268 #define PROMOTE_FUNCTION_ARGS
269
270 #if 0
271 /* Apparently not doing TRT if int < register-size. FIXME: Perhaps
272 FUNCTION_VALUE and LIBCALL_VALUE needs tweaking as some ports say. */
273 #define PROMOTE_FUNCTION_RETURN
274 #endif
275
276 /* I'm a little bit undecided about this one. It might be beneficial to
277 promote all operations. */
278 #define PROMOTE_FOR_CALL_ONLY
279
280 /* We need to align everything to 64 bits that can affect the alignment
281 of other types. Since address N is interpreted in MMIX as (N modulo
282 access_size), we must align. */
283 #define PARM_BOUNDARY 64
284 #define STACK_BOUNDARY 64
285 #define FUNCTION_BOUNDARY 32
286 #define BIGGEST_ALIGNMENT 64
287
288 /* This one is only used in the ADA front end. */
289 #define MINIMUM_ATOMIC_ALIGNMENT 8
290
291 /* Copied from elfos.h. */
292 #define MAX_OFILE_ALIGNMENT (32768 * 8)
293
294 #define DATA_ALIGNMENT(TYPE, BASIC_ALIGN) \
295 mmix_data_alignment (TYPE, BASIC_ALIGN)
296
297 #define CONSTANT_ALIGNMENT(CONSTANT, BASIC_ALIGN) \
298 mmix_constant_alignment (CONSTANT, BASIC_ALIGN)
299
300 #define LOCAL_ALIGNMENT(TYPE, BASIC_ALIGN) \
301 mmix_local_alignment (TYPE, BASIC_ALIGN)
302
303 /* Following other ports, this seems to most commonly be the word-size,
304 so let's do that here too. */
305 #define EMPTY_FIELD_BOUNDARY 64
306
307 /* We chose to have this low solely for similarity with the alpha. It has
308 nothing to do with passing the tests dg/c99-scope-2 and
309 execute/align-1.c. Nothing. Though the tests seem wrong. Padding of
310 the structure is automatically added to get alignment when needed if we
311 set this to just byte-boundary. */
312 #define STRUCTURE_SIZE_BOUNDARY 8
313
314 /* The lower bits are ignored. */
315 #define STRICT_ALIGNMENT 1
316
317
318 /* Node: Type Layout */
319
320 /* It might seem more natural to have 64-bit ints on a 64-bit machine,
321 but then an occasional MMIX programmer needs to know how to put a lot
322 of __attribute__ stuff to get to the 8, 16 and 32-bit modes rather
323 than the "intuitive" char, short and int types. */
324 #define INT_TYPE_SIZE 32
325 #define SHORT_TYPE_SIZE 16
326 #define LONG_LONG_TYPE_SIZE 64
327
328 #define FLOAT_TYPE_SIZE 32
329 #define DOUBLE_TYPE_SIZE 64
330 #define LONG_DOUBLE_TYPE_SIZE 64
331
332 #define DEFAULT_SIGNED_CHAR 1
333
334 /* I have no rationale for this other than pointing at Alpha. */
335 #define WCHAR_TYPE "unsigned int"
336 #define WCHAR_TYPE_SIZE 32
337
338
339 /* Node: Register Basics */
340 /* We tell GCC about all 256 general registers, and we also include
341 rD, rE, rH, rJ and rR (in that order) so we can describe what insns
342 clobber them. We use a faked register for the argument pointer. It is
343 always eliminated towards the frame-pointer or the stack-pointer, never
344 output in assembly. Any fixed register would do for this, like $255,
345 but future debugging is easier when using a separate register. It
346 counts as a global register for pseudorandom reasons. */
347 #define FIRST_PSEUDO_REGISTER 262
348
349 /* We treat general registers with no assigned purpose as fixed. The
350 stack pointer, $254, is also fixed. Register $255 is referred to as a
351 temporary register in the MMIX papers, and used as such in mmixal, so
352 it should not be used as a stack pointer. We set it to fixed, and use
353 it "manually" at times of despair. */
354 #define FIXED_REGISTERS \
355 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
356 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
357 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
358 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
359 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
360 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
361 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
362 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
363 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
364 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
365 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
366 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
367 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
368 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
369 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
370 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, \
371 1, 1, 0, 0, 0, 1 \
372 }
373
374 /* General registers are fixed and therefore "historically" marked
375 call-used. (FIXME: This has changed). Registers $15..$31 are
376 call-clobbered; we'll put arguments in $16 and up, and we need $15 for
377 the MMIX register-stack "hole". */
378 #define CALL_USED_REGISTERS \
379 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, \
380 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
381 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
382 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
383 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
384 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
385 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
386 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
387 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
388 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
389 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
390 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
391 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
392 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
393 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
394 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, \
395 1, 1, 1, 1, 1, 1 \
396 }
397
398 #define CONDITIONAL_REGISTER_USAGE mmix_conditional_register_usage ()
399
400 /* No LOCAL_REGNO, INCOMING_REGNO or OUTGOING_REGNO, since those macros
401 are not usable for MMIX: it doesn't have a fixed register window size.
402 FIXME: Perhaps we should say something about $0..$15 may sometimes be
403 the incoming $16..$31. Those macros need better documentation; it
404 looks like they're just bogus and that FUNCTION_INCOMING_ARG_REGNO_P
405 and FUNCTION_OUTGOING_VALUE should be used where they're used. For the
406 moment, do nothing; things seem to work anyway. */
407
408
409 /* Node: Allocation Order */
410
411 /* We should allocate registers from 0 to 31 by increasing number, because
412 I think that's what people expect. Beyond that, just use
413 call-clobbered global registers first, then call-clobbered special
414 registers. Last, the fixed registers. */
415 #define MMIX_MMIXWARE_ABI_REG_ALLOC_ORDER \
416 { 0, 1, 2, 3, 4, 5, 6, 7, \
417 8, 9, 10, 11, 12, 13, 14, 15, \
418 16, 17, 18, 19, 20, 21, 22, 23, \
419 24, 25, 26, 27, 28, 29, 30, 31, \
420 \
421 252, 251, 250, 249, 248, 247, \
422 246, 245, 244, 243, 242, 241, 240, 239, \
423 238, 237, 236, 235, 234, 233, 232, 231, \
424 \
425 253, \
426 \
427 258, 260, 259, \
428 \
429 32, 33, 34, 35, 36, 37, 38, 39, \
430 40, 41, 42, 43, 44, 45, 46, 47, \
431 48, 49, 50, 51, 52, 53, 54, 55, \
432 56, 57, 58, 59, 60, 61, 62, 63, \
433 64, 65, 66, 67, 68, 69, 70, 71, \
434 72, 73, 74, 75, 76, 77, 78, 79, \
435 80, 81, 82, 83, 84, 85, 86, 87, \
436 88, 89, 90, 91, 92, 93, 94, 95, \
437 96, 97, 98, 99, 100, 101, 102, 103, \
438 104, 105, 106, 107, 108, 109, 110, 111, \
439 112, 113, 114, 115, 116, 117, 118, 119, \
440 120, 121, 122, 123, 124, 125, 126, 127, \
441 128, 129, 130, 131, 132, 133, 134, 135, \
442 136, 137, 138, 139, 140, 141, 142, 143, \
443 144, 145, 146, 147, 148, 149, 150, 151, \
444 152, 153, 154, 155, 156, 157, 158, 159, \
445 160, 161, 162, 163, 164, 165, 166, 167, \
446 168, 169, 170, 171, 172, 173, 174, 175, \
447 176, 177, 178, 179, 180, 181, 182, 183, \
448 184, 185, 186, 187, 188, 189, 190, 191, \
449 192, 193, 194, 195, 196, 197, 198, 199, \
450 200, 201, 202, 203, 204, 205, 206, 207, \
451 208, 209, 210, 211, 212, 213, 214, 215, \
452 216, 217, 218, 219, 220, 221, 222, 223, \
453 224, 225, 226, 227, 228, 229, 230, 231, \
454 254, 255, 256, 257, 261 \
455 }
456
457 /* As a convenience, we put this nearby, for ease of comparison.
458 First, call-clobbered registers in reverse order of assignment as
459 parameters (also the top ones; not because they're parameters, but
460 for continuity).
461
462 Second, saved registers that go on the register-stack.
463
464 Third, special registers rH, rR and rJ. They should not normally be
465 allocated, but since they're call-clobbered, it is cheaper to use one
466 of them than using a call-saved register for a call-clobbered use,
467 assuming it is referenced a very limited number of times. Other global
468 and fixed registers come next; they are never allocated. */
469 #define MMIX_GNU_ABI_REG_ALLOC_ORDER \
470 { 252, 251, 250, 249, 248, 247, 246, \
471 245, 244, 243, 242, 241, 240, 239, 238, \
472 237, 236, 235, 234, 233, 232, \
473 \
474 0, 1, 2, 3, 4, 5, 6, 7, \
475 8, 9, 10, 11, 12, 13, 14, 15, \
476 16, 17, 18, 19, 20, 21, 22, 23, \
477 24, 25, 26, 27, 28, 29, 30, 31, \
478 \
479 253, \
480 \
481 258, 260, 259, \
482 \
483 32, 33, 34, 35, 36, 37, 38, 39, \
484 40, 41, 42, 43, 44, 45, 46, 47, \
485 48, 49, 50, 51, 52, 53, 54, 55, \
486 56, 57, 58, 59, 60, 61, 62, 63, \
487 64, 65, 66, 67, 68, 69, 70, 71, \
488 72, 73, 74, 75, 76, 77, 78, 79, \
489 80, 81, 82, 83, 84, 85, 86, 87, \
490 88, 89, 90, 91, 92, 93, 94, 95, \
491 96, 97, 98, 99, 100, 101, 102, 103, \
492 104, 105, 106, 107, 108, 109, 110, 111, \
493 112, 113, 114, 115, 116, 117, 118, 119, \
494 120, 121, 122, 123, 124, 125, 126, 127, \
495 128, 129, 130, 131, 132, 133, 134, 135, \
496 136, 137, 138, 139, 140, 141, 142, 143, \
497 144, 145, 146, 147, 148, 149, 150, 151, \
498 152, 153, 154, 155, 156, 157, 158, 159, \
499 160, 161, 162, 163, 164, 165, 166, 167, \
500 168, 169, 170, 171, 172, 173, 174, 175, \
501 176, 177, 178, 179, 180, 181, 182, 183, \
502 184, 185, 186, 187, 188, 189, 190, 191, \
503 192, 193, 194, 195, 196, 197, 198, 199, \
504 200, 201, 202, 203, 204, 205, 206, 207, \
505 208, 209, 210, 211, 212, 213, 214, 215, \
506 216, 217, 218, 219, 220, 221, 222, 223, \
507 224, 225, 226, 227, 228, 229, 230, 231, \
508 254, 255, 256, 257, 261 \
509 }
510
511 /* The default one. */
512 #define REG_ALLOC_ORDER MMIX_MMIXWARE_ABI_REG_ALLOC_ORDER
513
514 /* Node: Values in Registers */
515
516 #define HARD_REGNO_NREGS(REGNO, MODE) \
517 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) \
518 / UNITS_PER_WORD)
519
520 #define HARD_REGNO_MODE_OK(REGNO, MODE) 1
521
522 /* Note that no register can really be accessed in single-float mode, so
523 we *can* say 1 here. FIXME: Will TRT happen for single-float, or do
524 we have to punt to libgcc1.asm? */
525 #define MODES_TIEABLE_P(MODE1, MODE2) 1
526
527
528 /* Node: Leaf Functions */
529 /* (empty) */
530
531
532 /* Node: Register Classes */
533
534 enum reg_class
535 {
536 NO_REGS, GENERAL_REGS, REMAINDER_REG, HIMULT_REG,
537 SYSTEM_REGS, ALL_REGS, LIM_REG_CLASSES
538 };
539
540 #define N_REG_CLASSES (int) LIM_REG_CLASSES
541
542 #define REG_CLASS_NAMES \
543 {"NO_REGS", "GENERAL_REGS", "REMAINDER_REG", "HIMULT_REG", \
544 "SYSTEM_REGS", "ALL_REGS"}
545
546 /* Note that the contents of each item is always 32 bits. */
547 #define REG_CLASS_CONTENTS \
548 {{0, 0, 0, 0, 0, 0, 0, 0, 0}, \
549 {~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, 0x20}, \
550 {0, 0, 0, 0, 0, 0, 0, 0, 0x10}, \
551 {0, 0, 0, 0, 0, 0, 0, 0, 4}, \
552 {0, 0, 0, 0, 0, 0, 0, 0, 0x3f}, \
553 {~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, 0x3f}}
554
555 #define REGNO_REG_CLASS(REGNO) \
556 ((REGNO) <= MMIX_LAST_GENERAL_REGISTER \
557 || (REGNO) == MMIX_ARG_POINTER_REGNUM \
558 ? GENERAL_REGS \
559 : (REGNO) == MMIX_REMAINDER_REGNUM ? REMAINDER_REG \
560 : (REGNO) == MMIX_HIMULT_REGNUM ? HIMULT_REG : SYSTEM_REGS)
561
562 #define BASE_REG_CLASS GENERAL_REGS
563
564 #define INDEX_REG_CLASS GENERAL_REGS
565
566 #define REG_CLASS_FROM_LETTER(CHAR) \
567 ((CHAR) == 'x' ? SYSTEM_REGS \
568 : (CHAR) == 'y' ? REMAINDER_REG \
569 : (CHAR) == 'z' ? HIMULT_REG : NO_REGS)
570
571 #define REGNO_OK_FOR_BASE_P(REGNO) \
572 ((REGNO) <= MMIX_LAST_GENERAL_REGISTER \
573 || (REGNO) == MMIX_ARG_POINTER_REGNUM \
574 || (reg_renumber[REGNO] > 0 \
575 && reg_renumber[REGNO] <= MMIX_LAST_GENERAL_REGISTER))
576
577 #define REGNO_OK_FOR_INDEX_P(REGNO) REGNO_OK_FOR_BASE_P (REGNO)
578
579 #define PREFERRED_RELOAD_CLASS(X, CLASS) \
580 mmix_preferred_reload_class (X, CLASS)
581
582 #define PREFERRED_OUTPUT_RELOAD_CLASS(X, CLASS) \
583 mmix_preferred_output_reload_class (X, CLASS)
584
585 #define SECONDARY_INPUT_RELOAD_CLASS(CLASS, MODE, X) \
586 mmix_secondary_reload_class (CLASS, MODE, X, 1)
587
588 #define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS, MODE, X) \
589 mmix_secondary_reload_class (CLASS, MODE, X, 0)
590
591 #define CLASS_MAX_NREGS(CLASS, MODE) HARD_REGNO_NREGS (CLASS, MODE)
592
593 #define CONST_OK_FOR_LETTER_P(VALUE, C) \
594 mmix_const_ok_for_letter_p (VALUE, C)
595
596 #define EXTRA_CONSTRAINT(VALUE, C) \
597 mmix_extra_constraint (VALUE, C, MMIX_REG_OK_STRICT)
598
599 /* Do we need anything serious here? Yes, any FLOT constant. */
600 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
601 mmix_const_double_ok_for_letter_p (VALUE, C)
602
603
604 /* Node: Frame Layout */
605
606 #define STACK_GROWS_DOWNWARD
607 #define FRAME_GROWS_DOWNWARD
608
609 #define STARTING_FRAME_OFFSET \
610 mmix_starting_frame_offset ()
611
612 /* There is a stack slot between the frame-pointer and the first
613 parameter, where the return address is sometimes stored. FIXME:
614 Unnecessary. */
615 #define FIRST_PARM_OFFSET(FUNDECL) 8
616
617 #define DYNAMIC_CHAIN_ADDRESS(FRAMEADDR) \
618 mmix_dynamic_chain_address (FRAMEADDR)
619
620 /* FIXME: It seems RETURN_ADDR_OFFSET is undocumented. */
621
622 #define SETUP_FRAME_ADDRESSES() \
623 mmix_setup_frame_addresses ()
624
625 #define RETURN_ADDR_RTX(COUNT, FRAME) \
626 mmix_return_addr_rtx (COUNT, FRAME)
627
628 /* It's in rJ before we store it somewhere. */
629 #define INCOMING_RETURN_ADDR_RTX \
630 gen_rtx_REG (Pmode, MMIX_INCOMING_RETURN_ADDRESS_REGNUM)
631
632 /* FIXME: This does not seem properly documented or cross-indexed.
633 Nowhere except in the code does it say it *has* to be in the range
634 0..255, or else it will be truncated. That goes for the default too. */
635 #define DWARF_FRAME_RETURN_COLUMN \
636 DWARF_FRAME_REGNUM (MMIX_INCOMING_RETURN_ADDRESS_REGNUM)
637
638 /* No return address is stored there. */
639 #define INCOMING_FRAME_SP_OFFSET 0
640
641 /* Node: Stack Checking */
642 /* (empty) */
643
644
645 /* Node: Exception Handling */
646
647 #define EH_RETURN_DATA_REGNO(N) \
648 mmix_eh_return_data_regno (N)
649
650 #define EH_RETURN_STACKADJ_RTX \
651 mmix_eh_return_stackadj_rtx ()
652
653 #define EH_RETURN_HANDLER_RTX \
654 mmix_eh_return_handler_rtx ()
655
656 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \
657 mmix_asm_preferred_eh_data_format (CODE, GLOBAL)
658
659 /* Node: Frame Registers */
660 #define STACK_POINTER_REGNUM MMIX_STACK_POINTER_REGNUM
661
662 /* Perhaps we can use HARD_FRAME_POINTER_REGNUM and decide later on
663 what register we want to use. */
664 #define FRAME_POINTER_REGNUM MMIX_FRAME_POINTER_REGNUM
665 #define ARG_POINTER_REGNUM MMIX_ARG_POINTER_REGNUM
666
667 #define STATIC_CHAIN_REGNUM MMIX_STATIC_CHAIN_REGNUM
668
669
670 /* Node: Elimination */
671 /* FIXME: Is this requirement built-in? Anyway, we should try to get rid
672 of it; we can deduce the value. */
673 #define FRAME_POINTER_REQUIRED (nonlocal_goto_stack_level != NULL_RTX)
674
675 /* The frame-pointer is stored in a location that either counts to the
676 offset of incoming parameters, or that counts to the offset of the
677 frame, so we can't use a single offset. We therefore eliminate those
678 two separately. */
679 #define ELIMINABLE_REGS \
680 {{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
681 {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
682 {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
683
684 /* We need not worry about when the frame-pointer is required for other
685 reasons; GCC takes care of those cases. */
686 #define CAN_ELIMINATE(FROM, TO) 1
687
688 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
689 (OFFSET) = mmix_initial_elimination_offset (FROM, TO);
690
691
692 /* Node: Stack Arguments */
693
694 #define ACCUMULATE_OUTGOING_ARGS 1
695
696 #define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, STACKSIZE) 0
697
698
699 /* Node: Register Arguments */
700 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
701 mmix_function_arg (&(CUM), MODE, TYPE, NAMED, 0)
702
703 #define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) \
704 mmix_function_arg (&(CUM), MODE, TYPE, NAMED, 1)
705
706 #define FUNCTION_ARG_PASS_BY_REFERENCE(CUM, MODE, TYPE, NAMED) \
707 mmix_function_arg_pass_by_reference (&(CUM), MODE, TYPE, NAMED)
708
709 /* This *sounds* good, but does not seem to be implemented correctly to
710 be a win; at least it wasn't in 2.7.2. FIXME: Check and perhaps
711 replace with a big comment. */
712 #define FUNCTION_ARG_CALLEE_COPIES(CUM, MODE, TYPE, NAMED) 1
713
714 typedef struct { int regs; int lib; int now_varargs; } CUMULATIVE_ARGS;
715
716 #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT) \
717 ((CUM).regs = 0, (CUM).lib = ((LIBNAME) != 0), (CUM).now_varargs = 0)
718
719 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
720 ((CUM).regs \
721 = ((MUST_PASS_IN_STACK (MODE, TYPE)) \
722 || (MMIX_FUNCTION_ARG_SIZE (MODE, TYPE) > 8 \
723 && !TARGET_LIBFUNC && !(CUM).lib)) \
724 ? (MMIX_MAX_ARGS_IN_REGS) + 1 \
725 : (CUM).regs + (7 + (MMIX_FUNCTION_ARG_SIZE (MODE, TYPE))) / 8)
726
727 #define FUNCTION_ARG_REGNO_P(REGNO) \
728 mmix_function_arg_regno_p (REGNO, 0)
729
730 #define FUNCTION_INCOMING_ARG_REGNO_P(REGNO) \
731 mmix_function_arg_regno_p (REGNO, 1)
732
733
734 /* Node: Register Arguments */
735
736 #define FUNCTION_VALUE(VALTYPE, FUNC) \
737 gen_rtx_REG (TYPE_MODE (VALTYPE), MMIX_RETURN_VALUE_REGNUM)
738
739 /* This needs to take care of the register hole for complex return values. */
740 #define FUNCTION_OUTGOING_VALUE(VALTYPE, FUNC) \
741 mmix_function_outgoing_value (VALTYPE, FUNC)
742
743 #define LIBCALL_VALUE(MODE) \
744 gen_rtx_REG (MODE, MMIX_OUTGOING_RETURN_VALUE_REGNUM)
745
746 #define FUNCTION_VALUE_REGNO_P(REGNO) \
747 ((REGNO) == MMIX_OUTGOING_RETURN_VALUE_REGNUM)
748
749
750 /* Node: Aggregate Return */
751
752 #define STRUCT_VALUE_REGNUM MMIX_STRUCT_VALUE_REGNUM
753
754
755 /* Node: Caller Saves */
756 /* (empty) */
757
758
759 /* Node: Function Entry */
760
761 /* See mmix.c for TARGET_ASM_FUNCTION_PROLOGUE and
762 TARGET_ASM_FUNCTION_EPILOGUE. */
763
764 /* We need to say that the epilogue uses the return address, so the
765 initial-value machinery restores it. FIXME: Some targets
766 conditionalize on "reload_completed &&". Investigate difference.
767 FIXME: Not needed if nonlocal_goto_stack_level. */
768 #define EPILOGUE_USES(REGNO) \
769 ((REGNO) == MMIX_INCOMING_RETURN_ADDRESS_REGNUM)
770
771 #define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \
772 mmix_asm_output_mi_thunk (FILE, THUNK_FNDECL, DELTA, FUNCTION)
773
774
775 /* Node: Profiling */
776 #define FUNCTION_PROFILER(FILE, LABELNO) \
777 mmix_function_profiler (FILE, LABELNO)
778
779 /* Node: Varargs */
780
781 /* For the moment, let's stick to pushing argument registers on the stack.
782 Later, we can parse all arguments in registers, to improve
783 performance. */
784 #define SETUP_INCOMING_VARARGS(A, M, T, P, S) \
785 mmix_setup_incoming_varargs(&(A), M, T, &(P), S)
786
787 /* FIXME: This and other EXPAND_BUILTIN_VA_... target macros are not
788 documented, although used by several targets. */
789 #define EXPAND_BUILTIN_VA_ARG(VALIST, TYPE) \
790 mmix_expand_builtin_va_arg (VALIST, TYPE)
791
792 /* Node: Trampolines */
793
794 #define TRAMPOLINE_TEMPLATE(FILE) \
795 mmix_trampoline_template (FILE)
796
797 #define TRAMPOLINE_SIZE mmix_trampoline_size
798 #define INITIALIZE_TRAMPOLINE(ADDR, FNADDR, STATIC_CHAIN) \
799 mmix_initialize_trampoline (ADDR, FNADDR, STATIC_CHAIN)
800
801
802 /* Node: Library Calls */
803
804 #define TARGET_MEM_FUNCTIONS
805
806
807 /* Node: Addressing Modes */
808
809 #define CONSTANT_ADDRESS_P(X) \
810 mmix_constant_address_p (X)
811
812 #define MAX_REGS_PER_ADDRESS 2
813
814 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) \
815 if (mmix_legitimate_address (MODE, X, MMIX_REG_OK_STRICT)) \
816 goto LABEL
817
818 #ifndef REG_OK_STRICT
819 # define REG_OK_FOR_BASE_P(X) \
820 (REGNO (X) <= MMIX_LAST_GENERAL_REGISTER \
821 || REGNO (X) == MMIX_ARG_POINTER_REGNUM \
822 || REGNO (X) >= FIRST_PSEUDO_REGISTER)
823 #else
824 # define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
825 #endif /* REG_OK_STRICT */
826
827 #define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_BASE_P (X)
828
829 #define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN)
830
831 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL)
832
833 #define LEGITIMATE_CONSTANT_P(X) \
834 mmix_legitimate_constant_p (X)
835
836
837 /* Node: Condition Code */
838
839 #define EXTRA_CC_MODES \
840 CC(CC_UNSmode, "CC_UNS") \
841 CC(CC_FPmode, "CC_FP") \
842 CC(CC_FPEQmode, "CC_FPEQ") \
843 CC(CC_FUNmode, "CC_FUN")
844
845 #define SELECT_CC_MODE(OP, X, Y) \
846 mmix_select_cc_mode (OP, X, Y)
847
848 #define CANONICALIZE_COMPARISON(CODE, OP0, OP1) \
849 mmix_canonicalize_comparison (&(CODE), &(OP0), &(OP1));
850
851 #define REVERSIBLE_CC_MODE(MODE) \
852 mmix_reversible_cc_mode (MODE)
853
854
855 /* Node: Costs */
856
857 /* This one takes on both the RTX_COSTS and CONST_COSTS tasks. */
858 #define DEFAULT_RTX_COSTS(X, CODE, OUTER_CODE) \
859 { \
860 int mmix_rtx_cost; \
861 if (mmix_rtx_cost_recalculated (X, CODE, OUTER_CODE, \
862 &mmix_rtx_cost)) \
863 return mmix_rtx_cost; \
864 }
865
866 #define ADDRESS_COST(ADDRESS) mmix_address_cost (ADDRESS)
867
868 /* The special registers can only move to and from general regs, and we
869 need to check that their constraints match, so say 3 for them. */
870 /* WARNING: gcc-2.7.2.2 i686-pc-linux-gnulibc1 (as shipped with RH 4.2)
871 miscompiles reload1.c:reload_cse_simplify_set; a call to
872 reload_cse_regno_equal_p is missing when checking if a substitution of
873 a register setting is valid if this is defined to just the expression
874 in mmix_register_move_cost.
875
876 Symptom: a (all?) register setting is optimized away for e.g.
877 "char *p1(char *p) { return p+1; }" and the value of register zero ($0)
878 is returned.
879
880 We can workaround by making this a function call - unknown if this
881 causes dire speed effects. */
882 #define REGISTER_MOVE_COST(MODE, FROM, TO) \
883 mmix_register_move_cost (MODE, FROM, TO)
884
885 #define SLOW_BYTE_ACCESS 0
886
887
888 /* Node: Sections */
889
890 /* This must be a constant string, since it's used in crtstuff.c. */
891 #define TEXT_SECTION_ASM_OP \
892 "\t.text ! mmixal:= 9H LOC 8B"
893
894 /* FIXME: Not documented. */
895 #define DATA_SECTION_ASM_OP \
896 mmix_data_section_asm_op ()
897
898 /* Stuff copied from elfos.h. */
899 #define EXTRA_SECTIONS in_const
900
901 #define EXTRA_SECTION_FUNCTIONS \
902 CONST_SECTION_FUNCTION
903
904 #define READONLY_DATA_SECTION() const_section ()
905
906 #define CONST_SECTION_ASM_OP "\t.section\t.rodata"
907
908 #define CONST_SECTION_FUNCTION \
909 void \
910 const_section () \
911 { \
912 if (in_section != in_const) \
913 { \
914 fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \
915 in_section = in_const; \
916 } \
917 }
918
919 #undef SELECT_RTX_SECTION
920 #define SELECT_RTX_SECTION(MODE, RTX, ALIGN) const_section ()
921
922 #define SELECT_SECTION(DECL, RELOC, ALIGN) \
923 mmix_select_section (DECL, RELOC, ALIGN)
924
925 #define ENCODE_SECTION_INFO(DECL) \
926 mmix_encode_section_info (DECL)
927
928 #define STRIP_NAME_ENCODING(VAR, SYM_NAME) \
929 (VAR) = mmix_strip_name_encoding (SYM_NAME)
930
931 #define UNIQUE_SECTION(DECL, RELOC) \
932 mmix_unique_section (decl, reloc)
933
934 /* Node: PIC */
935 /* (empty) */
936
937
938 /* Node: File Framework */
939
940 #define ASM_FILE_START(STREAM) \
941 mmix_asm_file_start (STREAM)
942
943 #define ASM_FILE_END(STREAM) \
944 mmix_asm_file_end (STREAM)
945
946 /* While any other punctuation character but ";" would do, we prefer "%"
947 or "!"; "!" is an unary operator and so will not be mistakenly included
948 in correctly formed expressions. The hash character adds mass; catches
949 the eye. We can't have it as a comment char by itself, since it's a
950 hex-number prefix. */
951 #define ASM_COMMENT_START "!#"
952
953 /* These aren't currently functional. We just keep them as markers. */
954 #define ASM_APP_ON "%APP\n"
955 #define ASM_APP_OFF "%NO_APP\n"
956
957 #define ASM_OUTPUT_SOURCE_FILENAME(STREAM, NAME) \
958 mmix_asm_output_source_filename (STREAM, NAME)
959
960 #define OUTPUT_QUOTED_STRING(STREAM, STRING) \
961 mmix_output_quoted_string (STREAM, STRING, strlen (STRING))
962
963 #define ASM_OUTPUT_SOURCE_LINE(STREAM, LINE) \
964 mmix_asm_output_source_line (STREAM, LINE)
965
966 #define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
967
968
969 /* Node: Data Output */
970
971 #define ASM_OUTPUT_ASCII(STREAM, PTR, LEN) \
972 mmix_asm_output_ascii (STREAM, PTR, LEN)
973
974 /* Node: Uninitialized Data */
975
976 #define ASM_OUTPUT_ALIGNED_COMMON(ST, N, S, A) \
977 mmix_asm_output_aligned_common (ST, N, S, A)
978
979 #define ASM_OUTPUT_ALIGNED_LOCAL(ST, N, S, A) \
980 mmix_asm_output_aligned_local (ST, N, S, A)
981
982
983 /* Node: Label Output */
984
985 #define ASM_OUTPUT_LABEL(STREAM, NAME) \
986 mmix_asm_output_label (STREAM, NAME)
987
988 #define ASM_DECLARE_REGISTER_GLOBAL(STREAM, DECL, REGNO, NAME) \
989 mmix_asm_declare_register_global (STREAM, DECL, REGNO, NAME)
990
991 #define ASM_GLOBALIZE_LABEL(STREAM, NAME) \
992 mmix_asm_globalize_label (STREAM, NAME)
993
994 #define ASM_WEAKEN_LABEL(STREAM, NAME) \
995 mmix_asm_weaken_label (STREAM, NAME)
996
997 #define MAKE_DECL_ONE_ONLY(DECL) \
998 mmix_make_decl_one_only (DECL)
999
1000 #define ASM_OUTPUT_LABELREF(STREAM, NAME) \
1001 mmix_asm_output_labelref (STREAM, NAME)
1002
1003 #define ASM_OUTPUT_INTERNAL_LABEL(STREAM, PREFIX, NUM) \
1004 mmix_asm_output_internal_label (STREAM, PREFIX, NUM)
1005
1006 /* We insert a ":" to disambiguate against user symbols like L5. */
1007 #define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
1008 sprintf (LABEL, "*%s:%ld", PREFIX, (long)(NUM))
1009
1010 /* Insert "::"; these are rarer than internal labels. FIXME: Make sure no
1011 ":" is seen in the object file; we don't really want that mmixal
1012 feature visible there. We don't want the default, which uses a dot;
1013 that'd be incompatible with mmixal. */
1014 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
1015 ((OUTPUT) = (char *) alloca (strlen ((NAME)) + 2 + 10), \
1016 sprintf ((OUTPUT), "%s::%d", (NAME), (LABELNO)))
1017
1018 #define ASM_OUTPUT_DEF(STREAM, NAME, VALUE) \
1019 mmix_asm_output_def (STREAM, NAME, VALUE)
1020
1021 #define ASM_OUTPUT_DEFINE_LABEL_DIFFERENCE_SYMBOL(STREAM, SY, HI, LO) \
1022 mmix_asm_output_define_label_difference_symbol (STREAM, SY, HI, LO)
1023
1024
1025 /* Node: Macros for Initialization */
1026 /* We're compiling to ELF and linking to MMO; all ELF features that GCC
1027 care for are there. FIXME: Are they? */
1028
1029 /* These must be constant strings, since they're used in crtstuff.c. */
1030 #define INIT_SECTION_ASM_OP "\t.section .init,\"ax\" ! mmixal-incompatible"
1031
1032 #define FINI_SECTION_ASM_OP "\t.section .fini,\"ax\" ! mmixal-incompatible"
1033
1034 #define OBJECT_FORMAT_ELF
1035
1036
1037 /* Node: Instruction Output */
1038
1039 /* The non-$ register names must be prefixed with ":", since they're
1040 affected by PREFIX. We provide the non-colon names as additional
1041 names. */
1042 #define REGISTER_NAMES \
1043 {"$0", "$1", "$2", "$3", "$4", "$5", "$6", "$7", \
1044 "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", \
1045 "$16", "$17", "$18", "$19", "$20", "$21", "$22", "$23", \
1046 "$24", "$25", "$26", "$27", "$28", "$29", "$30", "$31", \
1047 "$32", "$33", "$34", "$35", "$36", "$37", "$38", "$39", \
1048 "$40", "$41", "$42", "$43", "$44", "$45", "$46", "$47", \
1049 "$48", "$49", "$50", "$51", "$52", "$53", "$54", "$55", \
1050 "$56", "$57", "$58", "$59", "$60", "$61", "$62", "$63", \
1051 "$64", "$65", "$66", "$67", "$68", "$69", "$70", "$71", \
1052 "$72", "$73", "$74", "$75", "$76", "$77", "$78", "$79", \
1053 "$80", "$81", "$82", "$83", "$84", "$85", "$86", "$87", \
1054 "$88", "$89", "$90", "$91", "$92", "$93", "$94", "$95", \
1055 "$96", "$97", "$98", "$99", "$100", "$101", "$102", "$103", \
1056 "$104", "$105", "$106", "$107", "$108", "$109", "$110", "$111", \
1057 "$112", "$113", "$114", "$115", "$116", "$117", "$118", "$119", \
1058 "$120", "$121", "$122", "$123", "$124", "$125", "$126", "$127", \
1059 "$128", "$129", "$130", "$131", "$132", "$133", "$134", "$135", \
1060 "$136", "$137", "$138", "$139", "$140", "$141", "$142", "$143", \
1061 "$144", "$145", "$146", "$147", "$148", "$149", "$150", "$151", \
1062 "$152", "$153", "$154", "$155", "$156", "$157", "$158", "$159", \
1063 "$160", "$161", "$162", "$163", "$164", "$165", "$166", "$167", \
1064 "$168", "$169", "$170", "$171", "$172", "$173", "$174", "$175", \
1065 "$176", "$177", "$178", "$179", "$180", "$181", "$182", "$183", \
1066 "$184", "$185", "$186", "$187", "$188", "$189", "$190", "$191", \
1067 "$192", "$193", "$194", "$195", "$196", "$197", "$198", "$199", \
1068 "$200", "$201", "$202", "$203", "$204", "$205", "$206", "$207", \
1069 "$208", "$209", "$210", "$211", "$212", "$213", "$214", "$215", \
1070 "$216", "$217", "$218", "$219", "$220", "$221", "$222", "$223", \
1071 "$224", "$225", "$226", "$227", "$228", "$229", "$230", "$231", \
1072 "$232", "$233", "$234", "$235", "$236", "$237", "$238", "$239", \
1073 "$240", "$241", "$242", "$243", "$244", "$245", "$246", "$247", \
1074 "$248", "$249", "$250", "$251", "$252", "$253", "$254", "$255", \
1075 ":rD", ":rE", ":rH", ":rJ", ":rR", "ap_!BAD!"}
1076
1077 #define ADDITIONAL_REGISTER_NAMES \
1078 {{"sp", 254}, {":sp", 254}, {"rD", 256}, {"rE", 257}, \
1079 {"rH", 258}, {"rJ", MMIX_rJ_REGNUM}}
1080
1081 #define PRINT_OPERAND(STREAM, X, CODE) \
1082 mmix_print_operand (STREAM, X, CODE)
1083
1084 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
1085 mmix_print_operand_punct_valid_p (CODE)
1086
1087 #define PRINT_OPERAND_ADDRESS(STREAM, X) \
1088 mmix_print_operand_address (STREAM, X)
1089
1090 #if 0
1091 #define USER_LABEL_PREFIX "_"
1092 #endif
1093
1094 #define ASM_OUTPUT_REG_PUSH(STREAM, REGNO) \
1095 mmix_asm_output_reg_push (STREAM, REGNO)
1096
1097 #define ASM_OUTPUT_REG_POP(STREAM, REGNO) \
1098 mmix_asm_output_reg_pop (STREAM, REGNO)
1099
1100
1101 /* Node: Dispatch Tables */
1102
1103 /* We define both types, since SImode is the better, but DImode the only
1104 possible for mmixal so that's the one actually used. */
1105 #define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM, BODY, VALUE, REL) \
1106 mmix_asm_output_addr_diff_elt (STREAM, BODY, VALUE, REL)
1107
1108 #define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \
1109 mmix_asm_output_addr_vec_elt (STREAM, VALUE)
1110
1111
1112 /* Node: Exception Region Output */
1113 /* (empty) */
1114
1115 /* Node: Alignment Output */
1116
1117 #define ASM_OUTPUT_SKIP(STREAM, NBYTES) \
1118 mmix_asm_output_skip (STREAM, NBYTES)
1119
1120 #define ASM_OUTPUT_ALIGN(STREAM, POWER) \
1121 mmix_asm_output_align (STREAM, POWER)
1122
1123
1124 /* Node: All Debuggers */
1125
1126 #define DBX_REGISTER_NUMBER(REGNO) \
1127 mmix_dbx_register_number (REGNO)
1128
1129
1130 /* Node: DBX Options */
1131 /* (empty) */
1132 /* Node: DBX Hooks */
1133 /* (empty) */
1134 /* Node: File Names and DBX */
1135 /* (empty) */
1136
1137
1138 /* Node: SDB and DWARF */
1139 #define DWARF2_DEBUGGING_INFO
1140 #define DWARF2_ASM_LINE_DEBUG_INFO 1
1141
1142 /* Node: Cross-compilation */
1143
1144 /* FIXME: I don't know whether it is best to tweak emit-rtl.c to handle
1145 the case where sizeof (float) == word_size / 2 on the target, or to fix
1146 real.h to define REAL_ARITHMETIC in that case. Anyway, it should be
1147 documented that a target can define this to force emulation. Note that
1148 we don't check #ifdef CROSS_COMPILE here; not even if mmix gets
1149 self-hosted must we do that. Case gcc.c-torture/compile/930611-1.c. */
1150 #define REAL_ARITHMETIC
1151
1152
1153 /* Node: Misc */
1154
1155 #define PREDICATE_CODES \
1156 {"mmix_reg_cc_operand", {SUBREG, REG}}, \
1157 {"mmix_foldable_comparison_operator", \
1158 {NE, EQ, GE, GT, LE, LT}}, \
1159 /* All '<', actually. */ \
1160 {"mmix_comparison_operator", \
1161 {NE, EQ, GE, GT, LE, LT, GEU, GTU, LEU, \
1162 LTU, UNORDERED, ORDERED, UNEQ, UNGE, UNLE, \
1163 UNLT, LTGT}}, \
1164 {"mmix_symbolic_or_address_operand", \
1165 {SYMBOL_REF, LABEL_REF, CONST, \
1166 SUBREG, REG, PLUS}}, \
1167 {"mmix_reg_or_constant_operand", \
1168 {CONST_INT, CONST_DOUBLE, SUBREG, REG}}, \
1169 {"mmix_reg_or_8bit_or_256_operand", \
1170 {CONST_INT, CONST_DOUBLE, SUBREG, REG}}, \
1171 {"mmix_reg_or_8bit_operand", \
1172 {CONST_INT, CONST_DOUBLE, SUBREG, REG}}, \
1173 {"mmix_reg_or_0_operand", \
1174 {CONST_INT, CONST_DOUBLE, SUBREG, REG}},
1175
1176 #define SPECIAL_MODE_PREDICATES "mmix_symbolic_or_address_operand",
1177
1178 /* There's no way to get a PC-relative offset into tables for SImode, so
1179 for the moment we have absolute entries in DImode.
1180 When we're going ELF, these should be SImode and 1. */
1181 #define CASE_VECTOR_MODE DImode
1182 #define CASE_VECTOR_PC_RELATIVE 0
1183
1184 #define WORD_REGISTER_OPERATIONS
1185
1186 /* We have a choice, which makes this yet another parameter to tweak. The
1187 gut feeling is currently that SIGN_EXTEND wins; "int" is more frequent
1188 than "unsigned int", and we have signed characters. FIXME: measure. */
1189 #define LOAD_EXTEND_OP(MODE) (TARGET_ZERO_EXTEND ? ZERO_EXTEND : SIGN_EXTEND)
1190
1191 #define MOVE_MAX 8
1192
1193 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
1194
1195 /* We have a choice here too. */
1196 #if 0
1197 /* FIXME: Revisit, we don't have scc expanders yet. */
1198 #define STORE_FLAG_VALUE 1
1199 #endif
1200
1201 #define Pmode DImode
1202
1203 #define FUNCTION_MODE QImode
1204
1205 /* When in due time we *will* have some specific headers. */
1206 #define NO_IMPLICIT_EXTERN_C
1207
1208 #define HANDLE_SYSV_PRAGMA
1209
1210 /* These are checked. */
1211 #define DOLLARS_IN_IDENTIFIERS 0
1212 #define NO_DOLLAR_IN_LABEL
1213 #define NO_DOT_IN_LABEL
1214
1215 #endif /* GCC_MMIX_H */
1216 /*
1217 * Local variables:
1218 * eval: (c-set-style "gnu")
1219 * indent-tabs-mode: t
1220 * End:
1221 */