1 /* Definitions of target machine for GNU compiler,
2 for ATMEL AVR at90s8515, ATmega103/103L, ATmega603/603L microcontrollers.
3 Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
4 Contributed by Denis Chertykov (denisc@overta.ru)
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. */
23 /* Names to predefine in the preprocessor for this target machine. */
25 #define TARGET_CPU_CPP_BUILTINS() \
28 builtin_define_std ("AVR"); \
29 if (avr_base_arch_macro) \
30 builtin_define (avr_base_arch_macro); \
31 if (avr_extra_arch_macro) \
32 builtin_define (avr_extra_arch_macro); \
34 builtin_define ("__AVR_ASM_ONLY__"); \
36 builtin_define ("__AVR_ENHANCED__"); \
38 builtin_define ("__AVR_MEGA__"); \
39 if (TARGET_NO_INTERRUPTS) \
40 builtin_define ("__NO_INTERRUPTS__"); \
44 /* This declaration should be present. */
45 extern int target_flags;
47 #define MASK_RTL_DUMP 0x00000010
48 #define MASK_ALL_DEBUG 0x00000FE0
49 #define MASK_ORDER_1 0x00001000
50 #define MASK_INSN_SIZE_DUMP 0x00002000
51 #define MASK_ORDER_2 0x00004000
52 #define MASK_NO_TABLEJUMP 0x00008000
53 #define MASK_INT8 0x00010000
54 #define MASK_NO_INTERRUPTS 0x00020000
55 #define MASK_CALL_PROLOGUES 0x00040000
56 #define MASK_TINY_STACK 0x00080000
57 #define MASK_SHORT_CALLS 0x00100000
59 #define TARGET_ORDER_1 (target_flags & MASK_ORDER_1)
60 #define TARGET_ORDER_2 (target_flags & MASK_ORDER_2)
61 #define TARGET_INT8 (target_flags & MASK_INT8)
62 #define TARGET_NO_INTERRUPTS (target_flags & MASK_NO_INTERRUPTS)
63 #define TARGET_INSN_SIZE_DUMP (target_flags & MASK_INSN_SIZE_DUMP)
64 #define TARGET_CALL_PROLOGUES (target_flags & MASK_CALL_PROLOGUES)
65 #define TARGET_TINY_STACK (target_flags & MASK_TINY_STACK)
66 #define TARGET_NO_TABLEJUMP (target_flags & MASK_NO_TABLEJUMP)
67 #define TARGET_SHORT_CALLS (target_flags & MASK_SHORT_CALLS)
69 /* Dump each assembler insn's rtl into the output file.
70 This is for debugging the compiler itself. */
72 #define TARGET_RTL_DUMP (target_flags & MASK_RTL_DUMP)
73 #define TARGET_ALL_DEBUG (target_flags & MASK_ALL_DEBUG)
75 #define TARGET_SWITCHES { \
76 { "order1", MASK_ORDER_1, NULL }, \
77 { "order2", MASK_ORDER_2, NULL }, \
78 { "int8", MASK_INT8, N_("Assume int to be 8 bit integer") }, \
79 { "no-interrupts", MASK_NO_INTERRUPTS, \
80 N_("Change the stack pointer without disabling interrupts") }, \
81 { "call-prologues", MASK_CALL_PROLOGUES, \
82 N_("Use subroutines for function prologue/epilogue") }, \
83 { "tiny-stack", MASK_TINY_STACK, \
84 N_("Change only the low 8 bits of the stack pointer") }, \
85 { "no-tablejump", MASK_NO_TABLEJUMP, \
86 N_("Do not generate tablejump insns") }, \
87 { "short-calls", MASK_SHORT_CALLS, \
88 N_("Use rjmp/rcall (limited range) on >8K devices") }, \
89 { "rtl", MASK_RTL_DUMP, NULL }, \
90 { "size", MASK_INSN_SIZE_DUMP, \
91 N_("Output instruction sizes to the asm file") }, \
92 { "deb", MASK_ALL_DEBUG, NULL }, \
95 extern const char *avr_init_stack;
96 extern const char *avr_mcu_name;
98 extern const char *avr_base_arch_macro;
99 extern const char *avr_extra_arch_macro;
100 extern int avr_mega_p;
101 extern int avr_enhanced_p;
102 extern int avr_asm_only_p;
104 #define AVR_MEGA (avr_mega_p && !TARGET_SHORT_CALLS)
105 #define AVR_ENHANCED (avr_enhanced_p)
107 #define TARGET_OPTIONS { \
108 { "init-stack=", &avr_init_stack, N_("Specify the initial stack address") }, \
109 { "mcu=", &avr_mcu_name, N_("Specify the MCU name") } }
111 #define TARGET_VERSION fprintf (stderr, " (GNU assembler syntax)");
112 /* This macro is a C statement to print on `stderr' a string
113 describing the particular machine description choice. Every
114 machine description should define `TARGET_VERSION'. For example:
117 #define TARGET_VERSION \
118 fprintf (stderr, " (68k, Motorola syntax)");
120 #define TARGET_VERSION \
121 fprintf (stderr, " (68k, MIT syntax)");
124 #define OVERRIDE_OPTIONS avr_override_options ()
125 /* `OVERRIDE_OPTIONS'
126 Sometimes certain combinations of command options do not make
127 sense on a particular target machine. You can define a macro
128 `OVERRIDE_OPTIONS' to take account of this. This macro, if
129 defined, is executed once just after all the command options have
132 Don't use this macro to turn on various extra optimizations for
133 `-O'. That is what `OPTIMIZATION_OPTIONS' is for. */
135 #define CAN_DEBUG_WITHOUT_FP
136 /* Define this macro if debugging can be performed even without a
137 frame pointer. If this macro is defined, GNU CC will turn on the
138 `-fomit-frame-pointer' option whenever `-O' is specified. */
140 /* Define this if most significant byte of a word is the lowest numbered. */
141 #define BITS_BIG_ENDIAN 0
143 /* Define this if most significant byte of a word is the lowest numbered. */
144 #define BYTES_BIG_ENDIAN 0
146 /* Define this if most significant word of a multiword number is the lowest
148 #define WORDS_BIG_ENDIAN 0
151 /* This is to get correct SI and DI modes in libgcc2.c (32 and 64 bits). */
152 #define UNITS_PER_WORD 4
154 /* Width of a word, in units (bytes). */
155 #define UNITS_PER_WORD 1
158 /* Width in bits of a pointer.
159 See also the macro `Pmode' defined below. */
160 #define POINTER_SIZE 16
163 /* Maximum sized of reasonable data type
164 DImode or Dfmode ... */
165 #define MAX_FIXED_MODE_SIZE 32
167 /* Allocation boundary (in *bits*) for storing arguments in argument list. */
168 #define PARM_BOUNDARY 8
170 /* Allocation boundary (in *bits*) for the code of a function. */
171 #define FUNCTION_BOUNDARY 8
173 /* Alignment of field after `int : 0' in a structure. */
174 #define EMPTY_FIELD_BOUNDARY 8
176 /* No data type wants to be aligned rounder than this. */
177 #define BIGGEST_ALIGNMENT 8
180 /* Define this if move instructions will actually fail to work
181 when given unaligned data. */
182 #define STRICT_ALIGNMENT 0
184 /* A C expression for the size in bits of the type `int' on the
185 target machine. If you don't define this, the default is one word. */
186 #define INT_TYPE_SIZE (TARGET_INT8 ? 8 : 16)
189 /* A C expression for the size in bits of the type `short' on the
190 target machine. If you don't define this, the default is half a
191 word. (If this would be less than one storage unit, it is rounded
193 #define SHORT_TYPE_SIZE (INT_TYPE_SIZE == 8 ? INT_TYPE_SIZE : 16)
195 /* A C expression for the size in bits of the type `long' on the
196 target machine. If you don't define this, the default is one word. */
197 #define LONG_TYPE_SIZE (INT_TYPE_SIZE == 8 ? 16 : 32)
199 #define MAX_LONG_TYPE_SIZE 32
200 /* Maximum number for the size in bits of the type `long' on the
201 target machine. If this is undefined, the default is
202 `LONG_TYPE_SIZE'. Otherwise, it is the constant value that is the
203 largest value that `LONG_TYPE_SIZE' can have at run-time. This is
207 #define LONG_LONG_TYPE_SIZE 64
208 /* A C expression for the size in bits of the type `long long' on the
209 target machine. If you don't define this, the default is two
210 words. If you want to support GNU Ada on your machine, the value
211 of macro must be at least 64. */
214 #define FLOAT_TYPE_SIZE 32
215 /* A C expression for the size in bits of the type `float' on the
216 target machine. If you don't define this, the default is one word. */
218 #define DOUBLE_TYPE_SIZE 32
219 /* A C expression for the size in bits of the type `double' on the
220 target machine. If you don't define this, the default is two
224 #define LONG_DOUBLE_TYPE_SIZE 32
225 /* A C expression for the size in bits of the type `long double' on
226 the target machine. If you don't define this, the default is two
229 #define DEFAULT_SIGNED_CHAR 1
230 /* An expression whose value is 1 or 0, according to whether the type
231 `char' should be signed or unsigned by default. The user can
232 always override this default with the options `-fsigned-char' and
233 `-funsigned-char'. */
235 /* `DEFAULT_SHORT_ENUMS'
236 A C expression to determine whether to give an `enum' type only as
237 many bytes as it takes to represent the range of possible values
238 of that type. A nonzero value means to do that; a zero value
239 means all `enum' types should be allocated like `int'.
241 If you don't define the macro, the default is 0. */
243 #define SIZE_TYPE (INT_TYPE_SIZE == 8 ? "long unsigned int" : "unsigned int")
244 /* A C expression for a string describing the name of the data type
245 to use for size values. The typedef name `size_t' is defined
246 using the contents of the string.
248 The string can contain more than one keyword. If so, separate
249 them with spaces, and write first any length keyword, then
250 `unsigned' if appropriate, and finally `int'. The string must
251 exactly match one of the data type names defined in the function
252 `init_decl_processing' in the file `c-decl.c'. You may not omit
253 `int' or change the order--that would cause the compiler to crash
256 If you don't define this macro, the default is `"long unsigned
259 #define PTRDIFF_TYPE (INT_TYPE_SIZE == 8 ? "long int" :"int")
260 /* A C expression for a string describing the name of the data type
261 to use for the result of subtracting two pointers. The typedef
262 name `ptrdiff_t' is defined using the contents of the string. See
263 `SIZE_TYPE' above for more information.
265 If you don't define this macro, the default is `"long int"'. */
268 #define WCHAR_TYPE_SIZE 16
269 /* A C expression for the size in bits of the data type for wide
270 characters. This is used in `cpp', which cannot make use of
273 #define FIRST_PSEUDO_REGISTER 36
274 /* Number of hardware registers known to the compiler. They receive
275 numbers 0 through `FIRST_PSEUDO_REGISTER-1'; thus, the first
276 pseudo register's number really is assigned the number
277 `FIRST_PSEUDO_REGISTER'. */
279 #define FIXED_REGISTERS {\
297 1,1 /* arg pointer */ }
298 /* An initializer that says which registers are used for fixed
299 purposes all throughout the compiled code and are therefore not
300 available for general allocation. These would include the stack
301 pointer, the frame pointer (except on machines where that can be
302 used as a general register when no frame pointer is needed), the
303 program counter on machines where that is considered one of the
304 addressable registers, and any other numbered register with a
307 This information is expressed as a sequence of numbers, separated
308 by commas and surrounded by braces. The Nth number is 1 if
309 register N is fixed, 0 otherwise.
311 The table initialized from this macro, and the table initialized by
312 the following one, may be overridden at run time either
313 automatically, by the actions of the macro
314 `CONDITIONAL_REGISTER_USAGE', or by the user with the command
315 options `-ffixed-REG', `-fcall-used-REG' and `-fcall-saved-REG'. */
317 #define CALL_USED_REGISTERS { \
335 1,1 /* arg pointer */ }
336 /* Like `FIXED_REGISTERS' but has 1 for each register that is
337 clobbered (in general) by function calls as well as for fixed
338 registers. This macro therefore identifies the registers that are
339 not available for general allocation of values that must live
340 across function calls.
342 If a register has 0 in `CALL_USED_REGISTERS', the compiler
343 automatically saves it on function entry and restores it on
344 function exit, if the register is used within the function. */
346 #define NON_SAVING_SETJMP 0
347 /* If this macro is defined and has a nonzero value, it means that
348 `setjmp' and related functions fail to save the registers, or that
349 `longjmp' fails to restore them. To compensate, the compiler
350 avoids putting variables in registers in functions that use
353 #define REG_ALLOC_ORDER { \
361 17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2, \
365 /* If defined, an initializer for a vector of integers, containing the
366 numbers of hard registers in the order in which GNU CC should
367 prefer to use them (from most preferred to least).
369 If this macro is not defined, registers are used lowest numbered
370 first (all else being equal).
372 One use of this macro is on machines where the highest numbered
373 registers must always be saved and the save-multiple-registers
374 instruction supports only sequences of consetionve registers. On
375 such machines, define `REG_ALLOC_ORDER' to be an initializer that
376 lists the highest numbered allocatable register first. */
378 #define ORDER_REGS_FOR_LOCAL_ALLOC order_regs_for_local_alloc ()
379 /* ORDER_REGS_FOR_LOCAL_ALLOC'
380 A C statement (sans semicolon) to choose the order in which to
381 allocate hard registers for pseudo-registers local to a basic
384 Store the desired register order in the array `reg_alloc_order'.
385 Element 0 should be the register to allocate first; element 1, the
386 next register; and so on.
388 The macro body should not assume anything about the contents of
389 `reg_alloc_order' before execution of the macro.
391 On most machines, it is not necessary to define this macro. */
394 #define HARD_REGNO_NREGS(REGNO, MODE) ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
396 /* A C expression for the number of consecutive hard registers,
397 starting at register number REGNO, required to hold a value of mode
400 On a machine where all registers are exactly one word, a suitable
401 definition of this macro is
403 #define HARD_REGNO_NREGS(REGNO, MODE) \
404 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) \
405 / UNITS_PER_WORD)) */
407 #define HARD_REGNO_MODE_OK(REGNO, MODE) avr_hard_regno_mode_ok(REGNO, MODE)
408 /* A C expression that is nonzero if it is permissible to store a
409 value of mode MODE in hard register number REGNO (or in several
410 registers starting with that one). For a machine where all
411 registers are equivalent, a suitable definition is
413 #define HARD_REGNO_MODE_OK(REGNO, MODE) 1
415 It is not necessary for this macro to check for the numbers of
416 fixed registers, because the allocation mechanism considers them
417 to be always occupied.
419 On some machines, double-precision values must be kept in even/odd
420 register pairs. The way to implement that is to define this macro
421 to reject odd register numbers for such modes.
423 The minimum requirement for a mode to be OK in a register is that
424 the `movMODE' instruction pattern support moves between the
425 register and any other hard register for which the mode is OK; and
426 that moving a value into the register and back out not alter it.
428 Since the same instruction used to move `SImode' will work for all
429 narrower integer modes, it is not necessary on any machine for
430 `HARD_REGNO_MODE_OK' to distinguish between these modes, provided
431 you define patterns `movhi', etc., to take advantage of this. This
432 is useful because of the interaction between `HARD_REGNO_MODE_OK'
433 and `MODES_TIEABLE_P'; it is very desirable for all integer modes
436 Many machines have special registers for floating point arithmetic.
437 Often people assume that floating point machine modes are allowed
438 only in floating point registers. This is not true. Any
439 registers that can hold integers can safely *hold* a floating
440 point machine mode, whether or not floating arithmetic can be done
441 on it in those registers. Integer move instructions can be used
444 On some machines, though, the converse is true: fixed-point machine
445 modes may not go in floating registers. This is true if the
446 floating registers normalize any value stored in them, because
447 storing a non-floating value there would garble it. In this case,
448 `HARD_REGNO_MODE_OK' should reject fixed-point machine modes in
449 floating registers. But if the floating registers do not
450 automatically normalize, if you can store any bit pattern in one
451 and retrieve it unchanged without a trap, then any machine mode
452 may go in a floating register, so you can define this macro to say
455 The primary significance of special floating registers is rather
456 that they are the registers acceptable in floating point arithmetic
457 instructions. However, this is of no concern to
458 `HARD_REGNO_MODE_OK'. You handle it by writing the proper
459 constraints for those instructions.
461 On some machines, the floating registers are especially slow to
462 access, so that it is better to store a value in a stack frame
463 than in such a register if floating point arithmetic is not being
464 done. As long as the floating registers are not in class
465 `GENERAL_REGS', they will not be used unless some pattern's
466 constraint asks for one. */
468 #define MODES_TIEABLE_P(MODE1, MODE2) 0
469 /* A C expression that is nonzero if it is desirable to choose
470 register allocation so as to avoid move instructions between a
471 value of mode MODE1 and a value of mode MODE2.
473 If `HARD_REGNO_MODE_OK (R, MODE1)' and `HARD_REGNO_MODE_OK (R,
474 MODE2)' are ever different for any R, then `MODES_TIEABLE_P (MODE1,
475 MODE2)' must be zero. */
480 POINTER_X_REGS, /* r26 - r27 */
481 POINTER_Y_REGS, /* r28 - r29 */
482 POINTER_Z_REGS, /* r30 - r31 */
483 STACK_REG, /* STACK */
484 BASE_POINTER_REGS, /* r28 - r31 */
485 POINTER_REGS, /* r26 - r31 */
486 ADDW_REGS, /* r24 - r31 */
487 SIMPLE_LD_REGS, /* r16 - r23 */
488 LD_REGS, /* r16 - r31 */
489 NO_LD_REGS, /* r0 - r15 */
490 GENERAL_REGS, /* r0 - r31 */
491 ALL_REGS, LIM_REG_CLASSES
493 /* An enumeral type that must be defined with all the register class
494 names as enumeral values. `NO_REGS' must be first. `ALL_REGS'
495 must be the last register class, followed by one more enumeral
496 value, `LIM_REG_CLASSES', which is not a register class but rather
497 tells how many classes there are.
499 Each register class has a number, which is the value of casting
500 the class name to type `int'. The number serves as an index in
501 many of the tables described below. */
504 #define N_REG_CLASSES (int)LIM_REG_CLASSES
505 /* The number of distinct register classes, defined as follows:
507 #define N_REG_CLASSES (int) LIM_REG_CLASSES */
509 #define REG_CLASS_NAMES { \
512 "POINTER_X_REGS", /* r26 - r27 */ \
513 "POINTER_Y_REGS", /* r28 - r29 */ \
514 "POINTER_Z_REGS", /* r30 - r31 */ \
515 "STACK_REG", /* STACK */ \
516 "BASE_POINTER_REGS", /* r28 - r31 */ \
517 "POINTER_REGS", /* r26 - r31 */ \
518 "ADDW_REGS", /* r24 - r31 */ \
519 "SIMPLE_LD_REGS", /* r16 - r23 */ \
520 "LD_REGS", /* r16 - r31 */ \
521 "NO_LD_REGS", /* r0 - r15 */ \
522 "GENERAL_REGS", /* r0 - r31 */ \
524 /* An initializer containing the names of the register classes as C
525 string constants. These names are used in writing some of the
533 #define REG_CLASS_CONTENTS { \
534 {0x00000000,0x00000000}, /* NO_REGS */ \
535 {0x00000001,0x00000000}, /* R0_REG */ \
536 {3 << REG_X,0x00000000}, /* POINTER_X_REGS, r26 - r27 */ \
537 {3 << REG_Y,0x00000000}, /* POINTER_Y_REGS, r28 - r29 */ \
538 {3 << REG_Z,0x00000000}, /* POINTER_Z_REGS, r30 - r31 */ \
539 {0x00000000,0x00000003}, /* STACK_REG, STACK */ \
540 {(3 << REG_Y) | (3 << REG_Z), \
541 0x00000000}, /* BASE_POINTER_REGS, r28 - r31 */ \
542 {(3 << REG_X) | (3 << REG_Y) | (3 << REG_Z), \
543 0x00000000}, /* POINTER_REGS, r26 - r31 */ \
544 {(3 << REG_X) | (3 << REG_Y) | (3 << REG_Z) | (3 << REG_W), \
545 0x00000000}, /* ADDW_REGS, r24 - r31 */ \
546 {0x00ff0000,0x00000000}, /* SIMPLE_LD_REGS r16 - r23 */ \
547 {(3 << REG_X)|(3 << REG_Y)|(3 << REG_Z)|(3 << REG_W)|(0xff << 16), \
548 0x00000000}, /* LD_REGS, r16 - r31 */ \
549 {0x0000ffff,0x00000000}, /* NO_LD_REGS r0 - r15 */ \
550 {0xffffffff,0x00000000}, /* GENERAL_REGS, r0 - r31 */ \
551 {0xffffffff,0x00000003} /* ALL_REGS */ \
553 /* An initializer containing the contents of the register classes, as
554 integers which are bit masks. The Nth integer specifies the
555 contents of class N. The way the integer MASK is interpreted is
556 that register R is in the class if `MASK & (1 << R)' is 1.
558 When the machine has more than 32 registers, an integer does not
559 suffice. Then the integers are replaced by sub-initializers,
560 braced groupings containing several integers. Each
561 sub-initializer must be suitable as an initializer for the type
562 `HARD_REG_SET' which is defined in `hard-reg-set.h'. */
564 #define REGNO_REG_CLASS(R) avr_regno_reg_class(R)
565 /* A C expression whose value is a register class containing hard
566 register REGNO. In general there is more than one such class;
567 choose a class which is "minimal", meaning that no smaller class
568 also contains the register. */
570 #define BASE_REG_CLASS POINTER_REGS
571 /* A macro whose definition is the name of the class to which a valid
572 base register must belong. A base register is one used in an
573 address which is the register value plus a displacement. */
575 #define INDEX_REG_CLASS NO_REGS
576 /* A macro whose definition is the name of the class to which a valid
577 index register must belong. An index register is one used in an
578 address where its value is either multiplied by a scale factor or
579 added to another register (as well as added to a displacement). */
581 #define REG_CLASS_FROM_LETTER(C) avr_reg_class_from_letter(C)
582 /* A C expression which defines the machine-dependent operand
583 constraint letters for register classes. If CHAR is such a
584 letter, the value should be the register class corresponding to
585 it. Otherwise, the value should be `NO_REGS'. The register
586 letter `r', corresponding to class `GENERAL_REGS', will not be
587 passed to this macro; you do not need to handle it. */
589 #define REGNO_OK_FOR_BASE_P(r) (((r) < FIRST_PSEUDO_REGISTER \
593 || (r) == ARG_POINTER_REGNUM)) \
595 && (reg_renumber[r] == REG_X \
596 || reg_renumber[r] == REG_Y \
597 || reg_renumber[r] == REG_Z \
598 || (reg_renumber[r] \
599 == ARG_POINTER_REGNUM))))
600 /* A C expression which is nonzero if register number NUM is suitable
601 for use as a base register in operand addresses. It may be either
602 a suitable hard register or a pseudo register that has been
603 allocated such a hard register. */
605 /* #define REGNO_MODE_OK_FOR_BASE_P(r, m) regno_mode_ok_for_base_p(r, m)
606 A C expression that is just like `REGNO_OK_FOR_BASE_P', except that
607 that expression may examine the mode of the memory reference in
608 MODE. You should define this macro if the mode of the memory
609 reference affects whether a register may be used as a base
610 register. If you define this macro, the compiler will use it
611 instead of `REGNO_OK_FOR_BASE_P'. */
613 #define REGNO_OK_FOR_INDEX_P(NUM) 0
614 /* A C expression which is nonzero if register number NUM is suitable
615 for use as an index register in operand addresses. It may be
616 either a suitable hard register or a pseudo register that has been
617 allocated such a hard register.
619 The difference between an index register and a base register is
620 that the index register may be scaled. If an address involves the
621 sum of two registers, neither one of them scaled, then either one
622 may be labeled the "base" and the other the "index"; but whichever
623 labeling is used must fit the machine's constraints of which
624 registers may serve in each capacity. The compiler will try both
625 labelings, looking for one that is valid, and will reload one or
626 both registers only if neither labeling works. */
628 #define PREFERRED_RELOAD_CLASS(X, CLASS) preferred_reload_class(X,CLASS)
629 /* A C expression that places additional restrictions on the register
630 class to use when it is necessary to copy value X into a register
631 in class CLASS. The value is a register class; perhaps CLASS, or
632 perhaps another, smaller class. On many machines, the following
635 #define PREFERRED_RELOAD_CLASS(X,CLASS) CLASS
637 Sometimes returning a more restrictive class makes better code.
638 For example, on the 68000, when X is an integer constant that is
639 in range for a `moveq' instruction, the value of this macro is
640 always `DATA_REGS' as long as CLASS includes the data registers.
641 Requiring a data register guarantees that a `moveq' will be used.
643 If X is a `const_double', by returning `NO_REGS' you can force X
644 into a memory constant. This is useful on certain machines where
645 immediate floating values cannot be loaded into certain kinds of
647 /* `PREFERRED_OUTPUT_RELOAD_CLASS (X, CLASS)'
648 Like `PREFERRED_RELOAD_CLASS', but for output reloads instead of
649 input reloads. If you don't define this macro, the default is to
650 use CLASS, unchanged. */
652 /* `LIMIT_RELOAD_CLASS (MODE, CLASS)'
653 A C expression that places additional restrictions on the register
654 class to use when it is necessary to be able to hold a value of
655 mode MODE in a reload register for which class CLASS would
658 Unlike `PREFERRED_RELOAD_CLASS', this macro should be used when
659 there are certain modes that simply can't go in certain reload
662 The value is a register class; perhaps CLASS, or perhaps another,
665 Don't define this macro unless the target machine has limitations
666 which require the macro to do something nontrivial. */
668 /* SECONDARY_INPUT_RELOAD_CLASS(CLASS, MODE, X)
669 `SECONDARY_RELOAD_CLASS (CLASS, MODE, X)'
670 `SECONDARY_OUTPUT_RELOAD_CLASS (CLASS, MODE, X)'
671 Many machines have some registers that cannot be copied directly
672 to or from memory or even from other types of registers. An
673 example is the `MQ' register, which on most machines, can only be
674 copied to or from general registers, but not memory. Some
675 machines allow copying all registers to and from memory, but
676 require a scratch register for stores to some memory locations
677 (e.g., those with symbolic address on the RT, and those with
678 certain symbolic address on the Sparc when compiling PIC). In
679 some cases, both an intermediate and a scratch register are
682 You should define these macros to indicate to the reload phase
683 that it may need to allocate at least one register for a reload in
684 addition to the register to contain the data. Specifically, if
685 copying X to a register CLASS in MODE requires an intermediate
686 register, you should define `SECONDARY_INPUT_RELOAD_CLASS' to
687 return the largest register class all of whose registers can be
688 used as intermediate registers or scratch registers.
690 If copying a register CLASS in MODE to X requires an intermediate
691 or scratch register, `SECONDARY_OUTPUT_RELOAD_CLASS' should be
692 defined to return the largest register class required. If the
693 requirements for input and output reloads are the same, the macro
694 `SECONDARY_RELOAD_CLASS' should be used instead of defining both
697 The values returned by these macros are often `GENERAL_REGS'.
698 Return `NO_REGS' if no spare register is needed; i.e., if X can be
699 directly copied to or from a register of CLASS in MODE without
700 requiring a scratch register. Do not define this macro if it
701 would always return `NO_REGS'.
703 If a scratch register is required (either with or without an
704 intermediate register), you should define patterns for
705 `reload_inM' or `reload_outM', as required (*note Standard
706 Names::.. These patterns, which will normally be implemented with
707 a `define_expand', should be similar to the `movM' patterns,
708 except that operand 2 is the scratch register.
710 Define constraints for the reload register and scratch register
711 that contain a single register class. If the original reload
712 register (whose class is CLASS) can meet the constraint given in
713 the pattern, the value returned by these macros is used for the
714 class of the scratch register. Otherwise, two additional reload
715 registers are required. Their classes are obtained from the
716 constraints in the insn pattern.
718 X might be a pseudo-register or a `subreg' of a pseudo-register,
719 which could either be in a hard register or in memory. Use
720 `true_regnum' to find out; it will return -1 if the pseudo is in
721 memory and the hard register number if it is in a register.
723 These macros should not be used in the case where a particular
724 class of registers can only be copied to memory and not to another
725 class of registers. In that case, secondary reload registers are
726 not needed and would not be helpful. Instead, a stack location
727 must be used to perform the copy and the `movM' pattern should use
728 memory as an intermediate storage. This case often occurs between
729 floating-point and general registers. */
731 /* `SECONDARY_MEMORY_NEEDED (CLASS1, CLASS2, M)'
732 Certain machines have the property that some registers cannot be
733 copied to some other registers without using memory. Define this
734 macro on those machines to be a C expression that is non-zero if
735 objects of mode M in registers of CLASS1 can only be copied to
736 registers of class CLASS2 by storing a register of CLASS1 into
737 memory and loading that memory location into a register of CLASS2.
739 Do not define this macro if its value would always be zero.
741 `SECONDARY_MEMORY_NEEDED_RTX (MODE)'
742 Normally when `SECONDARY_MEMORY_NEEDED' is defined, the compiler
743 allocates a stack slot for a memory location needed for register
744 copies. If this macro is defined, the compiler instead uses the
745 memory location defined by this macro.
747 Do not define this macro if you do not define
748 `SECONDARY_MEMORY_NEEDED'. */
750 #define SMALL_REGISTER_CLASSES 1
751 /* Normally the compiler avoids choosing registers that have been
752 explicitly mentioned in the rtl as spill registers (these
753 registers are normally those used to pass parameters and return
754 values). However, some machines have so few registers of certain
755 classes that there would not be enough registers to use as spill
756 registers if this were done.
758 Define `SMALL_REGISTER_CLASSES' to be an expression with a non-zero
759 value on these machines. When this macro has a non-zero value, the
760 compiler allows registers explicitly used in the rtl to be used as
761 spill registers but avoids extending the lifetime of these
764 It is always safe to define this macro with a non-zero value, but
765 if you unnecessarily define it, you will reduce the amount of
766 optimizations that can be performed in some cases. If you do not
767 define this macro with a non-zero value when it is required, the
768 compiler will run out of spill registers and print a fatal error
769 message. For most machines, you should not define this macro at
772 #define CLASS_LIKELY_SPILLED_P(c) class_likely_spilled_p(c)
773 /* A C expression whose value is nonzero if pseudos that have been
774 assigned to registers of class CLASS would likely be spilled
775 because registers of CLASS are needed for spill registers.
777 The default value of this macro returns 1 if CLASS has exactly one
778 register and zero otherwise. On most machines, this default
779 should be used. Only define this macro to some other expression
780 if pseudo allocated by `local-alloc.c' end up in memory because
781 their hard registers were needed for spill registers. If this
782 macro returns nonzero for those classes, those pseudos will only
783 be allocated by `global.c', which knows how to reallocate the
784 pseudo to another register. If there would not be another
785 register available for reallocation, you should not change the
786 definition of this macro since the only effect of such a
787 definition would be to slow down register allocation. */
789 #define CLASS_MAX_NREGS(CLASS, MODE) class_max_nregs (CLASS, MODE)
790 /* A C expression for the maximum number of consecutive registers of
791 class CLASS needed to hold a value of mode MODE.
793 This is closely related to the macro `HARD_REGNO_NREGS'. In fact,
794 the value of the macro `CLASS_MAX_NREGS (CLASS, MODE)' should be
795 the maximum value of `HARD_REGNO_NREGS (REGNO, MODE)' for all
796 REGNO values in the class CLASS.
798 This macro helps control the handling of multiple-word values in
801 #define CONST_OK_FOR_LETTER_P(VALUE, C) \
802 ((C) == 'I' ? (VALUE) >= 0 && (VALUE) <= 63 : \
803 (C) == 'J' ? (VALUE) <= 0 && (VALUE) >= -63: \
804 (C) == 'K' ? (VALUE) == 2 : \
805 (C) == 'L' ? (VALUE) == 0 : \
806 (C) == 'M' ? (VALUE) >= 0 && (VALUE) <= 0xff : \
807 (C) == 'N' ? (VALUE) == -1: \
808 (C) == 'O' ? (VALUE) == 8 || (VALUE) == 16 || (VALUE) == 24: \
809 (C) == 'P' ? (VALUE) == 1 : \
812 /* A C expression that defines the machine-dependent operand
813 constraint letters (`I', `J', `K', ... `P') that specify
814 particular ranges of integer values. If C is one of those
815 letters, the expression should check that VALUE, an integer, is in
816 the appropriate range and return 1 if so, 0 otherwise. If C is
817 not one of those letters, the value should be 0 regardless of
820 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
821 ((C) == 'G' ? (VALUE) == CONST0_RTX (SFmode) \
823 /* `CONST_DOUBLE_OK_FOR_LETTER_P (VALUE, C)'
824 A C expression that defines the machine-dependent operand
825 constraint letters that specify particular ranges of
826 `const_double' values (`G' or `H').
828 If C is one of those letters, the expression should check that
829 VALUE, an RTX of code `const_double', is in the appropriate range
830 and return 1 if so, 0 otherwise. If C is not one of those
831 letters, the value should be 0 regardless of VALUE.
833 `const_double' is used for all floating-point constants and for
834 `DImode' fixed-point constants. A given letter can accept either
835 or both kinds of values. It can use `GET_MODE' to distinguish
836 between these kinds. */
838 #define EXTRA_CONSTRAINT(x, c) extra_constraint(x, c)
839 /* A C expression that defines the optional machine-dependent
840 constraint letters (``Q', `R', `S', `T', `U') that can'
841 be used to segregate specific types of operands, usually memory
842 references, for the target machine. Normally this macro will not
843 be defined. If it is required for a particular target machine, it
844 should return 1 if VALUE corresponds to the operand type
845 represented by the constraint letter C. If C is not defined as an
846 extra constraint, the value returned should be 0 regardless of
849 For example, on the ROMP, load instructions cannot have their
850 output in r0 if the memory reference contains a symbolic address.
851 Constraint letter `Q' is defined as representing a memory address
852 that does *not* contain a symbolic address. An alternative is
853 specified with a `Q' constraint on the input and `r' on the
854 output. The next alternative specifies `m' on the input and a
855 register class that does not include r0 on the output. */
857 /* This is an undocumented variable which describes
858 how GCC will push a data */
859 #define STACK_PUSH_CODE POST_DEC
861 #define STACK_GROWS_DOWNWARD
862 /* Define this macro if pushing a word onto the stack moves the stack
863 pointer to a smaller address.
865 When we say, "define this macro if ...," it means that the
866 compiler checks this macro only with `#ifdef' so the precise
867 definition used does not matter. */
869 #define STARTING_FRAME_OFFSET 1
870 /* Offset from the frame pointer to the first local variable slot to
873 If `FRAME_GROWS_DOWNWARD', find the next slot's offset by
874 subtracting the first slot's length from `STARTING_FRAME_OFFSET'.
875 Otherwise, it is found by adding the length of the first slot to
876 the value `STARTING_FRAME_OFFSET'. */
878 #define STACK_POINTER_OFFSET 1
879 /* Offset from the stack pointer register to the first location at
880 which outgoing arguments are placed. If not specified, the
881 default value of zero is used. This is the proper value for most
884 If `ARGS_GROW_DOWNWARD', this is the offset to the location above
885 the first location at which outgoing arguments are placed. */
887 #define FIRST_PARM_OFFSET(FUNDECL) 0
888 /* Offset from the argument pointer register to the first argument's
889 address. On some machines it may depend on the data type of the
892 If `ARGS_GROW_DOWNWARD', this is the offset to the location above
893 the first argument's address. */
895 /* `STACK_DYNAMIC_OFFSET (FUNDECL)'
896 Offset from the stack pointer register to an item dynamically
897 allocated on the stack, e.g., by `alloca'.
899 The default value for this macro is `STACK_POINTER_OFFSET' plus the
900 length of the outgoing arguments. The default is correct for most
901 machines. See `function.c' for details. */
903 #define STACK_BOUNDARY 8
904 /* Define this macro if there is a guaranteed alignment for the stack
905 pointer on this machine. The definition is a C expression for the
906 desired alignment (measured in bits). This value is used as a
907 default if PREFERRED_STACK_BOUNDARY is not defined. */
909 #define STACK_POINTER_REGNUM 32
910 /* The register number of the stack pointer register, which must also
911 be a fixed register according to `FIXED_REGISTERS'. On most
912 machines, the hardware determines which register this is. */
914 #define FRAME_POINTER_REGNUM REG_Y
915 /* The register number of the frame pointer register, which is used to
916 access automatic variables in the stack frame. On some machines,
917 the hardware determines which register this is. On other
918 machines, you can choose any register you wish for this purpose. */
920 #define ARG_POINTER_REGNUM 34
921 /* The register number of the arg pointer register, which is used to
922 access the function's argument list. On some machines, this is
923 the same as the frame pointer register. On some machines, the
924 hardware determines which register this is. On other machines,
925 you can choose any register you wish for this purpose. If this is
926 not the same register as the frame pointer register, then you must
927 mark it as a fixed register according to `FIXED_REGISTERS', or
928 arrange to be able to eliminate it (*note Elimination::.). */
930 #define STATIC_CHAIN_REGNUM 2
931 /* Register numbers used for passing a function's static chain
932 pointer. If register windows are used, the register number as
933 seen by the called function is `STATIC_CHAIN_INCOMING_REGNUM',
934 while the register number as seen by the calling function is
935 `STATIC_CHAIN_REGNUM'. If these registers are the same,
936 `STATIC_CHAIN_INCOMING_REGNUM' need not be defined.
938 The static chain register need not be a fixed register.
940 If the static chain is passed in memory, these macros should not be
941 defined; instead, the next two macros should be defined. */
943 #define FRAME_POINTER_REQUIRED frame_pointer_required_p()
944 /* A C expression which is nonzero if a function must have and use a
945 frame pointer. This expression is evaluated in the reload pass.
946 If its value is nonzero the function will have a frame pointer.
948 The expression can in principle examine the current function and
949 decide according to the facts, but on most machines the constant 0
950 or the constant 1 suffices. Use 0 when the machine allows code to
951 be generated with no frame pointer, and doing so saves some time
952 or space. Use 1 when there is no possible advantage to avoiding a
955 In certain cases, the compiler does not know how to produce valid
956 code without a frame pointer. The compiler recognizes those cases
957 and automatically gives the function a frame pointer regardless of
958 what `FRAME_POINTER_REQUIRED' says. You don't need to worry about
961 In a function that does not require a frame pointer, the frame
962 pointer register can be allocated for ordinary usage, unless you
963 mark it as a fixed register. See `FIXED_REGISTERS' for more
966 #define ELIMINABLE_REGS { \
967 {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
968 {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM} \
969 ,{FRAME_POINTER_REGNUM+1,STACK_POINTER_REGNUM+1}}
970 /* If defined, this macro specifies a table of register pairs used to
971 eliminate unneeded registers that point into the stack frame. If
972 it is not defined, the only elimination attempted by the compiler
973 is to replace references to the frame pointer with references to
976 The definition of this macro is a list of structure
977 initializations, each of which specifies an original and
978 replacement register.
980 On some machines, the position of the argument pointer is not
981 known until the compilation is completed. In such a case, a
982 separate hard register must be used for the argument pointer.
983 This register can be eliminated by replacing it with either the
984 frame pointer or the argument pointer, depending on whether or not
985 the frame pointer has been eliminated.
987 In this case, you might specify:
988 #define ELIMINABLE_REGS \
989 {{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
990 {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
991 {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
993 Note that the elimination of the argument pointer with the stack
994 pointer is specified first since that is the preferred elimination. */
996 #define CAN_ELIMINATE(FROM, TO) (((FROM) == ARG_POINTER_REGNUM \
997 && (TO) == FRAME_POINTER_REGNUM) \
998 || (((FROM) == FRAME_POINTER_REGNUM \
999 || (FROM) == FRAME_POINTER_REGNUM+1) \
1000 && ! FRAME_POINTER_REQUIRED \
1002 /* A C expression that returns non-zero if the compiler is allowed to
1003 try to replace register number FROM-REG with register number
1004 TO-REG. This macro need only be defined if `ELIMINABLE_REGS' is
1005 defined, and will usually be the constant 1, since most of the
1006 cases preventing register elimination are things that the compiler
1007 already knows about. */
1009 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
1010 OFFSET = initial_elimination_offset (FROM, TO)
1011 /* This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'. It
1012 specifies the initial difference between the specified pair of
1013 registers. This macro must be defined if `ELIMINABLE_REGS' is
1016 #define RETURN_ADDR_RTX(count, x) \
1017 gen_rtx_MEM (Pmode, memory_address (Pmode, plus_constant (tem, 1)))
1019 #define PUSH_ROUNDING(NPUSHED) (NPUSHED)
1020 /* A C expression that is the number of bytes actually pushed onto the
1021 stack when an instruction attempts to push NPUSHED bytes.
1023 If the target machine does not have a push instruction, do not
1024 define this macro. That directs GNU CC to use an alternate
1025 strategy: to allocate the entire argument block and then store the
1028 On some machines, the definition
1030 #define PUSH_ROUNDING(BYTES) (BYTES)
1032 will suffice. But on other machines, instructions that appear to
1033 push one byte actually push two bytes in an attempt to maintain
1034 alignment. Then the definition should be
1036 #define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & ~1) */
1038 #define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, STACK_SIZE) 0
1039 /* A C expression that should indicate the number of bytes of its own
1040 arguments that a function pops on returning, or 0 if the function
1041 pops no arguments and the caller must therefore pop them all after
1042 the function returns.
1044 FUNDECL is a C variable whose value is a tree node that describes
1045 the function in question. Normally it is a node of type
1046 `FUNCTION_DECL' that describes the declaration of the function.
1047 From this you can obtain the DECL_ATTRIBUTES of the
1050 FUNTYPE is a C variable whose value is a tree node that describes
1051 the function in question. Normally it is a node of type
1052 `FUNCTION_TYPE' that describes the data type of the function.
1053 From this it is possible to obtain the data types of the value and
1054 arguments (if known).
1056 When a call to a library function is being considered, FUNDECL
1057 will contain an identifier node for the library function. Thus, if
1058 you need to distinguish among various library functions, you can
1059 do so by their names. Note that "library function" in this
1060 context means a function used to perform arithmetic, whose name is
1061 known specially in the compiler and was not mentioned in the C
1062 code being compiled.
1064 STACK-SIZE is the number of bytes of arguments passed on the
1065 stack. If a variable number of bytes is passed, it is zero, and
1066 argument popping will always be the responsibility of the calling
1069 On the VAX, all functions always pop their arguments, so the
1070 definition of this macro is STACK-SIZE. On the 68000, using the
1071 standard calling convention, no functions pop their arguments, so
1072 the value of the macro is always 0 in this case. But an
1073 alternative calling convention is available in which functions
1074 that take a fixed number of arguments pop them but other functions
1075 (such as `printf') pop nothing (the caller pops all). When this
1076 convention is in use, FUNTYPE is examined to determine whether a
1077 function takes a fixed number of arguments. */
1079 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) (function_arg (&(CUM), MODE, TYPE, NAMED))
1080 /* A C expression that controls whether a function argument is passed
1081 in a register, and which register.
1083 The arguments are CUM, which summarizes all the previous
1084 arguments; MODE, the machine mode of the argument; TYPE, the data
1085 type of the argument as a tree node or 0 if that is not known
1086 (which happens for C support library functions); and NAMED, which
1087 is 1 for an ordinary argument and 0 for nameless arguments that
1088 correspond to `...' in the called function's prototype.
1090 The value of the expression is usually either a `reg' RTX for the
1091 hard register in which to pass the argument, or zero to pass the
1092 argument on the stack.
1094 For machines like the VAX and 68000, where normally all arguments
1095 are pushed, zero suffices as a definition.
1097 The value of the expression can also be a `parallel' RTX. This is
1098 used when an argument is passed in multiple locations. The mode
1099 of the of the `parallel' should be the mode of the entire
1100 argument. The `parallel' holds any number of `expr_list' pairs;
1101 each one describes where part of the argument is passed. In each
1102 `expr_list', the first operand can be either a `reg' RTX for the
1103 hard register in which to pass this part of the argument, or zero
1104 to pass the argument on the stack. If this operand is a `reg',
1105 then the mode indicates how large this part of the argument is.
1106 The second operand of the `expr_list' is a `const_int' which gives
1107 the offset in bytes into the entire argument where this part
1110 The usual way to make the ANSI library `stdarg.h' work on a machine
1111 where some arguments are usually passed in registers, is to cause
1112 nameless arguments to be passed on the stack instead. This is done
1113 by making `FUNCTION_ARG' return 0 whenever NAMED is 0.
1115 You may use the macro `MUST_PASS_IN_STACK (MODE, TYPE)' in the
1116 definition of this macro to determine if this argument is of a
1117 type that must be passed in the stack. If `REG_PARM_STACK_SPACE'
1118 is not defined and `FUNCTION_ARG' returns non-zero for such an
1119 argument, the compiler will abort. If `REG_PARM_STACK_SPACE' is
1120 defined, the argument will be computed in the stack and then
1121 loaded into a register. */
1123 typedef struct avr_args {
1124 int nregs; /* # registers available for passing */
1125 int regno; /* next available register number */
1127 /* A C type for declaring a variable that is used as the first
1128 argument of `FUNCTION_ARG' and other related values. For some
1129 target machines, the type `int' suffices and can hold the number
1130 of bytes of argument so far.
1132 There is no need to record in `CUMULATIVE_ARGS' anything about the
1133 arguments that have been passed on the stack. The compiler has
1134 other variables to keep track of that. For target machines on
1135 which all arguments are passed on the stack, there is no need to
1136 store anything in `CUMULATIVE_ARGS'; however, the data structure
1137 must exist and should not be empty, so use `int'. */
1139 #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT) init_cumulative_args (&(CUM), FNTYPE, LIBNAME, INDIRECT)
1141 /* A C statement (sans semicolon) for initializing the variable CUM
1142 for the state at the beginning of the argument list. The variable
1143 has type `CUMULATIVE_ARGS'. The value of FNTYPE is the tree node
1144 for the data type of the function which will receive the args, or 0
1145 if the args are to a compiler support library function. The value
1146 of INDIRECT is nonzero when processing an indirect call, for
1147 example a call through a function pointer. The value of INDIRECT
1148 is zero for a call to an explicitly named function, a library
1149 function call, or when `INIT_CUMULATIVE_ARGS' is used to find
1150 arguments for the function being compiled.
1152 When processing a call to a compiler support library function,
1153 LIBNAME identifies which one. It is a `symbol_ref' rtx which
1154 contains the name of the function, as a string. LIBNAME is 0 when
1155 an ordinary C function call is being processed. Thus, each time
1156 this macro is called, either LIBNAME or FNTYPE is nonzero, but
1157 never both of them at once. */
1159 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
1160 (function_arg_advance (&CUM, MODE, TYPE, NAMED))
1162 /* A C statement (sans semicolon) to update the summarizer variable
1163 CUM to advance past an argument in the argument list. The values
1164 MODE, TYPE and NAMED describe that argument. Once this is done,
1165 the variable CUM is suitable for analyzing the *following*
1166 argument with `FUNCTION_ARG', etc.
1168 This macro need not do anything if the argument in question was
1169 passed on the stack. The compiler knows how to track the amount
1170 of stack space used for arguments without any special help. */
1172 #define FUNCTION_ARG_REGNO_P(r) function_arg_regno_p(r)
1173 /* A C expression that is nonzero if REGNO is the number of a hard
1174 register in which function arguments are sometimes passed. This
1175 does *not* include implicit arguments such as the static chain and
1176 the structure-value address. On many machines, no registers can be
1177 used for this purpose since all function arguments are pushed on
1180 extern int avr_reg_order[];
1182 #define RET_REGISTER avr_ret_register ()
1184 #define FUNCTION_VALUE(VALTYPE, FUNC) avr_function_value (VALTYPE, FUNC)
1185 /* A C expression to create an RTX representing the place where a
1186 function returns a value of data type VALTYPE. VALTYPE is a tree
1187 node representing a data type. Write `TYPE_MODE (VALTYPE)' to get
1188 the machine mode used to represent that type. On many machines,
1189 only the mode is relevant. (Actually, on most machines, scalar
1190 values are returned in the same place regardless of mode).
1192 The value of the expression is usually a `reg' RTX for the hard
1193 register where the return value is stored. The value can also be a
1194 `parallel' RTX, if the return value is in multiple places. See
1195 `FUNCTION_ARG' for an explanation of the `parallel' form.
1197 If `PROMOTE_FUNCTION_RETURN' is defined, you must apply the same
1198 promotion rules specified in `PROMOTE_MODE' if VALTYPE is a scalar
1201 If the precise function being called is known, FUNC is a tree node
1202 (`FUNCTION_DECL') for it; otherwise, FUNC is a null pointer. This
1203 makes it possible to use a different value-returning convention
1204 for specific functions when all their calls are known.
1206 `FUNCTION_VALUE' is not used for return vales with aggregate data
1207 types, because these are returned in another way. See
1208 `STRUCT_VALUE_REGNUM' and related macros, below. */
1210 #define LIBCALL_VALUE(MODE) avr_libcall_value (MODE)
1211 /* A C expression to create an RTX representing the place where a
1212 library function returns a value of mode MODE. If the precise
1213 function being called is known, FUNC is a tree node
1214 (`FUNCTION_DECL') for it; otherwise, FUNC is a null pointer. This
1215 makes it possible to use a different value-returning convention
1216 for specific functions when all their calls are known.
1218 Note that "library function" in this context means a compiler
1219 support routine, used to perform arithmetic, whose name is known
1220 specially by the compiler and was not mentioned in the C code being
1223 The definition of `LIBRARY_VALUE' need not be concerned aggregate
1224 data types, because none of the library functions returns such
1227 #define FUNCTION_VALUE_REGNO_P(N) ((N) == RET_REGISTER)
1228 /* A C expression that is nonzero if REGNO is the number of a hard
1229 register in which the values of called function may come back.
1231 A register whose use for returning values is limited to serving as
1232 the second of a pair (for a value of type `double', say) need not
1233 be recognized by this macro. So for most machines, this definition
1236 #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
1238 If the machine has register windows, so that the caller and the
1239 called function use different registers for the return value, this
1240 macro should recognize only the caller's register numbers. */
1242 #define RETURN_IN_MEMORY(TYPE) ((TYPE_MODE (TYPE) == BLKmode) \
1243 ? int_size_in_bytes (TYPE) > 8 \
1245 /* A C expression which can inhibit the returning of certain function
1246 values in registers, based on the type of value. A nonzero value
1247 says to return the function value in memory, just as large
1248 structures are always returned. Here TYPE will be a C expression
1249 of type `tree', representing the data type of the value.
1251 Note that values of mode `BLKmode' must be explicitly handled by
1252 this macro. Also, the option `-fpcc-struct-return' takes effect
1253 regardless of this macro. On most systems, it is possible to
1254 leave the macro undefined; this causes a default definition to be
1255 used, whose value is the constant 1 for `BLKmode' values, and 0
1258 Do not use this macro to indicate that structures and unions
1259 should always be returned in memory. You should instead use
1260 `DEFAULT_PCC_STRUCT_RETURN' to indicate this. */
1262 #define DEFAULT_PCC_STRUCT_RETURN 0
1263 /* Define this macro to be 1 if all structure and union return values
1264 must be in memory. Since this results in slower code, this should
1265 be defined only if needed for compatibility with other compilers
1266 or with an ABI. If you define this macro to be 0, then the
1267 conventions used for structure and union return values are decided
1268 by the `RETURN_IN_MEMORY' macro.
1270 If not defined, this defaults to the value 1. */
1272 #define STRUCT_VALUE 0
1273 /* If the structure value address is not passed in a register, define
1274 `STRUCT_VALUE' as an expression returning an RTX for the place
1275 where the address is passed. If it returns 0, the address is
1276 passed as an "invisible" first argument. */
1278 #define STRUCT_VALUE_INCOMING 0
1279 /* If the incoming location is not a register, then you should define
1280 `STRUCT_VALUE_INCOMING' as an expression for an RTX for where the
1281 called function should find the value. If it should find the
1282 value on the stack, define this to create a `mem' which refers to
1283 the frame pointer. A definition of 0 means that the address is
1284 passed as an "invisible" first argument. */
1286 #define EPILOGUE_USES(REGNO) 0
1287 /* Define this macro as a C expression that is nonzero for registers
1288 are used by the epilogue or the `return' pattern. The stack and
1289 frame pointer registers are already be assumed to be used as
1292 #define STRICT_ARGUMENT_NAMING 1
1293 /* Define this macro if the location where a function argument is
1294 passed depends on whether or not it is a named argument.
1296 This macro controls how the NAMED argument to `FUNCTION_ARG' is
1297 set for varargs and stdarg functions. With this macro defined,
1298 the NAMED argument is always true for named arguments, and false
1299 for unnamed arguments. If this is not defined, but
1300 `SETUP_INCOMING_VARARGS' is defined, then all arguments are
1301 treated as named. Otherwise, all named arguments except the last
1302 are treated as named. */
1305 #define HAVE_POST_INCREMENT 1
1306 /* Define this macro if the machine supports post-increment
1309 #define HAVE_PRE_DECREMENT 1
1310 /* #define HAVE_PRE_INCREMENT
1311 #define HAVE_POST_DECREMENT */
1312 /* Similar for other kinds of addressing. */
1314 #define CONSTANT_ADDRESS_P(X) CONSTANT_P (X)
1315 /* A C expression that is 1 if the RTX X is a constant which is a
1316 valid address. On most machines, this can be defined as
1317 `CONSTANT_P (X)', but a few machines are more restrictive in which
1318 constant addresses are supported.
1320 `CONSTANT_P' accepts integer-values expressions whose values are
1321 not explicitly known, such as `symbol_ref', `label_ref', and
1322 `high' expressions and `const' arithmetic expressions, in addition
1323 to `const_int' and `const_double' expressions. */
1325 #define MAX_REGS_PER_ADDRESS 1
1326 /* A number, the maximum number of registers that can appear in a
1327 valid memory address. Note that it is up to you to specify a
1328 value equal to the maximum number that `GO_IF_LEGITIMATE_ADDRESS'
1329 would ever accept. */
1331 #ifdef REG_OK_STRICT
1332 # define GO_IF_LEGITIMATE_ADDRESS(mode, operand, ADDR) \
1334 if (legitimate_address_p (mode, operand, 1)) \
1338 # define GO_IF_LEGITIMATE_ADDRESS(mode, operand, ADDR) \
1340 if (legitimate_address_p (mode, operand, 0)) \
1344 /* A C compound statement with a conditional `goto LABEL;' executed
1345 if X (an RTX) is a legitimate memory address on the target machine
1346 for a memory operand of mode MODE. */
1348 /* `REG_OK_FOR_BASE_P (X)'
1349 A C expression that is nonzero if X (assumed to be a `reg' RTX) is
1350 valid for use as a base register. For hard registers, it should
1351 always accept those which the hardware permits and reject the
1352 others. Whether the macro accepts or rejects pseudo registers
1353 must be controlled by `REG_OK_STRICT' as described above. This
1354 usually requires two variant definitions, of which `REG_OK_STRICT'
1355 controls the one actually used. */
1357 #define REG_OK_FOR_BASE_NOSTRICT_P(X) \
1358 (REGNO (X) >= FIRST_PSEUDO_REGISTER || REG_OK_FOR_BASE_STRICT_P(X))
1360 #define REG_OK_FOR_BASE_STRICT_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
1362 #ifdef REG_OK_STRICT
1363 # define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_STRICT_P (X)
1365 # define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_NOSTRICT_P (X)
1368 /* A C expression that is just like `REG_OK_FOR_BASE_P', except that
1369 that expression may examine the mode of the memory reference in
1370 MODE. You should define this macro if the mode of the memory
1371 reference affects whether a register may be used as a base
1372 register. If you define this macro, the compiler will use it
1373 instead of `REG_OK_FOR_BASE_P'. */
1374 #define REG_OK_FOR_INDEX_P(X) 0
1375 /* A C expression that is nonzero if X (assumed to be a `reg' RTX) is
1376 valid for use as an index register.
1378 The difference between an index register and a base register is
1379 that the index register may be scaled. If an address involves the
1380 sum of two registers, neither one of them scaled, then either one
1381 may be labeled the "base" and the other the "index"; but whichever
1382 labeling is used must fit the machine's constraints of which
1383 registers may serve in each capacity. The compiler will try both
1384 labelings, looking for one that is valid, and will reload one or
1385 both registers only if neither labeling works. */
1387 #define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
1389 (X) = legitimize_address (X, OLDX, MODE); \
1390 if (memory_address_p (MODE, X)) \
1393 /* A C compound statement that attempts to replace X with a valid
1394 memory address for an operand of mode MODE. WIN will be a C
1395 statement label elsewhere in the code; the macro definition may use
1397 GO_IF_LEGITIMATE_ADDRESS (MODE, X, WIN);
1399 to avoid further processing if the address has become legitimate.
1401 X will always be the result of a call to `break_out_memory_refs',
1402 and OLDX will be the operand that was given to that function to
1405 The code generated by this macro should not alter the substructure
1406 of X. If it transforms X into a more legitimate form, it should
1407 assign X (which will always be a C variable) a new value.
1409 It is not necessary for this macro to come up with a legitimate
1410 address. The compiler has standard ways of doing so in all cases.
1411 In fact, it is safe for this macro to do nothing. But often a
1412 machine-dependent strategy can generate better code. */
1414 #define XEXP_(X,Y) (X)
1415 #define LEGITIMIZE_RELOAD_ADDRESS(X, MODE, OPNUM, TYPE, IND_LEVELS, WIN) \
1417 if (1&&(GET_CODE (X) == POST_INC || GET_CODE (X) == PRE_DEC)) \
1419 push_reload (XEXP (X,0), XEXP (X,0), &XEXP (X,0), &XEXP (X,0), \
1420 POINTER_REGS, GET_MODE (X),GET_MODE (X) , 0, 0, \
1421 OPNUM, RELOAD_OTHER); \
1424 if (GET_CODE (X) == PLUS \
1425 && REG_P (XEXP (X, 0)) \
1426 && GET_CODE (XEXP (X, 1)) == CONST_INT \
1427 && INTVAL (XEXP (X, 1)) >= 1) \
1429 int fit = INTVAL (XEXP (X, 1)) <= (64 - GET_MODE_SIZE (MODE)); \
1432 if (reg_equiv_address[REGNO (XEXP (X, 0))] != 0) \
1434 int regno = REGNO (XEXP (X, 0)); \
1435 rtx mem = make_memloc (X, regno); \
1436 push_reload (XEXP (mem,0), NULL, &XEXP (mem,0), NULL, \
1437 POINTER_REGS, Pmode, VOIDmode, 0, 0, \
1438 1, ADDR_TYPE (TYPE)); \
1439 push_reload (mem, NULL_RTX, &XEXP (X, 0), NULL, \
1440 BASE_POINTER_REGS, GET_MODE (X), VOIDmode, 0, 0, \
1444 push_reload (XEXP (X, 0), NULL_RTX, &XEXP (X, 0), NULL, \
1445 BASE_POINTER_REGS, GET_MODE (X), VOIDmode, 0, 0, \
1449 else if (! (frame_pointer_needed && XEXP (X,0) == frame_pointer_rtx)) \
1451 push_reload (X, NULL_RTX, &X, NULL, \
1452 POINTER_REGS, GET_MODE (X), VOIDmode, 0, 0, \
1458 /* A C compound statement that attempts to replace X, which is an
1459 address that needs reloading, with a valid memory address for an
1460 operand of mode MODE. WIN will be a C statement label elsewhere
1461 in the code. It is not necessary to define this macro, but it
1462 might be useful for performance reasons.
1464 For example, on the i386, it is sometimes possible to use a single
1465 reload register instead of two by reloading a sum of two pseudo
1466 registers into a register. On the other hand, for number of RISC
1467 processors offsets are limited so that often an intermediate
1468 address needs to be generated in order to address a stack slot.
1469 By defining LEGITIMIZE_RELOAD_ADDRESS appropriately, the
1470 intermediate addresses generated for adjacent some stack slots can
1471 be made identical, and thus be shared.
1473 *Note*: This macro should be used with caution. It is necessary
1474 to know something of how reload works in order to effectively use
1475 this, and it is quite easy to produce macros that build in too
1476 much knowledge of reload internals.
1478 *Note*: This macro must be able to reload an address created by a
1479 previous invocation of this macro. If it fails to handle such
1480 addresses then the compiler may generate incorrect code or abort.
1482 The macro definition should use `push_reload' to indicate parts
1483 that need reloading; OPNUM, TYPE and IND_LEVELS are usually
1484 suitable to be passed unaltered to `push_reload'.
1486 The code generated by this macro must not alter the substructure of
1487 X. If it transforms X into a more legitimate form, it should
1488 assign X (which will always be a C variable) a new value. This
1489 also applies to parts that you change indirectly by calling
1492 The macro definition may use `strict_memory_address_p' to test if
1493 the address has become legitimate.
1495 If you want to change only a part of X, one standard way of doing
1496 this is to use `copy_rtx'. Note, however, that is unshares only a
1497 single level of rtl. Thus, if the part to be changed is not at the
1498 top level, you'll need to replace first the top leve It is not
1499 necessary for this macro to come up with a legitimate address;
1500 but often a machine-dependent strategy can generate better code. */
1502 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
1503 if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == PRE_DEC) \
1505 /* A C statement or compound statement with a conditional `goto
1506 LABEL;' executed if memory address X (an RTX) can have different
1507 meanings depending on the machine mode of the memory reference it
1508 is used for or if the address is valid for some modes but not
1511 Autoincrement and autodecrement addresses typically have
1512 mode-dependent effects because the amount of the increment or
1513 decrement is the size of the operand being addressed. Some
1514 machines have other mode-dependent addresses. Many RISC machines
1515 have no mode-dependent addresses.
1517 You may assume that ADDR is a valid address for the machine. */
1519 #define LEGITIMATE_CONSTANT_P(X) 1
1520 /* A C expression that is nonzero if X is a legitimate constant for
1521 an immediate operand on the target machine. You can assume that X
1522 satisfies `CONSTANT_P', so you need not check this. In fact, `1'
1523 is a suitable definition for this macro on machines where anything
1524 `CONSTANT_P' is valid. */
1526 #define CONST_COSTS(x,CODE,OUTER_CODE) \
1528 if (OUTER_CODE == PLUS \
1529 || OUTER_CODE == IOR \
1530 || OUTER_CODE == AND \
1531 || OUTER_CODE == MINUS \
1532 || OUTER_CODE == SET \
1533 || INTVAL (x) == 0) \
1535 if (OUTER_CODE == COMPARE \
1536 && INTVAL (x) >= 0 \
1537 && INTVAL (x) <= 255) \
1543 case CONST_DOUBLE: \
1546 /* A part of a C `switch' statement that describes the relative costs
1547 of constant RTL expressions. It must contain `case' labels for
1548 expression codes `const_int', `const', `symbol_ref', `label_ref'
1549 and `const_double'. Each case must ultimately reach a `return'
1550 statement to return the relative cost of the use of that kind of
1551 constant value in an expression. The cost may depend on the
1552 precise value of the constant, which is available for examination
1553 in X, and the rtx code of the expression in which it is contained,
1554 found in OUTER_CODE.
1556 CODE is the expression code--redundant, since it can be obtained
1557 with `GET_CODE (X)'. */
1559 #define DEFAULT_RTX_COSTS(x, code, outer_code) \
1561 int cst = default_rtx_costs (x, code, outer_code); \
1569 /* Like `CONST_COSTS' but applies to nonconstant RTL expressions.
1570 This can be used, for example, to indicate how costly a multiply
1571 instruction is. In writing this macro, you can use the construct
1572 `COSTS_N_INSNS (N)' to specify a cost equal to N fast
1573 instructions. OUTER_CODE is the code of the expression in which X
1576 This macro is optional; do not define it if the default cost
1577 assumptions are adequate for the target machine. */
1579 #define ADDRESS_COST(ADDRESS) avr_address_cost (ADDRESS)
1581 /* An expression giving the cost of an addressing mode that contains
1582 ADDRESS. If not defined, the cost is computed from the ADDRESS
1583 expression and the `CONST_COSTS' values.
1585 For most CISC machines, the default cost is a good approximation
1586 of the true cost of the addressing mode. However, on RISC
1587 machines, all instructions normally have the same length and
1588 execution time. Hence all addresses will have equal costs.
1590 In cases where more than one form of an address is known, the form
1591 with the lowest cost will be used. If multiple forms have the
1592 same, lowest, cost, the one that is the most complex will be used.
1594 For example, suppose an address that is equal to the sum of a
1595 register and a constant is used twice in the same basic block.
1596 When this macro is not defined, the address will be computed in a
1597 register and memory references will be indirect through that
1598 register. On machines where the cost of the addressing mode
1599 containing the sum is no higher than that of a simple indirect
1600 reference, this will produce an additional instruction and
1601 possibly require an additional register. Proper specification of
1602 this macro eliminates this overhead for such machines.
1604 Similar use of this macro is made in strength reduction of loops.
1606 ADDRESS need not be valid as an address. In such a case, the cost
1607 is not relevant and can be any value; invalid addresses need not be
1608 assigned a different cost.
1610 On machines where an address involving more than one register is as
1611 cheap as an address computation involving only one register,
1612 defining `ADDRESS_COST' to reflect this can cause two registers to
1613 be live over a region of code where only one would have been if
1614 `ADDRESS_COST' were not defined in that manner. This effect should
1615 be considered in the definition of this macro. Equivalent costs
1616 should probably only be given to addresses with different numbers
1617 of registers on machines with lots of registers.
1619 This macro will normally either not be defined or be defined as a
1622 #define REGISTER_MOVE_COST(MODE, FROM, TO) ((FROM) == STACK_REG ? 6 \
1623 : (TO) == STACK_REG ? 12 \
1625 /* A C expression for the cost of moving data from a register in class
1626 FROM to one in class TO. The classes are expressed using the
1627 enumeration values such as `GENERAL_REGS'. A value of 2 is the
1628 default; other values are interpreted relative to that.
1630 It is not required that the cost always equal 2 when FROM is the
1631 same as TO; on some machines it is expensive to move between
1632 registers if they are not general registers.
1634 If reload sees an insn consisting of a single `set' between two
1635 hard registers, and if `REGISTER_MOVE_COST' applied to their
1636 classes returns a value of 2, reload does not check to ensure that
1637 the constraints of the insn are met. Setting a cost of other than
1638 2 will allow reload to verify that the constraints are met. You
1639 should do this if the `movM' pattern's constraints do not allow
1642 #define MEMORY_MOVE_COST(MODE,CLASS,IN) ((MODE)==QImode ? 2 : \
1643 (MODE)==HImode ? 4 : \
1644 (MODE)==SImode ? 8 : \
1645 (MODE)==SFmode ? 8 : 16)
1646 /* A C expression for the cost of moving data of mode M between a
1647 register and memory. A value of 4 is the default; this cost is
1648 relative to those in `REGISTER_MOVE_COST'.
1650 If moving between registers and memory is more expensive than
1651 between two registers, you should define this macro to express the
1654 #define BRANCH_COST 0
1655 /* A C expression for the cost of a branch instruction. A value of 1
1656 is the default; other values are interpreted relative to that.
1658 Here are additional macros which do not specify precise relative
1659 costs, but only that certain actions are more expensive than GCC would
1660 ordinarily expect. */
1662 #define SLOW_BYTE_ACCESS 0
1663 /* Define this macro as a C expression which is nonzero if accessing
1664 less than a word of memory (i.e. a `char' or a `short') is no
1665 faster than accessing a word of memory, i.e., if such access
1666 require more than one instruction or if there is no difference in
1667 cost between byte and (aligned) word loads.
1669 When this macro is not defined, the compiler will access a field by
1670 finding the smallest containing object; when it is defined, a
1671 fullword load will be used if alignment permits. Unless bytes
1672 accesses are faster than word accesses, using word accesses is
1673 preferable since it may eliminate subsequent memory access if
1674 subsequent accesses occur to other fields in the same word of the
1675 structure, but to different bytes.
1677 `SLOW_UNALIGNED_ACCESS'
1678 Define this macro to be the value 1 if unaligned accesses have a
1679 cost many times greater than aligned accesses, for example if they
1680 are emulated in a trap handler.
1682 When this macro is non-zero, the compiler will act as if
1683 `STRICT_ALIGNMENT' were non-zero when generating code for block
1684 moves. This can cause significantly more instructions to be
1685 produced. Therefore, do not set this macro non-zero if unaligned
1686 accesses only add a cycle or two to the time for a memory access.
1688 If the value of this macro is always zero, it need not be defined.
1691 Define this macro to inhibit strength reduction of memory
1692 addresses. (On some machines, such strength reduction seems to do
1693 harm rather than good.)
1696 The number of scalar move insns which should be generated instead
1697 of a string move insn or a library call. Increasing the value
1698 will always make code faster, but eventually incurs high cost in
1699 increased code size.
1701 If you don't define this, a reasonable default is used. */
1703 #define NO_FUNCTION_CSE
1704 /* Define this macro if it is as good or better to call a constant
1705 function address than to call an address kept in a register. */
1707 #define NO_RECURSIVE_FUNCTION_CSE
1708 /* Define this macro if it is as good or better for a function to call
1709 itself with an explicit address than to call an address kept in a
1712 #define TEXT_SECTION_ASM_OP "\t.text"
1713 /* A C expression whose value is a string containing the assembler
1714 operation that should precede instructions and read-only data.
1715 Normally `"\t.text"' is right. */
1717 #define DATA_SECTION_ASM_OP "\t.data"
1718 /* A C expression whose value is a string containing the assembler
1719 operation to identify the following data as writable initialized
1720 data. Normally `"\t.data"' is right. */
1722 #define BSS_SECTION_ASM_OP "\t.section .bss"
1723 /* If defined, a C expression whose value is a string, including
1724 spacing, containing the assembler operation to identify the
1725 following data as uninitialized global data. If not defined, and
1726 neither `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined,
1727 uninitialized global data will be output in the data section if
1728 `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be
1731 /* Define the pseudo-ops used to switch to the .ctors and .dtors sections.
1732 There are no shared libraries on this target, and these sections are
1733 placed in the read-only program memory, so they are not writable. */
1735 #undef CTORS_SECTION_ASM_OP
1736 #define CTORS_SECTION_ASM_OP "\t.section .ctors,\"a\",@progbits"
1738 #undef DTORS_SECTION_ASM_OP
1739 #define DTORS_SECTION_ASM_OP "\t.section .dtors,\"a\",@progbits"
1741 #define TARGET_ASM_CONSTRUCTOR avr_asm_out_ctor
1742 /* If defined, a function that outputs assembler code to arrange to
1743 call the function referenced by SYMBOL at initialization time. */
1745 #define TARGET_ASM_DESTRUCTOR avr_asm_out_dtor
1746 /* This is like `TARGET_ASM_CONSTRUCTOR' but used for termination
1747 functions rather than initialization functions. */
1749 #define EXTRA_SECTIONS in_progmem
1750 /* A list of names for sections other than the standard two, which are
1751 `in_text' and `in_data'. You need not define this macro on a
1752 system with no other sections (that GCC needs to use). */
1754 #define EXTRA_SECTION_FUNCTIONS \
1757 progmem_section () \
1759 if (in_section != in_progmem) \
1761 fprintf (asm_out_file, \
1762 "\t.section .progmem.gcc_sw_table, \"%s\", @progbits\n", \
1763 AVR_MEGA ? "a" : "ax"); \
1764 /* Should already be aligned, this is just to be safe if it isn't. */ \
1765 fprintf (asm_out_file, "\t.p2align 1\n"); \
1766 in_section = in_progmem; \
1769 /* `EXTRA_SECTION_FUNCTIONS'
1770 One or more functions to be defined in `varasm.c'. These
1771 functions should do jobs analogous to those of `text_section' and
1772 `data_section', for your additional sections. Do not define this
1773 macro if you do not define `EXTRA_SECTIONS'. */
1775 #define READONLY_DATA_SECTION data_section
1776 /* On most machines, read-only variables, constants, and jump tables
1777 are placed in the text section. If this is not the case on your
1778 machine, this macro should be defined to be the name of a function
1779 (either `data_section' or a function defined in `EXTRA_SECTIONS')
1780 that switches to the section to be used for read-only items.
1782 If these items should be placed in the text section, this macro
1783 should not be defined. */
1785 #define JUMP_TABLES_IN_TEXT_SECTION 0
1786 /* Define this macro if jump tables (for `tablejump' insns) should be
1787 output in the text section, along with the assembler instructions.
1788 Otherwise, the readonly data section is used.
1790 This macro is irrelevant if there is no separate readonly data
1793 #define ASM_FILE_START(STREAM) asm_file_start (STREAM)
1794 /* A C expression which outputs to the stdio stream STREAM some
1795 appropriate text to go at the start of an assembler file.
1797 Normally this macro is defined to output a line containing
1798 `#NO_APP', which is a comment that has no effect on most
1799 assemblers but tells the GNU assembler that it can save time by not
1800 checking for certain assembler constructs.
1802 On systems that use SDB, it is necessary to output certain
1803 commands; see `attasm.h'. */
1805 #define ASM_FILE_END(STREAM) asm_file_end (STREAM)
1806 /* A C expression which outputs to the stdio stream STREAM some
1807 appropriate text to go at the end of an assembler file.
1809 If this macro is not defined, the default is to output nothing
1810 special at the end of the file. Most systems don't require any
1813 On systems that use SDB, it is necessary to output certain
1814 commands; see `attasm.h'. */
1816 #define ASM_COMMENT_START " ; "
1817 /* A C string constant describing how to begin a comment in the target
1818 assembler language. The compiler assumes that the comment will
1819 end at the end of the line. */
1821 #define ASM_APP_ON "/* #APP */\n"
1822 /* A C string constant for text to be output before each `asm'
1823 statement or group of consecutive ones. Normally this is
1824 `"#APP"', which is a comment that has no effect on most assemblers
1825 but tells the GNU assembler that it must check the lines that
1826 follow for all valid assembler constructs. */
1828 #define ASM_APP_OFF "/* #NOAPP */\n"
1829 /* A C string constant for text to be output after each `asm'
1830 statement or group of consecutive ones. Normally this is
1831 `"#NO_APP"', which tells the GNU assembler to resume making the
1832 time-saving assumptions that are valid for ordinary compiler
1835 #define ASM_OUTPUT_SOURCE_LINE(STREAM, LINE) fprintf (STREAM,"/* line: %d */\n",LINE)
1836 /* A C statement to output DBX or SDB debugging information before
1837 code for line number LINE of the current source file to the stdio
1840 This macro need not be defined if the standard form of debugging
1841 information for the debugger in use is appropriate. */
1843 /* Switch into a generic section. */
1844 #define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
1846 #define OBJC_PROLOGUE {}
1847 /* A C statement to output any assembler statements which are
1848 required to precede any Objective C object definitions or message
1849 sending. The statement is executed only when compiling an
1850 Objective C program. */
1853 #define ASM_OUTPUT_ASCII(FILE, P, SIZE) gas_output_ascii (FILE,P,SIZE)
1854 /* `ASM_OUTPUT_ASCII (STREAM, PTR, LEN)'
1855 output_ascii (FILE, P, SIZE)
1856 A C statement to output to the stdio stream STREAM an assembler
1857 instruction to assemble a string constant containing the LEN bytes
1858 at PTR. PTR will be a C expression of type `char *' and LEN a C
1859 expression of type `int'.
1861 If the assembler has a `.ascii' pseudo-op as found in the Berkeley
1862 Unix assembler, do not define the macro `ASM_OUTPUT_ASCII'. */
1864 #define IS_ASM_LOGICAL_LINE_SEPARATOR(C) ((C) == '\n' \
1866 /* Define this macro as a C expression which is nonzero if C is used
1867 as a logical line separator by the assembler.
1869 If you do not define this macro, the default is that only the
1870 character `;' is treated as a logical line separator. */
1872 /* These macros are provided by `real.h' for writing the definitions of
1873 `ASM_OUTPUT_DOUBLE' and the like: */
1875 #define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED) \
1877 fputs ("\t.comm ", (STREAM)); \
1878 assemble_name ((STREAM), (NAME)); \
1879 fprintf ((STREAM), ",%d,1\n", (SIZE)); \
1881 /* A C statement (sans semicolon) to output to the stdio stream
1882 STREAM the assembler definition of a common-label named NAME whose
1883 size is SIZE bytes. The variable ROUNDED is the size rounded up
1884 to whatever alignment the caller wants.
1886 Use the expression `assemble_name (STREAM, NAME)' to output the
1887 name itself; before and after that, output the additional
1888 assembler syntax for defining the name, and a newline.
1890 This macro controls how the assembler definitions of uninitialized
1891 common global variables are output. */
1893 #define ASM_OUTPUT_BSS(FILE, DECL, NAME, SIZE, ROUNDED) \
1894 asm_output_bss ((FILE), (DECL), (NAME), (SIZE), (ROUNDED))
1895 /* A C statement (sans semicolon) to output to the stdio stream
1896 STREAM the assembler definition of uninitialized global DECL named
1897 NAME whose size is SIZE bytes. The variable ROUNDED is the size
1898 rounded up to whatever alignment the caller wants. */
1900 #define ASM_OUTPUT_LOCAL(STREAM, NAME, SIZE, ROUNDED) \
1902 fputs ("\t.lcomm ", (STREAM)); \
1903 assemble_name ((STREAM), (NAME)); \
1904 fprintf ((STREAM), ",%d\n", (SIZE)); \
1906 /* A C statement (sans semicolon) to output to the stdio stream
1907 STREAM the assembler definition of a local-common-label named NAME
1908 whose size is SIZE bytes. The variable ROUNDED is the size
1909 rounded up to whatever alignment the caller wants.
1911 Use the expression `assemble_name (STREAM, NAME)' to output the
1912 name itself; before and after that, output the additional
1913 assembler syntax for defining the name, and a newline.
1915 This macro controls how the assembler definitions of uninitialized
1916 static variables are output. */
1921 #define TYPE_ASM_OP "\t.type\t"
1922 #define SIZE_ASM_OP "\t.size\t"
1923 #define WEAK_ASM_OP "\t.weak\t"
1924 /* Define the strings used for the special svr4 .type and .size directives.
1925 These strings generally do not vary from one system running svr4 to
1926 another, but if a given system (e.g. m88k running svr) needs to use
1927 different pseudo-op names for these, they may be overridden in the
1928 file which includes this one. */
1931 #undef TYPE_OPERAND_FMT
1932 #define TYPE_OPERAND_FMT "@%s"
1933 /* The following macro defines the format used to output the second
1934 operand of the .type assembler directive. Different svr4 assemblers
1935 expect various different forms for this operand. The one given here
1936 is just a default. You may need to override it in your machine-
1937 specific tm.h file (depending upon the particulars of your assembler). */
1939 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
1941 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \
1942 ASM_OUTPUT_LABEL (FILE, NAME); \
1945 /* A C statement (sans semicolon) to output to the stdio stream
1946 STREAM any text necessary for declaring the name NAME of a
1947 function which is being defined. This macro is responsible for
1948 outputting the label definition (perhaps using
1949 `ASM_OUTPUT_LABEL'). The argument DECL is the `FUNCTION_DECL'
1950 tree node representing the function.
1952 If this macro is not defined, then the function name is defined in
1953 the usual manner as a label (by means of `ASM_OUTPUT_LABEL'). */
1955 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
1957 if (!flag_inhibit_size_directive) \
1958 ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME); \
1960 /* A C statement (sans semicolon) to output to the stdio stream
1961 STREAM any text necessary for declaring the size of a function
1962 which is being defined. The argument NAME is the name of the
1963 function. The argument DECL is the `FUNCTION_DECL' tree node
1964 representing the function.
1966 If this macro is not defined, then the function size is not
1969 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
1971 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
1972 size_directive_output = 0; \
1973 if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
1975 size_directive_output = 1; \
1976 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, \
1977 int_size_in_bytes (TREE_TYPE (DECL))); \
1979 ASM_OUTPUT_LABEL(FILE, NAME); \
1981 /* A C statement (sans semicolon) to output to the stdio stream
1982 STREAM any text necessary for declaring the name NAME of an
1983 initialized variable which is being defined. This macro must
1984 output the label definition (perhaps using `ASM_OUTPUT_LABEL').
1985 The argument DECL is the `VAR_DECL' tree node representing the
1988 If this macro is not defined, then the variable name is defined in
1989 the usual manner as a label (by means of `ASM_OUTPUT_LABEL'). */
1991 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
1993 const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
1994 HOST_WIDE_INT size; \
1995 if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
1996 && ! AT_END && TOP_LEVEL \
1997 && DECL_INITIAL (DECL) == error_mark_node \
1998 && !size_directive_output) \
2000 size_directive_output = 1; \
2001 size = int_size_in_bytes (TREE_TYPE (DECL)); \
2002 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size); \
2006 /* A C statement (sans semicolon) to finish up declaring a variable
2007 name once the compiler has processed its initializer fully and
2008 thus has had a chance to determine the size of an array when
2009 controlled by an initializer. This is used on systems where it's
2010 necessary to declare something about the size of the object.
2012 If you don't define this macro, that is equivalent to defining it
2017 "\1\1\1\1\1\1\1\1btn\1fr\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
2018 \0\0\"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
2019 \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\\\0\0\0\
2020 \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\
2021 \1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
2022 \1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
2023 \1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\
2024 \1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1"
2025 /* A table of bytes codes used by the ASM_OUTPUT_ASCII and
2026 ASM_OUTPUT_LIMITED_STRING macros. Each byte in the table
2027 corresponds to a particular byte value [0..255]. For any
2028 given byte value, if the value in the corresponding table
2029 position is zero, the given character can be output directly.
2030 If the table value is 1, the byte must be output as a \ooo
2031 octal escape. If the tables value is anything else, then the
2032 byte value should be output as a \ followed by the value
2033 in the table. Note that we can use standard UN*X escape
2034 sequences for many control characters, but we don't use
2035 \a to represent BEL because some svr4 assemblers (e.g. on
2036 the i386) don't know about that. Also, we don't use \v
2037 since some versions of gas, such as 2.2 did not accept it. */
2039 #define STRING_LIMIT ((unsigned) 64)
2040 #define STRING_ASM_OP "\t.string\t"
2041 /* Some svr4 assemblers have a limit on the number of characters which
2042 can appear in the operand of a .string directive. If your assembler
2043 has such a limitation, you should define STRING_LIMIT to reflect that
2044 limit. Note that at least some svr4 assemblers have a limit on the
2045 actual number of bytes in the double-quoted string, and that they
2046 count each character in an escape sequence as one byte. Thus, an
2047 escape sequence like \377 would count as four bytes.
2049 If your target assembler doesn't support the .string directive, you
2050 should define this to zero. */
2052 /* Globalizing directive for a label. */
2053 #define GLOBAL_ASM_OP ".global\t"
2055 #define ASM_WEAKEN_LABEL(FILE, NAME) \
2058 fputs ("\t.weak\t", (FILE)); \
2059 assemble_name ((FILE), (NAME)); \
2060 fputc ('\n', (FILE)); \
2064 /* A C statement (sans semicolon) to output to the stdio stream
2065 STREAM some commands that will make the label NAME weak; that is,
2066 available for reference from other files but only used if no other
2067 definition is available. Use the expression `assemble_name
2068 (STREAM, NAME)' to output the name itself; before and after that,
2069 output the additional assembler syntax for making that name weak,
2072 If you don't define this macro, GNU CC will not support weak
2073 symbols and you should not define the `SUPPORTS_WEAK' macro.
2076 #define SUPPORTS_WEAK 1
2077 /* A C expression which evaluates to true if the target supports weak
2080 If you don't define this macro, `defaults.h' provides a default
2081 definition. If `ASM_WEAKEN_LABEL' is defined, the default
2082 definition is `1'; otherwise, it is `0'. Define this macro if you
2083 want to control weak symbol support with a compiler flag such as
2086 `MAKE_DECL_ONE_ONLY'
2087 A C statement (sans semicolon) to mark DECL to be emitted as a
2088 public symbol such that extra copies in multiple translation units
2089 will be discarded by the linker. Define this macro if your object
2090 file format provides support for this concept, such as the `COMDAT'
2091 section flags in the Microsoft Windows PE/COFF format, and this
2092 support requires changes to DECL, such as putting it in a separate
2096 A C expression which evaluates to true if the target supports
2099 If you don't define this macro, `varasm.c' provides a default
2100 definition. If `MAKE_DECL_ONE_ONLY' is defined, the default
2101 definition is `1'; otherwise, it is `0'. Define this macro if you
2102 want to control weak symbol support with a compiler flag, or if
2103 setting the `DECL_ONE_ONLY' flag is enough to mark a declaration to
2104 be emitted as one-only. */
2106 #define ASM_OUTPUT_INTERNAL_LABEL(STREAM, PREFIX, NUM) \
2107 fprintf(STREAM, ".%s%d:\n", PREFIX, NUM)
2108 /* A C statement to output to the stdio stream STREAM a label whose
2109 name is made from the string PREFIX and the number NUM.
2111 It is absolutely essential that these labels be distinct from the
2112 labels used for user-level functions and variables. Otherwise,
2113 certain programs will have name conflicts with internal labels.
2115 It is desirable to exclude internal labels from the symbol table
2116 of the object file. Most assemblers have a naming convention for
2117 labels that should be excluded; on many systems, the letter `L' at
2118 the beginning of a label has this effect. You should find out what
2119 convention your system uses, and follow it.
2121 The usual definition of this macro is as follows:
2123 fprintf (STREAM, "L%s%d:\n", PREFIX, NUM) */
2125 #define ASM_GENERATE_INTERNAL_LABEL(STRING, PREFIX, NUM) \
2126 sprintf (STRING, "*.%s%d", PREFIX, NUM)
2127 /* A C statement to store into the string STRING a label whose name
2128 is made from the string PREFIX and the number NUM.
2130 This string, when output subsequently by `assemble_name', should
2131 produce the output that `ASM_OUTPUT_INTERNAL_LABEL' would produce
2132 with the same PREFIX and NUM.
2134 If the string begins with `*', then `assemble_name' will output
2135 the rest of the string unchanged. It is often convenient for
2136 `ASM_GENERATE_INTERNAL_LABEL' to use `*' in this way. If the
2137 string doesn't start with `*', then `ASM_OUTPUT_LABELREF' gets to
2138 output the string, and may change it. (Of course,
2139 `ASM_OUTPUT_LABELREF' is also part of your machine description, so
2140 you should know what it does on your machine.) */
2142 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
2143 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
2144 sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
2146 /* A C expression to assign to OUTVAR (which is a variable of type
2147 `char *') a newly allocated string made from the string NAME and
2148 the number NUMBER, with some suitable punctuation added. Use
2149 `alloca' to get space for the string.
2151 The string will be used as an argument to `ASM_OUTPUT_LABELREF' to
2152 produce an assembler label for an internal static variable whose
2153 name is NAME. Therefore, the string must be such as to result in
2154 valid assembler code. The argument NUMBER is different each time
2155 this macro is executed; it prevents conflicts between
2156 similarly-named internal static variables in different scopes.
2158 Ideally this string should not be a valid C identifier, to prevent
2159 any conflict with the user's own symbols. Most assemblers allow
2160 periods or percent signs in assembler symbols; putting at least
2161 one of these between the name and the number will suffice. */
2163 /* `ASM_OUTPUT_WEAK_ALIAS (STREAM, NAME, VALUE)'
2164 A C statement to output to the stdio stream STREAM assembler code
2165 which defines (equates) the weak symbol NAME to have the value
2168 Define this macro if the target only supports weak aliases; define
2169 ASM_OUTPUT_DEF instead if possible. */
2171 #define HAS_INIT_SECTION 1
2172 /* If defined, `main' will not call `__main' as described above.
2173 This macro should be defined for systems that control the contents
2174 of the init section on a symbol-by-symbol basis, such as OSF/1,
2175 and should not be defined explicitly for systems that support
2176 `INIT_SECTION_ASM_OP'. */
2178 #define REGISTER_NAMES { \
2179 "r0","r1","r2","r3","r4","r5","r6","r7", \
2180 "r8","r9","r10","r11","r12","r13","r14","r15", \
2181 "r16","r17","r18","r19","r20","r21","r22","r23", \
2182 "r24","r25","r26","r27","r28","r29","r30","r31", \
2183 "__SPL__","__SPH__","argL","argH"}
2184 /* A C initializer containing the assembler's names for the machine
2185 registers, each one as a C string constant. This is what
2186 translates register numbers in the compiler into assembler
2189 #define FINAL_PRESCAN_INSN(insn, operand, nop) final_prescan_insn (insn, operand,nop)
2190 /* If defined, a C statement to be executed just prior to the output
2191 of assembler code for INSN, to modify the extracted operands so
2192 they will be output differently.
2194 Here the argument OPVEC is the vector containing the operands
2195 extracted from INSN, and NOPERANDS is the number of elements of
2196 the vector which contain meaningful data for this insn. The
2197 contents of this vector are what will be used to convert the insn
2198 template into assembler code, so you can change the assembler
2199 output by changing the contents of the vector.
2201 This macro is useful when various assembler syntaxes share a single
2202 file of instruction patterns; by defining this macro differently,
2203 you can cause a large class of instructions to be output
2204 differently (such as with rearranged operands). Naturally,
2205 variations in assembler syntax affecting individual insn patterns
2206 ought to be handled by writing conditional output routines in
2209 If this macro is not defined, it is equivalent to a null statement. */
2211 #define PRINT_OPERAND(STREAM, X, CODE) print_operand (STREAM, X, CODE)
2212 /* A C compound statement to output to stdio stream STREAM the
2213 assembler syntax for an instruction operand X. X is an RTL
2216 CODE is a value that can be used to specify one of several ways of
2217 printing the operand. It is used when identical operands must be
2218 printed differently depending on the context. CODE comes from the
2219 `%' specification that was used to request printing of the
2220 operand. If the specification was just `%DIGIT' then CODE is 0;
2221 if the specification was `%LTR DIGIT' then CODE is the ASCII code
2224 If X is a register, this macro should print the register's name.
2225 The names can be found in an array `reg_names' whose type is `char
2226 *[]'. `reg_names' is initialized from `REGISTER_NAMES'.
2228 When the machine description has a specification `%PUNCT' (a `%'
2229 followed by a punctuation character), this macro is called with a
2230 null pointer for X and the punctuation character for CODE. */
2232 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) ((CODE) == '~')
2233 /* A C expression which evaluates to true if CODE is a valid
2234 punctuation character for use in the `PRINT_OPERAND' macro. If
2235 `PRINT_OPERAND_PUNCT_VALID_P' is not defined, it means that no
2236 punctuation characters (except for the standard one, `%') are used
2239 #define PRINT_OPERAND_ADDRESS(STREAM, X) print_operand_address(STREAM, X)
2240 /* A C compound statement to output to stdio stream STREAM the
2241 assembler syntax for an instruction operand that is a memory
2242 reference whose address is X. X is an RTL expression. */
2244 #define USER_LABEL_PREFIX ""
2245 /* `LOCAL_LABEL_PREFIX'
2248 If defined, C string expressions to be used for the `%R', `%L',
2249 `%U', and `%I' options of `asm_fprintf' (see `final.c'). These
2250 are useful when a single `md' file must support multiple assembler
2251 formats. In that case, the various `tm.h' files can define these
2252 macros differently. */
2254 #define ASSEMBLER_DIALECT AVR_ENHANCED
2255 /* If your target supports multiple dialects of assembler language
2256 (such as different opcodes), define this macro as a C expression
2257 that gives the numeric index of the assembler language dialect to
2258 use, with zero as the first variant.
2260 If this macro is defined, you may use constructs of the form
2261 `{option0|option1|option2...}' in the output templates of patterns
2262 (*note Output Template::.) or in the first argument of
2263 `asm_fprintf'. This construct outputs `option0', `option1' or
2264 `option2', etc., if the value of `ASSEMBLER_DIALECT' is zero, one
2265 or two, etc. Any special characters within these strings retain
2266 their usual meaning.
2268 If you do not define this macro, the characters `{', `|' and `}'
2269 do not have any special meaning when used in templates or operands
2272 Define the macros `REGISTER_PREFIX', `LOCAL_LABEL_PREFIX',
2273 `USER_LABEL_PREFIX' and `IMMEDIATE_PREFIX' if you can express the
2274 variations in assembler language syntax with that mechanism.
2275 Define `ASSEMBLER_DIALECT' and use the `{option0|option1}' syntax
2276 if the syntax variant are larger and involve such things as
2277 different opcodes or operand order. */
2279 #define ASM_OUTPUT_REG_PUSH(STREAM, REGNO) \
2283 fprintf (STREAM, "\tpush\tr%d", REGNO); \
2285 /* A C expression to output to STREAM some assembler code which will
2286 push hard register number REGNO onto the stack. The code need not
2287 be optimal, since this macro is used only when profiling. */
2289 #define ASM_OUTPUT_REG_POP(STREAM, REGNO) \
2293 fprintf (STREAM, "\tpop\tr%d", REGNO); \
2295 /* A C expression to output to STREAM some assembler code which will
2296 pop hard register number REGNO off of the stack. The code need
2297 not be optimal, since this macro is used only when profiling. */
2299 #define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \
2300 avr_output_addr_vec_elt(STREAM, VALUE)
2301 /* This macro should be provided on machines where the addresses in a
2302 dispatch table are absolute.
2304 The definition should be a C statement to output to the stdio
2305 stream STREAM an assembler pseudo-instruction to generate a
2306 reference to a label. VALUE is the number of an internal label
2307 whose definition is output using `ASM_OUTPUT_INTERNAL_LABEL'. For
2310 fprintf (STREAM, "\t.word L%d\n", VALUE) */
2312 #define ASM_OUTPUT_CASE_LABEL(STREAM, PREFIX, NUM, TABLE) \
2313 progmem_section (), ASM_OUTPUT_INTERNAL_LABEL (STREAM, PREFIX, NUM)
2315 /* `ASM_OUTPUT_CASE_LABEL (STREAM, PREFIX, NUM, TABLE)'
2316 Define this if the label before a jump-table needs to be output
2317 specially. The first three arguments are the same as for
2318 `ASM_OUTPUT_INTERNAL_LABEL'; the fourth argument is the jump-table
2319 which follows (a `jump_insn' containing an `addr_vec' or
2322 This feature is used on system V to output a `swbeg' statement for
2325 If this macro is not defined, these labels are output with
2326 `ASM_OUTPUT_INTERNAL_LABEL'. */
2328 /* `ASM_OUTPUT_CASE_END (STREAM, NUM, TABLE)'
2329 Define this if something special must be output at the end of a
2330 jump-table. The definition should be a C statement to be executed
2331 after the assembler code for the table is written. It should write
2332 the appropriate code to stdio stream STREAM. The argument TABLE
2333 is the jump-table insn, and NUM is the label-number of the
2336 If this macro is not defined, nothing special is output at the end
2337 of the jump-table. */
2339 #define ASM_OUTPUT_SKIP(STREAM, N) \
2340 fprintf (STREAM, "\t.skip %d,0\n", N)
2341 /* A C statement to output to the stdio stream STREAM an assembler
2342 instruction to advance the location counter by NBYTES bytes.
2343 Those bytes should be zero when loaded. NBYTES will be a C
2344 expression of type `int'. */
2346 #define ASM_OUTPUT_ALIGN(STREAM, POWER)
2347 /* A C statement to output to the stdio stream STREAM an assembler
2348 command to advance the location counter to a multiple of 2 to the
2349 POWER bytes. POWER will be a C expression of type `int'. */
2351 #define CASE_VECTOR_MODE HImode
2352 /* An alias for a machine mode name. This is the machine mode that
2353 elements of a jump-table should have. */
2355 extern int avr_case_values_threshold;
2357 #define CASE_VALUES_THRESHOLD avr_case_values_threshold
2358 /* `CASE_VALUES_THRESHOLD'
2359 Define this to be the smallest number of different values for
2360 which it is best to use a jump-table instead of a tree of
2361 conditional branches. The default is four for machines with a
2362 `casesi' instruction and five otherwise. This is best for most
2365 #undef WORD_REGISTER_OPERATIONS
2366 /* Define this macro if operations between registers with integral
2367 mode smaller than a word are always performed on the entire
2368 register. Most RISC machines have this property and most CISC
2372 /* The maximum number of bytes that a single instruction can move
2373 quickly between memory and registers or between two memory
2376 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
2377 /* A C expression which is nonzero if on this machine it is safe to
2378 "convert" an integer of INPREC bits to one of OUTPREC bits (where
2379 OUTPREC is smaller than INPREC) by merely operating on it as if it
2380 had only OUTPREC bits.
2382 On many machines, this expression can be 1.
2384 When `TRULY_NOOP_TRUNCATION' returns 1 for a pair of sizes for
2385 modes for which `MODES_TIEABLE_P' is 0, suboptimal code can result.
2386 If this is the case, making `TRULY_NOOP_TRUNCATION' return 0 in
2387 such cases may improve things. */
2389 #define Pmode HImode
2390 /* An alias for the machine mode for pointers. On most machines,
2391 define this to be the integer mode corresponding to the width of a
2392 hardware pointer; `SImode' on 32-bit machine or `DImode' on 64-bit
2393 machines. On some machines you must define this to be one of the
2394 partial integer modes, such as `PSImode'.
2396 The width of `Pmode' must be at least as large as the value of
2397 `POINTER_SIZE'. If it is not equal, you must define the macro
2398 `POINTERS_EXTEND_UNSIGNED' to specify how pointers are extended to
2401 #define FUNCTION_MODE HImode
2402 /* An alias for the machine mode used for memory references to
2403 functions being called, in `call' RTL expressions. On most
2404 machines this should be `QImode'. */
2406 #define INTEGRATE_THRESHOLD(DECL) (1 + (3 * list_length (DECL_ARGUMENTS (DECL)) / 2))
2408 /* A C expression for the maximum number of instructions above which
2409 the function DECL should not be inlined. DECL is a
2410 `FUNCTION_DECL' node.
2412 The default definition of this macro is 64 plus 8 times the number
2413 of arguments that the function accepts. Some people think a larger
2414 threshold should be used on RISC machines. */
2416 #define DOLLARS_IN_IDENTIFIERS 0
2417 /* Define this macro to control use of the character `$' in identifier
2418 names. 0 means `$' is not allowed by default; 1 means it is
2419 allowed. 1 is the default; there is no need to define this macro
2420 in that case. This macro controls the compiler proper; it does
2421 not affect the preprocessor. */
2423 #define NO_DOLLAR_IN_LABEL 1
2424 /* Define this macro if the assembler does not accept the character
2425 `$' in label names. By default constructors and destructors in
2426 G++ have `$' in the identifiers. If this macro is defined, `.' is
2429 #define MACHINE_DEPENDENT_REORG(INSN) machine_dependent_reorg (INSN)
2430 /* In rare cases, correct code generation requires extra machine
2431 dependent processing between the second jump optimization pass and
2432 delayed branch scheduling. On those machines, define this macro
2433 as a C statement to act on the code starting at INSN. */
2435 #define GIV_SORT_CRITERION(X, Y) \
2436 if (GET_CODE ((X)->add_val) == CONST_INT \
2437 && GET_CODE ((Y)->add_val) == CONST_INT) \
2438 return INTVAL ((X)->add_val) - INTVAL ((Y)->add_val);
2440 /* `GIV_SORT_CRITERION(GIV1, GIV2)'
2441 In some cases, the strength reduction optimization pass can
2442 produce better code if this is defined. This macro controls the
2443 order that induction variables are combined. This macro is
2444 particularly useful if the target has limited addressing modes.
2445 For instance, the SH target has only positive offsets in
2446 addresses. Thus sorting to put the smallest address first allows
2447 the most combinations to be found. */
2449 #define TRAMPOLINE_TEMPLATE(FILE) \
2450 internal_error ("trampolines not supported")
2452 /* Length in units of the trampoline for entering a nested function. */
2454 #define TRAMPOLINE_SIZE 4
2456 /* Emit RTL insns to initialize the variable parts of a trampoline.
2457 FNADDR is an RTX for the address of the function's pure code.
2458 CXT is an RTX for the static chain value for the function. */
2460 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
2462 emit_move_insn (gen_rtx (MEM, HImode, plus_constant ((TRAMP), 2)), CXT); \
2463 emit_move_insn (gen_rtx (MEM, HImode, plus_constant ((TRAMP), 6)), FNADDR); \
2465 /* Store in cc_status the expressions
2466 that the condition codes will describe
2467 after execution of an instruction whose pattern is EXP.
2468 Do not alter them if the instruction would not alter the cc's. */
2470 #define NOTICE_UPDATE_CC(EXP, INSN) notice_update_cc(EXP, INSN)
2472 /* The add insns don't set overflow in a usable way. */
2473 #define CC_OVERFLOW_UNUSABLE 01000
2474 /* The mov,and,or,xor insns don't set carry. That's ok though as the
2475 Z bit is all we need when doing unsigned comparisons on the result of
2476 these insns (since they're always with 0). However, conditions.h has
2477 CC_NO_OVERFLOW defined for this purpose. Rename it to something more
2479 #define CC_NO_CARRY CC_NO_OVERFLOW
2482 /* Output assembler code to FILE to increment profiler label # LABELNO
2483 for profiling a function entry. */
2485 #define FUNCTION_PROFILER(FILE, LABELNO) \
2486 fprintf (FILE, "/* profiler %d */", (LABELNO))
2488 /* `FIRST_INSN_ADDRESS'
2489 When the `length' insn attribute is used, this macro specifies the
2490 value to be assigned to the address of the first insn in a
2491 function. If not specified, 0 is used. */
2493 #define ADJUST_INSN_LENGTH(INSN, LENGTH) (LENGTH =\
2494 adjust_insn_length (INSN, LENGTH))
2495 /* If defined, modifies the length assigned to instruction INSN as a
2496 function of the context in which it is used. LENGTH is an lvalue
2497 that contains the initially computed length of the insn and should
2498 be updated with the correct length of the insn. If updating is
2499 required, INSN must not be a varying-length insn.
2501 This macro will normally not be required. A case in which it is
2502 required is the ROMP. On this machine, the size of an `addr_vec'
2503 insn must be increased by two to compensate for the fact that
2504 alignment may be required. */
2506 #define TARGET_MEM_FUNCTIONS
2507 /* Define this macro if GNU CC should generate calls to the System V
2508 (and ANSI C) library functions `memcpy' and `memset' rather than
2509 the BSD functions `bcopy' and `bzero'. */
2511 #define CPP_SPEC "%{posix:-D_POSIX_SOURCE}"
2513 /* A C string constant that tells the GNU CC driver program options to
2514 pass to CPP. It can also specify how to translate options you
2515 give to GNU CC into options for GNU CC to pass to the CPP.
2517 Do not define this macro if it does not need to do anything. */
2519 #define CC1_SPEC "%{profile:-p}"
2520 /* A C string constant that tells the GNU CC driver program options to
2521 pass to `cc1'. It can also specify how to translate options you
2522 give to GNU CC into options for GNU CC to pass to the `cc1'.
2524 Do not define this macro if it does not need to do anything. */
2526 #define ASM_SPEC "%{mmcu=*:-mmcu=%*}"
2527 /* A C string constant that tells the GNU CC driver program options to
2528 pass to the assembler. It can also specify how to translate
2529 options you give to GNU CC into options for GNU CC to pass to the
2530 assembler. See the file `sun3.h' for an example of this.
2532 Do not define this macro if it does not need to do anything. */
2534 #define ASM_FINAL_SPEC ""
2535 /* A C string constant that tells the GNU CC driver program how to
2536 run any programs which cleanup after the normal assembler.
2537 Normally, this is not needed. See the file `mips.h' for an
2540 Do not define this macro if it does not need to do anything. */
2542 #define LINK_SPEC " %{!mmcu*:-m avr2}\
2543 %{mmcu=at90s1200|mmcu=attiny1*|mmcu=attiny28:-m avr1} \
2544 %{mmcu=attiny22|mmcu=attiny26|mmcu=at90s2*|mmcu=at90s4*|mmcu=at90s8*|mmcu=at90c8*|mmcu=at86rf401:-m avr2}\
2545 %{mmcu=atmega103|mmcu=atmega603|mmcu=at43*|mmcu=at76*:-m avr3}\
2546 %{mmcu=atmega8*:-m avr4}\
2547 %{mmcu=atmega16*|mmcu=atmega32*|mmcu=atmega64|mmcu=atmega128|mmcu=at94k:-m avr5}\
2548 %{mmcu=atmega64|mmcu=atmega128|mmcu=atmega162|mmcu=atmega169: -Tdata 0x800100} "
2550 /* A C string constant that tells the GNU CC driver program options to
2551 pass to the linker. It can also specify how to translate options
2552 you give to GNU CC into options for GNU CC to pass to the linker.
2554 Do not define this macro if it does not need to do anything. */
2557 "%{!mmcu=at90s1*:%{!mmcu=attiny1*:%{!mmcu=attiny28: -lc }}}"
2558 /* Another C string constant used much like `LINK_SPEC'. The
2559 difference between the two is that `LIB_SPEC' is used at the end
2560 of the command given to the linker.
2562 If this macro is not defined, a default is provided that loads the
2563 standard C library from the usual place. See `gcc.c'. */
2565 #define LIBSTDCXX "-lgcc"
2566 /* No libstdc++ for now. Empty string doesn't work. */
2568 #define LIBGCC_SPEC \
2569 "%{!mmcu=at90s1*:%{!mmcu=attiny1*:%{!mmcu=attiny28: -lgcc }}}"
2570 /* Another C string constant that tells the GNU CC driver program how
2571 and when to place a reference to `libgcc.a' into the linker
2572 command line. This constant is placed both before and after the
2573 value of `LIB_SPEC'.
2575 If this macro is not defined, the GNU CC driver provides a default
2576 that passes the string `-lgcc' to the linker unless the `-shared'
2577 option is specified. */
2579 #define STARTFILE_SPEC "%(crt_binutils)"
2580 /* Another C string constant used much like `LINK_SPEC'. The
2581 difference between the two is that `STARTFILE_SPEC' is used at the
2582 very beginning of the command given to the linker.
2584 If this macro is not defined, a default is provided that loads the
2585 standard C startup file from the usual place. See `gcc.c'. */
2587 #define ENDFILE_SPEC ""
2588 /* Another C string constant used much like `LINK_SPEC'. The
2589 difference between the two is that `ENDFILE_SPEC' is used at the
2590 very end of the command given to the linker.
2592 Do not define this macro if it does not need to do anything. */
2594 #define CRT_BINUTILS_SPECS "\
2595 %{mmcu=at90s1200|mmcu=avr1:crts1200.o%s} \
2596 %{mmcu=attiny11:crttn11.o%s} \
2597 %{mmcu=attiny12:crttn12.o%s} \
2598 %{mmcu=attiny15:crttn15.o%s} \
2599 %{mmcu=attiny28:crttn28.o%s} \
2600 %{!mmcu*|mmcu=at90s8515|mmcu=avr2:crts8515.o%s} \
2601 %{mmcu=at90s2313:crts2313.o%s} \
2602 %{mmcu=at90s2323:crts2323.o%s} \
2603 %{mmcu=at90s2333:crts2333.o%s} \
2604 %{mmcu=at90s2343:crts2343.o%s} \
2605 %{mmcu=attiny22:crttn22.o%s} \
2606 %{mmcu=attiny26:crttn26.o%s} \
2607 %{mmcu=at90s4433:crts4433.o%s} \
2608 %{mmcu=at90s4414:crts4414.o%s} \
2609 %{mmcu=at90s4434:crts4434.o%s} \
2610 %{mmcu=at90c8534:crtc8534.o%s} \
2611 %{mmcu=at90s8535:crts8535.o%s} \
2612 %{mmcu=at86rf401:crt86401.o%s} \
2613 %{mmcu=atmega103|mmcu=avr3:crtm103.o%s} \
2614 %{mmcu=atmega603:crtm603.o%s} \
2615 %{mmcu=at43usb320:crt43320.o%s} \
2616 %{mmcu=at43usb355:crt43355.o%s} \
2617 %{mmcu=at76c711:crt76711.o%s} \
2618 %{mmcu=atmega8|mmcu=avr4:crtm8.o%s} \
2619 %{mmcu=atmega8515:crtm8515.o%s} \
2620 %{mmcu=atmega8535:crtm8535.o%s} \
2621 %{mmcu=atmega16:crtm16.o%s} \
2622 %{mmcu=atmega161|mmcu=avr5:crtm161.o%s} \
2623 %{mmcu=atmega162:crtm162.o%s} \
2624 %{mmcu=atmega163:crtm163.o%s} \
2625 %{mmcu=atmega169:crtm169.o%s} \
2626 %{mmcu=atmega32:crtm32.o%s} \
2627 %{mmcu=atmega323:crtm323.o%s} \
2628 %{mmcu=atmega64:crtm64.o%s} \
2629 %{mmcu=atmega128:crtm128.o%s} \
2630 %{mmcu=at94k:crtat94k.o%s}"
2632 #define EXTRA_SPECS {"crt_binutils", CRT_BINUTILS_SPECS},
2634 /* Define this macro to provide additional specifications to put in
2635 the `specs' file that can be used in various specifications like
2638 /* This is the default without any -mmcu=* option (AT90S*). */
2639 #define MULTILIB_DEFAULTS { "mmcu=avr2" }
2641 /* This is undefined macro for collect2 disabling */
2642 #define LINKER_NAME "ld"
2644 #define TEST_HARD_REG_CLASS(CLASS, REGNO) \
2645 TEST_HARD_REG_BIT (reg_class_contents[ (int) (CLASS)], REGNO)
2647 /* Note that the other files fail to use these
2648 in some of the places where they should. */
2650 #if defined(__STDC__) || defined(ALMOST_STDC)
2651 #define AS2(a,b,c) #a " " #b "," #c
2652 #define AS2C(b,c) " " #b "," #c
2653 #define AS3(a,b,c,d) #a " " #b "," #c "," #d
2654 #define AS1(a,b) #a " " #b
2656 #define AS1(a,b) "a b"
2657 #define AS2(a,b,c) "a b,c"
2658 #define AS2C(b,c) " b,c"
2659 #define AS3(a,b,c,d) "a b,c,d"
2661 #define OUT_AS1(a,b) output_asm_insn (AS1(a,b), operands)
2662 #define OUT_AS2(a,b,c) output_asm_insn (AS2(a,b,c), operands)
2663 #define CR_TAB "\n\t"
2665 /* Define this macro as a C statement that declares additional library
2666 routines renames existing ones. `init_optabs' calls this macro
2667 after initializing all the normal library routines. */
2669 #define INIT_TARGET_OPTABS \
2674 /* Temporary register r0 */
2677 /* zero register r1 */
2678 #define ZERO_REGNO 1
2680 /* Temporary register which used for load immediate values to r0-r15 */
2681 #define LDI_REG_REGNO 31
2683 extern struct rtx_def *tmp_reg_rtx;
2684 extern struct rtx_def *zero_reg_rtx;
2685 extern struct rtx_def *ldi_reg_rtx;
2687 #define TARGET_FLOAT_FORMAT IEEE_FLOAT_FORMAT
2689 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
2691 /* Get the standard ELF stabs definitions. */