1 /* Definitions of target machine for GNU compiler. Sun 68000/68020 version.
2 Copyright (C) 1987, 88, 93-97, 1998 Free Software Foundation, Inc.
4 This file is part of GNU CC.
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING. If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
22 /* Note that some other tm.h files include this one and then override
23 many of the definitions that relate to assembler syntax. */
26 /* Names to predefine in the preprocessor for this target machine. */
28 /* See sun3.h, sun2.h, isi.h for different CPP_PREDEFINES. */
30 /* Print subsidiary information on the compiler version in use. */
32 #define TARGET_VERSION fprintf (stderr, " (68k, Motorola syntax)");
34 #define TARGET_VERSION fprintf (stderr, " (68k, MIT syntax)");
37 /* Define SUPPORT_SUN_FPA to include support for generating code for
38 the Sun Floating Point Accelerator, an optional product for Sun 3
39 machines. By default, it is not defined. Avoid defining it unless
40 you need to output code for the Sun3+FPA architecture, as it has the
41 effect of slowing down the register set operations in hard-reg-set.h
42 (total number of registers will exceed number of bits in a long,
43 if defined, causing the set operations to expand to loops).
44 SUPPORT_SUN_FPA is typically defined in sun3.h. */
46 /* Run-time compilation parameters selecting different hardware subsets. */
48 extern int target_flags;
50 /* Macros used in the machine description to test the flags. */
52 /* Compile for a 68020 (not a 68000 or 68010). */
54 #define TARGET_68020 (target_flags & MASK_68020)
56 /* Compile 68881 insns for floating point (not library calls). */
58 #define TARGET_68881 (target_flags & MASK_68881)
60 /* Compile using 68020 bitfield insns. */
61 #define MASK_BITFIELD 4
62 #define TARGET_BITFIELD (target_flags & MASK_BITFIELD)
64 /* Compile using rtd insn calling sequence.
65 This will not work unless you use prototypes at least
66 for all functions that can take varying numbers of args. */
68 #define TARGET_RTD (target_flags & MASK_RTD)
70 /* Compile passing first two args in regs 0 and 1.
71 This exists only to test compiler features that will
72 be needed for RISC chips. It is not usable
73 and is not intended to be usable on this cpu. */
74 #define MASK_REGPARM 16
75 #define TARGET_REGPARM (target_flags & MASK_REGPARM)
77 /* Compile with 16-bit `int'. */
79 #define TARGET_SHORT (target_flags & MASK_SHORT)
81 /* Compile with special insns for Sun FPA. */
83 #define TARGET_FPA (target_flags & MASK_FPA)
85 /* Compile (actually, link) for Sun SKY board. */
87 #define TARGET_SKY (target_flags & MASK_SKY)
89 /* Optimize for 68040, but still allow execution on 68020
90 (-m68020-40 or -m68040).
91 The 68040 will execute all 68030 and 68881/2 instructions, but some
92 of them must be emulated in software by the OS. When TARGET_68040 is
93 turned on, these instructions won't be used. This code will still
94 run on a 68030 and 68881/2. */
95 #define MASK_68040 256
96 #define TARGET_68040 (target_flags & MASK_68040)
98 /* Use the 68040-only fp instructions (-m68040 or -m68060). */
99 #define MASK_68040_ONLY 512
100 #define TARGET_68040_ONLY (target_flags & MASK_68040_ONLY)
102 /* Optimize for 68060, but still allow execution on 68020
103 (-m68020-60 or -m68060).
104 The 68060 will execute all 68030 and 68881/2 instructions, but some
105 of them must be emulated in software by the OS. When TARGET_68060 is
106 turned on, these instructions won't be used. This code will still
107 run on a 68030 and 68881/2. */
108 #define MASK_68060 1024
109 #define TARGET_68060 (target_flags & MASK_68060)
111 /* Compile for mcf5200 */
112 #define MASK_5200 2048
113 #define TARGET_5200 (target_flags & MASK_5200)
115 /* Align ints to a word boundary. This breaks compatibility with the
116 published ABI's for structures containing ints, but produces faster
117 code on cpus with 32 bit busses (020, 030, 040, 060, CPU32+, coldfire).
118 It's required for coldfire cpus without a misalignment module. */
119 #define MASK_ALIGN_INT 4096
120 #define TARGET_ALIGN_INT (target_flags & MASK_ALIGN_INT)
122 /* Compile for a CPU32 */
123 /* A 68020 without bitfields is a good heuristic for a CPU32 */
124 #define TARGET_CPU32 (TARGET_68020 && !TARGET_BITFIELD)
126 /* Macro to define tables used to set the flags.
127 This is a list in braces of pairs in braces,
128 each pair being { "NAME", VALUE }
129 where VALUE is the bits to set or minus the bits to clear.
130 An empty string NAME is used to identify the default VALUE. */
132 #define TARGET_SWITCHES \
133 { { "68020", - (MASK_5200|MASK_68060|MASK_68040|MASK_68040_ONLY)}, \
134 { "c68020", - (MASK_5200|MASK_68060|MASK_68040|MASK_68040_ONLY)}, \
135 { "68020", (MASK_68020|MASK_BITFIELD)}, \
136 { "c68020", (MASK_68020|MASK_BITFIELD)}, \
137 { "68000", - (MASK_5200|MASK_68060|MASK_68040|MASK_68040_ONLY \
138 |MASK_68020|MASK_BITFIELD|MASK_68881)}, \
139 { "c68000", - (MASK_5200|MASK_68060|MASK_68040|MASK_68040_ONLY \
140 |MASK_68020|MASK_BITFIELD|MASK_68881)}, \
141 { "bitfield", MASK_BITFIELD}, \
142 { "nobitfield", - MASK_BITFIELD}, \
143 { "rtd", MASK_RTD}, \
144 { "nortd", - MASK_RTD}, \
145 { "short", MASK_SHORT}, \
146 { "noshort", - MASK_SHORT}, \
147 { "fpa", -(MASK_SKY|MASK_68040_ONLY|MASK_68881)}, \
148 { "fpa", MASK_FPA}, \
149 { "nofpa", - MASK_FPA}, \
150 { "sky", -(MASK_FPA|MASK_68040_ONLY|MASK_68881)}, \
151 { "sky", MASK_SKY}, \
152 { "nosky", - MASK_SKY}, \
153 { "68881", - (MASK_FPA|MASK_SKY)}, \
154 { "68881", MASK_68881}, \
155 { "soft-float", - (MASK_FPA|MASK_SKY|MASK_68040_ONLY|MASK_68881)}, \
156 { "68020-40", -(MASK_5200|MASK_68060|MASK_68040_ONLY)}, \
157 { "68020-40", (MASK_BITFIELD|MASK_68881|MASK_68020|MASK_68040)}, \
158 { "68020-60", -(MASK_5200|MASK_68040_ONLY)}, \
159 { "68020-60", (MASK_BITFIELD|MASK_68881|MASK_68020|MASK_68040 \
161 { "68030", - (MASK_5200|MASK_68060|MASK_68040|MASK_68040_ONLY)}, \
162 { "68030", (MASK_68020|MASK_BITFIELD)}, \
163 { "68040", - (MASK_5200|MASK_68060)}, \
164 { "68040", (MASK_68020|MASK_68881|MASK_BITFIELD \
165 |MASK_68040_ONLY|MASK_68040)}, \
166 { "68060", - (MASK_5200|MASK_68040)}, \
167 { "68060", (MASK_68020|MASK_68881|MASK_BITFIELD \
168 |MASK_68040_ONLY|MASK_68060)}, \
169 { "5200", - (MASK_68060|MASK_68040|MASK_68040_ONLY|MASK_68020 \
170 |MASK_BITFIELD|MASK_68881)}, \
171 { "5200", (MASK_5200)}, \
174 { "68302", - (MASK_5200|MASK_68060|MASK_68040|MASK_68040_ONLY \
175 |MASK_68020|MASK_BITFIELD|MASK_68881)}, \
176 { "68332", - (MASK_5200|MASK_68060|MASK_68040|MASK_68040_ONLY \
177 |MASK_BITFIELD|MASK_68881)}, \
178 { "68332", MASK_68020}, \
179 { "cpu32", - (MASK_5200|MASK_68060|MASK_68040|MASK_68040_ONLY \
180 |MASK_BITFIELD|MASK_68881)}, \
181 { "cpu32", MASK_68020}, \
182 { "align-int", MASK_ALIGN_INT }, \
183 { "no-align-int", -MASK_ALIGN_INT }, \
185 { "", TARGET_DEFAULT}}
186 /* TARGET_DEFAULT is defined in sun*.h and isi.h, etc. */
188 /* This macro is similar to `TARGET_SWITCHES' but defines names of
189 command options that have values. Its definition is an
190 initializer with a subgrouping for each command option.
192 Each subgrouping contains a string constant, that defines the
193 fixed part of the option name, and the address of a variable. The
194 variable, type `char *', is set to the variable part of the given
195 option if the fixed part matches. The actual option name is made
196 by appending `-m' to the specified name. */
197 #define TARGET_OPTIONS \
198 { { "align-loops=", &m68k_align_loops_string }, \
199 { "align-jumps=", &m68k_align_jumps_string }, \
200 { "align-functions=", &m68k_align_funcs_string }, \
204 /* Sometimes certain combinations of command options do not make
205 sense on a particular target machine. You can define a macro
206 `OVERRIDE_OPTIONS' to take account of this. This macro, if
207 defined, is executed once just after all the command options have
210 Don't use this macro to turn on various extra optimizations for
211 `-O'. That is what `OPTIMIZATION_OPTIONS' is for. */
213 #define OVERRIDE_OPTIONS \
215 override_options(); \
216 if (! TARGET_68020 && flag_pic == 2) \
217 error("-fPIC is not currently supported on the 68000 or 68010\n"); \
218 SUBTARGET_OVERRIDE_OPTIONS; \
221 /* These are meant to be redefined in the host dependent files */
222 #define SUBTARGET_SWITCHES
223 #define SUBTARGET_OPTIONS
224 #define SUBTARGET_OVERRIDE_OPTIONS
226 /* target machine storage layout */
228 /* Define for XFmode extended real floating point support.
229 This will automatically cause REAL_ARITHMETIC to be defined. */
230 #define LONG_DOUBLE_TYPE_SIZE 96
232 /* Define if you don't want extended real, but do want to use the
233 software floating point emulator for REAL_ARITHMETIC and
234 decimal <-> binary conversion. */
235 /* #define REAL_ARITHMETIC */
237 /* Define this if most significant bit is lowest numbered
238 in instructions that operate on numbered bit-fields.
239 This is true for 68020 insns such as bfins and bfexts.
240 We make it true always by avoiding using the single-bit insns
241 except in special cases with constant bit numbers. */
242 #define BITS_BIG_ENDIAN 1
244 /* Define this if most significant byte of a word is the lowest numbered. */
245 /* That is true on the 68000. */
246 #define BYTES_BIG_ENDIAN 1
248 /* Define this if most significant word of a multiword number is the lowest
250 /* For 68000 we can decide arbitrarily
251 since there are no machine instructions for them.
252 So let's be consistent. */
253 #define WORDS_BIG_ENDIAN 1
255 /* number of bits in an addressable storage unit */
256 #define BITS_PER_UNIT 8
258 /* Width in bits of a "word", which is the contents of a machine register.
259 Note that this is not necessarily the width of data type `int';
260 if using 16-bit ints on a 68000, this would still be 32.
261 But on a machine with 16-bit registers, this would be 16. */
262 #define BITS_PER_WORD 32
264 /* Width of a word, in units (bytes). */
265 #define UNITS_PER_WORD 4
267 /* Width in bits of a pointer.
268 See also the macro `Pmode' defined below. */
269 #define POINTER_SIZE 32
271 /* Allocation boundary (in *bits*) for storing arguments in argument list. */
272 #define PARM_BOUNDARY (TARGET_SHORT ? 16 : 32)
274 /* Boundary (in *bits*) on which stack pointer should be aligned. */
275 #define STACK_BOUNDARY 16
277 /* Allocation boundary (in *bits*) for the code of a function. */
278 #define FUNCTION_BOUNDARY (1 << (m68k_align_funcs + 3))
280 /* Alignment of field after `int : 0' in a structure. */
281 #define EMPTY_FIELD_BOUNDARY 16
283 /* No data type wants to be aligned rounder than this.
284 Most published ABIs say that ints should be aligned on 16 bit
285 boundaries, but cpus with 32 bit busses get better performance
286 aligned on 32 bit boundaries. Coldfires without a misalignment
287 module require 32 bit alignment. */
288 #define BIGGEST_ALIGNMENT (TARGET_ALIGN_INT ? 32 : 16)
290 /* Set this nonzero if move instructions will actually fail to work
291 when given unaligned data. */
292 #define STRICT_ALIGNMENT 1
294 /* Maximum power of 2 that code can be aligned to. */
295 #define MAX_CODE_ALIGN 2 /* 4 byte alignment */
297 /* Align loop starts for optimal branching. */
298 #define LOOP_ALIGN(LABEL) (m68k_align_loops)
300 /* This is how to align an instruction for optimal branching. */
301 #define LABEL_ALIGN_AFTER_BARRIER(LABEL) (m68k_align_jumps)
303 #define SELECT_RTX_SECTION(MODE, X) \
306 readonly_data_section(); \
307 else if (LEGITIMATE_PIC_OPERAND_P (X)) \
308 readonly_data_section(); \
313 /* Define number of bits in most basic integer type.
314 (If undefined, default is BITS_PER_WORD). */
316 #define INT_TYPE_SIZE (TARGET_SHORT ? 16 : 32)
318 /* Define these to avoid dependence on meaning of `int'.
319 Note that WCHAR_TYPE_SIZE is used in cexp.y,
320 where TARGET_SHORT is not available. */
322 #define WCHAR_TYPE "long int"
323 #define WCHAR_TYPE_SIZE 32
325 /* Standard register usage. */
327 /* Number of actual hardware registers.
328 The hardware registers are assigned numbers for the compiler
329 from 0 to just below FIRST_PSEUDO_REGISTER.
330 All registers that the compiler knows about must be given numbers,
331 even those that are not normally considered general registers.
332 For the 68000, we give the data registers numbers 0-7,
333 the address registers numbers 010-017,
334 and the 68881 floating point registers numbers 020-027. */
335 #ifndef SUPPORT_SUN_FPA
336 #define FIRST_PSEUDO_REGISTER 24
338 #define FIRST_PSEUDO_REGISTER 56
341 /* This defines the register which is used to hold the offset table for PIC. */
342 #define PIC_OFFSET_TABLE_REGNUM 13
344 /* Used to output a (use pic_offset_table_rtx) so that we
345 always save/restore a5 in functions that use PIC relocation
346 at *any* time during the compilation process. */
347 #define FINALIZE_PIC finalize_pic()
349 #ifndef SUPPORT_SUN_FPA
351 /* 1 for registers that have pervasive standard uses
352 and are not available for the register allocator.
353 On the 68000, only the stack pointer is such. */
355 #define FIXED_REGISTERS \
356 {/* Data registers. */ \
357 0, 0, 0, 0, 0, 0, 0, 0, \
359 /* Address registers. */ \
360 0, 0, 0, 0, 0, 0, 0, 1, \
362 /* Floating point registers \
364 0, 0, 0, 0, 0, 0, 0, 0 }
366 /* 1 for registers not available across function calls.
367 These must include the FIXED_REGISTERS and also any
368 registers that can be used without being saved.
369 The latter must include the registers where values are returned
370 and the register where structure-value addresses are passed.
371 Aside from that, you can include as many other registers as you like. */
372 #define CALL_USED_REGISTERS \
373 {1, 1, 0, 0, 0, 0, 0, 0, \
374 1, 1, 0, 0, 0, 0, 0, 1, \
375 1, 1, 0, 0, 0, 0, 0, 0 }
377 #else /* SUPPORT_SUN_FPA */
379 /* 1 for registers that have pervasive standard uses
380 and are not available for the register allocator.
381 On the 68000, only the stack pointer is such. */
383 /* fpa0 is also reserved so that it can be used to move data back and
384 forth between high fpa regs and everything else. */
386 #define FIXED_REGISTERS \
387 {/* Data registers. */ \
388 0, 0, 0, 0, 0, 0, 0, 0, \
390 /* Address registers. */ \
391 0, 0, 0, 0, 0, 0, 0, 1, \
393 /* Floating point registers \
395 0, 0, 0, 0, 0, 0, 0, 0, \
397 /* Sun3 FPA registers. */ \
398 1, 0, 0, 0, 0, 0, 0, 0, \
399 0, 0, 0, 0, 0, 0, 0, 0, \
400 0, 0, 0, 0, 0, 0, 0, 0, \
401 0, 0, 0, 0, 0, 0, 0, 0 }
403 /* 1 for registers not available across function calls.
404 These must include the FIXED_REGISTERS and also any
405 registers that can be used without being saved.
406 The latter must include the registers where values are returned
407 and the register where structure-value addresses are passed.
408 Aside from that, you can include as many other registers as you like. */
409 #define CALL_USED_REGISTERS \
410 {1, 1, 0, 0, 0, 0, 0, 0, \
411 1, 1, 0, 0, 0, 0, 0, 1, \
412 1, 1, 0, 0, 0, 0, 0, 0, \
413 /* FPA registers. */ \
414 1, 1, 1, 1, 0, 0, 0, 0, \
415 0, 0, 0, 0, 0, 0, 0, 0, \
416 0, 0, 0, 0, 0, 0, 0, 0, \
417 0, 0, 0, 0, 0, 0, 0, 0 }
419 #endif /* defined SUPPORT_SUN_FPA */
422 /* Make sure everything's fine if we *don't* have a given processor.
423 This assumes that putting a register in fixed_regs will keep the
424 compiler's mitts completely off it. We don't bother to zero it out
425 of register classes. If neither TARGET_FPA or TARGET_68881 is set,
426 the compiler won't touch since no instructions that use these
427 registers will be valid. */
429 #ifdef SUPPORT_SUN_FPA
431 #define CONDITIONAL_REGISTER_USAGE \
437 COPY_HARD_REG_SET (x, reg_class_contents[(int)FPA_REGS]); \
438 for (i = 0; i < FIRST_PSEUDO_REGISTER; i++ ) \
439 if (TEST_HARD_REG_BIT (x, i)) \
440 fixed_regs[i] = call_used_regs[i] = 1; \
444 COPY_HARD_REG_SET (x, reg_class_contents[(int)FP_REGS]); \
445 for (i = 0; i < FIRST_PSEUDO_REGISTER; i++ ) \
446 if (TEST_HARD_REG_BIT (x, i)) \
447 fixed_regs[i] = call_used_regs[i] = 1; \
451 #endif /* defined SUPPORT_SUN_FPA */
453 /* Return number of consecutive hard regs needed starting at reg REGNO
454 to hold something of mode MODE.
455 This is ordinarily the length in words of a value of mode MODE
456 but can be less for certain modes in special long registers.
458 On the 68000, ordinary registers hold 32 bits worth;
459 for the 68881 registers, a single register is always enough for
460 anything that can be stored in them at all. */
461 #define HARD_REGNO_NREGS(REGNO, MODE) \
462 ((REGNO) >= 16 ? GET_MODE_NUNITS (MODE) \
463 : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
465 #ifndef SUPPORT_SUN_FPA
467 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
468 On the 68000, the cpu registers can hold any mode but the 68881 registers
469 can hold only SFmode or DFmode. The 68881 registers can't hold anything
470 if 68881 use is disabled. */
472 #define HARD_REGNO_MODE_OK(REGNO, MODE) \
474 && !((REGNO) < 8 && (REGNO) + GET_MODE_SIZE ((MODE)) / 4 > 8)) \
477 && (GET_MODE_CLASS (MODE) == MODE_FLOAT \
478 || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT)))
480 #else /* defined SUPPORT_SUN_FPA */
482 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
483 On the 68000, the cpu registers can hold any mode but the 68881 registers
484 can hold only SFmode or DFmode. And the 68881 registers can't hold anything
485 if 68881 use is disabled. However, the Sun FPA register can
486 (apparently) hold whatever you feel like putting in them.
487 If using the fpa, don't put a double in d7/a0. */
489 #define HARD_REGNO_MODE_OK(REGNO, MODE) \
492 && GET_MODE_CLASS ((MODE)) != MODE_INT \
493 && GET_MODE_UNIT_SIZE ((MODE)) > 4 \
494 && (REGNO) < 8 && (REGNO) + GET_MODE_SIZE ((MODE)) / 4 > 8 \
495 && (REGNO) % (GET_MODE_UNIT_SIZE ((MODE)) / 4) != 0)) \
497 ? TARGET_68881 && (GET_MODE_CLASS (MODE) == MODE_FLOAT \
498 || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT) \
499 : ((REGNO) < 56 ? TARGET_FPA : 0)))
501 #endif /* defined SUPPORT_SUN_FPA */
503 /* Value is 1 if it is a good idea to tie two pseudo registers
504 when one has mode MODE1 and one has mode MODE2.
505 If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
506 for any hard reg, then this must be 0 for correct output. */
507 #define MODES_TIEABLE_P(MODE1, MODE2) \
509 || ((GET_MODE_CLASS (MODE1) == MODE_FLOAT \
510 || GET_MODE_CLASS (MODE1) == MODE_COMPLEX_FLOAT) \
511 == (GET_MODE_CLASS (MODE2) == MODE_FLOAT \
512 || GET_MODE_CLASS (MODE2) == MODE_COMPLEX_FLOAT)))
514 /* Specify the registers used for certain standard purposes.
515 The values of these macros are register numbers. */
517 /* m68000 pc isn't overloaded on a register. */
518 /* #define PC_REGNUM */
520 /* Register to use for pushing function arguments. */
521 #define STACK_POINTER_REGNUM 15
523 /* Base register for access to local variables of the function. */
524 #define FRAME_POINTER_REGNUM 14
526 /* Value should be nonzero if functions must have frame pointers.
527 Zero means the frame pointer need not be set up (and parms
528 may be accessed via the stack pointer) in functions that seem suitable.
529 This is computed in `reload', in reload1.c. */
530 #define FRAME_POINTER_REQUIRED 0
532 /* Base register for access to arguments of the function. */
533 #define ARG_POINTER_REGNUM 14
535 /* Register in which static-chain is passed to a function. */
536 #define STATIC_CHAIN_REGNUM 8
538 /* Register in which address to store a structure value
539 is passed to a function. */
540 #define STRUCT_VALUE_REGNUM 9
542 /* Define the classes of registers for register constraints in the
543 machine description. Also define ranges of constants.
545 One of the classes must always be named ALL_REGS and include all hard regs.
546 If there is more than one class, another class must be named NO_REGS
547 and contain no registers.
549 The name GENERAL_REGS must be the name of a class (or an alias for
550 another name such as ALL_REGS). This is the class of registers
551 that is allowed by "g" or "r" in a register constraint.
552 Also, registers outside this class are allocated only when
553 instructions express preferences for them.
555 The classes must be numbered in nondecreasing order; that is,
556 a larger-numbered class must never be contained completely
557 in a smaller-numbered class.
559 For any two classes, it is very desirable that there be another
560 class that represents their union. */
562 /* The 68000 has three kinds of registers, so eight classes would be
563 a complete set. One of them is not needed. */
565 #ifndef SUPPORT_SUN_FPA
570 GENERAL_REGS, DATA_OR_FP_REGS,
571 ADDR_OR_FP_REGS, ALL_REGS,
574 #define N_REG_CLASSES (int) LIM_REG_CLASSES
576 /* Give names of register classes as strings for dump file. */
578 #define REG_CLASS_NAMES \
579 { "NO_REGS", "DATA_REGS", \
580 "ADDR_REGS", "FP_REGS", \
581 "GENERAL_REGS", "DATA_OR_FP_REGS", \
582 "ADDR_OR_FP_REGS", "ALL_REGS" }
584 /* Define which registers fit in which classes.
585 This is an initializer for a vector of HARD_REG_SET
586 of length N_REG_CLASSES. */
588 #define REG_CLASS_CONTENTS \
590 {0x00000000}, /* NO_REGS */ \
591 {0x000000ff}, /* DATA_REGS */ \
592 {0x0000ff00}, /* ADDR_REGS */ \
593 {0x00ff0000}, /* FP_REGS */ \
594 {0x0000ffff}, /* GENERAL_REGS */ \
595 {0x00ff00ff}, /* DATA_OR_FP_REGS */ \
596 {0x00ffff00}, /* ADDR_OR_FP_REGS */ \
597 {0x00ffffff}, /* ALL_REGS */ \
600 /* The same information, inverted:
601 Return the class number of the smallest class containing
602 reg number REGNO. This could be a conditional expression
603 or could index an array. */
605 #define REGNO_REG_CLASS(REGNO) (((REGNO)>>3)+1)
607 #else /* defined SUPPORT_SUN_FPA */
610 * Notes on final choices:
612 * 1) Didn't feel any need to union-ize LOW_FPA_REGS with anything
614 * 2) Removed all unions that involve address registers with
615 * floating point registers (left in unions of address and data with
617 * 3) Defined GENERAL_REGS as ADDR_OR_DATA_REGS.
618 * 4) Defined ALL_REGS as FPA_OR_FP_OR_GENERAL_REGS.
619 * 4) Left in everything else.
621 enum reg_class { NO_REGS, LO_FPA_REGS, FPA_REGS, FP_REGS,
622 FP_OR_FPA_REGS, DATA_REGS, DATA_OR_FPA_REGS, DATA_OR_FP_REGS,
623 DATA_OR_FP_OR_FPA_REGS, ADDR_REGS, GENERAL_REGS,
624 GENERAL_OR_FPA_REGS, GENERAL_OR_FP_REGS, ALL_REGS,
627 #define N_REG_CLASSES (int) LIM_REG_CLASSES
629 /* Give names of register classes as strings for dump file. */
631 #define REG_CLASS_NAMES \
632 { "NO_REGS", "LO_FPA_REGS", "FPA_REGS", "FP_REGS", \
633 "FP_OR_FPA_REGS", "DATA_REGS", "DATA_OR_FPA_REGS", "DATA_OR_FP_REGS", \
634 "DATA_OR_FP_OR_FPA_REGS", "ADDR_REGS", "GENERAL_REGS", \
635 "GENERAL_OR_FPA_REGS", "GENERAL_OR_FP_REGS", "ALL_REGS" }
637 /* Define which registers fit in which classes.
638 This is an initializer for a vector of HARD_REG_SET
639 of length N_REG_CLASSES. */
641 #define REG_CLASS_CONTENTS \
643 {0, 0}, /* NO_REGS */ \
644 {0xff000000, 0x000000ff}, /* LO_FPA_REGS */ \
645 {0xff000000, 0x00ffffff}, /* FPA_REGS */ \
646 {0x00ff0000, 0x00000000}, /* FP_REGS */ \
647 {0xffff0000, 0x00ffffff}, /* FP_OR_FPA_REGS */ \
648 {0x000000ff, 0x00000000}, /* DATA_REGS */ \
649 {0xff0000ff, 0x00ffffff}, /* DATA_OR_FPA_REGS */ \
650 {0x00ff00ff, 0x00000000}, /* DATA_OR_FP_REGS */ \
651 {0xffff00ff, 0x00ffffff}, /* DATA_OR_FP_OR_FPA_REGS */\
652 {0x0000ff00, 0x00000000}, /* ADDR_REGS */ \
653 {0x0000ffff, 0x00000000}, /* GENERAL_REGS */ \
654 {0xff00ffff, 0x00ffffff}, /* GENERAL_OR_FPA_REGS */\
655 {0x00ffffff, 0x00000000}, /* GENERAL_OR_FP_REGS */\
656 {0xffffffff, 0x00ffffff}, /* ALL_REGS */ \
659 /* The same information, inverted:
660 Return the class number of the smallest class containing
661 reg number REGNO. This could be a conditional expression
662 or could index an array. */
664 extern enum reg_class regno_reg_class[];
665 #define REGNO_REG_CLASS(REGNO) (regno_reg_class[(REGNO)>>3])
667 #endif /* SUPPORT_SUN_FPA */
669 /* The class value for index registers, and the one for base regs. */
671 #define INDEX_REG_CLASS GENERAL_REGS
672 #define BASE_REG_CLASS ADDR_REGS
674 /* Get reg_class from a letter such as appears in the machine description.
675 We do a trick here to modify the effective constraints on the
676 machine description; we zorch the constraint letters that aren't
677 appropriate for a specific target. This allows us to guarantee
678 that a specific kind of register will not be used for a given target
679 without fiddling with the register classes above. */
681 #ifndef SUPPORT_SUN_FPA
683 #define REG_CLASS_FROM_LETTER(C) \
684 ((C) == 'a' ? ADDR_REGS : \
685 ((C) == 'd' ? DATA_REGS : \
686 ((C) == 'f' ? (TARGET_68881 ? FP_REGS : \
690 #else /* defined SUPPORT_SUN_FPA */
692 #define REG_CLASS_FROM_LETTER(C) \
693 ((C) == 'a' ? ADDR_REGS : \
694 ((C) == 'd' ? DATA_REGS : \
695 ((C) == 'f' ? (TARGET_68881 ? FP_REGS : \
697 ((C) == 'x' ? (TARGET_FPA ? FPA_REGS : \
699 ((C) == 'y' ? (TARGET_FPA ? LO_FPA_REGS : \
703 #endif /* defined SUPPORT_SUN_FPA */
705 /* The letters I, J, K, L and M in a register constraint string
706 can be used to stand for particular ranges of immediate operands.
707 This macro defines what the ranges are.
708 C is the letter, and VALUE is a constant value.
709 Return 1 if VALUE is in the range specified by C.
711 For the 68000, `I' is used for the range 1 to 8
712 allowed as immediate shift counts and in addq.
713 `J' is used for the range of signed numbers that fit in 16 bits.
714 `K' is for numbers that moveq can't handle.
715 `L' is for range -8 to -1, range of values that can be added with subq.
716 `M' is for numbers that moveq+notb can't handle.
717 'N' is for range 24 to 31, rotatert:SI 8 to 1 expressed as rotate.
718 'O' is for 16 (for rotate using swap).
719 'P' is for range 8 to 15, rotatert:HI 8 to 1 expressed as rotate. */
721 #define CONST_OK_FOR_LETTER_P(VALUE, C) \
722 ((C) == 'I' ? (VALUE) > 0 && (VALUE) <= 8 : \
723 (C) == 'J' ? (VALUE) >= -0x8000 && (VALUE) <= 0x7FFF : \
724 (C) == 'K' ? (VALUE) < -0x80 || (VALUE) >= 0x80 : \
725 (C) == 'L' ? (VALUE) < 0 && (VALUE) >= -8 : \
726 (C) == 'M' ? (VALUE) < -0x100 || (VALUE) >= 0x100 : \
727 (C) == 'N' ? (VALUE) >= 24 && (VALUE) <= 31 : \
728 (C) == 'O' ? (VALUE) == 16 : \
729 (C) == 'P' ? (VALUE) >= 8 && (VALUE) <= 15 : 0)
732 * A small bit of explanation:
733 * "G" defines all of the floating constants that are *NOT* 68881
734 * constants. this is so 68881 constants get reloaded and the
735 * fpmovecr is used. "H" defines *only* the class of constants that
736 * the fpa can use, because these can be gotten at in any fpa
737 * instruction and there is no need to force reloads.
739 #ifndef SUPPORT_SUN_FPA
740 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
741 ((C) == 'G' ? ! (TARGET_68881 && standard_68881_constant_p (VALUE)) : 0 )
742 #else /* defined SUPPORT_SUN_FPA */
743 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
744 ((C) == 'G' ? ! (TARGET_68881 && standard_68881_constant_p (VALUE)) : \
745 (C) == 'H' ? (TARGET_FPA && standard_sun_fpa_constant_p (VALUE)) : 0)
746 #endif /* defined SUPPORT_SUN_FPA */
748 /* A C expression that defines the optional machine-dependent constraint
749 letters that can be used to segregate specific types of operands,
750 usually memory references, for the target machine. It should return 1 if
751 VALUE corresponds to the operand type represented by the constraint letter
752 C. If C is not defined as an extra constraint, the value returned should
753 be 0 regardless of VALUE. */
755 /* For the m68k, `Q' means address register indirect addressing mode. */
757 #define EXTRA_CONSTRAINT(OP, C) \
758 ((C) == 'Q' ? (GET_CODE (OP) == MEM && GET_CODE (XEXP (OP, 0)) == REG) : \
761 /* Given an rtx X being reloaded into a reg required to be
762 in class CLASS, return the class of reg to actually use.
763 In general this is just CLASS; but on some machines
764 in some cases it is preferable to use a more restrictive class.
765 On the 68000 series, use a data reg if possible when the
766 value is a constant in the range where moveq could be used
767 and we ensure that QImodes are reloaded into data regs.
768 Also, if a floating constant needs reloading, put it in memory.
769 Don't do this for !G constants, since all patterns in the md file
770 expect them to be loaded into a register via fpmovecr. See above. */
772 #define PREFERRED_RELOAD_CLASS(X,CLASS) \
773 ((GET_CODE (X) == CONST_INT \
774 && (unsigned) (INTVAL (X) + 0x80) < 0x100 \
775 && (CLASS) != ADDR_REGS) \
777 : (GET_MODE (X) == QImode && (CLASS) != ADDR_REGS) \
779 : (GET_CODE (X) == CONST_DOUBLE \
780 && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT) \
781 ? (! CONST_DOUBLE_OK_FOR_LETTER_P (X, 'G') \
782 && (CLASS == FP_REGS || CLASS == DATA_OR_FP_REGS) \
783 ? FP_REGS : NO_REGS) \
786 /* Force QImode output reloads from subregs to be allocated to data regs,
787 since QImode stores from address regs are not supported. We make the
788 assumption that if the class is not ADDR_REGS, then it must be a superset
791 #define LIMIT_RELOAD_CLASS(MODE, CLASS) \
792 (((MODE) == QImode && (CLASS) != ADDR_REGS) \
796 /* Return the maximum number of consecutive registers
797 needed to represent mode MODE in a register of class CLASS. */
798 /* On the 68000, this is the size of MODE in words,
799 except in the FP regs, where a single reg is always enough. */
800 #ifndef SUPPORT_SUN_FPA
802 #define CLASS_MAX_NREGS(CLASS, MODE) \
803 ((CLASS) == FP_REGS ? 1 \
804 : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
806 /* Moves between fp regs and other regs are two insns. */
807 #define REGISTER_MOVE_COST(CLASS1, CLASS2) \
808 (((CLASS1) == FP_REGS && (CLASS2) != FP_REGS) \
809 || ((CLASS2) == FP_REGS && (CLASS1) != FP_REGS) \
812 #else /* defined SUPPORT_SUN_FPA */
814 #define CLASS_MAX_NREGS(CLASS, MODE) \
815 ((CLASS) == FP_REGS || (CLASS) == FPA_REGS || (CLASS) == LO_FPA_REGS ? 1 \
816 : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
818 /* Moves between fp regs and other regs are two insns. */
819 /* Likewise for high fpa regs and other regs. */
820 #define REGISTER_MOVE_COST(CLASS1, CLASS2) \
821 ((((CLASS1) == FP_REGS && (CLASS2) != FP_REGS) \
822 || ((CLASS2) == FP_REGS && (CLASS1) != FP_REGS) \
823 || ((CLASS1) == FPA_REGS && (CLASS2) != FPA_REGS) \
824 || ((CLASS2) == FPA_REGS && (CLASS1) != FPA_REGS)) \
827 #endif /* define SUPPORT_SUN_FPA */
829 /* Stack layout; function entry, exit and calling. */
831 /* Define this if pushing a word on the stack
832 makes the stack pointer a smaller address. */
833 #define STACK_GROWS_DOWNWARD
835 /* Nonzero if we need to generate stack-probe insns.
836 On most systems they are not needed.
837 When they are needed, define this as the stack offset to probe at. */
840 /* Define this if the nominal address of the stack frame
841 is at the high-address end of the local variables;
842 that is, each additional local variable allocated
843 goes at a more negative offset in the frame. */
844 #define FRAME_GROWS_DOWNWARD
846 /* Offset within stack frame to start allocating local variables at.
847 If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
848 first local allocated. Otherwise, it is the offset to the BEGINNING
849 of the first local allocated. */
850 #define STARTING_FRAME_OFFSET 0
852 /* If we generate an insn to push BYTES bytes,
853 this says how many the stack pointer really advances by.
854 On the 68000, sp@- in a byte insn really pushes a word.
855 On the 5200 (coldfire), sp@- in a byte insn pushes just a byte. */
856 #define PUSH_ROUNDING(BYTES) (TARGET_5200 ? BYTES : ((BYTES) + 1) & ~1)
858 /* Offset of first parameter from the argument pointer register value. */
859 #define FIRST_PARM_OFFSET(FNDECL) 8
861 /* Offset of the CFA from the argument pointer register value. */
862 #define ARG_POINTER_CFA_OFFSET 8
864 /* Value is the number of byte of arguments automatically
865 popped when returning from a subroutine call.
866 FUNDECL is the declaration node of the function (as a tree),
867 FUNTYPE is the data type of the function (as a tree),
868 or for a library call it is an identifier node for the subroutine name.
869 SIZE is the number of bytes of arguments passed on the stack.
871 On the 68000, the RTS insn cannot pop anything.
872 On the 68010, the RTD insn may be used to pop them if the number
873 of args is fixed, but if the number is variable then the caller
874 must pop them all. RTD can't be used for library calls now
875 because the library is compiled with the Unix compiler.
876 Use of RTD is a selectable option, since it is incompatible with
877 standard Unix calling sequences. If the option is not selected,
878 the caller must always pop the args. */
880 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \
881 ((TARGET_RTD && (!(FUNDECL) || TREE_CODE (FUNDECL) != IDENTIFIER_NODE) \
882 && (TYPE_ARG_TYPES (FUNTYPE) == 0 \
883 || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE))) \
884 == void_type_node))) \
887 /* Define how to find the value returned by a function.
888 VALTYPE is the data type of the value (as a tree).
889 If the precise function being called is known, FUNC is its FUNCTION_DECL;
890 otherwise, FUNC is 0. */
892 /* On the 68000 the return value is in D0 regardless. */
894 #define FUNCTION_VALUE(VALTYPE, FUNC) \
895 gen_rtx_REG (TYPE_MODE (VALTYPE), 0)
897 /* Define how to find the value returned by a library function
898 assuming the value has mode MODE. */
900 /* On the 68000 the return value is in D0 regardless. */
902 #define LIBCALL_VALUE(MODE) gen_rtx_REG (MODE, 0)
904 /* 1 if N is a possible register number for a function value.
905 On the 68000, d0 is the only register thus used. */
907 #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
909 /* Define this to be true when FUNCTION_VALUE_REGNO_P is true for
910 more than one register. */
912 #define NEEDS_UNTYPED_CALL 0
914 /* Define this if PCC uses the nonreentrant convention for returning
915 structure and union values. */
917 #define PCC_STATIC_STRUCT_RETURN
919 /* 1 if N is a possible register number for function argument passing.
920 On the 68000, no registers are used in this way. */
922 #define FUNCTION_ARG_REGNO_P(N) 0
924 /* Define a data type for recording info about an argument list
925 during the scan of that argument list. This data type should
926 hold all necessary information about the function itself
927 and about the args processed so far, enough to enable macros
928 such as FUNCTION_ARG to determine where the next arg should go.
930 On the m68k, this is a single integer, which is a number of bytes
931 of arguments scanned so far. */
933 #define CUMULATIVE_ARGS int
935 /* Initialize a variable CUM of type CUMULATIVE_ARGS
936 for a call to a function whose data type is FNTYPE.
937 For a library call, FNTYPE is 0.
939 On the m68k, the offset starts at 0. */
941 #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT) \
944 /* Update the data in CUM to advance over an argument
945 of mode MODE and data type TYPE.
946 (TYPE is null for libcalls where that information may not be available.) */
948 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
949 ((CUM) += ((MODE) != BLKmode \
950 ? (GET_MODE_SIZE (MODE) + 3) & ~3 \
951 : (int_size_in_bytes (TYPE) + 3) & ~3))
953 /* Define where to put the arguments to a function.
954 Value is zero to push the argument on the stack,
955 or a hard register in which to store the argument.
957 MODE is the argument's machine mode.
958 TYPE is the data type of the argument (as a tree).
959 This is null for libcalls where that information may
961 CUM is a variable of type CUMULATIVE_ARGS which gives info about
962 the preceding args and about the function being called.
963 NAMED is nonzero if this argument is a named parameter
964 (otherwise it is an extra parameter matching an ellipsis). */
966 /* On the 68000 all args are pushed, except if -mregparm is specified
967 then the first two words of arguments are passed in d0, d1.
968 *NOTE* -mregparm does not work.
969 It exists only to test register calling conventions. */
971 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
972 ((TARGET_REGPARM && (CUM) < 8) ? gen_rtx_REG ((MODE), (CUM) / 4) : 0)
974 /* For an arg passed partly in registers and partly in memory,
975 this is the number of registers used.
976 For args passed entirely in registers or entirely in memory, zero. */
978 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
979 ((TARGET_REGPARM && (CUM) < 8 \
980 && 8 < ((CUM) + ((MODE) == BLKmode \
981 ? int_size_in_bytes (TYPE) \
982 : GET_MODE_SIZE (MODE)))) \
985 /* Generate the assembly code for function entry. */
986 #define FUNCTION_PROLOGUE(FILE, SIZE) output_function_prologue(FILE, SIZE)
988 /* Output assembler code to FILE to increment profiler label # LABELNO
989 for profiling a function entry. */
991 #define FUNCTION_PROFILER(FILE, LABELNO) \
992 asm_fprintf (FILE, "\tlea %LLP%d,%Ra0\n\tjsr mcount\n", (LABELNO))
994 /* Output assembler code to FILE to initialize this source file's
995 basic block profiling info, if that has not already been done. */
997 #define FUNCTION_BLOCK_PROFILER(FILE, BLOCK_OR_LABEL) \
1000 switch (profile_block_flag) \
1003 asm_fprintf (FILE, "\tpea %d\n\tpea %LLPBX0\n\tjsr %U__bb_init_trace_func\n\taddql %I8,%Rsp\n", \
1004 (BLOCK_OR_LABEL)); \
1008 asm_fprintf (FILE, "\ttstl %LLPBX0\n\tbne %LLPI%d\n\tpea %LLPBX0\n\tjsr %U__bb_init_func\n\taddql %I4,%Rsp\n%LLPI%d:\n", \
1009 (BLOCK_OR_LABEL), (BLOCK_OR_LABEL)); \
1015 /* Output assembler code to FILE to increment the counter for
1016 the BLOCKNO'th basic block in this source file. */
1018 #define BLOCK_PROFILER(FILE, BLOCKNO) \
1021 switch (profile_block_flag) \
1024 asm_fprintf (FILE, "\tmovel %Ra1,%Rsp@-\n\tlea ___bb,%Ra1\n\tmovel %I%d,%Ra1@(0)\n\tmovel %I%LLPBX0,%Ra1@(4)\n\tmovel %Rsp@+,%Ra1\n\tjsr %U__bb_trace_func\n", \
1029 asm_fprintf (FILE, "\taddql %I1,%LLPBX2+%d\n", 4 * BLOCKNO); \
1035 /* Output assembler code to FILE to indicate return from
1036 a function during basic block profiling. */
1038 #define FUNCTION_BLOCK_PROFILER_EXIT(FILE) \
1039 asm_fprintf (FILE, "\tjsr %U__bb_trace_ret\n");
1041 /* Save all registers which may be clobbered by a function call.
1042 MACHINE_STATE_SAVE and MACHINE_STATE_RESTORE are target-code macros,
1043 used in libgcc2.c. They may not refer to TARGET_* macros !!! */
1044 #if defined (__mc68010__) || defined(mc68010) \
1045 || defined(__mc68020__) || defined(mc68020) \
1046 || defined(__mc68030__) || defined(mc68030) \
1047 || defined(__mc68040__) || defined(mc68040) \
1048 || defined(__mcpu32__) || defined(mcpu32)
1049 #define MACHINE_STATE_m68010_up
1053 #if defined(__mcf5200__)
1054 #define MACHINE_STATE_SAVE(id) \
1056 asm ("sub.l 20,%sp"); \
1057 asm ("movm.l &0x0303,4(%sp)"); \
1058 asm ("move.w %ccr,%d0"); \
1059 asm ("movm.l &0x0001,(%sp)"); \
1061 #else /* !__mcf5200__ */
1062 #if defined(MACHINE_STATE_m68010_up)
1064 /* HPUX assembler does not accept %ccr. */
1065 #define MACHINE_STATE_SAVE(id) \
1067 asm ("move.w %cc,-(%sp)"); \
1068 asm ("movm.l &0xc0c0,-(%sp)"); \
1070 #else /* ! __HPUX_ASM__ */
1071 #define MACHINE_STATE_SAVE(id) \
1073 asm ("move.w %ccr,-(%sp)"); \
1074 asm ("movm.l &0xc0c0,-(%sp)"); \
1076 #endif /* __HPUX_ASM__ */
1077 #else /* !MACHINE_STATE_m68010_up */
1078 #define MACHINE_STATE_SAVE(id) \
1080 asm ("move.w %sr,-(%sp)"); \
1081 asm ("movm.l &0xc0c0,-(%sp)"); \
1083 #endif /* MACHINE_STATE_m68010_up */
1084 #endif /* __mcf5200__ */
1085 #else /* !MOTOROLA */
1086 #if defined(__mcf5200__)
1087 #define MACHINE_STATE_SAVE(id) \
1089 asm ("subl %#20,%/sp" : ); \
1090 asm ("movml %/d0/%/d1/%/a0/%/a1,%/sp@(4)" : ); \
1091 asm ("movew %/cc,%/d0" : ); \
1092 asm ("movml %/d0,%/sp@" : ); \
1094 #else /* !__mcf5200__ */
1095 #if defined(MACHINE_STATE_m68010_up)
1096 #define MACHINE_STATE_SAVE(id) \
1098 asm ("movew %/cc,%/sp@-" : ); \
1099 asm ("moveml %/d0/%/d1/%/a0/%/a1,%/sp@-" : ); \
1101 #else /* !MACHINE_STATE_m68010_up */
1102 #define MACHINE_STATE_SAVE(id) \
1104 asm ("movew %/sr,%/sp@-" : ); \
1105 asm ("moveml %/d0/%/d1/%/a0/%/a1,%/sp@-" : ); \
1107 #endif /* MACHINE_STATE_m68010_up */
1108 #endif /* __mcf5200__ */
1109 #endif /* MOTOROLA */
1111 /* Restore all registers saved by MACHINE_STATE_SAVE. */
1114 #if defined(__mcf5200__)
1115 #define MACHINE_STATE_RESTORE(id) \
1117 asm ("movm.l (%sp),&0x0001"); \
1118 asm ("move.w %d0,%ccr"); \
1119 asm ("movm.l 4(%sp),&0x0303"); \
1120 asm ("add.l 20,%sp"); \
1122 #else /* !__mcf5200__ */
1124 /* HPUX assembler does not accept %ccr. */
1125 #define MACHINE_STATE_RESTORE(id) \
1127 asm ("movm.l (%sp)+,&0x0303"); \
1128 asm ("move.w (%sp)+,%cc"); \
1130 #else /* ! __HPUX_ASM__ */
1131 #define MACHINE_STATE_RESTORE(id) \
1133 asm ("movm.l (%sp)+,&0x0303"); \
1134 asm ("move.w (%sp)+,%ccr"); \
1136 #endif /* __HPUX_ASM__ */
1137 #endif /* __mcf5200__ */
1138 #else /* !MOTOROLA */
1139 #if defined(__mcf5200__)
1140 #define MACHINE_STATE_RESTORE(id) \
1142 asm ("movml %/sp@,%/d0" : ); \
1143 asm ("movew %/d0,%/cc" : ); \
1144 asm ("movml %/sp@(4),%/d0/%/d1/%/a0/%/a1" : ); \
1145 asm ("addl %#20,%/sp" : ); \
1147 #else /* !__mcf5200__ */
1148 #define MACHINE_STATE_RESTORE(id) \
1150 asm ("moveml %/sp@+,%/d0/%/d1/%/a0/%/a1" : ); \
1151 asm ("movew %/sp@+,%/cc" : ); \
1153 #endif /* __mcf5200__ */
1154 #endif /* MOTOROLA */
1156 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
1157 the stack pointer does not matter. The value is tested only in
1158 functions that have frame pointers.
1159 No definition is equivalent to always zero. */
1161 #define EXIT_IGNORE_STACK 1
1163 /* Generate the assembly code for function exit. */
1164 #define FUNCTION_EPILOGUE(FILE, SIZE) output_function_epilogue (FILE, SIZE)
1166 /* This is a hook for other tm files to change. */
1167 /* #define FUNCTION_EXTRA_EPILOGUE(FILE, SIZE) */
1169 /* Determine if the epilogue should be output as RTL.
1170 You should override this if you define FUNCTION_EXTRA_EPILOGUE. */
1171 #define USE_RETURN_INSN use_return_insn ()
1173 /* Store in the variable DEPTH the initial difference between the
1174 frame pointer reg contents and the stack pointer reg contents,
1175 as of the start of the function body. This depends on the layout
1176 of the fixed parts of the stack frame and on how registers are saved.
1178 On the 68k, if we have a frame, we must add one word to its length
1179 to allow for the place that a6 is stored when we do have a frame pointer.
1180 Otherwise, we would need to compute the offset from the frame pointer
1181 of a local variable as a function of frame_pointer_needed, which
1184 #define INITIAL_FRAME_POINTER_OFFSET(DEPTH) \
1187 for (regno = 16; regno < FIRST_PSEUDO_REGISTER; regno++) \
1188 if (regs_ever_live[regno] && ! call_used_regs[regno]) \
1190 for (regno = 0; regno < 16; regno++) \
1191 if (regs_ever_live[regno] && ! call_used_regs[regno]) \
1193 (DEPTH) = (offset + ((get_frame_size () + 3) & -4) \
1194 + (get_frame_size () == 0 ? 0 : 4)); \
1197 /* Output assembler code for a block containing the constant parts
1198 of a trampoline, leaving space for the variable parts. */
1200 /* On the 68k, the trampoline looks like this:
1204 WARNING: Targets that may run on 68040+ cpus must arrange for
1205 the instruction cache to be flushed. Previous incarnations of
1206 the m68k trampoline code attempted to get around this by either
1207 using an out-of-line transfer function or pc-relative data, but
1208 the fact remains that the code to jump to the transfer function
1209 or the code to load the pc-relative data needs to be flushed
1210 just as much as the "variable" portion of the trampoline.
1211 Recognizing that a cache flush is going to be required anyway,
1212 dispense with such notions and build a smaller trampoline. */
1214 /* Since more instructions are required to move a template into
1215 place than to create it on the spot, don't use a template. */
1217 /* Length in units of the trampoline for entering a nested function. */
1219 #define TRAMPOLINE_SIZE 12
1221 /* Alignment required for a trampoline in bits. */
1223 #define TRAMPOLINE_ALIGNMENT 16
1225 /* Targets redefine this to invoke code to either flush the cache,
1226 or enable stack execution (or both). */
1228 #ifndef FINALIZE_TRAMPOLINE
1229 #define FINALIZE_TRAMPOLINE(TRAMP)
1232 /* Emit RTL insns to initialize the variable parts of a trampoline.
1233 FNADDR is an RTX for the address of the function's pure code.
1234 CXT is an RTX for the static chain value for the function.
1236 We generate a two-instructions program at address TRAMP :
1240 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
1242 emit_move_insn (gen_rtx_MEM (HImode, TRAMP), GEN_INT(0x207C)); \
1243 emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 2)), CXT); \
1244 emit_move_insn (gen_rtx_MEM (HImode, plus_constant (TRAMP, 6)), \
1246 emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 8)), FNADDR); \
1247 FINALIZE_TRAMPOLINE(TRAMP); \
1250 /* This is the library routine that is used
1251 to transfer control from the trampoline
1252 to the actual nested function.
1253 It is defined for backward compatibility,
1254 for linking with object code that used the old
1255 trampoline definition. */
1257 /* A colon is used with no explicit operands
1258 to cause the template string to be scanned for %-constructs. */
1259 /* The function name __transfer_from_trampoline is not actually used.
1260 The function definition just permits use of "asm with operands"
1261 (though the operand list is empty). */
1262 #define TRANSFER_FROM_TRAMPOLINE \
1264 __transfer_from_trampoline () \
1266 register char *a0 asm ("%a0"); \
1267 asm (GLOBAL_ASM_OP " ___trampoline"); \
1268 asm ("___trampoline:"); \
1269 asm volatile ("move%.l %0,%@" : : "m" (a0[22])); \
1270 asm volatile ("move%.l %1,%0" : "=a" (a0) : "m" (a0[18])); \
1274 /* Addressing modes, and classification of registers for them. */
1276 #define HAVE_POST_INCREMENT
1277 /* #define HAVE_POST_DECREMENT */
1279 #define HAVE_PRE_DECREMENT
1280 /* #define HAVE_PRE_INCREMENT */
1282 /* Macros to check register numbers against specific register classes. */
1284 /* These assume that REGNO is a hard or pseudo reg number.
1285 They give nonzero only if REGNO is a hard reg of the suitable class
1286 or a pseudo reg currently allocated to a suitable hard reg.
1287 Since they use reg_renumber, they are safe only once reg_renumber
1288 has been allocated, which happens in local-alloc.c. */
1290 #define REGNO_OK_FOR_INDEX_P(REGNO) \
1291 ((REGNO) < 16 || (unsigned) reg_renumber[REGNO] < 16)
1292 #define REGNO_OK_FOR_BASE_P(REGNO) \
1293 (((REGNO) ^ 010) < 8 || (unsigned) (reg_renumber[REGNO] ^ 010) < 8)
1294 #define REGNO_OK_FOR_DATA_P(REGNO) \
1295 ((REGNO) < 8 || (unsigned) reg_renumber[REGNO] < 8)
1296 #define REGNO_OK_FOR_FP_P(REGNO) \
1297 (((REGNO) ^ 020) < 8 || (unsigned) (reg_renumber[REGNO] ^ 020) < 8)
1298 #ifdef SUPPORT_SUN_FPA
1299 #define REGNO_OK_FOR_FPA_P(REGNO) \
1300 (((REGNO) >= 24 && (REGNO) < 56) || (reg_renumber[REGNO] >= 24 && reg_renumber[REGNO] < 56))
1303 /* Now macros that check whether X is a register and also,
1304 strictly, whether it is in a specified class.
1306 These macros are specific to the 68000, and may be used only
1307 in code for printing assembler insns and in conditions for
1308 define_optimization. */
1310 /* 1 if X is a data register. */
1312 #define DATA_REG_P(X) (REG_P (X) && REGNO_OK_FOR_DATA_P (REGNO (X)))
1314 /* 1 if X is an fp register. */
1316 #define FP_REG_P(X) (REG_P (X) && REGNO_OK_FOR_FP_P (REGNO (X)))
1318 /* 1 if X is an address register */
1320 #define ADDRESS_REG_P(X) (REG_P (X) && REGNO_OK_FOR_BASE_P (REGNO (X)))
1322 #ifdef SUPPORT_SUN_FPA
1323 /* 1 if X is a register in the Sun FPA. */
1324 #define FPA_REG_P(X) (REG_P (X) && REGNO_OK_FOR_FPA_P (REGNO (X)))
1326 /* Answer must be no if we don't have an FPA. */
1327 #define FPA_REG_P(X) 0
1330 /* Maximum number of registers that can appear in a valid memory address. */
1332 #define MAX_REGS_PER_ADDRESS 2
1334 /* Recognize any constant value that is a valid address. */
1336 #define CONSTANT_ADDRESS_P(X) \
1337 (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
1338 || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \
1339 || GET_CODE (X) == HIGH)
1341 /* Nonzero if the constant value X is a legitimate general operand.
1342 It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
1344 #define LEGITIMATE_CONSTANT_P(X) 1
1346 /* Nonzero if the constant value X is a legitimate general operand
1347 when generating PIC code. It is given that flag_pic is on and
1348 that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
1350 #define LEGITIMATE_PIC_OPERAND_P(X) \
1351 ((! symbolic_operand (X, VOIDmode) \
1352 && ! (GET_CODE (X) == CONST_DOUBLE && CONST_DOUBLE_MEM (X) \
1353 && GET_CODE (CONST_DOUBLE_MEM (X)) == MEM \
1354 && symbolic_operand (XEXP (CONST_DOUBLE_MEM (X), 0), \
1356 || (GET_CODE (X) == SYMBOL_REF && SYMBOL_REF_FLAG (X)))
1358 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
1359 and check its validity for a certain class.
1360 We have two alternate definitions for each of them.
1361 The usual definition accepts all pseudo regs; the other rejects
1362 them unless they have been allocated suitable hard regs.
1363 The symbol REG_OK_STRICT causes the latter definition to be used.
1365 Most source files want to accept pseudo regs in the hope that
1366 they will get allocated to the class that the insn wants them to be in.
1367 Source files for reload pass need to be strict.
1368 After reload, it makes no difference, since pseudo regs have
1369 been eliminated by then. */
1371 #ifndef REG_OK_STRICT
1373 /* Nonzero if X is a hard reg that can be used as an index
1374 or if it is a pseudo reg. */
1375 #define REG_OK_FOR_INDEX_P(X) ((REGNO (X) ^ 020) >= 8)
1376 /* Nonzero if X is a hard reg that can be used as a base reg
1377 or if it is a pseudo reg. */
1378 #define REG_OK_FOR_BASE_P(X) ((REGNO (X) & ~027) != 0)
1382 /* Nonzero if X is a hard reg that can be used as an index. */
1383 #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
1384 /* Nonzero if X is a hard reg that can be used as a base reg. */
1385 #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
1389 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
1390 that is a valid memory address for an instruction.
1391 The MODE argument is the machine mode for the MEM expression
1392 that wants to use this address.
1394 When generating PIC, an address involving a SYMBOL_REF is legitimate
1395 if and only if it is the sum of pic_offset_table_rtx and the SYMBOL_REF.
1396 We use LEGITIMATE_PIC_OPERAND_P to throw out the illegitimate addresses,
1397 and we explicitly check for the sum of pic_offset_table_rtx and a SYMBOL_REF.
1399 Likewise for a LABEL_REF when generating PIC.
1401 The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS. */
1403 /* Allow SUBREG everywhere we allow REG. This results in better code. It
1404 also makes function inlining work when inline functions are called with
1405 arguments that are SUBREGs. */
1407 #define LEGITIMATE_BASE_REG_P(X) \
1408 ((GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X)) \
1409 || (GET_CODE (X) == SUBREG \
1410 && GET_CODE (SUBREG_REG (X)) == REG \
1411 && REG_OK_FOR_BASE_P (SUBREG_REG (X))))
1413 #define INDIRECTABLE_1_ADDRESS_P(X) \
1414 ((CONSTANT_ADDRESS_P (X) && (!flag_pic || LEGITIMATE_PIC_OPERAND_P (X))) \
1415 || LEGITIMATE_BASE_REG_P (X) \
1416 || ((GET_CODE (X) == PRE_DEC || GET_CODE (X) == POST_INC) \
1417 && LEGITIMATE_BASE_REG_P (XEXP (X, 0))) \
1418 || (GET_CODE (X) == PLUS \
1419 && LEGITIMATE_BASE_REG_P (XEXP (X, 0)) \
1420 && GET_CODE (XEXP (X, 1)) == CONST_INT \
1421 && (TARGET_68020 || (unsigned) INTVAL (XEXP (X, 1)) + 0x8000) < 0x10000) \
1422 || (GET_CODE (X) == PLUS && XEXP (X, 0) == pic_offset_table_rtx \
1423 && flag_pic && GET_CODE (XEXP (X, 1)) == SYMBOL_REF) \
1424 || (GET_CODE (X) == PLUS && XEXP (X, 0) == pic_offset_table_rtx \
1425 && flag_pic && GET_CODE (XEXP (X, 1)) == LABEL_REF)) \
1428 /* This should replace the last two (non-pic) lines
1429 except that Sun's assembler does not seem to handle such operands. */
1430 && (TARGET_68020 ? CONSTANT_ADDRESS_P (XEXP (X, 1)) \
1431 : (GET_CODE (XEXP (X, 1)) == CONST_INT \
1432 && ((unsigned) INTVAL (XEXP (X, 1)) + 0x8000) < 0x10000))))
1436 #define GO_IF_NONINDEXED_ADDRESS(X, ADDR) \
1437 { if (INDIRECTABLE_1_ADDRESS_P (X)) goto ADDR; }
1439 /* Only labels on dispatch tables are valid for indexing from. */
1440 #define GO_IF_INDEXABLE_BASE(X, ADDR) \
1442 if (GET_CODE (X) == LABEL_REF \
1443 && (temp = next_nonnote_insn (XEXP (X, 0))) != 0 \
1444 && GET_CODE (temp) == JUMP_INSN \
1445 && (GET_CODE (PATTERN (temp)) == ADDR_VEC \
1446 || GET_CODE (PATTERN (temp)) == ADDR_DIFF_VEC)) \
1448 if (LEGITIMATE_BASE_REG_P (X)) goto ADDR; }
1450 #define GO_IF_INDEXING(X, ADDR) \
1451 { if (GET_CODE (X) == PLUS && LEGITIMATE_INDEX_P (XEXP (X, 0))) \
1452 { GO_IF_INDEXABLE_BASE (XEXP (X, 1), ADDR); } \
1453 if (GET_CODE (X) == PLUS && LEGITIMATE_INDEX_P (XEXP (X, 1))) \
1454 { GO_IF_INDEXABLE_BASE (XEXP (X, 0), ADDR); } }
1456 #define GO_IF_INDEXED_ADDRESS(X, ADDR) \
1457 { GO_IF_INDEXING (X, ADDR); \
1458 if (GET_CODE (X) == PLUS) \
1459 { if (GET_CODE (XEXP (X, 1)) == CONST_INT \
1460 && (TARGET_68020 || (unsigned) INTVAL (XEXP (X, 1)) + 0x80 < 0x100)) \
1461 { rtx go_temp = XEXP (X, 0); GO_IF_INDEXING (go_temp, ADDR); } \
1462 if (GET_CODE (XEXP (X, 0)) == CONST_INT \
1463 && (TARGET_68020 || (unsigned) INTVAL (XEXP (X, 0)) + 0x80 < 0x100)) \
1464 { rtx go_temp = XEXP (X, 1); GO_IF_INDEXING (go_temp, ADDR); } } }
1466 #define LEGITIMATE_INDEX_REG_P(X) \
1467 ((GET_CODE (X) == REG && REG_OK_FOR_INDEX_P (X)) \
1468 || (GET_CODE (X) == SIGN_EXTEND \
1469 && GET_CODE (XEXP (X, 0)) == REG \
1470 && GET_MODE (XEXP (X, 0)) == HImode \
1471 && REG_OK_FOR_INDEX_P (XEXP (X, 0))) \
1472 || (GET_CODE (X) == SUBREG \
1473 && GET_CODE (SUBREG_REG (X)) == REG \
1474 && REG_OK_FOR_INDEX_P (SUBREG_REG (X))))
1476 #define LEGITIMATE_INDEX_P(X) \
1477 (LEGITIMATE_INDEX_REG_P (X) \
1478 || ((TARGET_68020 || TARGET_5200) && GET_CODE (X) == MULT \
1479 && LEGITIMATE_INDEX_REG_P (XEXP (X, 0)) \
1480 && GET_CODE (XEXP (X, 1)) == CONST_INT \
1481 && (INTVAL (XEXP (X, 1)) == 2 \
1482 || INTVAL (XEXP (X, 1)) == 4 \
1483 || (INTVAL (XEXP (X, 1)) == 8 && !TARGET_5200))))
1485 /* If pic, we accept INDEX+LABEL, which is what do_tablejump makes. */
1486 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
1487 { GO_IF_NONINDEXED_ADDRESS (X, ADDR); \
1488 GO_IF_INDEXED_ADDRESS (X, ADDR); \
1489 if (flag_pic && MODE == CASE_VECTOR_MODE && GET_CODE (X) == PLUS \
1490 && LEGITIMATE_INDEX_P (XEXP (X, 0)) \
1491 && GET_CODE (XEXP (X, 1)) == LABEL_REF) \
1494 /* Don't call memory_address_noforce for the address to fetch
1495 the switch offset. This address is ok as it stands (see above),
1496 but memory_address_noforce would alter it. */
1497 #define PIC_CASE_VECTOR_ADDRESS(index) index
1499 /* Try machine-dependent ways of modifying an illegitimate address
1500 to be legitimate. If we find one, return the new, valid address.
1501 This macro is used in only one place: `memory_address' in explow.c.
1503 OLDX is the address as it was before break_out_memory_refs was called.
1504 In some cases it is useful to look at this to decide what needs to be done.
1506 MODE and WIN are passed so that this macro can use
1507 GO_IF_LEGITIMATE_ADDRESS.
1509 It is always safe for this macro to do nothing. It exists to recognize
1510 opportunities to optimize the output.
1512 For the 68000, we handle X+REG by loading X into a register R and
1513 using R+REG. R will go in an address reg and indexing will be used.
1514 However, if REG is a broken-out memory address or multiplication,
1515 nothing needs to be done because REG can certainly go in an address reg. */
1517 #define COPY_ONCE(Y) if (!copied) { Y = copy_rtx (Y); copied = ch = 1; }
1518 #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
1519 { register int ch = (X) != (OLDX); \
1520 if (GET_CODE (X) == PLUS) \
1522 if (GET_CODE (XEXP (X, 0)) == MULT) \
1523 { COPY_ONCE (X); XEXP (X, 0) = force_operand (XEXP (X, 0), 0);} \
1524 if (GET_CODE (XEXP (X, 1)) == MULT) \
1525 { COPY_ONCE (X); XEXP (X, 1) = force_operand (XEXP (X, 1), 0);} \
1526 if (ch && GET_CODE (XEXP (X, 1)) == REG \
1527 && GET_CODE (XEXP (X, 0)) == REG) \
1529 if (ch) { GO_IF_LEGITIMATE_ADDRESS (MODE, X, WIN); } \
1530 if (GET_CODE (XEXP (X, 0)) == REG \
1531 || (GET_CODE (XEXP (X, 0)) == SIGN_EXTEND \
1532 && GET_CODE (XEXP (XEXP (X, 0), 0)) == REG \
1533 && GET_MODE (XEXP (XEXP (X, 0), 0)) == HImode)) \
1534 { register rtx temp = gen_reg_rtx (Pmode); \
1535 register rtx val = force_operand (XEXP (X, 1), 0); \
1536 emit_move_insn (temp, val); \
1538 XEXP (X, 1) = temp; \
1540 else if (GET_CODE (XEXP (X, 1)) == REG \
1541 || (GET_CODE (XEXP (X, 1)) == SIGN_EXTEND \
1542 && GET_CODE (XEXP (XEXP (X, 1), 0)) == REG \
1543 && GET_MODE (XEXP (XEXP (X, 1), 0)) == HImode)) \
1544 { register rtx temp = gen_reg_rtx (Pmode); \
1545 register rtx val = force_operand (XEXP (X, 0), 0); \
1546 emit_move_insn (temp, val); \
1548 XEXP (X, 0) = temp; \
1551 /* Go to LABEL if ADDR (a legitimate address expression)
1552 has an effect that depends on the machine mode it is used for.
1553 On the 68000, only predecrement and postincrement address depend thus
1554 (the amount of decrement or increment being the length of the operand). */
1556 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
1557 if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == PRE_DEC) goto LABEL
1559 /* Specify the machine mode that this machine uses
1560 for the index in the tablejump instruction. */
1561 #define CASE_VECTOR_MODE HImode
1563 /* Define as C expression which evaluates to nonzero if the tablejump
1564 instruction expects the table to contain offsets from the address of the
1566 Do not define this if the table should contain absolute addresses. */
1567 #define CASE_VECTOR_PC_RELATIVE 1
1569 /* Specify the tree operation to be used to convert reals to integers. */
1570 #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
1572 /* This is the kind of divide that is easiest to do in the general case. */
1573 #define EASY_DIV_EXPR TRUNC_DIV_EXPR
1575 /* Define this as 1 if `char' should by default be signed; else as 0. */
1576 #define DEFAULT_SIGNED_CHAR 1
1578 /* Don't cse the address of the function being compiled. */
1579 #define NO_RECURSIVE_FUNCTION_CSE
1581 /* Max number of bytes we can move from memory to memory
1582 in one reasonably fast instruction. */
1585 /* Define this if zero-extension is slow (more than one real instruction). */
1586 #define SLOW_ZERO_EXTEND
1588 /* Nonzero if access to memory by bytes is slow and undesirable. */
1589 #define SLOW_BYTE_ACCESS 0
1591 /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
1592 is done just by pretending it is already truncated. */
1593 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
1595 /* We assume that the store-condition-codes instructions store 0 for false
1596 and some other value for true. This is the value stored for true. */
1598 #define STORE_FLAG_VALUE -1
1600 /* When a prototype says `char' or `short', really pass an `int'. */
1601 #define PROMOTE_PROTOTYPES
1603 /* Specify the machine mode that pointers have.
1604 After generation of rtl, the compiler makes no further distinction
1605 between pointers and any other objects of this machine mode. */
1606 #define Pmode SImode
1608 /* A function address in a call instruction
1609 is a byte address (for indexing purposes)
1610 so give the MEM rtx a byte's mode. */
1611 #define FUNCTION_MODE QImode
1613 /* Compute the cost of computing a constant rtl expression RTX
1614 whose rtx-code is CODE. The body of this macro is a portion
1615 of a switch statement. If the code is computed here,
1616 return it with a return statement. Otherwise, break from the switch. */
1618 #define CONST_COSTS(RTX,CODE,OUTER_CODE) \
1620 /* Constant zero is super cheap due to clr instruction. */ \
1621 if (RTX == const0_rtx) return 0; \
1622 /* if ((OUTER_CODE) == SET) */ \
1623 return const_int_cost(RTX); \
1628 case CONST_DOUBLE: \
1631 /* Compute the cost of various arithmetic operations.
1632 These are vaguely right for a 68020. */
1633 /* The costs for long multiply have been adjusted to
1634 work properly in synth_mult on the 68020,
1635 relative to an average of the time for add and the time for shift,
1636 taking away a little more because sometimes move insns are needed. */
1637 /* div?.w is relatively cheaper on 68000 counted in COSTS_N_INSNS terms. */
1638 #define MULL_COST (TARGET_68060 ? 2 : TARGET_68040 ? 5 : 13)
1639 #define MULW_COST (TARGET_68060 ? 2 : TARGET_68040 ? 3 : TARGET_68020 ? 8 : 5)
1640 #define DIVW_COST (TARGET_68020 ? 27 : 12)
1642 #define RTX_COSTS(X,CODE,OUTER_CODE) \
1644 /* An lea costs about three times as much as a simple add. */ \
1645 if (GET_MODE (X) == SImode \
1646 && GET_CODE (XEXP (X, 1)) == REG \
1647 && GET_CODE (XEXP (X, 0)) == MULT \
1648 && GET_CODE (XEXP (XEXP (X, 0), 0)) == REG \
1649 && GET_CODE (XEXP (XEXP (X, 0), 1)) == CONST_INT \
1650 && (INTVAL (XEXP (XEXP (X, 0), 1)) == 2 \
1651 || INTVAL (XEXP (XEXP (X, 0), 1)) == 4 \
1652 || INTVAL (XEXP (XEXP (X, 0), 1)) == 8)) \
1653 return COSTS_N_INSNS (3); /* lea an@(dx:l:i),am */ \
1659 return COSTS_N_INSNS(1); \
1660 if (! TARGET_68020) \
1662 if (GET_CODE (XEXP (X, 1)) == CONST_INT) \
1664 if (INTVAL (XEXP (X, 1)) < 16) \
1665 return COSTS_N_INSNS (2) + INTVAL (XEXP (X, 1)) / 2; \
1667 /* We're using clrw + swap for these cases. */ \
1668 return COSTS_N_INSNS (4) + (INTVAL (XEXP (X, 1)) - 16) / 2; \
1670 return COSTS_N_INSNS (10); /* worst case */ \
1672 /* A shift by a big integer takes an extra instruction. */ \
1673 if (GET_CODE (XEXP (X, 1)) == CONST_INT \
1674 && (INTVAL (XEXP (X, 1)) == 16)) \
1675 return COSTS_N_INSNS (2); /* clrw;swap */ \
1676 if (GET_CODE (XEXP (X, 1)) == CONST_INT \
1677 && !(INTVAL (XEXP (X, 1)) > 0 \
1678 && INTVAL (XEXP (X, 1)) <= 8)) \
1679 return COSTS_N_INSNS (3); /* lsr #i,dn */ \
1682 if ((GET_CODE (XEXP (X, 0)) == ZERO_EXTEND \
1683 || GET_CODE (XEXP (X, 0)) == SIGN_EXTEND) \
1684 && GET_MODE (X) == SImode) \
1685 return COSTS_N_INSNS (MULW_COST); \
1686 if (GET_MODE (X) == QImode || GET_MODE (X) == HImode) \
1687 return COSTS_N_INSNS (MULW_COST); \
1689 return COSTS_N_INSNS (MULL_COST); \
1694 if (GET_MODE (X) == QImode || GET_MODE (X) == HImode) \
1695 return COSTS_N_INSNS (DIVW_COST); /* div.w */ \
1696 return COSTS_N_INSNS (43); /* div.l */
1698 /* Tell final.c how to eliminate redundant test instructions. */
1700 /* Here we define machine-dependent flags and fields in cc_status
1701 (see `conditions.h'). */
1703 /* Set if the cc value is actually in the 68881, so a floating point
1704 conditional branch must be output. */
1705 #define CC_IN_68881 04000
1707 /* Store in cc_status the expressions that the condition codes will
1708 describe after execution of an instruction whose pattern is EXP.
1709 Do not alter them if the instruction would not alter the cc's. */
1711 /* On the 68000, all the insns to store in an address register fail to
1712 set the cc's. However, in some cases these instructions can make it
1713 possibly invalid to use the saved cc's. In those cases we clear out
1714 some or all of the saved cc's so they won't be used. */
1716 #define NOTICE_UPDATE_CC(EXP,INSN) notice_update_cc (EXP, INSN)
1718 #define OUTPUT_JUMP(NORMAL, FLOAT, NO_OV) \
1719 { if (cc_prev_status.flags & CC_IN_68881) \
1721 if (cc_prev_status.flags & CC_NO_OVERFLOW) \
1725 /* Control the assembler format that we output. */
1727 /* Output at beginning of assembler file. */
1729 #define ASM_FILE_START(FILE) \
1730 fprintf (FILE, "#NO_APP\n");
1732 /* Output to assembler file text saying following lines
1733 may contain character constants, extra white space, comments, etc. */
1735 #define ASM_APP_ON "#APP\n"
1737 /* Output to assembler file text saying following lines
1738 no longer contain unusual constructs. */
1740 #define ASM_APP_OFF "#NO_APP\n"
1742 /* Output before read-only data. */
1744 #define TEXT_SECTION_ASM_OP ".text"
1746 /* Output before writable data. */
1748 #define DATA_SECTION_ASM_OP ".data"
1750 /* Here are four prefixes that are used by asm_fprintf to
1751 facilitate customization for alternate assembler syntaxes.
1752 Machines with no likelihood of an alternate syntax need not
1753 define these and need not use asm_fprintf. */
1755 /* The prefix for register names. Note that REGISTER_NAMES
1756 is supposed to include this prefix. */
1758 #define REGISTER_PREFIX ""
1760 /* The prefix for local labels. You should be able to define this as
1761 an empty string, or any arbitrary string (such as ".", ".L%", etc)
1762 without having to make any other changes to account for the specific
1763 definition. Note it is a string literal, not interpreted by printf
1766 #define LOCAL_LABEL_PREFIX ""
1768 /* The prefix to add to user-visible assembler symbols. */
1770 #define USER_LABEL_PREFIX "_"
1772 /* The prefix for immediate operands. */
1774 #define IMMEDIATE_PREFIX "#"
1776 /* How to refer to registers in assembler output.
1777 This sequence is indexed by compiler's hard-register-number (see above). */
1779 #ifndef SUPPORT_SUN_FPA
1781 #define REGISTER_NAMES \
1782 {"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", \
1783 "a0", "a1", "a2", "a3", "a4", "a5", "a6", "sp", \
1784 "fp0", "fp1", "fp2", "fp3", "fp4", "fp5", "fp6", "fp7" }
1786 #else /* SUPPORTED_SUN_FPA */
1788 #define REGISTER_NAMES \
1789 {"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", \
1790 "a0", "a1", "a2", "a3", "a4", "a5", "a6", "sp", \
1791 "fp0", "fp1", "fp2", "fp3", "fp4", "fp5", "fp6", "fp7", \
1792 "fpa0", "fpa1", "fpa2", "fpa3", "fpa4", "fpa5", "fpa6", "fpa7", \
1793 "fpa8", "fpa9", "fpa10", "fpa11", "fpa12", "fpa13", "fpa14", "fpa15", \
1794 "fpa16", "fpa17", "fpa18", "fpa19", "fpa20", "fpa21", "fpa22", "fpa23", \
1795 "fpa24", "fpa25", "fpa26", "fpa27", "fpa28", "fpa29", "fpa30", "fpa31" }
1797 #endif /* defined SUPPORT_SUN_FPA */
1799 /* How to renumber registers for dbx and gdb.
1800 On the Sun-3, the floating point registers have numbers
1801 18 to 25, not 16 to 23 as they do in the compiler. */
1803 #define DBX_REGISTER_NUMBER(REGNO) ((REGNO) < 16 ? (REGNO) : (REGNO) + 2)
1805 /* Before the prologue, RA is at 0(%sp). */
1806 #define INCOMING_RETURN_ADDR_RTX \
1807 gen_rtx_MEM (VOIDmode, gen_rtx_REG (VOIDmode, STACK_POINTER_REGNUM))
1809 /* We must not use the DBX register numbers for the DWARF 2 CFA column
1810 numbers because that maps to numbers beyond FIRST_PSEUDO_REGISTER.
1811 Instead use the identity mapping. */
1812 #define DWARF_FRAME_REGNUM(REG) REG
1814 /* Before the prologue, the top of the frame is at 4(%sp). */
1815 #define INCOMING_FRAME_SP_OFFSET 4
1817 /* This is how to output the definition of a user-level label named NAME,
1818 such as the label on a static function or variable NAME. */
1820 #define ASM_OUTPUT_LABEL(FILE,NAME) \
1821 do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
1823 /* This is how to output a command to make the user-level label named NAME
1824 defined for reference from other files. */
1826 #define GLOBAL_ASM_OP ".globl"
1827 #define ASM_GLOBALIZE_LABEL(FILE,NAME) \
1828 do { fprintf (FILE, "%s ", GLOBAL_ASM_OP); \
1829 assemble_name (FILE, NAME); \
1830 fputs ("\n", FILE);} while (0)
1832 /* This is how to output a reference to a user-level label named NAME.
1833 `assemble_name' uses this. */
1835 #define ASM_OUTPUT_LABELREF(FILE,NAME) \
1836 asm_fprintf (FILE, "%0U%s", NAME)
1838 /* This is how to output an internal numbered label where
1839 PREFIX is the class of label and NUM is the number within the class. */
1841 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
1842 asm_fprintf (FILE, "%0L%s%d:\n", PREFIX, NUM)
1844 /* This is how to store into the string LABEL
1845 the symbol_ref name of an internal numbered label where
1846 PREFIX is the class of label and NUM is the number within the class.
1847 This is suitable for output with `assemble_name'. */
1849 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
1850 sprintf (LABEL, "*%s%s%d", LOCAL_LABEL_PREFIX, PREFIX, NUM)
1852 /* This is how to output a `long double' extended real constant. */
1854 #define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE) \
1856 REAL_VALUE_TO_TARGET_LONG_DOUBLE (VALUE, l); \
1857 fprintf (FILE, "\t.long 0x%lx,0x%lx,0x%lx\n", l[0], l[1], l[2]); \
1860 /* This is how to output an assembler line defining a `double' constant. */
1862 #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
1863 do { char dstr[30]; \
1864 REAL_VALUE_TO_DECIMAL (VALUE, "%.20g", dstr); \
1865 fprintf (FILE, "\t.double 0r%s\n", dstr); \
1868 /* This is how to output an assembler line defining a `float' constant. */
1870 #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
1872 REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
1873 fprintf (FILE, "\t.long 0x%lx\n", l); \
1876 /* This is how to output an assembler line defining an `int' constant. */
1878 #define ASM_OUTPUT_INT(FILE,VALUE) \
1879 ( fprintf (FILE, "\t.long "), \
1880 output_addr_const (FILE, (VALUE)), \
1881 fprintf (FILE, "\n"))
1883 /* Likewise for `char' and `short' constants. */
1885 #define ASM_OUTPUT_SHORT(FILE,VALUE) \
1886 ( fprintf (FILE, "\t.word "), \
1887 output_addr_const (FILE, (VALUE)), \
1888 fprintf (FILE, "\n"))
1890 #define ASM_OUTPUT_CHAR(FILE,VALUE) \
1891 ( fprintf (FILE, "\t.byte "), \
1892 output_addr_const (FILE, (VALUE)), \
1893 fprintf (FILE, "\n"))
1895 /* This is how to output an assembler line for a numeric constant byte. */
1897 #define ASM_OUTPUT_BYTE(FILE,VALUE) \
1898 fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
1900 /* This is how to output an insn to push a register on the stack.
1901 It need not be very fast code. */
1903 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
1904 asm_fprintf (FILE, "\tmovel %s,%Rsp@-\n", reg_names[REGNO])
1906 /* This is how to output an insn to pop a register from the stack.
1907 It need not be very fast code. */
1909 #define ASM_OUTPUT_REG_POP(FILE,REGNO) \
1910 asm_fprintf (FILE, "\tmovel %Rsp@+,%s\n", reg_names[REGNO])
1912 /* This is how to output an element of a case-vector that is absolute.
1913 (The 68000 does not use such vectors,
1914 but we must define this macro anyway.) */
1916 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
1917 asm_fprintf (FILE, "\t.long %LL%d\n", VALUE)
1919 /* This is how to output an element of a case-vector that is relative. */
1921 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
1922 asm_fprintf (FILE, "\t.word %LL%d-%LL%d\n", VALUE, REL)
1924 /* This is how to output an assembler line
1925 that says to advance the location counter
1926 to a multiple of 2**LOG bytes. */
1928 /* We don't have a way to align to more than a two-byte boundary, so do the
1929 best we can and don't complain. */
1930 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
1932 fprintf (FILE, "\t.even\n");
1934 #define ASM_OUTPUT_SKIP(FILE,SIZE) \
1935 fprintf (FILE, "\t.skip %u\n", (SIZE))
1937 /* This says how to output an assembler line
1938 to define a global common symbol. */
1940 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
1941 ( fputs (".comm ", (FILE)), \
1942 assemble_name ((FILE), (NAME)), \
1943 fprintf ((FILE), ",%u\n", (ROUNDED)))
1945 /* This says how to output an assembler line
1946 to define a local common symbol. */
1948 #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
1949 ( fputs (".lcomm ", (FILE)), \
1950 assemble_name ((FILE), (NAME)), \
1951 fprintf ((FILE), ",%u\n", (ROUNDED)))
1953 /* Store in OUTPUT a string (made with alloca) containing
1954 an assembler-name for a local static variable named NAME.
1955 LABELNO is an integer which is different for each call. */
1957 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
1958 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
1959 sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
1961 /* Define the parentheses used to group arithmetic operations
1962 in assembler code. */
1964 #define ASM_OPEN_PAREN "("
1965 #define ASM_CLOSE_PAREN ")"
1967 /* Define results of standard character escape sequences. */
1968 #define TARGET_BELL 007
1969 #define TARGET_BS 010
1970 #define TARGET_TAB 011
1971 #define TARGET_NEWLINE 012
1972 #define TARGET_VT 013
1973 #define TARGET_FF 014
1974 #define TARGET_CR 015
1976 /* Output a float value (represented as a C double) as an immediate operand.
1977 This macro is a 68k-specific macro. */
1979 #define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE) \
1984 REAL_VALUE_TO_DECIMAL (VALUE, "%.9g", dstr); \
1985 asm_fprintf ((FILE), "%I0r%s", dstr); \
1990 REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
1991 asm_fprintf ((FILE), "%I0x%lx", l); \
1995 /* Output a double value (represented as a C double) as an immediate operand.
1996 This macro is a 68k-specific macro. */
1997 #define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE) \
1998 do { char dstr[30]; \
1999 REAL_VALUE_TO_DECIMAL (VALUE, "%.20g", dstr); \
2000 asm_fprintf (FILE, "%I0r%s", dstr); \
2003 /* Note, long double immediate operands are not actually
2004 generated by m68k.md. */
2005 #define ASM_OUTPUT_LONG_DOUBLE_OPERAND(FILE,VALUE) \
2006 do { char dstr[30]; \
2007 REAL_VALUE_TO_DECIMAL (VALUE, "%.20g", dstr); \
2008 asm_fprintf (FILE, "%I0r%s", dstr); \
2011 /* Print operand X (an rtx) in assembler syntax to file FILE.
2012 CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
2013 For `%' followed by punctuation, CODE is the punctuation and X is null.
2015 On the 68000, we use several CODE characters:
2016 '.' for dot needed in Motorola-style opcode names.
2017 '-' for an operand pushing on the stack:
2018 sp@-, -(sp) or -(%sp) depending on the style of syntax.
2019 '+' for an operand pushing on the stack:
2020 sp@+, (sp)+ or (%sp)+ depending on the style of syntax.
2021 '@' for a reference to the top word on the stack:
2022 sp@, (sp) or (%sp) depending on the style of syntax.
2023 '#' for an immediate operand prefix (# in MIT and Motorola syntax
2024 but & in SGS syntax).
2025 '!' for the fpcr register (used in some float-to-fixed conversions).
2026 '$' for the letter `s' in an op code, but only on the 68040.
2027 '&' for the letter `d' in an op code, but only on the 68040.
2028 '/' for register prefix needed by longlong.h.
2030 'b' for byte insn (no effect, on the Sun; this is for the ISI).
2031 'd' to force memory addressing to be absolute, not relative.
2032 'f' for float insn (print a CONST_DOUBLE as a float rather than in hex)
2033 'w' for FPA insn (print a CONST_DOUBLE as a SunFPA constant rather
2034 than directly). Second part of 'y' below.
2035 'x' for float insn (print a CONST_DOUBLE as a float rather than in hex),
2036 or print pair of registers as rx:ry.
2037 'y' for a FPA insn (print pair of registers as rx:ry). This also outputs
2038 CONST_DOUBLE's as SunFPA constant RAM registers if
2039 possible, so it should not be used except for the SunFPA. */
2041 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
2042 ((CODE) == '.' || (CODE) == '#' || (CODE) == '-' \
2043 || (CODE) == '+' || (CODE) == '@' || (CODE) == '!' \
2044 || (CODE) == '$' || (CODE) == '&' || (CODE) == '/')
2046 /* A C compound statement to output to stdio stream STREAM the
2047 assembler syntax for an instruction operand X. X is an RTL
2050 CODE is a value that can be used to specify one of several ways
2051 of printing the operand. It is used when identical operands
2052 must be printed differently depending on the context. CODE
2053 comes from the `%' specification that was used to request
2054 printing of the operand. If the specification was just `%DIGIT'
2055 then CODE is 0; if the specification was `%LTR DIGIT' then CODE
2056 is the ASCII code for LTR.
2058 If X is a register, this macro should print the register's name.
2059 The names can be found in an array `reg_names' whose type is
2060 `char *[]'. `reg_names' is initialized from `REGISTER_NAMES'.
2062 When the machine description has a specification `%PUNCT' (a `%'
2063 followed by a punctuation character), this macro is called with
2064 a null pointer for X and the punctuation character for CODE.
2066 See m68k.c for the m68k specific codes. */
2068 #define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
2070 /* A C compound statement to output to stdio stream STREAM the
2071 assembler syntax for an instruction operand that is a memory
2072 reference whose address is ADDR. ADDR is an RTL expression.
2074 On some machines, the syntax for a symbolic address depends on
2075 the section that the address refers to. On these machines,
2076 define the macro `ENCODE_SECTION_INFO' to store the information
2077 into the `symbol_ref', and then check for it here. */
2079 #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
2081 /* Define functions defined in aux-output.c and used in templates. */
2083 extern char *output_move_const_into_data_reg ();
2084 extern char *output_move_simode_const ();
2085 extern char *output_move_simode ();
2086 extern char *output_move_himode ();
2087 extern char *output_move_qimode ();
2088 extern char *output_move_stricthi ();
2089 extern char *output_move_strictqi ();
2090 extern char *output_move_double ();
2091 extern char *output_move_const_single ();
2092 extern char *output_move_const_double ();
2093 extern char *output_btst ();
2094 extern char *output_scc_di ();
2095 extern char *output_addsi3 ();
2096 extern char *output_andsi3 ();
2097 extern char *output_iorsi3 ();
2098 extern char *output_xorsi3 ();
2099 extern void output_dbcc_and_branch ();
2100 extern int const_uint32_operand ();
2101 extern int const_sint32_operand ();
2102 extern int floating_exact_log2 ();
2103 extern int not_sp_operand ();
2104 extern int valid_dbcc_comparison_p ();
2105 extern int extend_operator ();
2106 extern int flags_in_68881 ();
2107 extern int strict_low_part_peephole_ok ();
2109 /* Variables in m68k.c */
2110 extern char *m68k_align_loops_string;
2111 extern char *m68k_align_jumps_string;
2112 extern char *m68k_align_funcs_string;
2113 extern int m68k_align_loops;
2114 extern int m68k_align_jumps;
2115 extern int m68k_align_funcs;
2116 extern int m68k_last_compare_had_fp_operands;
2118 /* Functions from m68k.c used in macros. */
2119 extern int symbolic_operand ();
2120 extern int const_int_cost ();
2121 extern int standard_68881_constant_p ();
2122 extern int standard_sun_fpa_constant_p ();
2123 extern void output_function_prologue ();
2124 extern int use_return_insn ();
2125 extern void print_operand_address ();
2126 extern void print_operand ();
2127 extern void notice_update_cc ();
2128 extern void finalize_pic ();
2129 extern void override_options ();