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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [config/] [m68k/] [m68k.h] - Blame information for rev 825

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
/* Definitions of target machine for GCC for Motorola 680x0/ColdFire.
2
   Copyright (C) 1987, 1988, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
3
   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
4
 
5
This file is part of GCC.
6
 
7
GCC 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 3, or (at your option)
10
any later version.
11
 
12
GCC 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 GCC; see the file COPYING3.  If not see
19
<http://www.gnu.org/licenses/>.  */
20
 
21
/* We need to have MOTOROLA always defined (either 0 or 1) because we use
22
   if-statements and ?: on it.  This way we have compile-time error checking
23
   for both the MOTOROLA and MIT code paths.  We do rely on the host compiler
24
   to optimize away all constant tests.  */
25
#ifdef MOTOROLA
26
# undef MOTOROLA
27
# define MOTOROLA 1  /* Use the Motorola assembly syntax.  */
28
# define TARGET_VERSION fprintf (stderr, " (68k, Motorola syntax)")
29
#else
30
# define TARGET_VERSION fprintf (stderr, " (68k, MIT syntax)")
31
# define MOTOROLA 0  /* Use the MIT assembly syntax.  */
32
#endif
33
 
34
/* Note that some other tm.h files include this one and then override
35
   many of the definitions that relate to assembler syntax.  */
36
 
37
#define TARGET_CPU_CPP_BUILTINS()               \
38
  do                                            \
39
    {                                           \
40
      builtin_define ("__m68k__");              \
41
      builtin_define_std ("mc68000");           \
42
      if (TARGET_68040_ONLY)                    \
43
        {                                       \
44
          if (TARGET_68060)                     \
45
            builtin_define_std ("mc68060");     \
46
          else                                  \
47
            builtin_define_std ("mc68040");     \
48
        }                                       \
49
      else if (TARGET_68060) /* -m68020-60 */   \
50
        {                                       \
51
          builtin_define_std ("mc68060");       \
52
          builtin_define_std ("mc68040");       \
53
          builtin_define_std ("mc68030");       \
54
          builtin_define_std ("mc68020");       \
55
        }                                       \
56
      else if (TARGET_68040) /* -m68020-40 */   \
57
        {                                       \
58
          builtin_define_std ("mc68040");       \
59
          builtin_define_std ("mc68030");       \
60
          builtin_define_std ("mc68020");       \
61
        }                                       \
62
      else if (TARGET_68030)                    \
63
        builtin_define_std ("mc68030");         \
64
      else if (TARGET_68020)                    \
65
        builtin_define_std ("mc68020");         \
66
      if (TARGET_68881)                         \
67
        builtin_define ("__HAVE_68881__");      \
68
      if (TARGET_CPU32)                         \
69
        {                                       \
70
          builtin_define_std ("mc68332");       \
71
          builtin_define_std ("mcpu32");        \
72
        }                                       \
73
      if (TARGET_COLDFIRE)                      \
74
        builtin_define ("__mcoldfire__");       \
75
      if (TARGET_5200)                          \
76
        builtin_define ("__mcf5200__");         \
77
      if (TARGET_528x)                          \
78
        {                                       \
79
          builtin_define ("__mcf528x__");       \
80
          builtin_define ("__mcf5200__");       \
81
        }                                       \
82
      if (TARGET_CFV3)                          \
83
        {                                       \
84
          builtin_define ("__mcf5300__");       \
85
          builtin_define ("__mcf5307__");       \
86
        }                                       \
87
      if (TARGET_CFV4)                          \
88
        {                                       \
89
          builtin_define ("__mcf5400__");       \
90
          builtin_define ("__mcf5407__");       \
91
        }                                       \
92
      if (TARGET_CFV4E)                         \
93
        {                                       \
94
          builtin_define ("__mcfv4e__");        \
95
        }                                       \
96
      if (TARGET_CF_HWDIV)                      \
97
        builtin_define ("__mcfhwdiv__");        \
98
      builtin_assert ("cpu=m68k");              \
99
      builtin_assert ("machine=m68k");          \
100
    }                                           \
101
  while (0)
102
 
103
/* Classify the groups of pseudo-ops used to assemble QI, HI and SI
104
   quantities.  */
105
#define INT_OP_STANDARD 0        /* .byte, .short, .long */
106
#define INT_OP_DOT_WORD 1       /* .byte, .word, .long */
107
#define INT_OP_NO_DOT   2       /* byte, short, long */
108
#define INT_OP_DC       3       /* dc.b, dc.w, dc.l */
109
 
110
/* Set the default.  */
111
#define INT_OP_GROUP INT_OP_DOT_WORD
112
 
113
/* Compile for a CPU32.  A 68020 without bitfields is a good
114
   heuristic for a CPU32.  */
115
#define TARGET_CPU32    (TARGET_68020 && !TARGET_BITFIELD)
116
 
117
/* Is the target a ColdFire?  */
118
#define MASK_COLDFIRE \
119
  (MASK_5200 | MASK_528x | MASK_CFV3 | MASK_CFV4 | MASK_CFV4E)
120
#define TARGET_COLDFIRE ((target_flags & MASK_COLDFIRE) != 0)
121
 
122
#define TARGET_COLDFIRE_FPU     TARGET_CFV4E
123
 
124
#define TARGET_HARD_FLOAT       (TARGET_68881 || TARGET_COLDFIRE_FPU)
125
/* Size (in bytes) of FPU registers.  */
126
#define TARGET_FP_REG_SIZE      (TARGET_COLDFIRE ? 8 : 12)
127
 
128
 
129
#define OVERRIDE_OPTIONS   override_options()
130
 
131
/* These are meant to be redefined in the host dependent files */
132
#define SUBTARGET_OVERRIDE_OPTIONS
133
 
134
/* target machine storage layout */
135
 
136
#define LONG_DOUBLE_TYPE_SIZE 80
137
 
138
/* Set the value of FLT_EVAL_METHOD in float.h.  When using 68040 fp
139
   instructions, we get proper intermediate rounding, otherwise we
140
   get extended precision results.  */
141
#define TARGET_FLT_EVAL_METHOD ((TARGET_68040_ONLY || ! TARGET_68881) ? 0 : 2)
142
 
143
#define BITS_BIG_ENDIAN 1
144
#define BYTES_BIG_ENDIAN 1
145
#define WORDS_BIG_ENDIAN 1
146
 
147
#define UNITS_PER_WORD 4
148
 
149
#define PARM_BOUNDARY (TARGET_SHORT ? 16 : 32)
150
#define STACK_BOUNDARY 16
151
#define FUNCTION_BOUNDARY 16
152
#define EMPTY_FIELD_BOUNDARY 16
153
 
154
/* No data type wants to be aligned rounder than this.
155
   Most published ABIs say that ints should be aligned on 16 bit
156
   boundaries, but CPUs with 32-bit busses get better performance
157
   aligned on 32-bit boundaries.  ColdFires without a misalignment
158
   module require 32-bit alignment.  */
159
#define BIGGEST_ALIGNMENT (TARGET_ALIGN_INT ? 32 : 16)
160
 
161
#define STRICT_ALIGNMENT (TARGET_STRICT_ALIGNMENT)
162
 
163
#define INT_TYPE_SIZE (TARGET_SHORT ? 16 : 32)
164
 
165
/* Define these to avoid dependence on meaning of `int'.  */
166
#define WCHAR_TYPE "long int"
167
#define WCHAR_TYPE_SIZE 32
168
 
169
/* Maximum number of library IDs we permit with -mid-shared-library.  */
170
#define MAX_LIBRARY_ID 255
171
 
172
 
173
/* Standard register usage.  */
174
 
175
/* For the m68k, we give the data registers numbers 0-7,
176
   the address registers numbers 010-017 (8-15),
177
   and the 68881 floating point registers numbers 020-027 (16-24).
178
   We also have a fake `arg-pointer' register 030 (25) used for
179
   register elimination.  */
180
#define FIRST_PSEUDO_REGISTER 25
181
 
182
/* All m68k targets (except AmigaOS) use %a5 as the PIC register  */
183
#define PIC_OFFSET_TABLE_REGNUM (flag_pic ? 13 : INVALID_REGNUM)
184
 
185
/* 1 for registers that have pervasive standard uses
186
   and are not available for the register allocator.
187
   On the m68k, only the stack pointer is such.
188
   Our fake arg-pointer is obviously fixed as well.  */
189
#define FIXED_REGISTERS        \
190
 {/* Data registers.  */       \
191
  0, 0, 0, 0, 0, 0, 0, 0,      \
192
                               \
193
  /* Address registers.  */    \
194
  0, 0, 0, 0, 0, 0, 0, 1,      \
195
                               \
196
  /* Floating point registers  \
197
     (if available).  */       \
198
  0, 0, 0, 0, 0, 0, 0, 0,      \
199
                               \
200
  /* Arg pointer.  */          \
201
  1 }
202
 
203
/* 1 for registers not available across function calls.
204
   These must include the FIXED_REGISTERS and also any
205
   registers that can be used without being saved.
206
   The latter must include the registers where values are returned
207
   and the register where structure-value addresses are passed.
208
   Aside from that, you can include as many other registers as you like.  */
209
#define CALL_USED_REGISTERS     \
210
 {/* Data registers.  */        \
211
  1, 1, 0, 0, 0, 0, 0, 0,       \
212
                                \
213
  /* Address registers.  */     \
214
  1, 1, 0, 0, 0, 0, 0, 1,       \
215
                                \
216
  /* Floating point registers   \
217
     (if available).  */        \
218
  1, 1, 0, 0, 0, 0, 0, 0,       \
219
                                \
220
  /* Arg pointer.  */           \
221
  1 }
222
 
223
#define REG_ALLOC_ORDER         \
224
{ /* d0/d1/a0/a1 */             \
225
  0, 1, 8, 9,                    \
226
  /* d2-d7 */                   \
227
  2, 3, 4, 5, 6, 7,             \
228
  /* a2-a7/arg */               \
229
  10, 11, 12, 13, 14, 15, 24,   \
230
  /* fp0-fp7 */                 \
231
  16, 17, 18, 19, 20, 21, 22, 23\
232
}
233
 
234
 
235
/* Make sure everything's fine if we *don't* have a given processor.
236
   This assumes that putting a register in fixed_regs will keep the
237
   compiler's mitts completely off it.  We don't bother to zero it out
238
   of register classes.  */
239
#define CONDITIONAL_REGISTER_USAGE                              \
240
{                                                               \
241
  int i;                                                        \
242
  HARD_REG_SET x;                                               \
243
  if (!TARGET_HARD_FLOAT)                                       \
244
    {                                                           \
245
      COPY_HARD_REG_SET (x, reg_class_contents[(int)FP_REGS]);  \
246
      for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)                \
247
        if (TEST_HARD_REG_BIT (x, i))                           \
248
          fixed_regs[i] = call_used_regs[i] = 1;                \
249
    }                                                           \
250
  if (PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM)                \
251
    fixed_regs[PIC_OFFSET_TABLE_REGNUM]                         \
252
      = call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1;            \
253
}
254
 
255
/* On the m68k, ordinary registers hold 32 bits worth;
256
   for the 68881 registers, a single register is always enough for
257
   anything that can be stored in them at all.  */
258
#define HARD_REGNO_NREGS(REGNO, MODE)   \
259
  ((REGNO) >= 16 ? GET_MODE_NUNITS (MODE)       \
260
   : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
261
 
262
/* A C expression that is nonzero if hard register NEW_REG can be
263
   considered for use as a rename register for OLD_REG register.  */
264
 
265
#define HARD_REGNO_RENAME_OK(OLD_REG, NEW_REG) \
266
  m68k_hard_regno_rename_ok (OLD_REG, NEW_REG)
267
 
268
/* Value is true if hard register REGNO can hold a value of machine-mode MODE.
269
   On the 68000, the cpu registers can hold any mode except bytes in
270
   address registers, the 68881 registers can hold only SFmode or DFmode.  */
271
 
272
#define HARD_REGNO_MODE_OK(REGNO, MODE) \
273
  m68k_regno_mode_ok ((REGNO), (MODE))
274
 
275
#define MODES_TIEABLE_P(MODE1, MODE2)                   \
276
  (! TARGET_HARD_FLOAT                                  \
277
   || ((GET_MODE_CLASS (MODE1) == MODE_FLOAT            \
278
        || GET_MODE_CLASS (MODE1) == MODE_COMPLEX_FLOAT)        \
279
       == (GET_MODE_CLASS (MODE2) == MODE_FLOAT         \
280
           || GET_MODE_CLASS (MODE2) == MODE_COMPLEX_FLOAT)))
281
 
282
/* Specify the registers used for certain standard purposes.
283
   The values of these macros are register numbers.  */
284
 
285
#define STACK_POINTER_REGNUM 15
286
 
287
/* Most m68k targets use %a6 as a frame pointer.  The AmigaOS
288
   ABI uses %a6 for shared library calls, therefore the frame
289
   pointer is shifted to %a5 on this target.  */
290
#define FRAME_POINTER_REGNUM 14
291
 
292
#define FRAME_POINTER_REQUIRED 0
293
 
294
/* Base register for access to arguments of the function.
295
 * This isn't a hardware register. It will be eliminated to the
296
 * stack pointer or frame pointer.
297
 */
298
#define ARG_POINTER_REGNUM 24
299
 
300
#define STATIC_CHAIN_REGNUM 8
301
 
302
/* Register in which address to store a structure value
303
   is passed to a function.  */
304
#define M68K_STRUCT_VALUE_REGNUM 9
305
 
306
 
307
 
308
/* The m68k has three kinds of registers, so eight classes would be
309
   a complete set.  One of them is not needed.  */
310
enum reg_class {
311
  NO_REGS, DATA_REGS,
312
  ADDR_REGS, FP_REGS,
313
  GENERAL_REGS, DATA_OR_FP_REGS,
314
  ADDR_OR_FP_REGS, ALL_REGS,
315
  LIM_REG_CLASSES };
316
 
317
#define N_REG_CLASSES (int) LIM_REG_CLASSES
318
 
319
#define REG_CLASS_NAMES \
320
 { "NO_REGS", "DATA_REGS",              \
321
   "ADDR_REGS", "FP_REGS",              \
322
   "GENERAL_REGS", "DATA_OR_FP_REGS",   \
323
   "ADDR_OR_FP_REGS", "ALL_REGS" }
324
 
325
#define REG_CLASS_CONTENTS \
326
{                                       \
327
  {0x00000000},  /* NO_REGS */          \
328
  {0x000000ff},  /* DATA_REGS */        \
329
  {0x0100ff00},  /* ADDR_REGS */        \
330
  {0x00ff0000},  /* FP_REGS */          \
331
  {0x0100ffff},  /* GENERAL_REGS */     \
332
  {0x00ff00ff},  /* DATA_OR_FP_REGS */  \
333
  {0x01ffff00},  /* ADDR_OR_FP_REGS */  \
334
  {0x01ffffff},  /* ALL_REGS */         \
335
}
336
 
337
extern enum reg_class regno_reg_class[];
338
#define REGNO_REG_CLASS(REGNO) (regno_reg_class[(REGNO)])
339
#define INDEX_REG_CLASS GENERAL_REGS
340
#define BASE_REG_CLASS ADDR_REGS
341
 
342
/* We do a trick here to modify the effective constraints on the
343
   machine description; we zorch the constraint letters that aren't
344
   appropriate for a specific target.  This allows us to guarantee
345
   that a specific kind of register will not be used for a given target
346
   without fiddling with the register classes above.  */
347
#define REG_CLASS_FROM_LETTER(C) \
348
  ((C) == 'a' ? ADDR_REGS :                     \
349
   ((C) == 'd' ? DATA_REGS :                    \
350
    ((C) == 'f' ? (TARGET_HARD_FLOAT ?          \
351
                   FP_REGS : NO_REGS) :         \
352
     NO_REGS)))
353
 
354
/* For the m68k, `I' is used for the range 1 to 8
355
   allowed as immediate shift counts and in addq.
356
   `J' is used for the range of signed numbers that fit in 16 bits.
357
   `K' is for numbers that moveq can't handle.
358
   `L' is for range -8 to -1, range of values that can be added with subq.
359
   `M' is for numbers that moveq+notb can't handle.
360
   'N' is for range 24 to 31, rotatert:SI 8 to 1 expressed as rotate.
361
   'O' is for 16 (for rotate using swap).
362
   'P' is for range 8 to 15, rotatert:HI 8 to 1 expressed as rotate.  */
363
#define CONST_OK_FOR_LETTER_P(VALUE, C) \
364
  ((C) == 'I' ? (VALUE) > 0 && (VALUE) <= 8 : \
365
   (C) == 'J' ? (VALUE) >= -0x8000 && (VALUE) <= 0x7FFF : \
366
   (C) == 'K' ? (VALUE) < -0x80 || (VALUE) >= 0x80 : \
367
   (C) == 'L' ? (VALUE) < 0 && (VALUE) >= -8 : \
368
   (C) == 'M' ? (VALUE) < -0x100 || (VALUE) >= 0x100 : \
369
   (C) == 'N' ? (VALUE) >= 24 && (VALUE) <= 31 : \
370
   (C) == 'O' ? (VALUE) == 16 : \
371
   (C) == 'P' ? (VALUE) >= 8 && (VALUE) <= 15 : 0)
372
 
373
/* "G" defines all of the floating constants that are *NOT* 68881
374
   constants.  This is so 68881 constants get reloaded and the
375
   fpmovecr is used.  */
376
#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C)  \
377
  ((C) == 'G' ? ! (TARGET_68881 && standard_68881_constant_p (VALUE)) : 0 )
378
 
379
/* `Q' means address register indirect addressing mode.
380
   `S' is for operands that satisfy 'm' when -mpcrel is in effect.
381
   `T' is for operands that satisfy 's' when -mpcrel is not in effect.
382
   `U' is for register offset addressing.  */
383
#define EXTRA_CONSTRAINT(OP,CODE)                       \
384
  (((CODE) == 'S')                                      \
385
   ? (TARGET_PCREL                                      \
386
      && GET_CODE (OP) == MEM                           \
387
      && (GET_CODE (XEXP (OP, 0)) == SYMBOL_REF          \
388
          || GET_CODE (XEXP (OP, 0)) == LABEL_REF        \
389
          || GET_CODE (XEXP (OP, 0)) == CONST))          \
390
   :                                                    \
391
  (((CODE) == 'T')                                      \
392
   ? ( !TARGET_PCREL                                    \
393
      && (GET_CODE (OP) == SYMBOL_REF                   \
394
          || GET_CODE (OP) == LABEL_REF                 \
395
          || GET_CODE (OP) == CONST))                   \
396
   :                                                    \
397
  (((CODE) == 'Q')                                      \
398
   ? (GET_CODE (OP) == MEM                              \
399
      && GET_CODE (XEXP (OP, 0)) == REG)         \
400
   :                                                    \
401
  (((CODE) == 'U')                                      \
402
   ? (GET_CODE (OP) == MEM                              \
403
      && GET_CODE (XEXP (OP, 0)) == PLUS         \
404
      && GET_CODE (XEXP (XEXP (OP, 0), 0)) == REG \
405
      && GET_CODE (XEXP (XEXP (OP, 0), 1)) == CONST_INT) \
406
   :                                                    \
407
   0))))
408
 
409
/* On the m68k, use a data reg if possible when the
410
   value is a constant in the range where moveq could be used
411
   and we ensure that QImodes are reloaded into data regs.  */
412
#define PREFERRED_RELOAD_CLASS(X,CLASS)  \
413
  ((GET_CODE (X) == CONST_INT                   \
414
    && (unsigned) (INTVAL (X) + 0x80) < 0x100   \
415
    && (CLASS) != ADDR_REGS)                    \
416
   ? DATA_REGS                                  \
417
   : (GET_MODE (X) == QImode && (CLASS) != ADDR_REGS) \
418
   ? DATA_REGS                                  \
419
   : (GET_CODE (X) == CONST_DOUBLE                                      \
420
      && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT)                   \
421
   ? (TARGET_HARD_FLOAT && (CLASS == FP_REGS || CLASS == DATA_OR_FP_REGS) \
422
      ? FP_REGS : NO_REGS)                                              \
423
   : (TARGET_PCREL                              \
424
      && (GET_CODE (X) == SYMBOL_REF || GET_CODE (X) == CONST \
425
          || GET_CODE (X) == LABEL_REF))        \
426
   ? ADDR_REGS                                  \
427
   : (CLASS))
428
 
429
/* Force QImode output reloads from subregs to be allocated to data regs,
430
   since QImode stores from address regs are not supported.  We make the
431
   assumption that if the class is not ADDR_REGS, then it must be a superset
432
   of DATA_REGS.  */
433
#define LIMIT_RELOAD_CLASS(MODE, CLASS) \
434
  (((MODE) == QImode && (CLASS) != ADDR_REGS)   \
435
   ? DATA_REGS                                  \
436
   : (CLASS))
437
 
438
/* On the m68k, this is the size of MODE in words,
439
   except in the FP regs, where a single reg is always enough.  */
440
#define CLASS_MAX_NREGS(CLASS, MODE)    \
441
 ((CLASS) == FP_REGS ? 1 \
442
  : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
443
 
444
/* Moves between fp regs and other regs are two insns.  */
445
#define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2)        \
446
  (((CLASS1) == FP_REGS && (CLASS2) != FP_REGS)         \
447
    || ((CLASS2) == FP_REGS && (CLASS1) != FP_REGS)     \
448
    ? 4 : 2)
449
 
450
/* Stack layout; function entry, exit and calling.  */
451
 
452
#define STACK_GROWS_DOWNWARD
453
#define FRAME_GROWS_DOWNWARD 1
454
#define STARTING_FRAME_OFFSET 0
455
 
456
/* On the 680x0, sp@- in a byte insn really pushes a word.
457
   On the ColdFire, sp@- in a byte insn pushes just a byte.  */
458
#define PUSH_ROUNDING(BYTES) (TARGET_COLDFIRE ? BYTES : ((BYTES) + 1) & ~1)
459
 
460
#define FIRST_PARM_OFFSET(FNDECL) 8
461
 
462
/* On the 68000, the RTS insn cannot pop anything.
463
   On the 68010, the RTD insn may be used to pop them if the number
464
     of args is fixed, but if the number is variable then the caller
465
     must pop them all.  RTD can't be used for library calls now
466
     because the library is compiled with the Unix compiler.
467
   Use of RTD is a selectable option, since it is incompatible with
468
   standard Unix calling sequences.  If the option is not selected,
469
   the caller must always pop the args.  */
470
#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE)   \
471
  ((TARGET_RTD && (!(FUNDECL) || TREE_CODE (FUNDECL) != IDENTIFIER_NODE)        \
472
    && (TYPE_ARG_TYPES (FUNTYPE) == 0                            \
473
        || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE)))   \
474
            == void_type_node)))                                \
475
   ? (SIZE) : 0)
476
 
477
/* On the m68k the return value is always in D0.  */
478
#define FUNCTION_VALUE(VALTYPE, FUNC)  \
479
  gen_rtx_REG (TYPE_MODE (VALTYPE), 0)
480
 
481
/* On the m68k the return value is always in D0.  */
482
#define LIBCALL_VALUE(MODE)  gen_rtx_REG (MODE, 0)
483
 
484
/* On the m68k, D0 is the only register used.  */
485
#define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
486
 
487
/* Define this to be true when FUNCTION_VALUE_REGNO_P is true for
488
   more than one register.
489
   XXX This macro is m68k specific and used only for m68kemb.h.  */
490
#define NEEDS_UNTYPED_CALL 0
491
 
492
#define PCC_STATIC_STRUCT_RETURN
493
 
494
/* On the m68k, all arguments are usually pushed on the stack.  */
495
#define FUNCTION_ARG_REGNO_P(N) 0
496
 
497
/* On the m68k, this is a single integer, which is a number of bytes
498
   of arguments scanned so far.  */
499
#define CUMULATIVE_ARGS int
500
 
501
/* On the m68k, the offset starts at 0.  */
502
#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \
503
 ((CUM) = 0)
504
 
505
#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED)    \
506
 ((CUM) += ((MODE) != BLKmode                   \
507
            ? (GET_MODE_SIZE (MODE) + 3) & ~3   \
508
            : (int_size_in_bytes (TYPE) + 3) & ~3))
509
 
510
/* On the m68k all args are always pushed.  */
511
#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) 0
512
 
513
#define FUNCTION_PROFILER(FILE, LABELNO)  \
514
  asm_fprintf (FILE, "\tlea %LLP%d,%Ra0\n\tjsr mcount\n", (LABELNO))
515
 
516
#define EXIT_IGNORE_STACK 1
517
 
518
/* Determine if the epilogue should be output as RTL.
519
   You should override this if you define FUNCTION_EXTRA_EPILOGUE.
520
 
521
   XXX This macro is m68k-specific and only used in m68k.md.  */
522
#define USE_RETURN_INSN use_return_insn ()
523
 
524
/* Output assembler code for a block containing the constant parts
525
   of a trampoline, leaving space for the variable parts.
526
 
527
   On the m68k, the trampoline looks like this:
528
     movl #STATIC,a0
529
     jmp  FUNCTION
530
 
531
   WARNING: Targets that may run on 68040+ cpus must arrange for
532
   the instruction cache to be flushed.  Previous incarnations of
533
   the m68k trampoline code attempted to get around this by either
534
   using an out-of-line transfer function or pc-relative data, but
535
   the fact remains that the code to jump to the transfer function
536
   or the code to load the pc-relative data needs to be flushed
537
   just as much as the "variable" portion of the trampoline.
538
   Recognizing that a cache flush is going to be required anyway,
539
   dispense with such notions and build a smaller trampoline.
540
 
541
   Since more instructions are required to move a template into
542
   place than to create it on the spot, don't use a template.  */
543
 
544
#define TRAMPOLINE_SIZE 12
545
#define TRAMPOLINE_ALIGNMENT 16
546
 
547
/* Targets redefine this to invoke code to either flush the cache,
548
   or enable stack execution (or both).  */
549
#ifndef FINALIZE_TRAMPOLINE
550
#define FINALIZE_TRAMPOLINE(TRAMP)
551
#endif
552
 
553
/* We generate a two-instructions program at address TRAMP :
554
        movea.l &CXT,%a0
555
        jmp FNADDR  */
556
#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT)                       \
557
{                                                                       \
558
  emit_move_insn (gen_rtx_MEM (HImode, TRAMP), GEN_INT(0x207C));        \
559
  emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 2)), CXT); \
560
  emit_move_insn (gen_rtx_MEM (HImode, plus_constant (TRAMP, 6)),       \
561
                  GEN_INT(0x4EF9));                                     \
562
  emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 8)), FNADDR); \
563
  FINALIZE_TRAMPOLINE(TRAMP);                                           \
564
}
565
 
566
/* This is the library routine that is used to transfer control from the
567
   trampoline to the actual nested function.  It is defined for backward
568
   compatibility, for linking with object code that used the old trampoline
569
   definition.
570
 
571
   A colon is used with no explicit operands to cause the template string
572
   to be scanned for %-constructs.
573
 
574
   The function name __transfer_from_trampoline is not actually used.
575
   The function definition just permits use of "asm with operands"
576
   (though the operand list is empty).  */
577
#define TRANSFER_FROM_TRAMPOLINE                                \
578
void                                                            \
579
__transfer_from_trampoline ()                                   \
580
{                                                               \
581
  register char *a0 asm ("%a0");                                \
582
  asm (GLOBAL_ASM_OP "___trampoline");                          \
583
  asm ("___trampoline:");                                       \
584
  asm volatile ("move%.l %0,%@" : : "m" (a0[22]));              \
585
  asm volatile ("move%.l %1,%0" : "=a" (a0) : "m" (a0[18]));    \
586
  asm ("rts":);                                                 \
587
}
588
 
589
/* There are two registers that can always be eliminated on the m68k.
590
   The frame pointer and the arg pointer can be replaced by either the
591
   hard frame pointer or to the stack pointer, depending upon the
592
   circumstances.  The hard frame pointer is not used before reload and
593
   so it is not eligible for elimination.  */
594
#define ELIMINABLE_REGS                                 \
595
{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM },          \
596
 { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM },          \
597
 { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM }}
598
 
599
#define CAN_ELIMINATE(FROM, TO) \
600
  ((TO) == STACK_POINTER_REGNUM ? ! frame_pointer_needed : 1)
601
 
602
#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET)                    \
603
  (OFFSET) = m68k_initial_elimination_offset(FROM, TO)
604
 
605
/* Addressing modes, and classification of registers for them.  */
606
 
607
#define HAVE_POST_INCREMENT 1
608
#define HAVE_PRE_DECREMENT 1
609
 
610
/* Macros to check register numbers against specific register classes.  */
611
 
612
#define REGNO_OK_FOR_INDEX_P(REGNO) \
613
((REGNO) < 16 || (unsigned) reg_renumber[REGNO] < 16)
614
#define REGNO_OK_FOR_BASE_P(REGNO) \
615
(((REGNO) ^ 010) < 8 || (unsigned) (reg_renumber[REGNO] ^ 010) < 8)
616
#define REGNO_OK_FOR_DATA_P(REGNO) \
617
((REGNO) < 8 || (unsigned) reg_renumber[REGNO] < 8)
618
#define REGNO_OK_FOR_FP_P(REGNO) \
619
(((REGNO) ^ 020) < 8 || (unsigned) (reg_renumber[REGNO] ^ 020) < 8)
620
 
621
/* Now macros that check whether X is a register and also,
622
   strictly, whether it is in a specified class.
623
 
624
   These macros are specific to the m68k, and may be used only
625
   in code for printing assembler insns and in conditions for
626
   define_optimization.  */
627
 
628
/* 1 if X is a data register.  */
629
#define DATA_REG_P(X) (REG_P (X) && REGNO_OK_FOR_DATA_P (REGNO (X)))
630
 
631
/* 1 if X is an fp register.  */
632
#define FP_REG_P(X) (REG_P (X) && REGNO_OK_FOR_FP_P (REGNO (X)))
633
 
634
/* 1 if X is an address register  */
635
#define ADDRESS_REG_P(X) (REG_P (X) && REGNO_OK_FOR_BASE_P (REGNO (X)))
636
 
637
 
638
#define MAX_REGS_PER_ADDRESS 2
639
 
640
#define CONSTANT_ADDRESS_P(X)   \
641
  (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF              \
642
   || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST                \
643
   || GET_CODE (X) == HIGH)
644
 
645
/* Nonzero if the constant value X is a legitimate general operand.
646
   It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE.  */
647
#define LEGITIMATE_CONSTANT_P(X) (GET_MODE (X) != XFmode)
648
 
649
#ifndef REG_OK_STRICT
650
#define PCREL_GENERAL_OPERAND_OK 0
651
#else
652
#define PCREL_GENERAL_OPERAND_OK (TARGET_PCREL)
653
#endif
654
 
655
#define LEGITIMATE_PIC_OPERAND_P(X)     \
656
  (! symbolic_operand (X, VOIDmode)                             \
657
   || (GET_CODE (X) == SYMBOL_REF && SYMBOL_REF_FLAG (X))       \
658
   || PCREL_GENERAL_OPERAND_OK)
659
 
660
#ifndef REG_OK_STRICT
661
 
662
/* Nonzero if X is a hard reg that can be used as an index
663
   or if it is a pseudo reg.  */
664
#define REG_OK_FOR_INDEX_P(X) ((REGNO (X) ^ 020) >= 8)
665
/* Nonzero if X is a hard reg that can be used as a base reg
666
   or if it is a pseudo reg.  */
667
#define REG_OK_FOR_BASE_P(X) ((REGNO (X) & ~027) != 0)
668
 
669
#else
670
 
671
/* Nonzero if X is a hard reg that can be used as an index.  */
672
#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
673
/* Nonzero if X is a hard reg that can be used as a base reg.  */
674
#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
675
 
676
#endif
677
 
678
/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
679
   that is a valid memory address for an instruction.
680
   The MODE argument is the machine mode for the MEM expression
681
   that wants to use this address.
682
 
683
   When generating PIC, an address involving a SYMBOL_REF is legitimate
684
   if and only if it is the sum of pic_offset_table_rtx and the SYMBOL_REF.
685
   We use LEGITIMATE_PIC_OPERAND_P to throw out the illegitimate addresses,
686
   and we explicitly check for the sum of pic_offset_table_rtx and a SYMBOL_REF.
687
 
688
   Likewise for a LABEL_REF when generating PIC.
689
 
690
   The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS.  */
691
 
692
/* Allow SUBREG everywhere we allow REG.  This results in better code.  It
693
   also makes function inlining work when inline functions are called with
694
   arguments that are SUBREGs.  */
695
 
696
#define LEGITIMATE_BASE_REG_P(X)   \
697
  ((GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X))       \
698
   || (GET_CODE (X) == SUBREG                           \
699
       && GET_CODE (SUBREG_REG (X)) == REG              \
700
       && REG_OK_FOR_BASE_P (SUBREG_REG (X))))
701
 
702
#define INDIRECTABLE_1_ADDRESS_P(X)  \
703
  ((CONSTANT_ADDRESS_P (X) && (!flag_pic || LEGITIMATE_PIC_OPERAND_P (X))) \
704
   || LEGITIMATE_BASE_REG_P (X)                                         \
705
   || ((GET_CODE (X) == PRE_DEC || GET_CODE (X) == POST_INC)            \
706
       && LEGITIMATE_BASE_REG_P (XEXP (X, 0)))                           \
707
   || (GET_CODE (X) == PLUS                                             \
708
       && LEGITIMATE_BASE_REG_P (XEXP (X, 0))                            \
709
       && GET_CODE (XEXP (X, 1)) == CONST_INT                           \
710
       && (TARGET_68020                                                 \
711
           || ((unsigned) INTVAL (XEXP (X, 1)) + 0x8000) < 0x10000))    \
712
   || (GET_CODE (X) == PLUS && XEXP (X, 0) == pic_offset_table_rtx       \
713
       && flag_pic && GET_CODE (XEXP (X, 1)) == SYMBOL_REF)             \
714
   || (GET_CODE (X) == PLUS && XEXP (X, 0) == pic_offset_table_rtx       \
715
       && flag_pic && GET_CODE (XEXP (X, 1)) == LABEL_REF))
716
 
717
#define GO_IF_NONINDEXED_ADDRESS(X, ADDR)  \
718
{ if (INDIRECTABLE_1_ADDRESS_P (X)) goto ADDR; }
719
 
720
/* Only labels on dispatch tables are valid for indexing from.  */
721
#define GO_IF_INDEXABLE_BASE(X, ADDR)                           \
722
{ rtx temp;                                                     \
723
  if (GET_CODE (X) == LABEL_REF                                 \
724
      && (temp = next_nonnote_insn (XEXP (X, 0))) != 0            \
725
      && GET_CODE (temp) == JUMP_INSN                           \
726
      && (GET_CODE (PATTERN (temp)) == ADDR_VEC                 \
727
          || GET_CODE (PATTERN (temp)) == ADDR_DIFF_VEC))       \
728
    goto ADDR;                                                  \
729
  if (LEGITIMATE_BASE_REG_P (X)) goto ADDR; }
730
 
731
#define GO_IF_INDEXING(X, ADDR) \
732
{ if (GET_CODE (X) == PLUS && LEGITIMATE_INDEX_P (XEXP (X, 0)))          \
733
    { GO_IF_INDEXABLE_BASE (XEXP (X, 1), ADDR); }                       \
734
  if (GET_CODE (X) == PLUS && LEGITIMATE_INDEX_P (XEXP (X, 1)))         \
735
    { GO_IF_INDEXABLE_BASE (XEXP (X, 0), ADDR); } }
736
 
737
#define GO_IF_INDEXED_ADDRESS(X, ADDR)   \
738
{ GO_IF_INDEXING (X, ADDR);                                             \
739
  if (GET_CODE (X) == PLUS)                                             \
740
    { if (GET_CODE (XEXP (X, 1)) == CONST_INT                           \
741
          && (TARGET_68020 || (unsigned) INTVAL (XEXP (X, 1)) + 0x80 < 0x100))          \
742
        { rtx go_temp = XEXP (X, 0); GO_IF_INDEXING (go_temp, ADDR); }   \
743
      if (GET_CODE (XEXP (X, 0)) == CONST_INT                            \
744
          && (TARGET_68020 || (unsigned) INTVAL (XEXP (X, 0)) + 0x80 < 0x100))           \
745
        { rtx go_temp = XEXP (X, 1); GO_IF_INDEXING (go_temp, ADDR); } } }
746
 
747
/* ColdFire/5200 does not allow HImode index registers.  */
748
#define LEGITIMATE_INDEX_REG_P(X)   \
749
  ((GET_CODE (X) == REG && REG_OK_FOR_INDEX_P (X))      \
750
   || (! TARGET_COLDFIRE                                        \
751
       && GET_CODE (X) == SIGN_EXTEND                   \
752
       && GET_CODE (XEXP (X, 0)) == REG                  \
753
       && GET_MODE (XEXP (X, 0)) == HImode               \
754
       && REG_OK_FOR_INDEX_P (XEXP (X, 0)))              \
755
   || (GET_CODE (X) == SUBREG                           \
756
       && GET_CODE (SUBREG_REG (X)) == REG              \
757
       && REG_OK_FOR_INDEX_P (SUBREG_REG (X))))
758
 
759
#define LEGITIMATE_INDEX_P(X)   \
760
   (LEGITIMATE_INDEX_REG_P (X)                          \
761
    || ((TARGET_68020 || TARGET_COLDFIRE) && GET_CODE (X) == MULT \
762
        && LEGITIMATE_INDEX_REG_P (XEXP (X, 0))          \
763
        && GET_CODE (XEXP (X, 1)) == CONST_INT          \
764
        && (INTVAL (XEXP (X, 1)) == 2                   \
765
            || INTVAL (XEXP (X, 1)) == 4                \
766
            || (INTVAL (XEXP (X, 1)) == 8               \
767
                && (TARGET_CFV4E || !TARGET_COLDFIRE)))))
768
 
769
/* Coldfire FPU only accepts addressing modes 2-5 */
770
#define GO_IF_COLDFIRE_FPU_LEGITIMATE_ADDRESS(MODE, X, ADDR)            \
771
{ if (LEGITIMATE_BASE_REG_P (X)                                         \
772
      || ((GET_CODE (X) == PRE_DEC || GET_CODE (X) == POST_INC)         \
773
          && LEGITIMATE_BASE_REG_P (XEXP (X, 0)))                        \
774
      || ((GET_CODE (X) == PLUS) && LEGITIMATE_BASE_REG_P (XEXP (X, 0))  \
775
          && (GET_CODE (XEXP (X, 1)) == CONST_INT)                      \
776
          && ((((unsigned) INTVAL (XEXP (X, 1)) + 0x8000) < 0x10000)))) \
777
  goto ADDR;}
778
 
779
/* If pic, we accept INDEX+LABEL, which is what do_tablejump makes.  */
780
#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR)                         \
781
{ if (TARGET_COLDFIRE_FPU && (GET_MODE_CLASS (MODE) == MODE_FLOAT))     \
782
    {                                                                   \
783
      GO_IF_COLDFIRE_FPU_LEGITIMATE_ADDRESS (MODE, X, ADDR);            \
784
    }                                                                   \
785
  else                                                                  \
786
    {                                                                   \
787
      GO_IF_NONINDEXED_ADDRESS (X, ADDR);                               \
788
      GO_IF_INDEXED_ADDRESS (X, ADDR);                                  \
789
      if (flag_pic && MODE == CASE_VECTOR_MODE && GET_CODE (X) == PLUS  \
790
          && LEGITIMATE_INDEX_P (XEXP (X, 0))                            \
791
          && GET_CODE (XEXP (X, 1)) == LABEL_REF)                       \
792
        goto ADDR;                                                      \
793
    }}
794
 
795
/* Don't call memory_address_noforce for the address to fetch
796
   the switch offset.  This address is ok as it stands (see above),
797
   but memory_address_noforce would alter it.  */
798
#define PIC_CASE_VECTOR_ADDRESS(index) index
799
 
800
/* For the 68000, we handle X+REG by loading X into a register R and
801
   using R+REG.  R will go in an address reg and indexing will be used.
802
   However, if REG is a broken-out memory address or multiplication,
803
   nothing needs to be done because REG can certainly go in an address reg.  */
804
#define COPY_ONCE(Y) if (!copied) { Y = copy_rtx (Y); copied = ch = 1; }
805
#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN)   \
806
{ register int ch = (X) != (OLDX);                                      \
807
  if (GET_CODE (X) == PLUS)                                             \
808
    { int copied = 0;                                                    \
809
      if (GET_CODE (XEXP (X, 0)) == MULT)                                \
810
        { COPY_ONCE (X); XEXP (X, 0) = force_operand (XEXP (X, 0), 0);}    \
811
      if (GET_CODE (XEXP (X, 1)) == MULT)                               \
812
        { COPY_ONCE (X); XEXP (X, 1) = force_operand (XEXP (X, 1), 0);}  \
813
      if (ch && GET_CODE (XEXP (X, 1)) == REG                           \
814
          && GET_CODE (XEXP (X, 0)) == REG)                              \
815
        { if (TARGET_CFV4E && GET_MODE_CLASS (MODE) == MODE_FLOAT)      \
816
            { COPY_ONCE (X); X = force_operand (X, 0);}                  \
817
          goto WIN; }                                                   \
818
      if (ch) { GO_IF_LEGITIMATE_ADDRESS (MODE, X, WIN); }              \
819
      if (GET_CODE (XEXP (X, 0)) == REG                                  \
820
               || (GET_CODE (XEXP (X, 0)) == SIGN_EXTEND         \
821
                   && GET_CODE (XEXP (XEXP (X, 0), 0)) == REG             \
822
                   && GET_MODE (XEXP (XEXP (X, 0), 0)) == HImode))        \
823
        { register rtx temp = gen_reg_rtx (Pmode);                      \
824
          register rtx val = force_operand (XEXP (X, 1), 0);             \
825
          emit_move_insn (temp, val);                                   \
826
          COPY_ONCE (X);                                                \
827
          XEXP (X, 1) = temp;                                           \
828
          if (TARGET_COLDFIRE_FPU && GET_MODE_CLASS (MODE) == MODE_FLOAT \
829
              && GET_CODE (XEXP (X, 0)) == REG)                          \
830
            X = force_operand (X, 0);                                    \
831
          goto WIN; }                                                   \
832
      else if (GET_CODE (XEXP (X, 1)) == REG                            \
833
               || (GET_CODE (XEXP (X, 1)) == SIGN_EXTEND                \
834
                   && GET_CODE (XEXP (XEXP (X, 1), 0)) == REG            \
835
                   && GET_MODE (XEXP (XEXP (X, 1), 0)) == HImode))       \
836
        { register rtx temp = gen_reg_rtx (Pmode);                      \
837
          register rtx val = force_operand (XEXP (X, 0), 0);              \
838
          emit_move_insn (temp, val);                                   \
839
          COPY_ONCE (X);                                                \
840
          XEXP (X, 0) = temp;                                            \
841
          if (TARGET_COLDFIRE_FPU && GET_MODE_CLASS (MODE) == MODE_FLOAT \
842
              && GET_CODE (XEXP (X, 1)) == REG)                         \
843
            X = force_operand (X, 0);                                    \
844
          goto WIN; }}}
845
 
846
/* On the 68000, only predecrement and postincrement address depend thus
847
   (the amount of decrement or increment being the length of the operand).  */
848
#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL)        \
849
 if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == PRE_DEC) goto LABEL
850
 
851
#define CASE_VECTOR_MODE HImode
852
#define CASE_VECTOR_PC_RELATIVE 1
853
 
854
#define DEFAULT_SIGNED_CHAR 1
855
#define MOVE_MAX 4
856
#define SLOW_BYTE_ACCESS 0
857
 
858
#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
859
 
860
#define STORE_FLAG_VALUE (-1)
861
 
862
#define Pmode SImode
863
#define FUNCTION_MODE QImode
864
 
865
 
866
/* Tell final.c how to eliminate redundant test instructions.  */
867
 
868
/* Here we define machine-dependent flags and fields in cc_status
869
   (see `conditions.h').  */
870
 
871
/* Set if the cc value is actually in the 68881, so a floating point
872
   conditional branch must be output.  */
873
#define CC_IN_68881 04000
874
 
875
/* On the 68000, all the insns to store in an address register fail to
876
   set the cc's.  However, in some cases these instructions can make it
877
   possibly invalid to use the saved cc's.  In those cases we clear out
878
   some or all of the saved cc's so they won't be used.  */
879
#define NOTICE_UPDATE_CC(EXP,INSN) notice_update_cc (EXP, INSN)
880
 
881
#define OUTPUT_JUMP(NORMAL, FLOAT, NO_OV)  \
882
do { if (cc_prev_status.flags & CC_IN_68881)                    \
883
    return FLOAT;                                               \
884
  if (cc_prev_status.flags & CC_NO_OVERFLOW)                    \
885
    return NO_OV;                                               \
886
  return NORMAL; } while (0)
887
 
888
/* Control the assembler format that we output.  */
889
 
890
#define ASM_APP_ON "#APP\n"
891
#define ASM_APP_OFF "#NO_APP\n"
892
#define TEXT_SECTION_ASM_OP "\t.text"
893
#define DATA_SECTION_ASM_OP "\t.data"
894
#define GLOBAL_ASM_OP "\t.globl\t"
895
#define REGISTER_PREFIX ""
896
#define LOCAL_LABEL_PREFIX ""
897
#define USER_LABEL_PREFIX "_"
898
#define IMMEDIATE_PREFIX "#"
899
 
900
#define REGISTER_NAMES \
901
{REGISTER_PREFIX"d0", REGISTER_PREFIX"d1", REGISTER_PREFIX"d2", \
902
 REGISTER_PREFIX"d3", REGISTER_PREFIX"d4", REGISTER_PREFIX"d5", \
903
 REGISTER_PREFIX"d6", REGISTER_PREFIX"d7",                      \
904
 REGISTER_PREFIX"a0", REGISTER_PREFIX"a1", REGISTER_PREFIX"a2", \
905
 REGISTER_PREFIX"a3", REGISTER_PREFIX"a4", REGISTER_PREFIX"a5", \
906
 REGISTER_PREFIX"a6", REGISTER_PREFIX"sp",                      \
907
 REGISTER_PREFIX"fp0", REGISTER_PREFIX"fp1", REGISTER_PREFIX"fp2", \
908
 REGISTER_PREFIX"fp3", REGISTER_PREFIX"fp4", REGISTER_PREFIX"fp5", \
909
 REGISTER_PREFIX"fp6", REGISTER_PREFIX"fp7", REGISTER_PREFIX"argptr" }
910
 
911
#define M68K_FP_REG_NAME REGISTER_PREFIX"fp"
912
 
913
/* Return a register name by index, handling %fp nicely.
914
   We don't replace %fp for targets that don't map it to %a6
915
   since it may confuse GAS.  */
916
#define M68K_REGNAME(r) ( \
917
  ((FRAME_POINTER_REGNUM == 14) \
918
    && ((r) == FRAME_POINTER_REGNUM) \
919
    && frame_pointer_needed) ? \
920
    M68K_FP_REG_NAME : reg_names[(r)])
921
 
922
/* On the Sun-3, the floating point registers have numbers
923
   18 to 25, not 16 to 23 as they do in the compiler.  */
924
#define DBX_REGISTER_NUMBER(REGNO) ((REGNO) < 16 ? (REGNO) : (REGNO) + 2)
925
 
926
/* Before the prologue, RA is at 0(%sp).  */
927
#define INCOMING_RETURN_ADDR_RTX \
928
  gen_rtx_MEM (VOIDmode, gen_rtx_REG (VOIDmode, STACK_POINTER_REGNUM))
929
 
930
/* After the prologue, RA is at 4(AP) in the current frame.  */
931
#define RETURN_ADDR_RTX(COUNT, FRAME)                                      \
932
  ((COUNT) == 0                                                             \
933
   ? gen_rtx_MEM (Pmode, plus_constant (arg_pointer_rtx, UNITS_PER_WORD)) \
934
   : gen_rtx_MEM (Pmode, plus_constant (FRAME, UNITS_PER_WORD)))
935
 
936
/* We must not use the DBX register numbers for the DWARF 2 CFA column
937
   numbers because that maps to numbers beyond FIRST_PSEUDO_REGISTER.
938
   Instead use the identity mapping.  */
939
#define DWARF_FRAME_REGNUM(REG) REG
940
 
941
/* Before the prologue, the top of the frame is at 4(%sp).  */
942
#define INCOMING_FRAME_SP_OFFSET 4
943
 
944
/* Describe how we implement __builtin_eh_return.  */
945
#define EH_RETURN_DATA_REGNO(N) \
946
  ((N) < 2 ? (N) : INVALID_REGNUM)
947
#define EH_RETURN_STACKADJ_RTX  gen_rtx_REG (Pmode, 8)
948
#define EH_RETURN_HANDLER_RTX                                       \
949
  gen_rtx_MEM (Pmode,                                               \
950
               gen_rtx_PLUS (Pmode, arg_pointer_rtx,                \
951
                             plus_constant (EH_RETURN_STACKADJ_RTX, \
952
                                            UNITS_PER_WORD)))
953
 
954
/* Select a format to encode pointers in exception handling data.  CODE
955
   is 0 for data, 1 for code labels, 2 for function pointers.  GLOBAL is
956
   true if the symbol may be affected by dynamic relocations.  */
957
#define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL)                         \
958
  (flag_pic                                                                \
959
   ? ((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4 \
960
   : DW_EH_PE_absptr)
961
 
962
#define ASM_OUTPUT_LABELREF(FILE,NAME)  \
963
  asm_fprintf (FILE, "%U%s", NAME)
964
 
965
#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM)   \
966
  sprintf (LABEL, "*%s%s%ld", LOCAL_LABEL_PREFIX, PREFIX, (long)(NUM))
967
 
968
#define ASM_OUTPUT_REG_PUSH(FILE,REGNO)  \
969
  asm_fprintf (FILE, "\tmovel %s,%Rsp@-\n", reg_names[REGNO])
970
#define ASM_OUTPUT_REG_POP(FILE,REGNO)  \
971
  asm_fprintf (FILE, "\tmovel %Rsp@+,%s\n", reg_names[REGNO])
972
 
973
/* The m68k does not use absolute case-vectors, but we must define this macro
974
   anyway.  */
975
#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE)  \
976
  asm_fprintf (FILE, "\t.long %LL%d\n", VALUE)
977
 
978
#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL)  \
979
  asm_fprintf (FILE, "\t.word %LL%d-%LL%d\n", VALUE, REL)
980
 
981
/* We don't have a way to align to more than a two-byte boundary, so do the
982
   best we can and don't complain.  */
983
#define ASM_OUTPUT_ALIGN(FILE,LOG)      \
984
  if ((LOG) >= 1)                       \
985
    fprintf (FILE, "\t.even\n");
986
 
987
#define ASM_OUTPUT_SKIP(FILE,SIZE)  \
988
  fprintf (FILE, "\t.skip %u\n", (int)(SIZE))
989
 
990
#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED)  \
991
( fputs (".comm ", (FILE)),                     \
992
  assemble_name ((FILE), (NAME)),               \
993
  fprintf ((FILE), ",%u\n", (int)(ROUNDED)))
994
 
995
#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED)  \
996
( fputs (".lcomm ", (FILE)),                    \
997
  assemble_name ((FILE), (NAME)),               \
998
  fprintf ((FILE), ",%u\n", (int)(ROUNDED)))
999
 
1000
/* Output a float value (represented as a C double) as an immediate operand.
1001
   This macro is m68k-specific.  */
1002
#define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE)               \
1003
 do {                                                           \
1004
      if (CODE == 'f')                                          \
1005
        {                                                       \
1006
          char dstr[30];                                        \
1007
          real_to_decimal (dstr, &(VALUE), sizeof (dstr), 9, 0); \
1008
          asm_fprintf ((FILE), "%I0r%s", dstr);                 \
1009
        }                                                       \
1010
      else                                                      \
1011
        {                                                       \
1012
          long l;                                               \
1013
          REAL_VALUE_TO_TARGET_SINGLE (VALUE, l);               \
1014
          asm_fprintf ((FILE), "%I0x%lx", l);                   \
1015
        }                                                       \
1016
     } while (0)
1017
 
1018
/* Output a double value (represented as a C double) as an immediate operand.
1019
   This macro is m68k-specific.  */
1020
#define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE)                           \
1021
 do { char dstr[30];                                                    \
1022
      real_to_decimal (dstr, &(VALUE), sizeof (dstr), 0, 1);             \
1023
      asm_fprintf (FILE, "%I0r%s", dstr);                               \
1024
    } while (0)
1025
 
1026
/* Note, long double immediate operands are not actually
1027
   generated by m68k.md.  */
1028
#define ASM_OUTPUT_LONG_DOUBLE_OPERAND(FILE,VALUE)                      \
1029
 do { char dstr[30];                                                    \
1030
      real_to_decimal (dstr, &(VALUE), sizeof (dstr), 0, 1);             \
1031
      asm_fprintf (FILE, "%I0r%s", dstr);                               \
1032
    } while (0)
1033
 
1034
/* On the 68000, we use several CODE characters:
1035
   '.' for dot needed in Motorola-style opcode names.
1036
   '-' for an operand pushing on the stack:
1037
       sp@-, -(sp) or -(%sp) depending on the style of syntax.
1038
   '+' for an operand pushing on the stack:
1039
       sp@+, (sp)+ or (%sp)+ depending on the style of syntax.
1040
   '@' for a reference to the top word on the stack:
1041
       sp@, (sp) or (%sp) depending on the style of syntax.
1042
   '#' for an immediate operand prefix (# in MIT and Motorola syntax
1043
       but & in SGS syntax).
1044
   '!' for the fpcr register (used in some float-to-fixed conversions).
1045
   '$' for the letter `s' in an op code, but only on the 68040.
1046
   '&' for the letter `d' in an op code, but only on the 68040.
1047
   '/' for register prefix needed by longlong.h.
1048
 
1049
   'b' for byte insn (no effect, on the Sun; this is for the ISI).
1050
   'd' to force memory addressing to be absolute, not relative.
1051
   'f' for float insn (print a CONST_DOUBLE as a float rather than in hex)
1052
   'o' for operands to go directly to output_operand_address (bypassing
1053
       print_operand_address--used only for SYMBOL_REFs under TARGET_PCREL)
1054
   'x' for float insn (print a CONST_DOUBLE as a float rather than in hex),
1055
       or print pair of registers as rx:ry.  */
1056
 
1057
#define PRINT_OPERAND_PUNCT_VALID_P(CODE)                               \
1058
  ((CODE) == '.' || (CODE) == '#' || (CODE) == '-'                      \
1059
   || (CODE) == '+' || (CODE) == '@' || (CODE) == '!'                   \
1060
   || (CODE) == '$' || (CODE) == '&' || (CODE) == '/')
1061
 
1062
 
1063
/* See m68k.c for the m68k specific codes.  */
1064
#define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
1065
 
1066
#define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
1067
 
1068
/* Variables in m68k.c */
1069
extern const char *m68k_library_id_string;
1070
extern int m68k_last_compare_had_fp_operands;

powered by: WebSVN 2.1.0

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