OSDN Git Service

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