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