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