1 /* Definitions of target machine for GNU compiler.
2 Sun 68000/68020 version.
3 Copyright (C) 1987, 1988, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4 2000, 2001, 2002 Free Software Foundation, Inc.
6 This file is part of GNU CC.
8 GNU CC 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 2, or (at your option)
13 GNU CC 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.
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING. If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
24 /* Note that some other tm.h files include this one and then override
25 many of the definitions that relate to assembler syntax. */
28 /* Classify the groups of pseudo-ops used to assemble QI, HI and SI
30 #define INT_OP_STANDARD 0 /* .byte, .short, .long */
31 #define INT_OP_DOT_WORD 1 /* .byte, .word, .long */
32 #define INT_OP_NO_DOT 2 /* byte, short, long */
33 #define INT_OP_DC 3 /* dc.b, dc.w, dc.l */
36 #define INT_OP_GROUP INT_OP_DOT_WORD
38 /* Names to predefine in the preprocessor for this target machine. */
40 /* See sun3.h, sun2.h, isi.h for different CPP_PREDEFINES. */
42 /* Print subsidiary information on the compiler version in use. */
44 #define TARGET_VERSION fprintf (stderr, " (68k, Motorola syntax)");
46 #define TARGET_VERSION fprintf (stderr, " (68k, MIT syntax)");
49 /* Define SUPPORT_SUN_FPA to include support for generating code for
50 the Sun Floating Point Accelerator, an optional product for Sun 3
51 machines. By default, it is not defined. Avoid defining it unless
52 you need to output code for the Sun3+FPA architecture, as it has the
53 effect of slowing down the register set operations in hard-reg-set.h
54 (total number of registers will exceed number of bits in a long,
55 if defined, causing the set operations to expand to loops).
56 SUPPORT_SUN_FPA is typically defined in sun3.h. */
58 /* Run-time compilation parameters selecting different hardware subsets. */
60 extern int target_flags;
62 /* Macros used in the machine description to test the flags. */
64 /* Compile for a 68020 (not a 68000 or 68010). */
66 #define TARGET_68020 (target_flags & MASK_68020)
68 /* Compile 68881 insns for floating point (not library calls). */
70 #define TARGET_68881 (target_flags & MASK_68881)
72 /* Compile using 68020 bitfield insns. */
73 #define MASK_BITFIELD 4
74 #define TARGET_BITFIELD (target_flags & MASK_BITFIELD)
76 /* Compile using rtd insn calling sequence.
77 This will not work unless you use prototypes at least
78 for all functions that can take varying numbers of args. */
80 #define TARGET_RTD (target_flags & MASK_RTD)
82 /* Compile passing first two args in regs 0 and 1.
83 This exists only to test compiler features that will
84 be needed for RISC chips. It is not usable
85 and is not intended to be usable on this cpu. */
86 #define MASK_REGPARM 16
87 #define TARGET_REGPARM (target_flags & MASK_REGPARM)
89 /* Compile with 16-bit `int'. */
91 #define TARGET_SHORT (target_flags & MASK_SHORT)
93 /* Compile with special insns for Sun FPA. */
95 #define TARGET_FPA (target_flags & MASK_FPA)
97 /* Compile (actually, link) for Sun SKY board. */
99 #define TARGET_SKY (target_flags & MASK_SKY)
101 /* Optimize for 68040, but still allow execution on 68020
102 (-m68020-40 or -m68040).
103 The 68040 will execute all 68030 and 68881/2 instructions, but some
104 of them must be emulated in software by the OS. When TARGET_68040 is
105 turned on, these instructions won't be used. This code will still
106 run on a 68030 and 68881/2. */
107 #define MASK_68040 256
108 #define TARGET_68040 (target_flags & MASK_68040)
110 /* Use the 68040-only fp instructions (-m68040 or -m68060). */
111 #define MASK_68040_ONLY 512
112 #define TARGET_68040_ONLY (target_flags & MASK_68040_ONLY)
114 /* Optimize for 68060, but still allow execution on 68020
115 (-m68020-60 or -m68060).
116 The 68060 will execute all 68030 and 68881/2 instructions, but some
117 of them must be emulated in software by the OS. When TARGET_68060 is
118 turned on, these instructions won't be used. This code will still
119 run on a 68030 and 68881/2. */
120 #define MASK_68060 1024
121 #define TARGET_68060 (target_flags & MASK_68060)
123 /* Compile for mcf5200 */
124 #define MASK_5200 2048
125 #define TARGET_5200 (target_flags & MASK_5200)
127 /* Align ints to a word boundary. This breaks compatibility with the
128 published ABI's for structures containing ints, but produces faster
129 code on cpus with 32 bit busses (020, 030, 040, 060, CPU32+, coldfire).
130 It's required for coldfire cpus without a misalignment module. */
131 #define MASK_ALIGN_INT 4096
132 #define TARGET_ALIGN_INT (target_flags & MASK_ALIGN_INT)
134 /* Compile for a CPU32 */
135 /* A 68020 without bitfields is a good heuristic for a CPU32 */
136 #define TARGET_CPU32 (TARGET_68020 && !TARGET_BITFIELD)
138 /* Use PC-relative addressing modes (without using a global offset table).
139 The m68000 supports 16-bit PC-relative addressing.
140 The m68020 supports 32-bit PC-relative addressing
141 (using outer displacements).
143 Under this model, all SYMBOL_REFs (and CONSTs) and LABEL_REFs are
144 treated as all containing an implicit PC-relative component, and hence
145 cannot be used directly as addresses for memory writes. See the comments
146 in m68k.c for more information. */
147 #define MASK_PCREL 8192
148 #define TARGET_PCREL (target_flags & MASK_PCREL)
150 /* Relax strict alignment. */
151 #define MASK_NO_STRICT_ALIGNMENT 16384
152 #define TARGET_STRICT_ALIGNMENT (~target_flags & MASK_NO_STRICT_ALIGNMENT)
154 /* Macro to define tables used to set the flags.
155 This is a list in braces of pairs in braces,
156 each pair being { "NAME", VALUE }
157 where VALUE is the bits to set or minus the bits to clear.
158 An empty string NAME is used to identify the default VALUE. */
160 #define TARGET_SWITCHES \
161 { { "68020", - (MASK_5200|MASK_68060|MASK_68040|MASK_68040_ONLY), \
162 N_("Generate code for a 68020") }, \
163 { "c68020", - (MASK_5200|MASK_68060|MASK_68040|MASK_68040_ONLY), \
164 N_("Generate code for a 68020") }, \
165 { "68020", (MASK_68020|MASK_BITFIELD), "" }, \
166 { "c68020", (MASK_68020|MASK_BITFIELD), "" }, \
167 { "68000", - (MASK_5200|MASK_68060|MASK_68040|MASK_68040_ONLY \
168 |MASK_68020|MASK_BITFIELD|MASK_68881), \
169 N_("Generate code for a 68000") }, \
170 { "c68000", - (MASK_5200|MASK_68060|MASK_68040|MASK_68040_ONLY \
171 |MASK_68020|MASK_BITFIELD|MASK_68881), \
172 N_("Generate code for a 68000") }, \
173 { "bitfield", MASK_BITFIELD, \
174 N_("Use the bit-field instructions") }, \
175 { "nobitfield", - MASK_BITFIELD, \
176 N_("Do not use the bit-field instructions") }, \
178 N_("Use different calling convention using 'rtd'") }, \
179 { "nortd", - MASK_RTD, \
180 N_("Use normal calling convention") }, \
181 { "short", MASK_SHORT, \
182 N_("Consider type `int' to be 16 bits wide") }, \
183 { "noshort", - MASK_SHORT, \
184 N_("Consider type `int' to be 32 bits wide") }, \
185 { "fpa", -(MASK_SKY|MASK_68040_ONLY|MASK_68881), \
186 N_("Generate code for a Sun FPA") }, \
187 { "fpa", MASK_FPA, "" }, \
188 { "nofpa", - MASK_FPA, \
189 N_("Do not generate code for a Sun FPA") }, \
190 { "sky", -(MASK_FPA|MASK_68040_ONLY|MASK_68881), \
191 N_("Generate code for a Sun Sky board") }, \
193 N_("Generate code for a Sun Sky board") }, \
194 { "nosky", - MASK_SKY, \
195 N_("Do not use Sky linkage convention") }, \
196 { "68881", - (MASK_FPA|MASK_SKY), \
197 N_("Generate code for a 68881") }, \
198 { "68881", MASK_68881, "" }, \
199 { "soft-float", - (MASK_FPA|MASK_SKY|MASK_68040_ONLY|MASK_68881), \
200 N_("Generate code with library calls for floating point") }, \
201 { "68020-40", -(MASK_5200|MASK_68060|MASK_68040_ONLY), \
202 N_("Generate code for a 68040, without any new instructions") }, \
203 { "68020-40", (MASK_BITFIELD|MASK_68881|MASK_68020|MASK_68040), ""},\
204 { "68020-60", -(MASK_5200|MASK_68040_ONLY), \
205 N_("Generate code for a 68060, without any new instructions") }, \
206 { "68020-60", (MASK_BITFIELD|MASK_68881|MASK_68020|MASK_68040 \
207 |MASK_68060), "" }, \
208 { "68030", - (MASK_5200|MASK_68060|MASK_68040|MASK_68040_ONLY), \
209 N_("Generate code for a 68030") }, \
210 { "68030", (MASK_68020|MASK_BITFIELD), "" }, \
211 { "68040", - (MASK_5200|MASK_68060), \
212 N_("Generate code for a 68040") }, \
213 { "68040", (MASK_68020|MASK_68881|MASK_BITFIELD \
214 |MASK_68040_ONLY|MASK_68040), "" }, \
215 { "68060", - (MASK_5200|MASK_68040), \
216 N_("Generate code for a 68060") }, \
217 { "68060", (MASK_68020|MASK_68881|MASK_BITFIELD \
218 |MASK_68040_ONLY|MASK_68060), "" }, \
219 { "5200", - (MASK_68060|MASK_68040|MASK_68040_ONLY|MASK_68020 \
220 |MASK_BITFIELD|MASK_68881), \
221 N_("Generate code for a 520X") }, \
222 { "5200", (MASK_5200), "" }, \
224 N_("Generate code for a 68851") }, \
226 N_("Do no generate code for a 68851") }, \
227 { "68302", - (MASK_5200|MASK_68060|MASK_68040|MASK_68040_ONLY \
228 |MASK_68020|MASK_BITFIELD|MASK_68881), \
229 N_("Generate code for a 68302") }, \
230 { "68332", - (MASK_5200|MASK_68060|MASK_68040|MASK_68040_ONLY \
231 |MASK_BITFIELD|MASK_68881), \
232 N_("Generate code for a 68332") }, \
233 { "68332", MASK_68020, "" }, \
234 { "cpu32", - (MASK_5200|MASK_68060|MASK_68040|MASK_68040_ONLY \
235 |MASK_BITFIELD|MASK_68881), \
236 N_("Generate code for a cpu32") }, \
237 { "cpu32", MASK_68020, "" }, \
238 { "align-int", MASK_ALIGN_INT, \
239 N_("Align variables on a 32-bit boundary") }, \
240 { "no-align-int", -MASK_ALIGN_INT, \
241 N_("Align variables on a 16-bit boundary") }, \
242 { "pcrel", MASK_PCREL, \
243 N_("Generate pc-relative code") }, \
244 { "strict-align", -MASK_NO_STRICT_ALIGNMENT, \
245 N_("Do not use unaligned memory references") }, \
246 { "no-strict-align", MASK_NO_STRICT_ALIGNMENT, \
247 N_("Use unaligned memory references") }, \
249 { "", TARGET_DEFAULT, "" }}
250 /* TARGET_DEFAULT is defined in sun*.h and isi.h, etc. */
252 /* This macro is similar to `TARGET_SWITCHES' but defines names of
253 command options that have values. Its definition is an
254 initializer with a subgrouping for each command option.
256 Each subgrouping contains a string constant, that defines the
257 fixed part of the option name, and the address of a variable. The
258 variable, type `char *', is set to the variable part of the given
259 option if the fixed part matches. The actual option name is made
260 by appending `-m' to the specified name. */
261 #define TARGET_OPTIONS \
262 { { "align-loops=", &m68k_align_loops_string, \
263 N_("Loop code aligned to this power of 2") }, \
264 { "align-jumps=", &m68k_align_jumps_string, \
265 N_("Jump targets are aligned to this power of 2") }, \
266 { "align-functions=", &m68k_align_funcs_string, \
267 N_("Function starts are aligned to this power of 2") }, \
271 /* Sometimes certain combinations of command options do not make
272 sense on a particular target machine. You can define a macro
273 `OVERRIDE_OPTIONS' to take account of this. This macro, if
274 defined, is executed once just after all the command options have
277 Don't use this macro to turn on various extra optimizations for
278 `-O'. That is what `OPTIMIZATION_OPTIONS' is for. */
280 #define OVERRIDE_OPTIONS \
282 override_options(); \
283 if (! TARGET_68020 && flag_pic == 2) \
284 error("-fPIC is not currently supported on the 68000 or 68010\n"); \
285 if (TARGET_PCREL && flag_pic == 0) \
287 SUBTARGET_OVERRIDE_OPTIONS; \
290 /* These are meant to be redefined in the host dependent files */
291 #define SUBTARGET_SWITCHES
292 #define SUBTARGET_OPTIONS
293 #define SUBTARGET_OVERRIDE_OPTIONS
295 /* target machine storage layout */
297 /* Define for XFmode extended real floating point support. */
298 #define LONG_DOUBLE_TYPE_SIZE 96
300 /* Define this if most significant bit is lowest numbered
301 in instructions that operate on numbered bit-fields.
302 This is true for 68020 insns such as bfins and bfexts.
303 We make it true always by avoiding using the single-bit insns
304 except in special cases with constant bit numbers. */
305 #define BITS_BIG_ENDIAN 1
307 /* Define this if most significant byte of a word is the lowest numbered. */
308 /* That is true on the 68000. */
309 #define BYTES_BIG_ENDIAN 1
311 /* Define this if most significant word of a multiword number is the lowest
313 /* For 68000 we can decide arbitrarily
314 since there are no machine instructions for them.
315 So let's be consistent. */
316 #define WORDS_BIG_ENDIAN 1
318 /* Width of a word, in units (bytes). */
319 #define UNITS_PER_WORD 4
321 /* Allocation boundary (in *bits*) for storing arguments in argument list. */
322 #define PARM_BOUNDARY (TARGET_SHORT ? 16 : 32)
324 /* Boundary (in *bits*) on which stack pointer should be aligned. */
325 #define STACK_BOUNDARY 16
327 /* Allocation boundary (in *bits*) for the code of a function. */
328 #define FUNCTION_BOUNDARY (1 << (m68k_align_funcs + 3))
330 /* Alignment of field after `int : 0' in a structure. */
331 #define EMPTY_FIELD_BOUNDARY 16
333 /* No data type wants to be aligned rounder than this.
334 Most published ABIs say that ints should be aligned on 16 bit
335 boundaries, but cpus with 32 bit busses get better performance
336 aligned on 32 bit boundaries. Coldfires without a misalignment
337 module require 32 bit alignment. */
338 #define BIGGEST_ALIGNMENT (TARGET_ALIGN_INT ? 32 : 16)
340 /* Set this nonzero if move instructions will actually fail to work
341 when given unaligned data. */
342 #define STRICT_ALIGNMENT (TARGET_STRICT_ALIGNMENT)
344 /* Maximum power of 2 that code can be aligned to. */
345 #define MAX_CODE_ALIGN 2 /* 4 byte alignment */
347 /* Align loop starts for optimal branching. */
348 #define LOOP_ALIGN(LABEL) (m68k_align_loops)
350 /* This is how to align an instruction for optimal branching. */
351 #define LABEL_ALIGN_AFTER_BARRIER(LABEL) (m68k_align_jumps)
353 #define SELECT_RTX_SECTION(MODE, X, ALIGN) \
356 readonly_data_section(); \
357 else if (LEGITIMATE_PIC_OPERAND_P (X)) \
358 readonly_data_section(); \
363 /* Define number of bits in most basic integer type.
364 (If undefined, default is BITS_PER_WORD). */
366 #define INT_TYPE_SIZE (TARGET_SHORT ? 16 : 32)
368 /* Define these to avoid dependence on meaning of `int'. */
370 #define WCHAR_TYPE "long int"
371 #define WCHAR_TYPE_SIZE 32
373 /* Standard register usage. */
375 /* Number of actual hardware registers.
376 The hardware registers are assigned numbers for the compiler
377 from 0 to just below FIRST_PSEUDO_REGISTER.
378 All registers that the compiler knows about must be given numbers,
379 even those that are not normally considered general registers.
380 For the 68000, we give the data registers numbers 0-7,
381 the address registers numbers 010-017,
382 and the 68881 floating point registers numbers 020-027. */
383 #ifndef SUPPORT_SUN_FPA
384 #define FIRST_PSEUDO_REGISTER 24
386 #define FIRST_PSEUDO_REGISTER 56
389 /* This defines the register which is used to hold the offset table for PIC. */
390 #define PIC_OFFSET_TABLE_REGNUM (flag_pic ? 13 : INVALID_REGNUM)
392 #ifndef SUPPORT_SUN_FPA
394 /* 1 for registers that have pervasive standard uses
395 and are not available for the register allocator.
396 On the 68000, only the stack pointer is such. */
398 #define FIXED_REGISTERS \
399 {/* Data registers. */ \
400 0, 0, 0, 0, 0, 0, 0, 0, \
402 /* Address registers. */ \
403 0, 0, 0, 0, 0, 0, 0, 1, \
405 /* Floating point registers \
407 0, 0, 0, 0, 0, 0, 0, 0 }
409 /* 1 for registers not available across function calls.
410 These must include the FIXED_REGISTERS and also any
411 registers that can be used without being saved.
412 The latter must include the registers where values are returned
413 and the register where structure-value addresses are passed.
414 Aside from that, you can include as many other registers as you like. */
415 #define CALL_USED_REGISTERS \
416 {1, 1, 0, 0, 0, 0, 0, 0, \
417 1, 1, 0, 0, 0, 0, 0, 1, \
418 1, 1, 0, 0, 0, 0, 0, 0 }
420 #else /* SUPPORT_SUN_FPA */
422 /* 1 for registers that have pervasive standard uses
423 and are not available for the register allocator.
424 On the 68000, only the stack pointer is such. */
426 /* fpa0 is also reserved so that it can be used to move data back and
427 forth between high fpa regs and everything else. */
429 #define FIXED_REGISTERS \
430 {/* Data registers. */ \
431 0, 0, 0, 0, 0, 0, 0, 0, \
433 /* Address registers. */ \
434 0, 0, 0, 0, 0, 0, 0, 1, \
436 /* Floating point registers \
438 0, 0, 0, 0, 0, 0, 0, 0, \
440 /* Sun3 FPA registers. */ \
441 1, 0, 0, 0, 0, 0, 0, 0, \
442 0, 0, 0, 0, 0, 0, 0, 0, \
443 0, 0, 0, 0, 0, 0, 0, 0, \
444 0, 0, 0, 0, 0, 0, 0, 0 }
446 /* 1 for registers not available across function calls.
447 These must include the FIXED_REGISTERS and also any
448 registers that can be used without being saved.
449 The latter must include the registers where values are returned
450 and the register where structure-value addresses are passed.
451 Aside from that, you can include as many other registers as you like. */
452 #define CALL_USED_REGISTERS \
453 {1, 1, 0, 0, 0, 0, 0, 0, \
454 1, 1, 0, 0, 0, 0, 0, 1, \
455 1, 1, 0, 0, 0, 0, 0, 0, \
456 /* FPA registers. */ \
457 1, 1, 1, 1, 0, 0, 0, 0, \
458 0, 0, 0, 0, 0, 0, 0, 0, \
459 0, 0, 0, 0, 0, 0, 0, 0, \
460 0, 0, 0, 0, 0, 0, 0, 0 }
462 #endif /* defined SUPPORT_SUN_FPA */
465 /* Make sure everything's fine if we *don't* have a given processor.
466 This assumes that putting a register in fixed_regs will keep the
467 compiler's mitts completely off it. We don't bother to zero it out
468 of register classes. */
470 #ifdef SUPPORT_SUN_FPA
472 #define CONDITIONAL_REGISTER_USAGE \
478 COPY_HARD_REG_SET (x, reg_class_contents[(int)FPA_REGS]); \
479 for (i = 0; i < FIRST_PSEUDO_REGISTER; i++ ) \
480 if (TEST_HARD_REG_BIT (x, i)) \
481 fixed_regs[i] = call_used_regs[i] = 1; \
483 if (! TARGET_68881) \
485 COPY_HARD_REG_SET (x, reg_class_contents[(int)FP_REGS]); \
486 for (i = 0; i < FIRST_PSEUDO_REGISTER; i++ ) \
487 if (TEST_HARD_REG_BIT (x, i)) \
488 fixed_regs[i] = call_used_regs[i] = 1; \
490 if (PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM) \
491 fixed_regs[PIC_OFFSET_TABLE_REGNUM] \
492 = call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
495 #define CONDITIONAL_REGISTER_USAGE \
499 if (! TARGET_68881) \
501 COPY_HARD_REG_SET (x, reg_class_contents[(int)FP_REGS]); \
502 for (i = 0; i < FIRST_PSEUDO_REGISTER; i++ ) \
503 if (TEST_HARD_REG_BIT (x, i)) \
504 fixed_regs[i] = call_used_regs[i] = 1; \
506 if (PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM) \
507 fixed_regs[PIC_OFFSET_TABLE_REGNUM] \
508 = call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
511 #endif /* defined SUPPORT_SUN_FPA */
513 /* Return number of consecutive hard regs needed starting at reg REGNO
514 to hold something of mode MODE.
515 This is ordinarily the length in words of a value of mode MODE
516 but can be less for certain modes in special long registers.
518 On the 68000, ordinary registers hold 32 bits worth;
519 for the 68881 registers, a single register is always enough for
520 anything that can be stored in them at all. */
521 #define HARD_REGNO_NREGS(REGNO, MODE) \
522 ((REGNO) >= 16 ? GET_MODE_NUNITS (MODE) \
523 : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
525 #ifndef SUPPORT_SUN_FPA
527 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
528 On the 68000, the cpu registers can hold any mode but the 68881 registers
529 can hold only SFmode or DFmode. */
531 #define HARD_REGNO_MODE_OK(REGNO, MODE) \
533 && !((REGNO) < 8 && (REGNO) + GET_MODE_SIZE (MODE) / 4 > 8)) \
534 || ((REGNO) >= 16 && (REGNO) < 24 \
535 && (GET_MODE_CLASS (MODE) == MODE_FLOAT \
536 || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT) \
537 && GET_MODE_UNIT_SIZE (MODE) <= 12))
539 #else /* defined SUPPORT_SUN_FPA */
541 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
542 On the 68000, the cpu registers can hold any mode but the 68881 registers
543 can hold only SFmode or DFmode. However, the Sun FPA register can
544 (apparently) hold whatever you feel like putting in them.
545 If using the fpa, don't put a double in d7/a0. */
547 /* ??? This is confused. The check to prohibit d7/a0 overlaps should always
548 be enabled regardless of whether TARGET_FPA is specified. It isn't clear
549 what the other d/a register checks are for. Every check using REGNO
550 actually needs to use a range, e.g. 24>=X<56 not <56. There is probably
551 no one using this code anymore.
552 This code used to be used to suppress register usage for the 68881 by
553 saying that the 68881 registers couldn't hold values of any mode if there
554 was no 68881. This was wrong, because reload (etc.) will still try
555 to save and restore call-saved registers during, for instance, non-local
557 #define HARD_REGNO_MODE_OK(REGNO, MODE) \
560 && GET_MODE_CLASS ((MODE)) != MODE_INT \
561 && GET_MODE_UNIT_SIZE ((MODE)) > 4 \
562 && (REGNO) < 8 && (REGNO) + GET_MODE_SIZE ((MODE)) / 4 > 8 \
563 && (REGNO) % (GET_MODE_UNIT_SIZE ((MODE)) / 4) != 0)) \
564 || ((REGNO) >= 16 && (REGNO) < 24 \
565 ? ((GET_MODE_CLASS (MODE) == MODE_FLOAT \
566 || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT) \
567 && GET_MODE_UNIT_SIZE (MODE) <= 12) \
568 : ((REGNO) < 56 ? TARGET_FPA && GET_MODE_UNIT_SIZE (MODE) <= 8 : 0)))
570 #endif /* defined SUPPORT_SUN_FPA */
572 /* Value is 1 if it is a good idea to tie two pseudo registers
573 when one has mode MODE1 and one has mode MODE2.
574 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
575 for any hard reg, then this must be 0 for correct output. */
576 #define MODES_TIEABLE_P(MODE1, MODE2) \
578 || ((GET_MODE_CLASS (MODE1) == MODE_FLOAT \
579 || GET_MODE_CLASS (MODE1) == MODE_COMPLEX_FLOAT) \
580 == (GET_MODE_CLASS (MODE2) == MODE_FLOAT \
581 || GET_MODE_CLASS (MODE2) == MODE_COMPLEX_FLOAT)))
583 /* Specify the registers used for certain standard purposes.
584 The values of these macros are register numbers. */
586 /* m68000 pc isn't overloaded on a register. */
587 /* #define PC_REGNUM */
589 /* Register to use for pushing function arguments. */
590 #define STACK_POINTER_REGNUM 15
592 /* Base register for access to local variables of the function. */
593 #define FRAME_POINTER_REGNUM 14
595 /* Value should be nonzero if functions must have frame pointers.
596 Zero means the frame pointer need not be set up (and parms
597 may be accessed via the stack pointer) in functions that seem suitable.
598 This is computed in `reload', in reload1.c. */
599 #define FRAME_POINTER_REQUIRED 0
601 /* Base register for access to arguments of the function. */
602 #define ARG_POINTER_REGNUM 14
604 /* Register in which static-chain is passed to a function. */
605 #define STATIC_CHAIN_REGNUM 8
607 /* Register in which address to store a structure value
608 is passed to a function. */
609 #define STRUCT_VALUE_REGNUM 9
611 /* Define the classes of registers for register constraints in the
612 machine description. Also define ranges of constants.
614 One of the classes must always be named ALL_REGS and include all hard regs.
615 If there is more than one class, another class must be named NO_REGS
616 and contain no registers.
618 The name GENERAL_REGS must be the name of a class (or an alias for
619 another name such as ALL_REGS). This is the class of registers
620 that is allowed by "g" or "r" in a register constraint.
621 Also, registers outside this class are allocated only when
622 instructions express preferences for them.
624 The classes must be numbered in nondecreasing order; that is,
625 a larger-numbered class must never be contained completely
626 in a smaller-numbered class.
628 For any two classes, it is very desirable that there be another
629 class that represents their union. */
631 /* The 68000 has three kinds of registers, so eight classes would be
632 a complete set. One of them is not needed. */
634 #ifndef SUPPORT_SUN_FPA
639 GENERAL_REGS, DATA_OR_FP_REGS,
640 ADDR_OR_FP_REGS, ALL_REGS,
643 #define N_REG_CLASSES (int) LIM_REG_CLASSES
645 /* Give names of register classes as strings for dump file. */
647 #define REG_CLASS_NAMES \
648 { "NO_REGS", "DATA_REGS", \
649 "ADDR_REGS", "FP_REGS", \
650 "GENERAL_REGS", "DATA_OR_FP_REGS", \
651 "ADDR_OR_FP_REGS", "ALL_REGS" }
653 /* Define which registers fit in which classes.
654 This is an initializer for a vector of HARD_REG_SET
655 of length N_REG_CLASSES. */
657 #define REG_CLASS_CONTENTS \
659 {0x00000000}, /* NO_REGS */ \
660 {0x000000ff}, /* DATA_REGS */ \
661 {0x0000ff00}, /* ADDR_REGS */ \
662 {0x00ff0000}, /* FP_REGS */ \
663 {0x0000ffff}, /* GENERAL_REGS */ \
664 {0x00ff00ff}, /* DATA_OR_FP_REGS */ \
665 {0x00ffff00}, /* ADDR_OR_FP_REGS */ \
666 {0x00ffffff}, /* ALL_REGS */ \
669 /* The same information, inverted:
670 Return the class number of the smallest class containing
671 reg number REGNO. This could be a conditional expression
672 or could index an array. */
674 #define REGNO_REG_CLASS(REGNO) (((REGNO)>>3)+1)
676 #else /* defined SUPPORT_SUN_FPA */
679 * Notes on final choices:
681 * 1) Didn't feel any need to union-ize LOW_FPA_REGS with anything
683 * 2) Removed all unions that involve address registers with
684 * floating point registers (left in unions of address and data with
686 * 3) Defined GENERAL_REGS as ADDR_OR_DATA_REGS.
687 * 4) Defined ALL_REGS as FPA_OR_FP_OR_GENERAL_REGS.
688 * 4) Left in everything else.
690 enum reg_class { NO_REGS, LO_FPA_REGS, FPA_REGS, FP_REGS,
691 FP_OR_FPA_REGS, DATA_REGS, DATA_OR_FPA_REGS, DATA_OR_FP_REGS,
692 DATA_OR_FP_OR_FPA_REGS, ADDR_REGS, GENERAL_REGS,
693 GENERAL_OR_FPA_REGS, GENERAL_OR_FP_REGS, ALL_REGS,
696 #define N_REG_CLASSES (int) LIM_REG_CLASSES
698 /* Give names of register classes as strings for dump file. */
700 #define REG_CLASS_NAMES \
701 { "NO_REGS", "LO_FPA_REGS", "FPA_REGS", "FP_REGS", \
702 "FP_OR_FPA_REGS", "DATA_REGS", "DATA_OR_FPA_REGS", "DATA_OR_FP_REGS", \
703 "DATA_OR_FP_OR_FPA_REGS", "ADDR_REGS", "GENERAL_REGS", \
704 "GENERAL_OR_FPA_REGS", "GENERAL_OR_FP_REGS", "ALL_REGS" }
706 /* Define which registers fit in which classes.
707 This is an initializer for a vector of HARD_REG_SET
708 of length N_REG_CLASSES. */
710 #define REG_CLASS_CONTENTS \
712 {0, 0}, /* NO_REGS */ \
713 {0xff000000, 0x000000ff}, /* LO_FPA_REGS */ \
714 {0xff000000, 0x00ffffff}, /* FPA_REGS */ \
715 {0x00ff0000, 0x00000000}, /* FP_REGS */ \
716 {0xffff0000, 0x00ffffff}, /* FP_OR_FPA_REGS */ \
717 {0x000000ff, 0x00000000}, /* DATA_REGS */ \
718 {0xff0000ff, 0x00ffffff}, /* DATA_OR_FPA_REGS */ \
719 {0x00ff00ff, 0x00000000}, /* DATA_OR_FP_REGS */ \
720 {0xffff00ff, 0x00ffffff}, /* DATA_OR_FP_OR_FPA_REGS */\
721 {0x0000ff00, 0x00000000}, /* ADDR_REGS */ \
722 {0x0000ffff, 0x00000000}, /* GENERAL_REGS */ \
723 {0xff00ffff, 0x00ffffff}, /* GENERAL_OR_FPA_REGS */\
724 {0x00ffffff, 0x00000000}, /* GENERAL_OR_FP_REGS */\
725 {0xffffffff, 0x00ffffff}, /* ALL_REGS */ \
728 /* The same information, inverted:
729 Return the class number of the smallest class containing
730 reg number REGNO. This could be a conditional expression
731 or could index an array. */
733 extern const enum reg_class regno_reg_class[];
734 #define REGNO_REG_CLASS(REGNO) (regno_reg_class[(REGNO)>>3])
736 #endif /* SUPPORT_SUN_FPA */
738 /* The class value for index registers, and the one for base regs. */
740 #define INDEX_REG_CLASS GENERAL_REGS
741 #define BASE_REG_CLASS ADDR_REGS
743 /* Get reg_class from a letter such as appears in the machine description.
744 We do a trick here to modify the effective constraints on the
745 machine description; we zorch the constraint letters that aren't
746 appropriate for a specific target. This allows us to guarantee
747 that a specific kind of register will not be used for a given target
748 without fiddling with the register classes above. */
750 #ifndef SUPPORT_SUN_FPA
752 #define REG_CLASS_FROM_LETTER(C) \
753 ((C) == 'a' ? ADDR_REGS : \
754 ((C) == 'd' ? DATA_REGS : \
755 ((C) == 'f' ? (TARGET_68881 ? FP_REGS : \
759 #else /* defined SUPPORT_SUN_FPA */
761 #define REG_CLASS_FROM_LETTER(C) \
762 ((C) == 'a' ? ADDR_REGS : \
763 ((C) == 'd' ? DATA_REGS : \
764 ((C) == 'f' ? (TARGET_68881 ? FP_REGS : \
766 ((C) == 'x' ? (TARGET_FPA ? FPA_REGS : \
768 ((C) == 'y' ? (TARGET_FPA ? LO_FPA_REGS : \
772 #endif /* defined SUPPORT_SUN_FPA */
774 /* The letters I, J, K, L and M in a register constraint string
775 can be used to stand for particular ranges of immediate operands.
776 This macro defines what the ranges are.
777 C is the letter, and VALUE is a constant value.
778 Return 1 if VALUE is in the range specified by C.
780 For the 68000, `I' is used for the range 1 to 8
781 allowed as immediate shift counts and in addq.
782 `J' is used for the range of signed numbers that fit in 16 bits.
783 `K' is for numbers that moveq can't handle.
784 `L' is for range -8 to -1, range of values that can be added with subq.
785 `M' is for numbers that moveq+notb can't handle.
786 'N' is for range 24 to 31, rotatert:SI 8 to 1 expressed as rotate.
787 'O' is for 16 (for rotate using swap).
788 'P' is for range 8 to 15, rotatert:HI 8 to 1 expressed as rotate. */
790 #define CONST_OK_FOR_LETTER_P(VALUE, C) \
791 ((C) == 'I' ? (VALUE) > 0 && (VALUE) <= 8 : \
792 (C) == 'J' ? (VALUE) >= -0x8000 && (VALUE) <= 0x7FFF : \
793 (C) == 'K' ? (VALUE) < -0x80 || (VALUE) >= 0x80 : \
794 (C) == 'L' ? (VALUE) < 0 && (VALUE) >= -8 : \
795 (C) == 'M' ? (VALUE) < -0x100 || (VALUE) >= 0x100 : \
796 (C) == 'N' ? (VALUE) >= 24 && (VALUE) <= 31 : \
797 (C) == 'O' ? (VALUE) == 16 : \
798 (C) == 'P' ? (VALUE) >= 8 && (VALUE) <= 15 : 0)
801 * A small bit of explanation:
802 * "G" defines all of the floating constants that are *NOT* 68881
803 * constants. this is so 68881 constants get reloaded and the
804 * fpmovecr is used. "H" defines *only* the class of constants that
805 * the fpa can use, because these can be gotten at in any fpa
806 * instruction and there is no need to force reloads.
808 #ifndef SUPPORT_SUN_FPA
809 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
810 ((C) == 'G' ? ! (TARGET_68881 && standard_68881_constant_p (VALUE)) : 0 )
811 #else /* defined SUPPORT_SUN_FPA */
812 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
813 ((C) == 'G' ? ! (TARGET_68881 && standard_68881_constant_p (VALUE)) : \
814 (C) == 'H' ? (TARGET_FPA && standard_sun_fpa_constant_p (VALUE)) : 0)
815 #endif /* defined SUPPORT_SUN_FPA */
817 /* A C expression that defines the optional machine-dependent constraint
818 letters that can be used to segregate specific types of operands,
819 usually memory references, for the target machine. It should return 1 if
820 VALUE corresponds to the operand type represented by the constraint letter
821 C. If C is not defined as an extra constraint, the value returned should
822 be 0 regardless of VALUE. */
824 /* Letters in the range `Q' through `U' may be defined in a
825 machine-dependent fashion to stand for arbitrary operand types.
826 The machine description macro `EXTRA_CONSTRAINT' is passed the
827 operand as its first argument and the constraint letter as its
830 `Q' means address register indirect addressing mode.
831 `S' is for operands that satisfy 'm' when -mpcrel is in effect.
832 `T' is for operands that satisfy 's' when -mpcrel is not in effect. */
834 #define EXTRA_CONSTRAINT(OP,CODE) \
837 && GET_CODE (OP) == MEM \
838 && (GET_CODE (XEXP (OP, 0)) == SYMBOL_REF \
839 || GET_CODE (XEXP (OP, 0)) == LABEL_REF \
840 || GET_CODE (XEXP (OP, 0)) == CONST)) \
844 && (GET_CODE (OP) == SYMBOL_REF \
845 || GET_CODE (OP) == LABEL_REF \
846 || GET_CODE (OP) == CONST)) \
849 ? (GET_CODE (OP) == MEM \
850 && GET_CODE (XEXP (OP, 0)) == REG) \
854 /* Given an rtx X being reloaded into a reg required to be
855 in class CLASS, return the class of reg to actually use.
856 In general this is just CLASS; but on some machines
857 in some cases it is preferable to use a more restrictive class.
858 On the 68000 series, use a data reg if possible when the
859 value is a constant in the range where moveq could be used
860 and we ensure that QImodes are reloaded into data regs. */
862 #define PREFERRED_RELOAD_CLASS(X,CLASS) \
863 ((GET_CODE (X) == CONST_INT \
864 && (unsigned) (INTVAL (X) + 0x80) < 0x100 \
865 && (CLASS) != ADDR_REGS) \
867 : (GET_MODE (X) == QImode && (CLASS) != ADDR_REGS) \
869 : (GET_CODE (X) == CONST_DOUBLE \
870 && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT) \
871 ? (TARGET_68881 && (CLASS == FP_REGS || CLASS == DATA_OR_FP_REGS) \
872 ? FP_REGS : NO_REGS) \
874 && (GET_CODE (X) == SYMBOL_REF || GET_CODE (X) == CONST \
875 || GET_CODE (X) == LABEL_REF)) \
879 /* Force QImode output reloads from subregs to be allocated to data regs,
880 since QImode stores from address regs are not supported. We make the
881 assumption that if the class is not ADDR_REGS, then it must be a superset
884 #define LIMIT_RELOAD_CLASS(MODE, CLASS) \
885 (((MODE) == QImode && (CLASS) != ADDR_REGS) \
889 /* Return the maximum number of consecutive registers
890 needed to represent mode MODE in a register of class CLASS. */
891 /* On the 68000, this is the size of MODE in words,
892 except in the FP regs, where a single reg is always enough. */
893 #ifndef SUPPORT_SUN_FPA
895 #define CLASS_MAX_NREGS(CLASS, MODE) \
896 ((CLASS) == FP_REGS ? 1 \
897 : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
899 /* Moves between fp regs and other regs are two insns. */
900 #define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2) \
901 (((CLASS1) == FP_REGS && (CLASS2) != FP_REGS) \
902 || ((CLASS2) == FP_REGS && (CLASS1) != FP_REGS) \
905 #else /* defined SUPPORT_SUN_FPA */
907 #define CLASS_MAX_NREGS(CLASS, MODE) \
908 ((CLASS) == FP_REGS || (CLASS) == FPA_REGS || (CLASS) == LO_FPA_REGS ? 1 \
909 : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
911 /* Moves between fp regs and other regs are two insns. */
912 /* Likewise for high fpa regs and other regs. */
913 #define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2) \
914 ((((CLASS1) == FP_REGS && (CLASS2) != FP_REGS) \
915 || ((CLASS2) == FP_REGS && (CLASS1) != FP_REGS) \
916 || ((CLASS1) == FPA_REGS && (CLASS2) != FPA_REGS) \
917 || ((CLASS2) == FPA_REGS && (CLASS1) != FPA_REGS)) \
920 #endif /* define SUPPORT_SUN_FPA */
922 /* Stack layout; function entry, exit and calling. */
924 /* Define this if pushing a word on the stack
925 makes the stack pointer a smaller address. */
926 #define STACK_GROWS_DOWNWARD
928 /* Nonzero if we need to generate stack-probe insns.
929 On most systems they are not needed.
930 When they are needed, define this as the stack offset to probe at. */
933 /* Define this if the nominal address of the stack frame
934 is at the high-address end of the local variables;
935 that is, each additional local variable allocated
936 goes at a more negative offset in the frame. */
937 #define FRAME_GROWS_DOWNWARD
939 /* Offset within stack frame to start allocating local variables at.
940 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
941 first local allocated. Otherwise, it is the offset to the BEGINNING
942 of the first local allocated. */
943 #define STARTING_FRAME_OFFSET 0
945 /* If we generate an insn to push BYTES bytes,
946 this says how many the stack pointer really advances by.
947 On the 68000, sp@- in a byte insn really pushes a word.
948 On the 5200 (coldfire), sp@- in a byte insn pushes just a byte. */
949 #define PUSH_ROUNDING(BYTES) (TARGET_5200 ? BYTES : ((BYTES) + 1) & ~1)
951 /* We want to avoid trying to push bytes. */
952 #define MOVE_BY_PIECES_P(SIZE, ALIGN) \
953 (move_by_pieces_ninsns (SIZE, ALIGN) < MOVE_RATIO \
954 && (((SIZE) >=16 && (ALIGN) >= 16) || (TARGET_5200)))
956 /* Offset of first parameter from the argument pointer register value. */
957 #define FIRST_PARM_OFFSET(FNDECL) 8
959 /* Value is the number of byte of arguments automatically
960 popped when returning from a subroutine call.
961 FUNDECL is the declaration node of the function (as a tree),
962 FUNTYPE is the data type of the function (as a tree),
963 or for a library call it is an identifier node for the subroutine name.
964 SIZE is the number of bytes of arguments passed on the stack.
966 On the 68000, the RTS insn cannot pop anything.
967 On the 68010, the RTD insn may be used to pop them if the number
968 of args is fixed, but if the number is variable then the caller
969 must pop them all. RTD can't be used for library calls now
970 because the library is compiled with the Unix compiler.
971 Use of RTD is a selectable option, since it is incompatible with
972 standard Unix calling sequences. If the option is not selected,
973 the caller must always pop the args. */
975 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \
976 ((TARGET_RTD && (!(FUNDECL) || TREE_CODE (FUNDECL) != IDENTIFIER_NODE) \
977 && (TYPE_ARG_TYPES (FUNTYPE) == 0 \
978 || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE))) \
979 == void_type_node))) \
982 /* Define how to find the value returned by a function.
983 VALTYPE is the data type of the value (as a tree).
984 If the precise function being called is known, FUNC is its FUNCTION_DECL;
985 otherwise, FUNC is 0. */
987 /* On the 68000 the return value is in D0 regardless. */
989 #define FUNCTION_VALUE(VALTYPE, FUNC) \
990 gen_rtx_REG (TYPE_MODE (VALTYPE), 0)
992 /* Define how to find the value returned by a library function
993 assuming the value has mode MODE. */
995 /* On the 68000 the return value is in D0 regardless. */
997 #define LIBCALL_VALUE(MODE) gen_rtx_REG (MODE, 0)
999 /* 1 if N is a possible register number for a function value.
1000 On the 68000, d0 is the only register thus used. */
1002 #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
1004 /* Define this to be true when FUNCTION_VALUE_REGNO_P is true for
1005 more than one register. */
1007 #define NEEDS_UNTYPED_CALL 0
1009 /* Define this if PCC uses the nonreentrant convention for returning
1010 structure and union values. */
1012 #define PCC_STATIC_STRUCT_RETURN
1014 /* 1 if N is a possible register number for function argument passing.
1015 On the 68000, no registers are used in this way. */
1017 #define FUNCTION_ARG_REGNO_P(N) 0
1019 /* Define a data type for recording info about an argument list
1020 during the scan of that argument list. This data type should
1021 hold all necessary information about the function itself
1022 and about the args processed so far, enough to enable macros
1023 such as FUNCTION_ARG to determine where the next arg should go.
1025 On the m68k, this is a single integer, which is a number of bytes
1026 of arguments scanned so far. */
1028 #define CUMULATIVE_ARGS int
1030 /* Initialize a variable CUM of type CUMULATIVE_ARGS
1031 for a call to a function whose data type is FNTYPE.
1032 For a library call, FNTYPE is 0.
1034 On the m68k, the offset starts at 0. */
1036 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
1039 /* Update the data in CUM to advance over an argument
1040 of mode MODE and data type TYPE.
1041 (TYPE is null for libcalls where that information may not be available.) */
1043 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
1044 ((CUM) += ((MODE) != BLKmode \
1045 ? (GET_MODE_SIZE (MODE) + 3) & ~3 \
1046 : (int_size_in_bytes (TYPE) + 3) & ~3))
1048 /* Define where to put the arguments to a function.
1049 Value is zero to push the argument on the stack,
1050 or a hard register in which to store the argument.
1052 MODE is the argument's machine mode.
1053 TYPE is the data type of the argument (as a tree).
1054 This is null for libcalls where that information may
1056 CUM is a variable of type CUMULATIVE_ARGS which gives info about
1057 the preceding args and about the function being called.
1058 NAMED is nonzero if this argument is a named parameter
1059 (otherwise it is an extra parameter matching an ellipsis). */
1061 /* On the 68000 all args are pushed, except if -mregparm is specified
1062 then the first two words of arguments are passed in d0, d1.
1063 *NOTE* -mregparm does not work.
1064 It exists only to test register calling conventions. */
1066 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
1067 ((TARGET_REGPARM && (CUM) < 8) ? gen_rtx_REG ((MODE), (CUM) / 4) : 0)
1069 /* For an arg passed partly in registers and partly in memory,
1070 this is the number of registers used.
1071 For args passed entirely in registers or entirely in memory, zero. */
1073 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
1074 ((TARGET_REGPARM && (CUM) < 8 \
1075 && 8 < ((CUM) + ((MODE) == BLKmode \
1076 ? int_size_in_bytes (TYPE) \
1077 : GET_MODE_SIZE (MODE)))) \
1078 ? 2 - (CUM) / 4 : 0)
1080 /* Output assembler code to FILE to increment profiler label # LABELNO
1081 for profiling a function entry. */
1083 #define FUNCTION_PROFILER(FILE, LABELNO) \
1084 asm_fprintf (FILE, "\tlea %LLP%d,%Ra0\n\tjsr mcount\n", (LABELNO))
1086 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
1087 the stack pointer does not matter. The value is tested only in
1088 functions that have frame pointers.
1089 No definition is equivalent to always zero. */
1091 #define EXIT_IGNORE_STACK 1
1093 /* This is a hook for other tm files to change. */
1094 /* #define FUNCTION_EXTRA_EPILOGUE(FILE, SIZE) */
1096 /* Determine if the epilogue should be output as RTL.
1097 You should override this if you define FUNCTION_EXTRA_EPILOGUE. */
1098 #define USE_RETURN_INSN use_return_insn ()
1100 /* Store in the variable DEPTH the initial difference between the
1101 frame pointer reg contents and the stack pointer reg contents,
1102 as of the start of the function body. This depends on the layout
1103 of the fixed parts of the stack frame and on how registers are saved.
1105 On the 68k, if we have a frame, we must add one word to its length
1106 to allow for the place that a6 is stored when we do have a frame pointer.
1107 Otherwise, we would need to compute the offset from the frame pointer
1108 of a local variable as a function of frame_pointer_needed, which
1111 #define INITIAL_FRAME_POINTER_OFFSET(DEPTH) \
1114 for (regno = 16; regno < FIRST_PSEUDO_REGISTER; regno++) \
1115 if (regs_ever_live[regno] && ! call_used_regs[regno]) \
1117 for (regno = 0; regno < 16; regno++) \
1118 if (regs_ever_live[regno] && ! call_used_regs[regno]) \
1120 if (flag_pic && current_function_uses_pic_offset_table) \
1122 (DEPTH) = (offset + ((get_frame_size () + 3) & -4) \
1123 + (get_frame_size () == 0 ? 0 : 4)); \
1126 /* Output assembler code for a block containing the constant parts
1127 of a trampoline, leaving space for the variable parts. */
1129 /* On the 68k, the trampoline looks like this:
1133 WARNING: Targets that may run on 68040+ cpus must arrange for
1134 the instruction cache to be flushed. Previous incarnations of
1135 the m68k trampoline code attempted to get around this by either
1136 using an out-of-line transfer function or pc-relative data, but
1137 the fact remains that the code to jump to the transfer function
1138 or the code to load the pc-relative data needs to be flushed
1139 just as much as the "variable" portion of the trampoline.
1140 Recognizing that a cache flush is going to be required anyway,
1141 dispense with such notions and build a smaller trampoline. */
1143 /* Since more instructions are required to move a template into
1144 place than to create it on the spot, don't use a template. */
1146 /* Length in units of the trampoline for entering a nested function. */
1148 #define TRAMPOLINE_SIZE 12
1150 /* Alignment required for a trampoline in bits. */
1152 #define TRAMPOLINE_ALIGNMENT 16
1154 /* Targets redefine this to invoke code to either flush the cache,
1155 or enable stack execution (or both). */
1157 #ifndef FINALIZE_TRAMPOLINE
1158 #define FINALIZE_TRAMPOLINE(TRAMP)
1161 /* Emit RTL insns to initialize the variable parts of a trampoline.
1162 FNADDR is an RTX for the address of the function's pure code.
1163 CXT is an RTX for the static chain value for the function.
1165 We generate a two-instructions program at address TRAMP :
1169 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
1171 emit_move_insn (gen_rtx_MEM (HImode, TRAMP), GEN_INT(0x207C)); \
1172 emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 2)), CXT); \
1173 emit_move_insn (gen_rtx_MEM (HImode, plus_constant (TRAMP, 6)), \
1175 emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 8)), FNADDR); \
1176 FINALIZE_TRAMPOLINE(TRAMP); \
1179 /* This is the library routine that is used
1180 to transfer control from the trampoline
1181 to the actual nested function.
1182 It is defined for backward compatibility,
1183 for linking with object code that used the old
1184 trampoline definition. */
1186 /* A colon is used with no explicit operands
1187 to cause the template string to be scanned for %-constructs. */
1188 /* The function name __transfer_from_trampoline is not actually used.
1189 The function definition just permits use of "asm with operands"
1190 (though the operand list is empty). */
1191 #define TRANSFER_FROM_TRAMPOLINE \
1193 __transfer_from_trampoline () \
1195 register char *a0 asm ("%a0"); \
1196 asm (GLOBAL_ASM_OP "___trampoline"); \
1197 asm ("___trampoline:"); \
1198 asm volatile ("move%.l %0,%@" : : "m" (a0[22])); \
1199 asm volatile ("move%.l %1,%0" : "=a" (a0) : "m" (a0[18])); \
1203 /* Addressing modes, and classification of registers for them. */
1205 #define HAVE_POST_INCREMENT 1
1206 /* #define HAVE_POST_DECREMENT 0 */
1208 #define HAVE_PRE_DECREMENT 1
1209 /* #define HAVE_PRE_INCREMENT 0 */
1211 /* Macros to check register numbers against specific register classes. */
1213 /* These assume that REGNO is a hard or pseudo reg number.
1214 They give nonzero only if REGNO is a hard reg of the suitable class
1215 or a pseudo reg currently allocated to a suitable hard reg.
1216 Since they use reg_renumber, they are safe only once reg_renumber
1217 has been allocated, which happens in local-alloc.c. */
1219 #define REGNO_OK_FOR_INDEX_P(REGNO) \
1220 ((REGNO) < 16 || (unsigned) reg_renumber[REGNO] < 16)
1221 #define REGNO_OK_FOR_BASE_P(REGNO) \
1222 (((REGNO) ^ 010) < 8 || (unsigned) (reg_renumber[REGNO] ^ 010) < 8)
1223 #define REGNO_OK_FOR_DATA_P(REGNO) \
1224 ((REGNO) < 8 || (unsigned) reg_renumber[REGNO] < 8)
1225 #define REGNO_OK_FOR_FP_P(REGNO) \
1226 (((REGNO) ^ 020) < 8 || (unsigned) (reg_renumber[REGNO] ^ 020) < 8)
1227 #ifdef SUPPORT_SUN_FPA
1228 #define REGNO_OK_FOR_FPA_P(REGNO) \
1229 (((REGNO) >= 24 && (REGNO) < 56) || (reg_renumber[REGNO] >= 24 && reg_renumber[REGNO] < 56))
1232 /* Now macros that check whether X is a register and also,
1233 strictly, whether it is in a specified class.
1235 These macros are specific to the 68000, and may be used only
1236 in code for printing assembler insns and in conditions for
1237 define_optimization. */
1239 /* 1 if X is a data register. */
1241 #define DATA_REG_P(X) (REG_P (X) && REGNO_OK_FOR_DATA_P (REGNO (X)))
1243 /* 1 if X is an fp register. */
1245 #define FP_REG_P(X) (REG_P (X) && REGNO_OK_FOR_FP_P (REGNO (X)))
1247 /* 1 if X is an address register */
1249 #define ADDRESS_REG_P(X) (REG_P (X) && REGNO_OK_FOR_BASE_P (REGNO (X)))
1251 #ifdef SUPPORT_SUN_FPA
1252 /* 1 if X is a register in the Sun FPA. */
1253 #define FPA_REG_P(X) (REG_P (X) && REGNO_OK_FOR_FPA_P (REGNO (X)))
1255 /* Answer must be no if we don't have an FPA. */
1256 #define FPA_REG_P(X) 0
1259 /* Maximum number of registers that can appear in a valid memory address. */
1261 #define MAX_REGS_PER_ADDRESS 2
1263 /* Recognize any constant value that is a valid address. */
1265 #define CONSTANT_ADDRESS_P(X) \
1266 (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
1267 || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \
1268 || GET_CODE (X) == HIGH)
1270 /* Nonzero if the constant value X is a legitimate general operand.
1271 It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
1273 #define LEGITIMATE_CONSTANT_P(X) 1
1275 /* Nonzero if the constant value X is a legitimate general operand
1276 when generating PIC code. It is given that flag_pic is on and
1277 that X satisfies CONSTANT_P or is a CONST_DOUBLE.
1279 PCREL_GENERAL_OPERAND_OK makes reload accept addresses that are
1280 accepted by insn predicates, but which would otherwise fail the
1281 `general_operand' test. */
1283 #ifndef REG_OK_STRICT
1284 #define PCREL_GENERAL_OPERAND_OK 0
1286 #define PCREL_GENERAL_OPERAND_OK (TARGET_PCREL)
1289 #define LEGITIMATE_PIC_OPERAND_P(X) \
1290 ((! symbolic_operand (X, VOIDmode) \
1291 && ! (GET_CODE (X) == CONST_DOUBLE && mem_for_const_double (X) != 0 \
1292 && GET_CODE (mem_for_const_double (X)) == MEM \
1293 && symbolic_operand (XEXP (mem_for_const_double (X), 0), \
1295 || (GET_CODE (X) == SYMBOL_REF && SYMBOL_REF_FLAG (X)) \
1296 || PCREL_GENERAL_OPERAND_OK)
1298 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
1299 and check its validity for a certain class.
1300 We have two alternate definitions for each of them.
1301 The usual definition accepts all pseudo regs; the other rejects
1302 them unless they have been allocated suitable hard regs.
1303 The symbol REG_OK_STRICT causes the latter definition to be used.
1305 Most source files want to accept pseudo regs in the hope that
1306 they will get allocated to the class that the insn wants them to be in.
1307 Source files for reload pass need to be strict.
1308 After reload, it makes no difference, since pseudo regs have
1309 been eliminated by then. */
1311 #ifndef REG_OK_STRICT
1313 /* Nonzero if X is a hard reg that can be used as an index
1314 or if it is a pseudo reg. */
1315 #define REG_OK_FOR_INDEX_P(X) ((REGNO (X) ^ 020) >= 8)
1316 /* Nonzero if X is a hard reg that can be used as a base reg
1317 or if it is a pseudo reg. */
1318 #define REG_OK_FOR_BASE_P(X) ((REGNO (X) & ~027) != 0)
1322 /* Nonzero if X is a hard reg that can be used as an index. */
1323 #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
1324 /* Nonzero if X is a hard reg that can be used as a base reg. */
1325 #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
1329 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
1330 that is a valid memory address for an instruction.
1331 The MODE argument is the machine mode for the MEM expression
1332 that wants to use this address.
1334 When generating PIC, an address involving a SYMBOL_REF is legitimate
1335 if and only if it is the sum of pic_offset_table_rtx and the SYMBOL_REF.
1336 We use LEGITIMATE_PIC_OPERAND_P to throw out the illegitimate addresses,
1337 and we explicitly check for the sum of pic_offset_table_rtx and a SYMBOL_REF.
1339 Likewise for a LABEL_REF when generating PIC.
1341 The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS. */
1343 /* Allow SUBREG everywhere we allow REG. This results in better code. It
1344 also makes function inlining work when inline functions are called with
1345 arguments that are SUBREGs. */
1347 #define LEGITIMATE_BASE_REG_P(X) \
1348 ((GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) \
1349 || (GET_CODE (X) == SUBREG \
1350 && GET_CODE (SUBREG_REG (X)) == REG \
1351 && REG_OK_FOR_BASE_P (SUBREG_REG (X))))
1353 #define INDIRECTABLE_1_ADDRESS_P(X) \
1354 ((CONSTANT_ADDRESS_P (X) && (!flag_pic || LEGITIMATE_PIC_OPERAND_P (X))) \
1355 || LEGITIMATE_BASE_REG_P (X) \
1356 || ((GET_CODE (X) == PRE_DEC || GET_CODE (X) == POST_INC) \
1357 && LEGITIMATE_BASE_REG_P (XEXP (X, 0))) \
1358 || (GET_CODE (X) == PLUS \
1359 && LEGITIMATE_BASE_REG_P (XEXP (X, 0)) \
1360 && GET_CODE (XEXP (X, 1)) == CONST_INT \
1362 || ((unsigned) INTVAL (XEXP (X, 1)) + 0x8000) < 0x10000)) \
1363 || (GET_CODE (X) == PLUS && XEXP (X, 0) == pic_offset_table_rtx \
1364 && flag_pic && GET_CODE (XEXP (X, 1)) == SYMBOL_REF) \
1365 || (GET_CODE (X) == PLUS && XEXP (X, 0) == pic_offset_table_rtx \
1366 && flag_pic && GET_CODE (XEXP (X, 1)) == LABEL_REF))
1368 #define GO_IF_NONINDEXED_ADDRESS(X, ADDR) \
1369 { if (INDIRECTABLE_1_ADDRESS_P (X)) goto ADDR; }
1371 /* Only labels on dispatch tables are valid for indexing from. */
1372 #define GO_IF_INDEXABLE_BASE(X, ADDR) \
1374 if (GET_CODE (X) == LABEL_REF \
1375 && (temp = next_nonnote_insn (XEXP (X, 0))) != 0 \
1376 && GET_CODE (temp) == JUMP_INSN \
1377 && (GET_CODE (PATTERN (temp)) == ADDR_VEC \
1378 || GET_CODE (PATTERN (temp)) == ADDR_DIFF_VEC)) \
1380 if (LEGITIMATE_BASE_REG_P (X)) goto ADDR; }
1382 #define GO_IF_INDEXING(X, ADDR) \
1383 { if (GET_CODE (X) == PLUS && LEGITIMATE_INDEX_P (XEXP (X, 0))) \
1384 { GO_IF_INDEXABLE_BASE (XEXP (X, 1), ADDR); } \
1385 if (GET_CODE (X) == PLUS && LEGITIMATE_INDEX_P (XEXP (X, 1))) \
1386 { GO_IF_INDEXABLE_BASE (XEXP (X, 0), ADDR); } }
1388 #define GO_IF_INDEXED_ADDRESS(X, ADDR) \
1389 { GO_IF_INDEXING (X, ADDR); \
1390 if (GET_CODE (X) == PLUS) \
1391 { if (GET_CODE (XEXP (X, 1)) == CONST_INT \
1392 && (TARGET_68020 || (unsigned) INTVAL (XEXP (X, 1)) + 0x80 < 0x100)) \
1393 { rtx go_temp = XEXP (X, 0); GO_IF_INDEXING (go_temp, ADDR); } \
1394 if (GET_CODE (XEXP (X, 0)) == CONST_INT \
1395 && (TARGET_68020 || (unsigned) INTVAL (XEXP (X, 0)) + 0x80 < 0x100)) \
1396 { rtx go_temp = XEXP (X, 1); GO_IF_INDEXING (go_temp, ADDR); } } }
1398 /* coldfire/5200 does not allow HImode index registers. */
1399 #define LEGITIMATE_INDEX_REG_P(X) \
1400 ((GET_CODE (X) == REG && REG_OK_FOR_INDEX_P (X)) \
1402 && GET_CODE (X) == SIGN_EXTEND \
1403 && GET_CODE (XEXP (X, 0)) == REG \
1404 && GET_MODE (XEXP (X, 0)) == HImode \
1405 && REG_OK_FOR_INDEX_P (XEXP (X, 0))) \
1406 || (GET_CODE (X) == SUBREG \
1407 && GET_CODE (SUBREG_REG (X)) == REG \
1408 && REG_OK_FOR_INDEX_P (SUBREG_REG (X))))
1410 #define LEGITIMATE_INDEX_P(X) \
1411 (LEGITIMATE_INDEX_REG_P (X) \
1412 || ((TARGET_68020 || TARGET_5200) && GET_CODE (X) == MULT \
1413 && LEGITIMATE_INDEX_REG_P (XEXP (X, 0)) \
1414 && GET_CODE (XEXP (X, 1)) == CONST_INT \
1415 && (INTVAL (XEXP (X, 1)) == 2 \
1416 || INTVAL (XEXP (X, 1)) == 4 \
1417 || (INTVAL (XEXP (X, 1)) == 8 && !TARGET_5200))))
1419 /* If pic, we accept INDEX+LABEL, which is what do_tablejump makes. */
1420 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
1421 { GO_IF_NONINDEXED_ADDRESS (X, ADDR); \
1422 GO_IF_INDEXED_ADDRESS (X, ADDR); \
1423 if (flag_pic && MODE == CASE_VECTOR_MODE && GET_CODE (X) == PLUS \
1424 && LEGITIMATE_INDEX_P (XEXP (X, 0)) \
1425 && GET_CODE (XEXP (X, 1)) == LABEL_REF) \
1428 /* Don't call memory_address_noforce for the address to fetch
1429 the switch offset. This address is ok as it stands (see above),
1430 but memory_address_noforce would alter it. */
1431 #define PIC_CASE_VECTOR_ADDRESS(index) index
1433 /* Try machine-dependent ways of modifying an illegitimate address
1434 to be legitimate. If we find one, return the new, valid address.
1435 This macro is used in only one place: `memory_address' in explow.c.
1437 OLDX is the address as it was before break_out_memory_refs was called.
1438 In some cases it is useful to look at this to decide what needs to be done.
1440 MODE and WIN are passed so that this macro can use
1441 GO_IF_LEGITIMATE_ADDRESS.
1443 It is always safe for this macro to do nothing. It exists to recognize
1444 opportunities to optimize the output.
1446 For the 68000, we handle X+REG by loading X into a register R and
1447 using R+REG. R will go in an address reg and indexing will be used.
1448 However, if REG is a broken-out memory address or multiplication,
1449 nothing needs to be done because REG can certainly go in an address reg. */
1451 #define COPY_ONCE(Y) if (!copied) { Y = copy_rtx (Y); copied = ch = 1; }
1452 #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
1453 { register int ch = (X) != (OLDX); \
1454 if (GET_CODE (X) == PLUS) \
1456 if (GET_CODE (XEXP (X, 0)) == MULT) \
1457 { COPY_ONCE (X); XEXP (X, 0) = force_operand (XEXP (X, 0), 0);} \
1458 if (GET_CODE (XEXP (X, 1)) == MULT) \
1459 { COPY_ONCE (X); XEXP (X, 1) = force_operand (XEXP (X, 1), 0);} \
1460 if (ch && GET_CODE (XEXP (X, 1)) == REG \
1461 && GET_CODE (XEXP (X, 0)) == REG) \
1463 if (ch) { GO_IF_LEGITIMATE_ADDRESS (MODE, X, WIN); } \
1464 if (GET_CODE (XEXP (X, 0)) == REG \
1465 || (GET_CODE (XEXP (X, 0)) == SIGN_EXTEND \
1466 && GET_CODE (XEXP (XEXP (X, 0), 0)) == REG \
1467 && GET_MODE (XEXP (XEXP (X, 0), 0)) == HImode)) \
1468 { register rtx temp = gen_reg_rtx (Pmode); \
1469 register rtx val = force_operand (XEXP (X, 1), 0); \
1470 emit_move_insn (temp, val); \
1472 XEXP (X, 1) = temp; \
1474 else if (GET_CODE (XEXP (X, 1)) == REG \
1475 || (GET_CODE (XEXP (X, 1)) == SIGN_EXTEND \
1476 && GET_CODE (XEXP (XEXP (X, 1), 0)) == REG \
1477 && GET_MODE (XEXP (XEXP (X, 1), 0)) == HImode)) \
1478 { register rtx temp = gen_reg_rtx (Pmode); \
1479 register rtx val = force_operand (XEXP (X, 0), 0); \
1480 emit_move_insn (temp, val); \
1482 XEXP (X, 0) = temp; \
1485 /* Go to LABEL if ADDR (a legitimate address expression)
1486 has an effect that depends on the machine mode it is used for.
1487 On the 68000, only predecrement and postincrement address depend thus
1488 (the amount of decrement or increment being the length of the operand). */
1490 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
1491 if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == PRE_DEC) goto LABEL
1493 /* Specify the machine mode that this machine uses
1494 for the index in the tablejump instruction. */
1495 #define CASE_VECTOR_MODE HImode
1497 /* Define as C expression which evaluates to nonzero if the tablejump
1498 instruction expects the table to contain offsets from the address of the
1500 Do not define this if the table should contain absolute addresses. */
1501 #define CASE_VECTOR_PC_RELATIVE 1
1503 /* Define this as 1 if `char' should by default be signed; else as 0. */
1504 #define DEFAULT_SIGNED_CHAR 1
1506 /* Don't cse the address of the function being compiled. */
1507 #define NO_RECURSIVE_FUNCTION_CSE
1509 /* Max number of bytes we can move from memory to memory
1510 in one reasonably fast instruction. */
1513 /* Nonzero if access to memory by bytes is slow and undesirable. */
1514 #define SLOW_BYTE_ACCESS 0
1516 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
1517 is done just by pretending it is already truncated. */
1518 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
1520 /* We assume that the store-condition-codes instructions store 0 for false
1521 and some other value for true. This is the value stored for true. */
1523 #define STORE_FLAG_VALUE (-1)
1525 /* When a prototype says `char' or `short', really pass an `int'. */
1526 #define PROMOTE_PROTOTYPES 1
1528 /* Specify the machine mode that pointers have.
1529 After generation of rtl, the compiler makes no further distinction
1530 between pointers and any other objects of this machine mode. */
1531 #define Pmode SImode
1533 /* A function address in a call instruction
1534 is a byte address (for indexing purposes)
1535 so give the MEM rtx a byte's mode. */
1536 #define FUNCTION_MODE QImode
1538 /* Compute the cost of computing a constant rtl expression RTX
1539 whose rtx-code is CODE. The body of this macro is a portion
1540 of a switch statement. If the code is computed here,
1541 return it with a return statement. Otherwise, break from the switch. */
1543 #define CONST_COSTS(RTX,CODE,OUTER_CODE) \
1545 /* Constant zero is super cheap due to clr instruction. */ \
1546 if (RTX == const0_rtx) return 0; \
1547 /* if ((OUTER_CODE) == SET) */ \
1548 return const_int_cost(RTX); \
1553 case CONST_DOUBLE: \
1554 /* Make 0.0 cheaper than other floating constants to \
1555 encourage creating tstsf and tstdf insns. */ \
1556 if ((OUTER_CODE) == COMPARE \
1557 && ((RTX) == CONST0_RTX (SFmode) \
1558 || (RTX) == CONST0_RTX (DFmode))) \
1562 /* Compute the cost of various arithmetic operations.
1563 These are vaguely right for a 68020. */
1564 /* The costs for long multiply have been adjusted to
1565 work properly in synth_mult on the 68020,
1566 relative to an average of the time for add and the time for shift,
1567 taking away a little more because sometimes move insns are needed. */
1568 /* div?.w is relatively cheaper on 68000 counted in COSTS_N_INSNS terms. */
1569 #define MULL_COST (TARGET_68060 ? 2 : TARGET_68040 ? 5 : 13)
1570 #define MULW_COST (TARGET_68060 ? 2 : TARGET_68040 ? 3 : TARGET_68020 ? 8 : 5)
1571 #define DIVW_COST (TARGET_68020 ? 27 : 12)
1573 #define RTX_COSTS(X,CODE,OUTER_CODE) \
1575 /* An lea costs about three times as much as a simple add. */ \
1576 if (GET_MODE (X) == SImode \
1577 && GET_CODE (XEXP (X, 1)) == REG \
1578 && GET_CODE (XEXP (X, 0)) == MULT \
1579 && GET_CODE (XEXP (XEXP (X, 0), 0)) == REG \
1580 && GET_CODE (XEXP (XEXP (X, 0), 1)) == CONST_INT \
1581 && (INTVAL (XEXP (XEXP (X, 0), 1)) == 2 \
1582 || INTVAL (XEXP (XEXP (X, 0), 1)) == 4 \
1583 || INTVAL (XEXP (XEXP (X, 0), 1)) == 8)) \
1584 return COSTS_N_INSNS (3); /* lea an@(dx:l:i),am */ \
1590 return COSTS_N_INSNS(1); \
1591 if (! TARGET_68020) \
1593 if (GET_CODE (XEXP (X, 1)) == CONST_INT) \
1595 if (INTVAL (XEXP (X, 1)) < 16) \
1596 return COSTS_N_INSNS (2) + INTVAL (XEXP (X, 1)) / 2; \
1598 /* We're using clrw + swap for these cases. */ \
1599 return COSTS_N_INSNS (4) + (INTVAL (XEXP (X, 1)) - 16) / 2; \
1601 return COSTS_N_INSNS (10); /* worst case */ \
1603 /* A shift by a big integer takes an extra instruction. */ \
1604 if (GET_CODE (XEXP (X, 1)) == CONST_INT \
1605 && (INTVAL (XEXP (X, 1)) == 16)) \
1606 return COSTS_N_INSNS (2); /* clrw;swap */ \
1607 if (GET_CODE (XEXP (X, 1)) == CONST_INT \
1608 && !(INTVAL (XEXP (X, 1)) > 0 \
1609 && INTVAL (XEXP (X, 1)) <= 8)) \
1610 return COSTS_N_INSNS (3); /* lsr #i,dn */ \
1613 if ((GET_CODE (XEXP (X, 0)) == ZERO_EXTEND \
1614 || GET_CODE (XEXP (X, 0)) == SIGN_EXTEND) \
1615 && GET_MODE (X) == SImode) \
1616 return COSTS_N_INSNS (MULW_COST); \
1617 if (GET_MODE (X) == QImode || GET_MODE (X) == HImode) \
1618 return COSTS_N_INSNS (MULW_COST); \
1620 return COSTS_N_INSNS (MULL_COST); \
1625 if (GET_MODE (X) == QImode || GET_MODE (X) == HImode) \
1626 return COSTS_N_INSNS (DIVW_COST); /* div.w */ \
1627 return COSTS_N_INSNS (43); /* div.l */
1629 /* Tell final.c how to eliminate redundant test instructions. */
1631 /* Here we define machine-dependent flags and fields in cc_status
1632 (see `conditions.h'). */
1634 /* Set if the cc value is actually in the 68881, so a floating point
1635 conditional branch must be output. */
1636 #define CC_IN_68881 04000
1638 /* Store in cc_status the expressions that the condition codes will
1639 describe after execution of an instruction whose pattern is EXP.
1640 Do not alter them if the instruction would not alter the cc's. */
1642 /* On the 68000, all the insns to store in an address register fail to
1643 set the cc's. However, in some cases these instructions can make it
1644 possibly invalid to use the saved cc's. In those cases we clear out
1645 some or all of the saved cc's so they won't be used. */
1647 #define NOTICE_UPDATE_CC(EXP,INSN) notice_update_cc (EXP, INSN)
1649 #define OUTPUT_JUMP(NORMAL, FLOAT, NO_OV) \
1650 { if (cc_prev_status.flags & CC_IN_68881) \
1652 if (cc_prev_status.flags & CC_NO_OVERFLOW) \
1656 /* Control the assembler format that we output. */
1658 /* Output at beginning of assembler file. */
1660 #define ASM_FILE_START(FILE) \
1661 fprintf (FILE, "#NO_APP\n");
1663 /* Output to assembler file text saying following lines
1664 may contain character constants, extra white space, comments, etc. */
1666 #define ASM_APP_ON "#APP\n"
1668 /* Output to assembler file text saying following lines
1669 no longer contain unusual constructs. */
1671 #define ASM_APP_OFF "#NO_APP\n"
1673 /* Output before read-only data. */
1675 #define TEXT_SECTION_ASM_OP "\t.text"
1677 /* Output before writable data. */
1679 #define DATA_SECTION_ASM_OP "\t.data"
1681 /* Here are four prefixes that are used by asm_fprintf to
1682 facilitate customization for alternate assembler syntaxes.
1683 Machines with no likelihood of an alternate syntax need not
1684 define these and need not use asm_fprintf. */
1686 /* The prefix for register names. Note that REGISTER_NAMES
1687 is supposed to include this prefix. */
1689 #define REGISTER_PREFIX ""
1691 /* The prefix for local labels. You should be able to define this as
1692 an empty string, or any arbitrary string (such as ".", ".L%", etc)
1693 without having to make any other changes to account for the specific
1694 definition. Note it is a string literal, not interpreted by printf
1697 #define LOCAL_LABEL_PREFIX ""
1699 /* The prefix to add to user-visible assembler symbols. */
1701 #define USER_LABEL_PREFIX "_"
1703 /* The prefix for immediate operands. */
1705 #define IMMEDIATE_PREFIX "#"
1707 /* How to refer to registers in assembler output.
1708 This sequence is indexed by compiler's hard-register-number (see above). */
1710 #ifndef SUPPORT_SUN_FPA
1712 #define REGISTER_NAMES \
1713 {"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", \
1714 "a0", "a1", "a2", "a3", "a4", "a5", "a6", "sp", \
1715 "fp0", "fp1", "fp2", "fp3", "fp4", "fp5", "fp6", "fp7" }
1717 #else /* SUPPORTED_SUN_FPA */
1719 #define REGISTER_NAMES \
1720 {"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", \
1721 "a0", "a1", "a2", "a3", "a4", "a5", "a6", "sp", \
1722 "fp0", "fp1", "fp2", "fp3", "fp4", "fp5", "fp6", "fp7", \
1723 "fpa0", "fpa1", "fpa2", "fpa3", "fpa4", "fpa5", "fpa6", "fpa7", \
1724 "fpa8", "fpa9", "fpa10", "fpa11", "fpa12", "fpa13", "fpa14", "fpa15", \
1725 "fpa16", "fpa17", "fpa18", "fpa19", "fpa20", "fpa21", "fpa22", "fpa23", \
1726 "fpa24", "fpa25", "fpa26", "fpa27", "fpa28", "fpa29", "fpa30", "fpa31" }
1728 #endif /* defined SUPPORT_SUN_FPA */
1730 /* How to renumber registers for dbx and gdb.
1731 On the Sun-3, the floating point registers have numbers
1732 18 to 25, not 16 to 23 as they do in the compiler. */
1734 #define DBX_REGISTER_NUMBER(REGNO) ((REGNO) < 16 ? (REGNO) : (REGNO) + 2)
1736 /* Before the prologue, RA is at 0(%sp). */
1737 #define INCOMING_RETURN_ADDR_RTX \
1738 gen_rtx_MEM (VOIDmode, gen_rtx_REG (VOIDmode, STACK_POINTER_REGNUM))
1740 /* We must not use the DBX register numbers for the DWARF 2 CFA column
1741 numbers because that maps to numbers beyond FIRST_PSEUDO_REGISTER.
1742 Instead use the identity mapping. */
1743 #define DWARF_FRAME_REGNUM(REG) REG
1745 /* Before the prologue, the top of the frame is at 4(%sp). */
1746 #define INCOMING_FRAME_SP_OFFSET 4
1748 /* This is how to output the definition of a user-level label named NAME,
1749 such as the label on a static function or variable NAME. */
1751 #define ASM_OUTPUT_LABEL(FILE,NAME) \
1752 do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
1754 /* This is how to output a command to make the user-level label named NAME
1755 defined for reference from other files. */
1757 #define GLOBAL_ASM_OP "\t.globl\t"
1758 #define ASM_GLOBALIZE_LABEL(FILE,NAME) \
1759 do { fprintf (FILE, "%s", GLOBAL_ASM_OP); \
1760 assemble_name (FILE, NAME); \
1761 fputs ("\n", FILE);} while (0)
1763 /* This is how to output a reference to a user-level label named NAME.
1764 `assemble_name' uses this. */
1766 #define ASM_OUTPUT_LABELREF(FILE,NAME) \
1767 asm_fprintf (FILE, "%0U%s", NAME)
1769 /* This is how to output an internal numbered label where
1770 PREFIX is the class of label and NUM is the number within the class. */
1772 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
1773 asm_fprintf (FILE, "%0L%s%d:\n", PREFIX, NUM)
1775 /* This is how to store into the string LABEL
1776 the symbol_ref name of an internal numbered label where
1777 PREFIX is the class of label and NUM is the number within the class.
1778 This is suitable for output with `assemble_name'. */
1780 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
1781 sprintf (LABEL, "*%s%s%ld", LOCAL_LABEL_PREFIX, PREFIX, (long)(NUM))
1783 /* This is how to output an insn to push a register on the stack.
1784 It need not be very fast code. */
1786 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
1787 asm_fprintf (FILE, "\tmovel %s,%Rsp@-\n", reg_names[REGNO])
1789 /* This is how to output an insn to pop a register from the stack.
1790 It need not be very fast code. */
1792 #define ASM_OUTPUT_REG_POP(FILE,REGNO) \
1793 asm_fprintf (FILE, "\tmovel %Rsp@+,%s\n", reg_names[REGNO])
1795 /* This is how to output an element of a case-vector that is absolute.
1796 (The 68000 does not use such vectors,
1797 but we must define this macro anyway.) */
1799 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
1800 asm_fprintf (FILE, "\t.long %LL%d\n", VALUE)
1802 /* This is how to output an element of a case-vector that is relative. */
1804 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
1805 asm_fprintf (FILE, "\t.word %LL%d-%LL%d\n", VALUE, REL)
1807 /* This is how to output an assembler line
1808 that says to advance the location counter
1809 to a multiple of 2**LOG bytes. */
1811 /* We don't have a way to align to more than a two-byte boundary, so do the
1812 best we can and don't complain. */
1813 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
1815 fprintf (FILE, "\t.even\n");
1817 #define ASM_OUTPUT_SKIP(FILE,SIZE) \
1818 fprintf (FILE, "\t.skip %u\n", (SIZE))
1820 /* This says how to output an assembler line
1821 to define a global common symbol. */
1823 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
1824 ( fputs (".comm ", (FILE)), \
1825 assemble_name ((FILE), (NAME)), \
1826 fprintf ((FILE), ",%u\n", (ROUNDED)))
1828 /* This says how to output an assembler line
1829 to define a local common symbol. */
1831 #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
1832 ( fputs (".lcomm ", (FILE)), \
1833 assemble_name ((FILE), (NAME)), \
1834 fprintf ((FILE), ",%u\n", (ROUNDED)))
1836 /* Store in OUTPUT a string (made with alloca) containing
1837 an assembler-name for a local static variable named NAME.
1838 LABELNO is an integer which is different for each call. */
1840 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
1841 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
1842 sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
1844 /* Output a float value (represented as a C double) as an immediate operand.
1845 This macro is a 68k-specific macro. */
1847 #define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE) \
1852 REAL_VALUE_TO_DECIMAL (VALUE, "%.9g", dstr); \
1853 asm_fprintf ((FILE), "%I0r%s", dstr); \
1858 REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
1859 asm_fprintf ((FILE), "%I0x%lx", l); \
1863 /* Output a double value (represented as a C double) as an immediate operand.
1864 This macro is a 68k-specific macro. */
1865 #define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE) \
1866 do { char dstr[30]; \
1867 REAL_VALUE_TO_DECIMAL (VALUE, "%.20g", dstr); \
1868 asm_fprintf (FILE, "%I0r%s", dstr); \
1871 /* Note, long double immediate operands are not actually
1872 generated by m68k.md. */
1873 #define ASM_OUTPUT_LONG_DOUBLE_OPERAND(FILE,VALUE) \
1874 do { char dstr[30]; \
1875 REAL_VALUE_TO_DECIMAL (VALUE, "%.20g", dstr); \
1876 asm_fprintf (FILE, "%I0r%s", dstr); \
1879 /* Print operand X (an rtx) in assembler syntax to file FILE.
1880 CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
1881 For `%' followed by punctuation, CODE is the punctuation and X is null.
1883 On the 68000, we use several CODE characters:
1884 '.' for dot needed in Motorola-style opcode names.
1885 '-' for an operand pushing on the stack:
1886 sp@-, -(sp) or -(%sp) depending on the style of syntax.
1887 '+' for an operand pushing on the stack:
1888 sp@+, (sp)+ or (%sp)+ depending on the style of syntax.
1889 '@' for a reference to the top word on the stack:
1890 sp@, (sp) or (%sp) depending on the style of syntax.
1891 '#' for an immediate operand prefix (# in MIT and Motorola syntax
1892 but & in SGS syntax).
1893 '!' for the fpcr register (used in some float-to-fixed conversions).
1894 '$' for the letter `s' in an op code, but only on the 68040.
1895 '&' for the letter `d' in an op code, but only on the 68040.
1896 '/' for register prefix needed by longlong.h.
1898 'b' for byte insn (no effect, on the Sun; this is for the ISI).
1899 'd' to force memory addressing to be absolute, not relative.
1900 'f' for float insn (print a CONST_DOUBLE as a float rather than in hex)
1901 'o' for operands to go directly to output_operand_address (bypassing
1902 print_operand_address--used only for SYMBOL_REFs under TARGET_PCREL)
1903 'w' for FPA insn (print a CONST_DOUBLE as a SunFPA constant rather
1904 than directly). Second part of 'y' below.
1905 'x' for float insn (print a CONST_DOUBLE as a float rather than in hex),
1906 or print pair of registers as rx:ry.
1907 'y' for a FPA insn (print pair of registers as rx:ry). This also outputs
1908 CONST_DOUBLE's as SunFPA constant RAM registers if
1909 possible, so it should not be used except for the SunFPA. */
1911 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
1912 ((CODE) == '.' || (CODE) == '#' || (CODE) == '-' \
1913 || (CODE) == '+' || (CODE) == '@' || (CODE) == '!' \
1914 || (CODE) == '$' || (CODE) == '&' || (CODE) == '/')
1916 /* A C compound statement to output to stdio stream STREAM the
1917 assembler syntax for an instruction operand X. X is an RTL
1920 CODE is a value that can be used to specify one of several ways
1921 of printing the operand. It is used when identical operands
1922 must be printed differently depending on the context. CODE
1923 comes from the `%' specification that was used to request
1924 printing of the operand. If the specification was just `%DIGIT'
1925 then CODE is 0; if the specification was `%LTR DIGIT' then CODE
1926 is the ASCII code for LTR.
1928 If X is a register, this macro should print the register's name.
1929 The names can be found in an array `reg_names' whose type is
1930 `char *[]'. `reg_names' is initialized from `REGISTER_NAMES'.
1932 When the machine description has a specification `%PUNCT' (a `%'
1933 followed by a punctuation character), this macro is called with
1934 a null pointer for X and the punctuation character for CODE.
1936 See m68k.c for the m68k specific codes. */
1938 #define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
1940 /* A C compound statement to output to stdio stream STREAM the
1941 assembler syntax for an instruction operand that is a memory
1942 reference whose address is ADDR. ADDR is an RTL expression.
1944 On some machines, the syntax for a symbolic address depends on
1945 the section that the address refers to. On these machines,
1946 define the macro `ENCODE_SECTION_INFO' to store the information
1947 into the `symbol_ref', and then check for it here. */
1949 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
1951 /* Variables in m68k.c */
1952 extern const char *m68k_align_loops_string;
1953 extern const char *m68k_align_jumps_string;
1954 extern const char *m68k_align_funcs_string;
1955 extern int m68k_align_loops;
1956 extern int m68k_align_jumps;
1957 extern int m68k_align_funcs;
1958 extern int m68k_last_compare_had_fp_operands;