OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [config/] [mmix/] [mmix.h] - Blame information for rev 709

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.