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 OPTIMIZATION_OPTIONS(LEVEL, SIZE) \
136 avr_optimization_options (LEVEL, SIZE)
138 #define CAN_DEBUG_WITHOUT_FP
139 /* Define this macro if debugging can be performed even without a
140 frame pointer. If this macro is defined, GNU CC will turn on the
141 `-fomit-frame-pointer' option whenever `-O' is specified. */
143 /* Define this if most significant byte of a word is the lowest numbered. */
144 #define BITS_BIG_ENDIAN 0
146 /* Define this if most significant byte of a word is the lowest numbered. */
147 #define BYTES_BIG_ENDIAN 0
149 /* Define this if most significant word of a multiword number is the lowest
151 #define WORDS_BIG_ENDIAN 0
154 /* This is to get correct SI and DI modes in libgcc2.c (32 and 64 bits). */
155 #define UNITS_PER_WORD 4
157 /* Width of a word, in units (bytes). */
158 #define UNITS_PER_WORD 1
161 /* Width in bits of a pointer.
162 See also the macro `Pmode' defined below. */
163 #define POINTER_SIZE 16
166 /* Maximum sized of reasonable data type
167 DImode or Dfmode ... */
168 #define MAX_FIXED_MODE_SIZE 32
170 /* Allocation boundary (in *bits*) for storing arguments in argument list. */
171 #define PARM_BOUNDARY 8
173 /* Allocation boundary (in *bits*) for the code of a function. */
174 #define FUNCTION_BOUNDARY 8
176 /* Alignment of field after `int : 0' in a structure. */
177 #define EMPTY_FIELD_BOUNDARY 8
179 /* No data type wants to be aligned rounder than this. */
180 #define BIGGEST_ALIGNMENT 8
183 /* Define this if move instructions will actually fail to work
184 when given unaligned data. */
185 #define STRICT_ALIGNMENT 0
187 /* A C expression for the size in bits of the type `int' on the
188 target machine. If you don't define this, the default is one word. */
189 #define INT_TYPE_SIZE (TARGET_INT8 ? 8 : 16)
192 /* A C expression for the size in bits of the type `short' on the
193 target machine. If you don't define this, the default is half a
194 word. (If this would be less than one storage unit, it is rounded
196 #define SHORT_TYPE_SIZE (INT_TYPE_SIZE == 8 ? INT_TYPE_SIZE : 16)
198 /* A C expression for the size in bits of the type `long' on the
199 target machine. If you don't define this, the default is one word. */
200 #define LONG_TYPE_SIZE (INT_TYPE_SIZE == 8 ? 16 : 32)
202 #define MAX_LONG_TYPE_SIZE 32
203 /* Maximum number for the size in bits of the type `long' on the
204 target machine. If this is undefined, the default is
205 `LONG_TYPE_SIZE'. Otherwise, it is the constant value that is the
206 largest value that `LONG_TYPE_SIZE' can have at run-time. This is
210 #define LONG_LONG_TYPE_SIZE 64
211 /* A C expression for the size in bits of the type `long long' on the
212 target machine. If you don't define this, the default is two
213 words. If you want to support GNU Ada on your machine, the value
214 of macro must be at least 64. */
217 #define FLOAT_TYPE_SIZE 32
218 /* A C expression for the size in bits of the type `float' on the
219 target machine. If you don't define this, the default is one word. */
221 #define DOUBLE_TYPE_SIZE 32
222 /* A C expression for the size in bits of the type `double' on the
223 target machine. If you don't define this, the default is two
227 #define LONG_DOUBLE_TYPE_SIZE 32
228 /* A C expression for the size in bits of the type `long double' on
229 the target machine. If you don't define this, the default is two
232 #define DEFAULT_SIGNED_CHAR 1
233 /* An expression whose value is 1 or 0, according to whether the type
234 `char' should be signed or unsigned by default. The user can
235 always override this default with the options `-fsigned-char' and
236 `-funsigned-char'. */
238 /* `DEFAULT_SHORT_ENUMS'
239 A C expression to determine whether to give an `enum' type only as
240 many bytes as it takes to represent the range of possible values
241 of that type. A nonzero value means to do that; a zero value
242 means all `enum' types should be allocated like `int'.
244 If you don't define the macro, the default is 0. */
246 #define SIZE_TYPE (INT_TYPE_SIZE == 8 ? "long unsigned int" : "unsigned int")
247 /* A C expression for a string describing the name of the data type
248 to use for size values. The typedef name `size_t' is defined
249 using the contents of the string.
251 The string can contain more than one keyword. If so, separate
252 them with spaces, and write first any length keyword, then
253 `unsigned' if appropriate, and finally `int'. The string must
254 exactly match one of the data type names defined in the function
255 `init_decl_processing' in the file `c-decl.c'. You may not omit
256 `int' or change the order--that would cause the compiler to crash
259 If you don't define this macro, the default is `"long unsigned
262 #define PTRDIFF_TYPE (INT_TYPE_SIZE == 8 ? "long int" :"int")
263 /* A C expression for a string describing the name of the data type
264 to use for the result of subtracting two pointers. The typedef
265 name `ptrdiff_t' is defined using the contents of the string. See
266 `SIZE_TYPE' above for more information.
268 If you don't define this macro, the default is `"long int"'. */
271 #define WCHAR_TYPE_SIZE 16
272 /* A C expression for the size in bits of the data type for wide
273 characters. This is used in `cpp', which cannot make use of
276 #define FIRST_PSEUDO_REGISTER 36
277 /* Number of hardware registers known to the compiler. They receive
278 numbers 0 through `FIRST_PSEUDO_REGISTER-1'; thus, the first
279 pseudo register's number really is assigned the number
280 `FIRST_PSEUDO_REGISTER'. */
282 #define FIXED_REGISTERS {\
300 1,1 /* arg pointer */ }
301 /* An initializer that says which registers are used for fixed
302 purposes all throughout the compiled code and are therefore not
303 available for general allocation. These would include the stack
304 pointer, the frame pointer (except on machines where that can be
305 used as a general register when no frame pointer is needed), the
306 program counter on machines where that is considered one of the
307 addressable registers, and any other numbered register with a
310 This information is expressed as a sequence of numbers, separated
311 by commas and surrounded by braces. The Nth number is 1 if
312 register N is fixed, 0 otherwise.
314 The table initialized from this macro, and the table initialized by
315 the following one, may be overridden at run time either
316 automatically, by the actions of the macro
317 `CONDITIONAL_REGISTER_USAGE', or by the user with the command
318 options `-ffixed-REG', `-fcall-used-REG' and `-fcall-saved-REG'. */
320 #define CALL_USED_REGISTERS { \
338 1,1 /* arg pointer */ }
339 /* Like `FIXED_REGISTERS' but has 1 for each register that is
340 clobbered (in general) by function calls as well as for fixed
341 registers. This macro therefore identifies the registers that are
342 not available for general allocation of values that must live
343 across function calls.
345 If a register has 0 in `CALL_USED_REGISTERS', the compiler
346 automatically saves it on function entry and restores it on
347 function exit, if the register is used within the function. */
349 #define NON_SAVING_SETJMP 0
350 /* If this macro is defined and has a nonzero value, it means that
351 `setjmp' and related functions fail to save the registers, or that
352 `longjmp' fails to restore them. To compensate, the compiler
353 avoids putting variables in registers in functions that use
356 #define REG_ALLOC_ORDER { \
364 17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2, \
368 /* If defined, an initializer for a vector of integers, containing the
369 numbers of hard registers in the order in which GNU CC should
370 prefer to use them (from most preferred to least).
372 If this macro is not defined, registers are used lowest numbered
373 first (all else being equal).
375 One use of this macro is on machines where the highest numbered
376 registers must always be saved and the save-multiple-registers
377 instruction supports only sequences of consetionve registers. On
378 such machines, define `REG_ALLOC_ORDER' to be an initializer that
379 lists the highest numbered allocatable register first. */
381 #define ORDER_REGS_FOR_LOCAL_ALLOC order_regs_for_local_alloc ()
382 /* ORDER_REGS_FOR_LOCAL_ALLOC'
383 A C statement (sans semicolon) to choose the order in which to
384 allocate hard registers for pseudo-registers local to a basic
387 Store the desired register order in the array `reg_alloc_order'.
388 Element 0 should be the register to allocate first; element 1, the
389 next register; and so on.
391 The macro body should not assume anything about the contents of
392 `reg_alloc_order' before execution of the macro.
394 On most machines, it is not necessary to define this macro. */
397 #define HARD_REGNO_NREGS(REGNO, MODE) ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
399 /* A C expression for the number of consecutive hard registers,
400 starting at register number REGNO, required to hold a value of mode
403 On a machine where all registers are exactly one word, a suitable
404 definition of this macro is
406 #define HARD_REGNO_NREGS(REGNO, MODE) \
407 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) \
408 / UNITS_PER_WORD)) */
410 #define HARD_REGNO_MODE_OK(REGNO, MODE) avr_hard_regno_mode_ok(REGNO, MODE)
411 /* A C expression that is nonzero if it is permissible to store a
412 value of mode MODE in hard register number REGNO (or in several
413 registers starting with that one). For a machine where all
414 registers are equivalent, a suitable definition is
416 #define HARD_REGNO_MODE_OK(REGNO, MODE) 1
418 It is not necessary for this macro to check for the numbers of
419 fixed registers, because the allocation mechanism considers them
420 to be always occupied.
422 On some machines, double-precision values must be kept in even/odd
423 register pairs. The way to implement that is to define this macro
424 to reject odd register numbers for such modes.
426 The minimum requirement for a mode to be OK in a register is that
427 the `movMODE' instruction pattern support moves between the
428 register and any other hard register for which the mode is OK; and
429 that moving a value into the register and back out not alter it.
431 Since the same instruction used to move `SImode' will work for all
432 narrower integer modes, it is not necessary on any machine for
433 `HARD_REGNO_MODE_OK' to distinguish between these modes, provided
434 you define patterns `movhi', etc., to take advantage of this. This
435 is useful because of the interaction between `HARD_REGNO_MODE_OK'
436 and `MODES_TIEABLE_P'; it is very desirable for all integer modes
439 Many machines have special registers for floating point arithmetic.
440 Often people assume that floating point machine modes are allowed
441 only in floating point registers. This is not true. Any
442 registers that can hold integers can safely *hold* a floating
443 point machine mode, whether or not floating arithmetic can be done
444 on it in those registers. Integer move instructions can be used
447 On some machines, though, the converse is true: fixed-point machine
448 modes may not go in floating registers. This is true if the
449 floating registers normalize any value stored in them, because
450 storing a non-floating value there would garble it. In this case,
451 `HARD_REGNO_MODE_OK' should reject fixed-point machine modes in
452 floating registers. But if the floating registers do not
453 automatically normalize, if you can store any bit pattern in one
454 and retrieve it unchanged without a trap, then any machine mode
455 may go in a floating register, so you can define this macro to say
458 The primary significance of special floating registers is rather
459 that they are the registers acceptable in floating point arithmetic
460 instructions. However, this is of no concern to
461 `HARD_REGNO_MODE_OK'. You handle it by writing the proper
462 constraints for those instructions.
464 On some machines, the floating registers are especially slow to
465 access, so that it is better to store a value in a stack frame
466 than in such a register if floating point arithmetic is not being
467 done. As long as the floating registers are not in class
468 `GENERAL_REGS', they will not be used unless some pattern's
469 constraint asks for one. */
471 #define MODES_TIEABLE_P(MODE1, MODE2) 0
472 /* A C expression that is nonzero if it is desirable to choose
473 register allocation so as to avoid move instructions between a
474 value of mode MODE1 and a value of mode MODE2.
476 If `HARD_REGNO_MODE_OK (R, MODE1)' and `HARD_REGNO_MODE_OK (R,
477 MODE2)' are ever different for any R, then `MODES_TIEABLE_P (MODE1,
478 MODE2)' must be zero. */
483 POINTER_X_REGS, /* r26 - r27 */
484 POINTER_Y_REGS, /* r28 - r29 */
485 POINTER_Z_REGS, /* r30 - r31 */
486 STACK_REG, /* STACK */
487 BASE_POINTER_REGS, /* r28 - r31 */
488 POINTER_REGS, /* r26 - r31 */
489 ADDW_REGS, /* r24 - r31 */
490 SIMPLE_LD_REGS, /* r16 - r23 */
491 LD_REGS, /* r16 - r31 */
492 NO_LD_REGS, /* r0 - r15 */
493 GENERAL_REGS, /* r0 - r31 */
494 ALL_REGS, LIM_REG_CLASSES
496 /* An enumeral type that must be defined with all the register class
497 names as enumeral values. `NO_REGS' must be first. `ALL_REGS'
498 must be the last register class, followed by one more enumeral
499 value, `LIM_REG_CLASSES', which is not a register class but rather
500 tells how many classes there are.
502 Each register class has a number, which is the value of casting
503 the class name to type `int'. The number serves as an index in
504 many of the tables described below. */
507 #define N_REG_CLASSES (int)LIM_REG_CLASSES
508 /* The number of distinct register classes, defined as follows:
510 #define N_REG_CLASSES (int) LIM_REG_CLASSES */
512 #define REG_CLASS_NAMES { \
515 "POINTER_X_REGS", /* r26 - r27 */ \
516 "POINTER_Y_REGS", /* r28 - r29 */ \
517 "POINTER_Z_REGS", /* r30 - r31 */ \
518 "STACK_REG", /* STACK */ \
519 "BASE_POINTER_REGS", /* r28 - r31 */ \
520 "POINTER_REGS", /* r26 - r31 */ \
521 "ADDW_REGS", /* r24 - r31 */ \
522 "SIMPLE_LD_REGS", /* r16 - r23 */ \
523 "LD_REGS", /* r16 - r31 */ \
524 "NO_LD_REGS", /* r0 - r15 */ \
525 "GENERAL_REGS", /* r0 - r31 */ \
527 /* An initializer containing the names of the register classes as C
528 string constants. These names are used in writing some of the
536 #define REG_CLASS_CONTENTS { \
537 {0x00000000,0x00000000}, /* NO_REGS */ \
538 {0x00000001,0x00000000}, /* R0_REG */ \
539 {3 << REG_X,0x00000000}, /* POINTER_X_REGS, r26 - r27 */ \
540 {3 << REG_Y,0x00000000}, /* POINTER_Y_REGS, r28 - r29 */ \
541 {3 << REG_Z,0x00000000}, /* POINTER_Z_REGS, r30 - r31 */ \
542 {0x00000000,0x00000003}, /* STACK_REG, STACK */ \
543 {(3 << REG_Y) | (3 << REG_Z), \
544 0x00000000}, /* BASE_POINTER_REGS, r28 - r31 */ \
545 {(3 << REG_X) | (3 << REG_Y) | (3 << REG_Z), \
546 0x00000000}, /* POINTER_REGS, r26 - r31 */ \
547 {(3 << REG_X) | (3 << REG_Y) | (3 << REG_Z) | (3 << REG_W), \
548 0x00000000}, /* ADDW_REGS, r24 - r31 */ \
549 {0x00ff0000,0x00000000}, /* SIMPLE_LD_REGS r16 - r23 */ \
550 {(3 << REG_X)|(3 << REG_Y)|(3 << REG_Z)|(3 << REG_W)|(0xff << 16), \
551 0x00000000}, /* LD_REGS, r16 - r31 */ \
552 {0x0000ffff,0x00000000}, /* NO_LD_REGS r0 - r15 */ \
553 {0xffffffff,0x00000000}, /* GENERAL_REGS, r0 - r31 */ \
554 {0xffffffff,0x00000003} /* ALL_REGS */ \
556 /* An initializer containing the contents of the register classes, as
557 integers which are bit masks. The Nth integer specifies the
558 contents of class N. The way the integer MASK is interpreted is
559 that register R is in the class if `MASK & (1 << R)' is 1.
561 When the machine has more than 32 registers, an integer does not
562 suffice. Then the integers are replaced by sub-initializers,
563 braced groupings containing several integers. Each
564 sub-initializer must be suitable as an initializer for the type
565 `HARD_REG_SET' which is defined in `hard-reg-set.h'. */
567 #define REGNO_REG_CLASS(R) avr_regno_reg_class(R)
568 /* A C expression whose value is a register class containing hard
569 register REGNO. In general there is more than one such class;
570 choose a class which is "minimal", meaning that no smaller class
571 also contains the register. */
573 #define BASE_REG_CLASS POINTER_REGS
574 /* A macro whose definition is the name of the class to which a valid
575 base register must belong. A base register is one used in an
576 address which is the register value plus a displacement. */
578 #define INDEX_REG_CLASS NO_REGS
579 /* A macro whose definition is the name of the class to which a valid
580 index register must belong. An index register is one used in an
581 address where its value is either multiplied by a scale factor or
582 added to another register (as well as added to a displacement). */
584 #define REG_CLASS_FROM_LETTER(C) avr_reg_class_from_letter(C)
585 /* A C expression which defines the machine-dependent operand
586 constraint letters for register classes. If CHAR is such a
587 letter, the value should be the register class corresponding to
588 it. Otherwise, the value should be `NO_REGS'. The register
589 letter `r', corresponding to class `GENERAL_REGS', will not be
590 passed to this macro; you do not need to handle it. */
592 #define REGNO_OK_FOR_BASE_P(r) (((r) < FIRST_PSEUDO_REGISTER \
596 || (r) == ARG_POINTER_REGNUM)) \
598 && (reg_renumber[r] == REG_X \
599 || reg_renumber[r] == REG_Y \
600 || reg_renumber[r] == REG_Z \
601 || (reg_renumber[r] \
602 == ARG_POINTER_REGNUM))))
603 /* A C expression which is nonzero if register number NUM is suitable
604 for use as a base register in operand addresses. It may be either
605 a suitable hard register or a pseudo register that has been
606 allocated such a hard register. */
608 /* #define REGNO_MODE_OK_FOR_BASE_P(r, m) regno_mode_ok_for_base_p(r, m)
609 A C expression that is just like `REGNO_OK_FOR_BASE_P', except that
610 that expression may examine the mode of the memory reference in
611 MODE. You should define this macro if the mode of the memory
612 reference affects whether a register may be used as a base
613 register. If you define this macro, the compiler will use it
614 instead of `REGNO_OK_FOR_BASE_P'. */
616 #define REGNO_OK_FOR_INDEX_P(NUM) 0
617 /* A C expression which is nonzero if register number NUM is suitable
618 for use as an index register in operand addresses. It may be
619 either a suitable hard register or a pseudo register that has been
620 allocated such a hard register.
622 The difference between an index register and a base register is
623 that the index register may be scaled. If an address involves the
624 sum of two registers, neither one of them scaled, then either one
625 may be labeled the "base" and the other the "index"; but whichever
626 labeling is used must fit the machine's constraints of which
627 registers may serve in each capacity. The compiler will try both
628 labelings, looking for one that is valid, and will reload one or
629 both registers only if neither labeling works. */
631 #define PREFERRED_RELOAD_CLASS(X, CLASS) preferred_reload_class(X,CLASS)
632 /* A C expression that places additional restrictions on the register
633 class to use when it is necessary to copy value X into a register
634 in class CLASS. The value is a register class; perhaps CLASS, or
635 perhaps another, smaller class. On many machines, the following
638 #define PREFERRED_RELOAD_CLASS(X,CLASS) CLASS
640 Sometimes returning a more restrictive class makes better code.
641 For example, on the 68000, when X is an integer constant that is
642 in range for a `moveq' instruction, the value of this macro is
643 always `DATA_REGS' as long as CLASS includes the data registers.
644 Requiring a data register guarantees that a `moveq' will be used.
646 If X is a `const_double', by returning `NO_REGS' you can force X
647 into a memory constant. This is useful on certain machines where
648 immediate floating values cannot be loaded into certain kinds of
650 /* `PREFERRED_OUTPUT_RELOAD_CLASS (X, CLASS)'
651 Like `PREFERRED_RELOAD_CLASS', but for output reloads instead of
652 input reloads. If you don't define this macro, the default is to
653 use CLASS, unchanged. */
655 /* `LIMIT_RELOAD_CLASS (MODE, CLASS)'
656 A C expression that places additional restrictions on the register
657 class to use when it is necessary to be able to hold a value of
658 mode MODE in a reload register for which class CLASS would
661 Unlike `PREFERRED_RELOAD_CLASS', this macro should be used when
662 there are certain modes that simply can't go in certain reload
665 The value is a register class; perhaps CLASS, or perhaps another,
668 Don't define this macro unless the target machine has limitations
669 which require the macro to do something nontrivial. */
671 /* SECONDARY_INPUT_RELOAD_CLASS(CLASS, MODE, X)
672 `SECONDARY_RELOAD_CLASS (CLASS, MODE, X)'
673 `SECONDARY_OUTPUT_RELOAD_CLASS (CLASS, MODE, X)'
674 Many machines have some registers that cannot be copied directly
675 to or from memory or even from other types of registers. An
676 example is the `MQ' register, which on most machines, can only be
677 copied to or from general registers, but not memory. Some
678 machines allow copying all registers to and from memory, but
679 require a scratch register for stores to some memory locations
680 (e.g., those with symbolic address on the RT, and those with
681 certain symbolic address on the Sparc when compiling PIC). In
682 some cases, both an intermediate and a scratch register are
685 You should define these macros to indicate to the reload phase
686 that it may need to allocate at least one register for a reload in
687 addition to the register to contain the data. Specifically, if
688 copying X to a register CLASS in MODE requires an intermediate
689 register, you should define `SECONDARY_INPUT_RELOAD_CLASS' to
690 return the largest register class all of whose registers can be
691 used as intermediate registers or scratch registers.
693 If copying a register CLASS in MODE to X requires an intermediate
694 or scratch register, `SECONDARY_OUTPUT_RELOAD_CLASS' should be
695 defined to return the largest register class required. If the
696 requirements for input and output reloads are the same, the macro
697 `SECONDARY_RELOAD_CLASS' should be used instead of defining both
700 The values returned by these macros are often `GENERAL_REGS'.
701 Return `NO_REGS' if no spare register is needed; i.e., if X can be
702 directly copied to or from a register of CLASS in MODE without
703 requiring a scratch register. Do not define this macro if it
704 would always return `NO_REGS'.
706 If a scratch register is required (either with or without an
707 intermediate register), you should define patterns for
708 `reload_inM' or `reload_outM', as required (*note Standard
709 Names::.. These patterns, which will normally be implemented with
710 a `define_expand', should be similar to the `movM' patterns,
711 except that operand 2 is the scratch register.
713 Define constraints for the reload register and scratch register
714 that contain a single register class. If the original reload
715 register (whose class is CLASS) can meet the constraint given in
716 the pattern, the value returned by these macros is used for the
717 class of the scratch register. Otherwise, two additional reload
718 registers are required. Their classes are obtained from the
719 constraints in the insn pattern.
721 X might be a pseudo-register or a `subreg' of a pseudo-register,
722 which could either be in a hard register or in memory. Use
723 `true_regnum' to find out; it will return -1 if the pseudo is in
724 memory and the hard register number if it is in a register.
726 These macros should not be used in the case where a particular
727 class of registers can only be copied to memory and not to another
728 class of registers. In that case, secondary reload registers are
729 not needed and would not be helpful. Instead, a stack location
730 must be used to perform the copy and the `movM' pattern should use
731 memory as an intermediate storage. This case often occurs between
732 floating-point and general registers. */
734 /* `SECONDARY_MEMORY_NEEDED (CLASS1, CLASS2, M)'
735 Certain machines have the property that some registers cannot be
736 copied to some other registers without using memory. Define this
737 macro on those machines to be a C expression that is non-zero if
738 objects of mode M in registers of CLASS1 can only be copied to
739 registers of class CLASS2 by storing a register of CLASS1 into
740 memory and loading that memory location into a register of CLASS2.
742 Do not define this macro if its value would always be zero.
744 `SECONDARY_MEMORY_NEEDED_RTX (MODE)'
745 Normally when `SECONDARY_MEMORY_NEEDED' is defined, the compiler
746 allocates a stack slot for a memory location needed for register
747 copies. If this macro is defined, the compiler instead uses the
748 memory location defined by this macro.
750 Do not define this macro if you do not define
751 `SECONDARY_MEMORY_NEEDED'. */
753 #define SMALL_REGISTER_CLASSES 1
754 /* Normally the compiler avoids choosing registers that have been
755 explicitly mentioned in the rtl as spill registers (these
756 registers are normally those used to pass parameters and return
757 values). However, some machines have so few registers of certain
758 classes that there would not be enough registers to use as spill
759 registers if this were done.
761 Define `SMALL_REGISTER_CLASSES' to be an expression with a non-zero
762 value on these machines. When this macro has a non-zero value, the
763 compiler allows registers explicitly used in the rtl to be used as
764 spill registers but avoids extending the lifetime of these
767 It is always safe to define this macro with a non-zero value, but
768 if you unnecessarily define it, you will reduce the amount of
769 optimizations that can be performed in some cases. If you do not
770 define this macro with a non-zero value when it is required, the
771 compiler will run out of spill registers and print a fatal error
772 message. For most machines, you should not define this macro at
775 #define CLASS_LIKELY_SPILLED_P(c) class_likely_spilled_p(c)
776 /* A C expression whose value is nonzero if pseudos that have been
777 assigned to registers of class CLASS would likely be spilled
778 because registers of CLASS are needed for spill registers.
780 The default value of this macro returns 1 if CLASS has exactly one
781 register and zero otherwise. On most machines, this default
782 should be used. Only define this macro to some other expression
783 if pseudo allocated by `local-alloc.c' end up in memory because
784 their hard registers were needed for spill registers. If this
785 macro returns nonzero for those classes, those pseudos will only
786 be allocated by `global.c', which knows how to reallocate the
787 pseudo to another register. If there would not be another
788 register available for reallocation, you should not change the
789 definition of this macro since the only effect of such a
790 definition would be to slow down register allocation. */
792 #define CLASS_MAX_NREGS(CLASS, MODE) class_max_nregs (CLASS, MODE)
793 /* A C expression for the maximum number of consecutive registers of
794 class CLASS needed to hold a value of mode MODE.
796 This is closely related to the macro `HARD_REGNO_NREGS'. In fact,
797 the value of the macro `CLASS_MAX_NREGS (CLASS, MODE)' should be
798 the maximum value of `HARD_REGNO_NREGS (REGNO, MODE)' for all
799 REGNO values in the class CLASS.
801 This macro helps control the handling of multiple-word values in
804 #define CONST_OK_FOR_LETTER_P(VALUE, C) \
805 ((C) == 'I' ? (VALUE) >= 0 && (VALUE) <= 63 : \
806 (C) == 'J' ? (VALUE) <= 0 && (VALUE) >= -63: \
807 (C) == 'K' ? (VALUE) == 2 : \
808 (C) == 'L' ? (VALUE) == 0 : \
809 (C) == 'M' ? (VALUE) >= 0 && (VALUE) <= 0xff : \
810 (C) == 'N' ? (VALUE) == -1: \
811 (C) == 'O' ? (VALUE) == 8 || (VALUE) == 16 || (VALUE) == 24: \
812 (C) == 'P' ? (VALUE) == 1 : \
815 /* A C expression that defines the machine-dependent operand
816 constraint letters (`I', `J', `K', ... `P') that specify
817 particular ranges of integer values. If C is one of those
818 letters, the expression should check that VALUE, an integer, is in
819 the appropriate range and return 1 if so, 0 otherwise. If C is
820 not one of those letters, the value should be 0 regardless of
823 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
824 ((C) == 'G' ? (VALUE) == CONST0_RTX (SFmode) \
826 /* `CONST_DOUBLE_OK_FOR_LETTER_P (VALUE, C)'
827 A C expression that defines the machine-dependent operand
828 constraint letters that specify particular ranges of
829 `const_double' values (`G' or `H').
831 If C is one of those letters, the expression should check that
832 VALUE, an RTX of code `const_double', is in the appropriate range
833 and return 1 if so, 0 otherwise. If C is not one of those
834 letters, the value should be 0 regardless of VALUE.
836 `const_double' is used for all floating-point constants and for
837 `DImode' fixed-point constants. A given letter can accept either
838 or both kinds of values. It can use `GET_MODE' to distinguish
839 between these kinds. */
841 #define EXTRA_CONSTRAINT(x, c) extra_constraint(x, c)
842 /* A C expression that defines the optional machine-dependent
843 constraint letters (``Q', `R', `S', `T', `U') that can'
844 be used to segregate specific types of operands, usually memory
845 references, for the target machine. Normally this macro will not
846 be defined. If it is required for a particular target machine, it
847 should return 1 if VALUE corresponds to the operand type
848 represented by the constraint letter C. If C is not defined as an
849 extra constraint, the value returned should be 0 regardless of
852 For example, on the ROMP, load instructions cannot have their
853 output in r0 if the memory reference contains a symbolic address.
854 Constraint letter `Q' is defined as representing a memory address
855 that does *not* contain a symbolic address. An alternative is
856 specified with a `Q' constraint on the input and `r' on the
857 output. The next alternative specifies `m' on the input and a
858 register class that does not include r0 on the output. */
860 /* This is an undocumented variable which describes
861 how GCC will push a data */
862 #define STACK_PUSH_CODE POST_DEC
864 #define STACK_GROWS_DOWNWARD
865 /* Define this macro if pushing a word onto the stack moves the stack
866 pointer to a smaller address.
868 When we say, "define this macro if ...," it means that the
869 compiler checks this macro only with `#ifdef' so the precise
870 definition used does not matter. */
872 #define STARTING_FRAME_OFFSET 1
873 /* Offset from the frame pointer to the first local variable slot to
876 If `FRAME_GROWS_DOWNWARD', find the next slot's offset by
877 subtracting the first slot's length from `STARTING_FRAME_OFFSET'.
878 Otherwise, it is found by adding the length of the first slot to
879 the value `STARTING_FRAME_OFFSET'. */
881 #define STACK_POINTER_OFFSET 1
882 /* Offset from the stack pointer register to the first location at
883 which outgoing arguments are placed. If not specified, the
884 default value of zero is used. This is the proper value for most
887 If `ARGS_GROW_DOWNWARD', this is the offset to the location above
888 the first location at which outgoing arguments are placed. */
890 #define FIRST_PARM_OFFSET(FUNDECL) 0
891 /* Offset from the argument pointer register to the first argument's
892 address. On some machines it may depend on the data type of the
895 If `ARGS_GROW_DOWNWARD', this is the offset to the location above
896 the first argument's address. */
898 /* `STACK_DYNAMIC_OFFSET (FUNDECL)'
899 Offset from the stack pointer register to an item dynamically
900 allocated on the stack, e.g., by `alloca'.
902 The default value for this macro is `STACK_POINTER_OFFSET' plus the
903 length of the outgoing arguments. The default is correct for most
904 machines. See `function.c' for details. */
906 #define STACK_BOUNDARY 8
907 /* Define this macro if there is a guaranteed alignment for the stack
908 pointer on this machine. The definition is a C expression for the
909 desired alignment (measured in bits). This value is used as a
910 default if PREFERRED_STACK_BOUNDARY is not defined. */
912 #define STACK_POINTER_REGNUM 32
913 /* The register number of the stack pointer register, which must also
914 be a fixed register according to `FIXED_REGISTERS'. On most
915 machines, the hardware determines which register this is. */
917 #define FRAME_POINTER_REGNUM REG_Y
918 /* The register number of the frame pointer register, which is used to
919 access automatic variables in the stack frame. On some machines,
920 the hardware determines which register this is. On other
921 machines, you can choose any register you wish for this purpose. */
923 #define ARG_POINTER_REGNUM 34
924 /* The register number of the arg pointer register, which is used to
925 access the function's argument list. On some machines, this is
926 the same as the frame pointer register. On some machines, the
927 hardware determines which register this is. On other machines,
928 you can choose any register you wish for this purpose. If this is
929 not the same register as the frame pointer register, then you must
930 mark it as a fixed register according to `FIXED_REGISTERS', or
931 arrange to be able to eliminate it (*note Elimination::.). */
933 #define STATIC_CHAIN_REGNUM 2
934 /* Register numbers used for passing a function's static chain
935 pointer. If register windows are used, the register number as
936 seen by the called function is `STATIC_CHAIN_INCOMING_REGNUM',
937 while the register number as seen by the calling function is
938 `STATIC_CHAIN_REGNUM'. If these registers are the same,
939 `STATIC_CHAIN_INCOMING_REGNUM' need not be defined.
941 The static chain register need not be a fixed register.
943 If the static chain is passed in memory, these macros should not be
944 defined; instead, the next two macros should be defined. */
946 #define FRAME_POINTER_REQUIRED frame_pointer_required_p()
947 /* A C expression which is nonzero if a function must have and use a
948 frame pointer. This expression is evaluated in the reload pass.
949 If its value is nonzero the function will have a frame pointer.
951 The expression can in principle examine the current function and
952 decide according to the facts, but on most machines the constant 0
953 or the constant 1 suffices. Use 0 when the machine allows code to
954 be generated with no frame pointer, and doing so saves some time
955 or space. Use 1 when there is no possible advantage to avoiding a
958 In certain cases, the compiler does not know how to produce valid
959 code without a frame pointer. The compiler recognizes those cases
960 and automatically gives the function a frame pointer regardless of
961 what `FRAME_POINTER_REQUIRED' says. You don't need to worry about
964 In a function that does not require a frame pointer, the frame
965 pointer register can be allocated for ordinary usage, unless you
966 mark it as a fixed register. See `FIXED_REGISTERS' for more
969 #define ELIMINABLE_REGS { \
970 {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
971 {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM} \
972 ,{FRAME_POINTER_REGNUM+1,STACK_POINTER_REGNUM+1}}
973 /* If defined, this macro specifies a table of register pairs used to
974 eliminate unneeded registers that point into the stack frame. If
975 it is not defined, the only elimination attempted by the compiler
976 is to replace references to the frame pointer with references to
979 The definition of this macro is a list of structure
980 initializations, each of which specifies an original and
981 replacement register.
983 On some machines, the position of the argument pointer is not
984 known until the compilation is completed. In such a case, a
985 separate hard register must be used for the argument pointer.
986 This register can be eliminated by replacing it with either the
987 frame pointer or the argument pointer, depending on whether or not
988 the frame pointer has been eliminated.
990 In this case, you might specify:
991 #define ELIMINABLE_REGS \
992 {{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
993 {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
994 {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
996 Note that the elimination of the argument pointer with the stack
997 pointer is specified first since that is the preferred elimination. */
999 #define CAN_ELIMINATE(FROM, TO) (((FROM) == ARG_POINTER_REGNUM \
1000 && (TO) == FRAME_POINTER_REGNUM) \
1001 || (((FROM) == FRAME_POINTER_REGNUM \
1002 || (FROM) == FRAME_POINTER_REGNUM+1) \
1003 && ! FRAME_POINTER_REQUIRED \
1005 /* A C expression that returns non-zero if the compiler is allowed to
1006 try to replace register number FROM-REG with register number
1007 TO-REG. This macro need only be defined if `ELIMINABLE_REGS' is
1008 defined, and will usually be the constant 1, since most of the
1009 cases preventing register elimination are things that the compiler
1010 already knows about. */
1012 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
1013 OFFSET = initial_elimination_offset (FROM, TO)
1014 /* This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'. It
1015 specifies the initial difference between the specified pair of
1016 registers. This macro must be defined if `ELIMINABLE_REGS' is
1019 #define RETURN_ADDR_RTX(count, x) \
1020 gen_rtx_MEM (Pmode, memory_address (Pmode, plus_constant (tem, 1)))
1022 #define PUSH_ROUNDING(NPUSHED) (NPUSHED)
1023 /* A C expression that is the number of bytes actually pushed onto the
1024 stack when an instruction attempts to push NPUSHED bytes.
1026 If the target machine does not have a push instruction, do not
1027 define this macro. That directs GNU CC to use an alternate
1028 strategy: to allocate the entire argument block and then store the
1031 On some machines, the definition
1033 #define PUSH_ROUNDING(BYTES) (BYTES)
1035 will suffice. But on other machines, instructions that appear to
1036 push one byte actually push two bytes in an attempt to maintain
1037 alignment. Then the definition should be
1039 #define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & ~1) */
1041 #define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, STACK_SIZE) 0
1042 /* A C expression that should indicate the number of bytes of its own
1043 arguments that a function pops on returning, or 0 if the function
1044 pops no arguments and the caller must therefore pop them all after
1045 the function returns.
1047 FUNDECL is a C variable whose value is a tree node that describes
1048 the function in question. Normally it is a node of type
1049 `FUNCTION_DECL' that describes the declaration of the function.
1050 From this you can obtain the DECL_ATTRIBUTES of the
1053 FUNTYPE is a C variable whose value is a tree node that describes
1054 the function in question. Normally it is a node of type
1055 `FUNCTION_TYPE' that describes the data type of the function.
1056 From this it is possible to obtain the data types of the value and
1057 arguments (if known).
1059 When a call to a library function is being considered, FUNDECL
1060 will contain an identifier node for the library function. Thus, if
1061 you need to distinguish among various library functions, you can
1062 do so by their names. Note that "library function" in this
1063 context means a function used to perform arithmetic, whose name is
1064 known specially in the compiler and was not mentioned in the C
1065 code being compiled.
1067 STACK-SIZE is the number of bytes of arguments passed on the
1068 stack. If a variable number of bytes is passed, it is zero, and
1069 argument popping will always be the responsibility of the calling
1072 On the VAX, all functions always pop their arguments, so the
1073 definition of this macro is STACK-SIZE. On the 68000, using the
1074 standard calling convention, no functions pop their arguments, so
1075 the value of the macro is always 0 in this case. But an
1076 alternative calling convention is available in which functions
1077 that take a fixed number of arguments pop them but other functions
1078 (such as `printf') pop nothing (the caller pops all). When this
1079 convention is in use, FUNTYPE is examined to determine whether a
1080 function takes a fixed number of arguments. */
1082 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) (function_arg (&(CUM), MODE, TYPE, NAMED))
1083 /* A C expression that controls whether a function argument is passed
1084 in a register, and which register.
1086 The arguments are CUM, which summarizes all the previous
1087 arguments; MODE, the machine mode of the argument; TYPE, the data
1088 type of the argument as a tree node or 0 if that is not known
1089 (which happens for C support library functions); and NAMED, which
1090 is 1 for an ordinary argument and 0 for nameless arguments that
1091 correspond to `...' in the called function's prototype.
1093 The value of the expression is usually either a `reg' RTX for the
1094 hard register in which to pass the argument, or zero to pass the
1095 argument on the stack.
1097 For machines like the VAX and 68000, where normally all arguments
1098 are pushed, zero suffices as a definition.
1100 The value of the expression can also be a `parallel' RTX. This is
1101 used when an argument is passed in multiple locations. The mode
1102 of the of the `parallel' should be the mode of the entire
1103 argument. The `parallel' holds any number of `expr_list' pairs;
1104 each one describes where part of the argument is passed. In each
1105 `expr_list', the first operand can be either a `reg' RTX for the
1106 hard register in which to pass this part of the argument, or zero
1107 to pass the argument on the stack. If this operand is a `reg',
1108 then the mode indicates how large this part of the argument is.
1109 The second operand of the `expr_list' is a `const_int' which gives
1110 the offset in bytes into the entire argument where this part
1113 The usual way to make the ANSI library `stdarg.h' work on a machine
1114 where some arguments are usually passed in registers, is to cause
1115 nameless arguments to be passed on the stack instead. This is done
1116 by making `FUNCTION_ARG' return 0 whenever NAMED is 0.
1118 You may use the macro `MUST_PASS_IN_STACK (MODE, TYPE)' in the
1119 definition of this macro to determine if this argument is of a
1120 type that must be passed in the stack. If `REG_PARM_STACK_SPACE'
1121 is not defined and `FUNCTION_ARG' returns non-zero for such an
1122 argument, the compiler will abort. If `REG_PARM_STACK_SPACE' is
1123 defined, the argument will be computed in the stack and then
1124 loaded into a register. */
1126 typedef struct avr_args {
1127 int nregs; /* # registers available for passing */
1128 int regno; /* next available register number */
1130 /* A C type for declaring a variable that is used as the first
1131 argument of `FUNCTION_ARG' and other related values. For some
1132 target machines, the type `int' suffices and can hold the number
1133 of bytes of argument so far.
1135 There is no need to record in `CUMULATIVE_ARGS' anything about the
1136 arguments that have been passed on the stack. The compiler has
1137 other variables to keep track of that. For target machines on
1138 which all arguments are passed on the stack, there is no need to
1139 store anything in `CUMULATIVE_ARGS'; however, the data structure
1140 must exist and should not be empty, so use `int'. */
1142 #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT) init_cumulative_args (&(CUM), FNTYPE, LIBNAME, INDIRECT)
1144 /* A C statement (sans semicolon) for initializing the variable CUM
1145 for the state at the beginning of the argument list. The variable
1146 has type `CUMULATIVE_ARGS'. The value of FNTYPE is the tree node
1147 for the data type of the function which will receive the args, or 0
1148 if the args are to a compiler support library function. The value
1149 of INDIRECT is nonzero when processing an indirect call, for
1150 example a call through a function pointer. The value of INDIRECT
1151 is zero for a call to an explicitly named function, a library
1152 function call, or when `INIT_CUMULATIVE_ARGS' is used to find
1153 arguments for the function being compiled.
1155 When processing a call to a compiler support library function,
1156 LIBNAME identifies which one. It is a `symbol_ref' rtx which
1157 contains the name of the function, as a string. LIBNAME is 0 when
1158 an ordinary C function call is being processed. Thus, each time
1159 this macro is called, either LIBNAME or FNTYPE is nonzero, but
1160 never both of them at once. */
1162 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
1163 (function_arg_advance (&CUM, MODE, TYPE, NAMED))
1165 /* A C statement (sans semicolon) to update the summarizer variable
1166 CUM to advance past an argument in the argument list. The values
1167 MODE, TYPE and NAMED describe that argument. Once this is done,
1168 the variable CUM is suitable for analyzing the *following*
1169 argument with `FUNCTION_ARG', etc.
1171 This macro need not do anything if the argument in question was
1172 passed on the stack. The compiler knows how to track the amount
1173 of stack space used for arguments without any special help. */
1175 #define FUNCTION_ARG_REGNO_P(r) function_arg_regno_p(r)
1176 /* A C expression that is nonzero if REGNO is the number of a hard
1177 register in which function arguments are sometimes passed. This
1178 does *not* include implicit arguments such as the static chain and
1179 the structure-value address. On many machines, no registers can be
1180 used for this purpose since all function arguments are pushed on
1183 extern int avr_reg_order[];
1185 #define RET_REGISTER avr_ret_register ()
1187 #define FUNCTION_VALUE(VALTYPE, FUNC) avr_function_value (VALTYPE, FUNC)
1188 /* A C expression to create an RTX representing the place where a
1189 function returns a value of data type VALTYPE. VALTYPE is a tree
1190 node representing a data type. Write `TYPE_MODE (VALTYPE)' to get
1191 the machine mode used to represent that type. On many machines,
1192 only the mode is relevant. (Actually, on most machines, scalar
1193 values are returned in the same place regardless of mode).
1195 The value of the expression is usually a `reg' RTX for the hard
1196 register where the return value is stored. The value can also be a
1197 `parallel' RTX, if the return value is in multiple places. See
1198 `FUNCTION_ARG' for an explanation of the `parallel' form.
1200 If `PROMOTE_FUNCTION_RETURN' is defined, you must apply the same
1201 promotion rules specified in `PROMOTE_MODE' if VALTYPE is a scalar
1204 If the precise function being called is known, FUNC is a tree node
1205 (`FUNCTION_DECL') for it; otherwise, FUNC is a null pointer. This
1206 makes it possible to use a different value-returning convention
1207 for specific functions when all their calls are known.
1209 `FUNCTION_VALUE' is not used for return vales with aggregate data
1210 types, because these are returned in another way. See
1211 `STRUCT_VALUE_REGNUM' and related macros, below. */
1213 #define LIBCALL_VALUE(MODE) avr_libcall_value (MODE)
1214 /* A C expression to create an RTX representing the place where a
1215 library function returns a value of mode MODE. If the precise
1216 function being called is known, FUNC is a tree node
1217 (`FUNCTION_DECL') for it; otherwise, FUNC is a null pointer. This
1218 makes it possible to use a different value-returning convention
1219 for specific functions when all their calls are known.
1221 Note that "library function" in this context means a compiler
1222 support routine, used to perform arithmetic, whose name is known
1223 specially by the compiler and was not mentioned in the C code being
1226 The definition of `LIBRARY_VALUE' need not be concerned aggregate
1227 data types, because none of the library functions returns such
1230 #define FUNCTION_VALUE_REGNO_P(N) ((N) == RET_REGISTER)
1231 /* A C expression that is nonzero if REGNO is the number of a hard
1232 register in which the values of called function may come back.
1234 A register whose use for returning values is limited to serving as
1235 the second of a pair (for a value of type `double', say) need not
1236 be recognized by this macro. So for most machines, this definition
1239 #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
1241 If the machine has register windows, so that the caller and the
1242 called function use different registers for the return value, this
1243 macro should recognize only the caller's register numbers. */
1245 #define RETURN_IN_MEMORY(TYPE) ((TYPE_MODE (TYPE) == BLKmode) \
1246 ? int_size_in_bytes (TYPE) > 8 \
1248 /* A C expression which can inhibit the returning of certain function
1249 values in registers, based on the type of value. A nonzero value
1250 says to return the function value in memory, just as large
1251 structures are always returned. Here TYPE will be a C expression
1252 of type `tree', representing the data type of the value.
1254 Note that values of mode `BLKmode' must be explicitly handled by
1255 this macro. Also, the option `-fpcc-struct-return' takes effect
1256 regardless of this macro. On most systems, it is possible to
1257 leave the macro undefined; this causes a default definition to be
1258 used, whose value is the constant 1 for `BLKmode' values, and 0
1261 Do not use this macro to indicate that structures and unions
1262 should always be returned in memory. You should instead use
1263 `DEFAULT_PCC_STRUCT_RETURN' to indicate this. */
1265 #define DEFAULT_PCC_STRUCT_RETURN 0
1266 /* Define this macro to be 1 if all structure and union return values
1267 must be in memory. Since this results in slower code, this should
1268 be defined only if needed for compatibility with other compilers
1269 or with an ABI. If you define this macro to be 0, then the
1270 conventions used for structure and union return values are decided
1271 by the `RETURN_IN_MEMORY' macro.
1273 If not defined, this defaults to the value 1. */
1275 #define STRUCT_VALUE 0
1276 /* If the structure value address is not passed in a register, define
1277 `STRUCT_VALUE' as an expression returning an RTX for the place
1278 where the address is passed. If it returns 0, the address is
1279 passed as an "invisible" first argument. */
1281 #define STRUCT_VALUE_INCOMING 0
1282 /* If the incoming location is not a register, then you should define
1283 `STRUCT_VALUE_INCOMING' as an expression for an RTX for where the
1284 called function should find the value. If it should find the
1285 value on the stack, define this to create a `mem' which refers to
1286 the frame pointer. A definition of 0 means that the address is
1287 passed as an "invisible" first argument. */
1289 #define EPILOGUE_USES(REGNO) 0
1290 /* Define this macro as a C expression that is nonzero for registers
1291 are used by the epilogue or the `return' pattern. The stack and
1292 frame pointer registers are already be assumed to be used as
1295 #define STRICT_ARGUMENT_NAMING 1
1296 /* Define this macro if the location where a function argument is
1297 passed depends on whether or not it is a named argument.
1299 This macro controls how the NAMED argument to `FUNCTION_ARG' is
1300 set for varargs and stdarg functions. With this macro defined,
1301 the NAMED argument is always true for named arguments, and false
1302 for unnamed arguments. If this is not defined, but
1303 `SETUP_INCOMING_VARARGS' is defined, then all arguments are
1304 treated as named. Otherwise, all named arguments except the last
1305 are treated as named. */
1308 #define HAVE_POST_INCREMENT 1
1309 /* Define this macro if the machine supports post-increment
1312 #define HAVE_PRE_DECREMENT 1
1313 /* #define HAVE_PRE_INCREMENT
1314 #define HAVE_POST_DECREMENT */
1315 /* Similar for other kinds of addressing. */
1317 #define CONSTANT_ADDRESS_P(X) CONSTANT_P (X)
1318 /* A C expression that is 1 if the RTX X is a constant which is a
1319 valid address. On most machines, this can be defined as
1320 `CONSTANT_P (X)', but a few machines are more restrictive in which
1321 constant addresses are supported.
1323 `CONSTANT_P' accepts integer-values expressions whose values are
1324 not explicitly known, such as `symbol_ref', `label_ref', and
1325 `high' expressions and `const' arithmetic expressions, in addition
1326 to `const_int' and `const_double' expressions. */
1328 #define MAX_REGS_PER_ADDRESS 1
1329 /* A number, the maximum number of registers that can appear in a
1330 valid memory address. Note that it is up to you to specify a
1331 value equal to the maximum number that `GO_IF_LEGITIMATE_ADDRESS'
1332 would ever accept. */
1334 #ifdef REG_OK_STRICT
1335 # define GO_IF_LEGITIMATE_ADDRESS(mode, operand, ADDR) \
1337 if (legitimate_address_p (mode, operand, 1)) \
1341 # define GO_IF_LEGITIMATE_ADDRESS(mode, operand, ADDR) \
1343 if (legitimate_address_p (mode, operand, 0)) \
1347 /* A C compound statement with a conditional `goto LABEL;' executed
1348 if X (an RTX) is a legitimate memory address on the target machine
1349 for a memory operand of mode MODE. */
1351 /* `REG_OK_FOR_BASE_P (X)'
1352 A C expression that is nonzero if X (assumed to be a `reg' RTX) is
1353 valid for use as a base register. For hard registers, it should
1354 always accept those which the hardware permits and reject the
1355 others. Whether the macro accepts or rejects pseudo registers
1356 must be controlled by `REG_OK_STRICT' as described above. This
1357 usually requires two variant definitions, of which `REG_OK_STRICT'
1358 controls the one actually used. */
1360 #define REG_OK_FOR_BASE_NOSTRICT_P(X) \
1361 (REGNO (X) >= FIRST_PSEUDO_REGISTER || REG_OK_FOR_BASE_STRICT_P(X))
1363 #define REG_OK_FOR_BASE_STRICT_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
1365 #ifdef REG_OK_STRICT
1366 # define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_STRICT_P (X)
1368 # define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_NOSTRICT_P (X)
1371 /* A C expression that is just like `REG_OK_FOR_BASE_P', except that
1372 that expression may examine the mode of the memory reference in
1373 MODE. You should define this macro if the mode of the memory
1374 reference affects whether a register may be used as a base
1375 register. If you define this macro, the compiler will use it
1376 instead of `REG_OK_FOR_BASE_P'. */
1377 #define REG_OK_FOR_INDEX_P(X) 0
1378 /* A C expression that is nonzero if X (assumed to be a `reg' RTX) is
1379 valid for use as an index register.
1381 The difference between an index register and a base register is
1382 that the index register may be scaled. If an address involves the
1383 sum of two registers, neither one of them scaled, then either one
1384 may be labeled the "base" and the other the "index"; but whichever
1385 labeling is used must fit the machine's constraints of which
1386 registers may serve in each capacity. The compiler will try both
1387 labelings, looking for one that is valid, and will reload one or
1388 both registers only if neither labeling works. */
1390 #define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
1392 (X) = legitimize_address (X, OLDX, MODE); \
1393 if (memory_address_p (MODE, X)) \
1396 /* A C compound statement that attempts to replace X with a valid
1397 memory address for an operand of mode MODE. WIN will be a C
1398 statement label elsewhere in the code; the macro definition may use
1400 GO_IF_LEGITIMATE_ADDRESS (MODE, X, WIN);
1402 to avoid further processing if the address has become legitimate.
1404 X will always be the result of a call to `break_out_memory_refs',
1405 and OLDX will be the operand that was given to that function to
1408 The code generated by this macro should not alter the substructure
1409 of X. If it transforms X into a more legitimate form, it should
1410 assign X (which will always be a C variable) a new value.
1412 It is not necessary for this macro to come up with a legitimate
1413 address. The compiler has standard ways of doing so in all cases.
1414 In fact, it is safe for this macro to do nothing. But often a
1415 machine-dependent strategy can generate better code. */
1417 #define XEXP_(X,Y) (X)
1418 #define LEGITIMIZE_RELOAD_ADDRESS(X, MODE, OPNUM, TYPE, IND_LEVELS, WIN) \
1420 if (1&&(GET_CODE (X) == POST_INC || GET_CODE (X) == PRE_DEC)) \
1422 push_reload (XEXP (X,0), XEXP (X,0), &XEXP (X,0), &XEXP (X,0), \
1423 POINTER_REGS, GET_MODE (X),GET_MODE (X) , 0, 0, \
1424 OPNUM, RELOAD_OTHER); \
1427 if (GET_CODE (X) == PLUS \
1428 && REG_P (XEXP (X, 0)) \
1429 && GET_CODE (XEXP (X, 1)) == CONST_INT \
1430 && INTVAL (XEXP (X, 1)) >= 1) \
1432 int fit = INTVAL (XEXP (X, 1)) <= (64 - GET_MODE_SIZE (MODE)); \
1435 if (reg_equiv_address[REGNO (XEXP (X, 0))] != 0) \
1437 int regno = REGNO (XEXP (X, 0)); \
1438 rtx mem = make_memloc (X, regno); \
1439 push_reload (XEXP (mem,0), NULL, &XEXP (mem,0), NULL, \
1440 POINTER_REGS, Pmode, VOIDmode, 0, 0, \
1441 1, ADDR_TYPE (TYPE)); \
1442 push_reload (mem, NULL_RTX, &XEXP (X, 0), NULL, \
1443 BASE_POINTER_REGS, GET_MODE (X), VOIDmode, 0, 0, \
1447 push_reload (XEXP (X, 0), NULL_RTX, &XEXP (X, 0), NULL, \
1448 BASE_POINTER_REGS, GET_MODE (X), VOIDmode, 0, 0, \
1452 else if (! (frame_pointer_needed && XEXP (X,0) == frame_pointer_rtx)) \
1454 push_reload (X, NULL_RTX, &X, NULL, \
1455 POINTER_REGS, GET_MODE (X), VOIDmode, 0, 0, \
1461 /* A C compound statement that attempts to replace X, which is an
1462 address that needs reloading, with a valid memory address for an
1463 operand of mode MODE. WIN will be a C statement label elsewhere
1464 in the code. It is not necessary to define this macro, but it
1465 might be useful for performance reasons.
1467 For example, on the i386, it is sometimes possible to use a single
1468 reload register instead of two by reloading a sum of two pseudo
1469 registers into a register. On the other hand, for number of RISC
1470 processors offsets are limited so that often an intermediate
1471 address needs to be generated in order to address a stack slot.
1472 By defining LEGITIMIZE_RELOAD_ADDRESS appropriately, the
1473 intermediate addresses generated for adjacent some stack slots can
1474 be made identical, and thus be shared.
1476 *Note*: This macro should be used with caution. It is necessary
1477 to know something of how reload works in order to effectively use
1478 this, and it is quite easy to produce macros that build in too
1479 much knowledge of reload internals.
1481 *Note*: This macro must be able to reload an address created by a
1482 previous invocation of this macro. If it fails to handle such
1483 addresses then the compiler may generate incorrect code or abort.
1485 The macro definition should use `push_reload' to indicate parts
1486 that need reloading; OPNUM, TYPE and IND_LEVELS are usually
1487 suitable to be passed unaltered to `push_reload'.
1489 The code generated by this macro must not alter the substructure of
1490 X. If it transforms X into a more legitimate form, it should
1491 assign X (which will always be a C variable) a new value. This
1492 also applies to parts that you change indirectly by calling
1495 The macro definition may use `strict_memory_address_p' to test if
1496 the address has become legitimate.
1498 If you want to change only a part of X, one standard way of doing
1499 this is to use `copy_rtx'. Note, however, that is unshares only a
1500 single level of rtl. Thus, if the part to be changed is not at the
1501 top level, you'll need to replace first the top leve It is not
1502 necessary for this macro to come up with a legitimate address;
1503 but often a machine-dependent strategy can generate better code. */
1505 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
1506 if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == PRE_DEC) \
1508 /* A C statement or compound statement with a conditional `goto
1509 LABEL;' executed if memory address X (an RTX) can have different
1510 meanings depending on the machine mode of the memory reference it
1511 is used for or if the address is valid for some modes but not
1514 Autoincrement and autodecrement addresses typically have
1515 mode-dependent effects because the amount of the increment or
1516 decrement is the size of the operand being addressed. Some
1517 machines have other mode-dependent addresses. Many RISC machines
1518 have no mode-dependent addresses.
1520 You may assume that ADDR is a valid address for the machine. */
1522 #define LEGITIMATE_CONSTANT_P(X) 1
1523 /* A C expression that is nonzero if X is a legitimate constant for
1524 an immediate operand on the target machine. You can assume that X
1525 satisfies `CONSTANT_P', so you need not check this. In fact, `1'
1526 is a suitable definition for this macro on machines where anything
1527 `CONSTANT_P' is valid. */
1529 #define CONST_COSTS(x,CODE,OUTER_CODE) \
1531 if (OUTER_CODE == PLUS \
1532 || OUTER_CODE == IOR \
1533 || OUTER_CODE == AND \
1534 || OUTER_CODE == MINUS \
1535 || OUTER_CODE == SET \
1536 || INTVAL (x) == 0) \
1538 if (OUTER_CODE == COMPARE \
1539 && INTVAL (x) >= 0 \
1540 && INTVAL (x) <= 255) \
1546 case CONST_DOUBLE: \
1549 /* A part of a C `switch' statement that describes the relative costs
1550 of constant RTL expressions. It must contain `case' labels for
1551 expression codes `const_int', `const', `symbol_ref', `label_ref'
1552 and `const_double'. Each case must ultimately reach a `return'
1553 statement to return the relative cost of the use of that kind of
1554 constant value in an expression. The cost may depend on the
1555 precise value of the constant, which is available for examination
1556 in X, and the rtx code of the expression in which it is contained,
1557 found in OUTER_CODE.
1559 CODE is the expression code--redundant, since it can be obtained
1560 with `GET_CODE (X)'. */
1562 #define DEFAULT_RTX_COSTS(x, code, outer_code) \
1564 int cst = default_rtx_costs (x, code, outer_code); \
1572 /* Like `CONST_COSTS' but applies to nonconstant RTL expressions.
1573 This can be used, for example, to indicate how costly a multiply
1574 instruction is. In writing this macro, you can use the construct
1575 `COSTS_N_INSNS (N)' to specify a cost equal to N fast
1576 instructions. OUTER_CODE is the code of the expression in which X
1579 This macro is optional; do not define it if the default cost
1580 assumptions are adequate for the target machine. */
1582 #define ADDRESS_COST(ADDRESS) avr_address_cost (ADDRESS)
1584 /* An expression giving the cost of an addressing mode that contains
1585 ADDRESS. If not defined, the cost is computed from the ADDRESS
1586 expression and the `CONST_COSTS' values.
1588 For most CISC machines, the default cost is a good approximation
1589 of the true cost of the addressing mode. However, on RISC
1590 machines, all instructions normally have the same length and
1591 execution time. Hence all addresses will have equal costs.
1593 In cases where more than one form of an address is known, the form
1594 with the lowest cost will be used. If multiple forms have the
1595 same, lowest, cost, the one that is the most complex will be used.
1597 For example, suppose an address that is equal to the sum of a
1598 register and a constant is used twice in the same basic block.
1599 When this macro is not defined, the address will be computed in a
1600 register and memory references will be indirect through that
1601 register. On machines where the cost of the addressing mode
1602 containing the sum is no higher than that of a simple indirect
1603 reference, this will produce an additional instruction and
1604 possibly require an additional register. Proper specification of
1605 this macro eliminates this overhead for such machines.
1607 Similar use of this macro is made in strength reduction of loops.
1609 ADDRESS need not be valid as an address. In such a case, the cost
1610 is not relevant and can be any value; invalid addresses need not be
1611 assigned a different cost.
1613 On machines where an address involving more than one register is as
1614 cheap as an address computation involving only one register,
1615 defining `ADDRESS_COST' to reflect this can cause two registers to
1616 be live over a region of code where only one would have been if
1617 `ADDRESS_COST' were not defined in that manner. This effect should
1618 be considered in the definition of this macro. Equivalent costs
1619 should probably only be given to addresses with different numbers
1620 of registers on machines with lots of registers.
1622 This macro will normally either not be defined or be defined as a
1625 #define REGISTER_MOVE_COST(MODE, FROM, TO) ((FROM) == STACK_REG ? 6 \
1626 : (TO) == STACK_REG ? 12 \
1628 /* A C expression for the cost of moving data from a register in class
1629 FROM to one in class TO. The classes are expressed using the
1630 enumeration values such as `GENERAL_REGS'. A value of 2 is the
1631 default; other values are interpreted relative to that.
1633 It is not required that the cost always equal 2 when FROM is the
1634 same as TO; on some machines it is expensive to move between
1635 registers if they are not general registers.
1637 If reload sees an insn consisting of a single `set' between two
1638 hard registers, and if `REGISTER_MOVE_COST' applied to their
1639 classes returns a value of 2, reload does not check to ensure that
1640 the constraints of the insn are met. Setting a cost of other than
1641 2 will allow reload to verify that the constraints are met. You
1642 should do this if the `movM' pattern's constraints do not allow
1645 #define MEMORY_MOVE_COST(MODE,CLASS,IN) ((MODE)==QImode ? 2 : \
1646 (MODE)==HImode ? 4 : \
1647 (MODE)==SImode ? 8 : \
1648 (MODE)==SFmode ? 8 : 16)
1649 /* A C expression for the cost of moving data of mode M between a
1650 register and memory. A value of 4 is the default; this cost is
1651 relative to those in `REGISTER_MOVE_COST'.
1653 If moving between registers and memory is more expensive than
1654 between two registers, you should define this macro to express the
1657 #define BRANCH_COST 0
1658 /* A C expression for the cost of a branch instruction. A value of 1
1659 is the default; other values are interpreted relative to that.
1661 Here are additional macros which do not specify precise relative
1662 costs, but only that certain actions are more expensive than GCC would
1663 ordinarily expect. */
1665 #define SLOW_BYTE_ACCESS 0
1666 /* Define this macro as a C expression which is nonzero if accessing
1667 less than a word of memory (i.e. a `char' or a `short') is no
1668 faster than accessing a word of memory, i.e., if such access
1669 require more than one instruction or if there is no difference in
1670 cost between byte and (aligned) word loads.
1672 When this macro is not defined, the compiler will access a field by
1673 finding the smallest containing object; when it is defined, a
1674 fullword load will be used if alignment permits. Unless bytes
1675 accesses are faster than word accesses, using word accesses is
1676 preferable since it may eliminate subsequent memory access if
1677 subsequent accesses occur to other fields in the same word of the
1678 structure, but to different bytes.
1680 `SLOW_UNALIGNED_ACCESS'
1681 Define this macro to be the value 1 if unaligned accesses have a
1682 cost many times greater than aligned accesses, for example if they
1683 are emulated in a trap handler.
1685 When this macro is non-zero, the compiler will act as if
1686 `STRICT_ALIGNMENT' were non-zero when generating code for block
1687 moves. This can cause significantly more instructions to be
1688 produced. Therefore, do not set this macro non-zero if unaligned
1689 accesses only add a cycle or two to the time for a memory access.
1691 If the value of this macro is always zero, it need not be defined.
1694 Define this macro to inhibit strength reduction of memory
1695 addresses. (On some machines, such strength reduction seems to do
1696 harm rather than good.)
1699 The number of scalar move insns which should be generated instead
1700 of a string move insn or a library call. Increasing the value
1701 will always make code faster, but eventually incurs high cost in
1702 increased code size.
1704 If you don't define this, a reasonable default is used. */
1706 #define NO_FUNCTION_CSE
1707 /* Define this macro if it is as good or better to call a constant
1708 function address than to call an address kept in a register. */
1710 #define NO_RECURSIVE_FUNCTION_CSE
1711 /* Define this macro if it is as good or better for a function to call
1712 itself with an explicit address than to call an address kept in a
1715 #define TEXT_SECTION_ASM_OP "\t.text"
1716 /* A C expression whose value is a string containing the assembler
1717 operation that should precede instructions and read-only data.
1718 Normally `"\t.text"' is right. */
1720 #define DATA_SECTION_ASM_OP "\t.data"
1721 /* A C expression whose value is a string containing the assembler
1722 operation to identify the following data as writable initialized
1723 data. Normally `"\t.data"' is right. */
1725 #define BSS_SECTION_ASM_OP "\t.section .bss"
1726 /* If defined, a C expression whose value is a string, including
1727 spacing, containing the assembler operation to identify the
1728 following data as uninitialized global data. If not defined, and
1729 neither `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined,
1730 uninitialized global data will be output in the data section if
1731 `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be
1734 /* Define the pseudo-ops used to switch to the .ctors and .dtors sections.
1735 There are no shared libraries on this target, and these sections are
1736 placed in the read-only program memory, so they are not writable. */
1738 #undef CTORS_SECTION_ASM_OP
1739 #define CTORS_SECTION_ASM_OP "\t.section .ctors,\"a\",@progbits"
1741 #undef DTORS_SECTION_ASM_OP
1742 #define DTORS_SECTION_ASM_OP "\t.section .dtors,\"a\",@progbits"
1744 #define TARGET_ASM_CONSTRUCTOR avr_asm_out_ctor
1745 /* If defined, a function that outputs assembler code to arrange to
1746 call the function referenced by SYMBOL at initialization time. */
1748 #define TARGET_ASM_DESTRUCTOR avr_asm_out_dtor
1749 /* This is like `TARGET_ASM_CONSTRUCTOR' but used for termination
1750 functions rather than initialization functions. */
1752 #define EXTRA_SECTIONS in_progmem
1753 /* A list of names for sections other than the standard two, which are
1754 `in_text' and `in_data'. You need not define this macro on a
1755 system with no other sections (that GCC needs to use). */
1757 #define EXTRA_SECTION_FUNCTIONS \
1760 progmem_section (void) \
1762 if (in_section != in_progmem) \
1764 fprintf (asm_out_file, \
1765 "\t.section .progmem.gcc_sw_table, \"%s\", @progbits\n", \
1766 AVR_MEGA ? "a" : "ax"); \
1767 /* Should already be aligned, this is just to be safe if it isn't. */ \
1768 fprintf (asm_out_file, "\t.p2align 1\n"); \
1769 in_section = in_progmem; \
1772 /* `EXTRA_SECTION_FUNCTIONS'
1773 One or more functions to be defined in `varasm.c'. These
1774 functions should do jobs analogous to those of `text_section' and
1775 `data_section', for your additional sections. Do not define this
1776 macro if you do not define `EXTRA_SECTIONS'. */
1778 #define READONLY_DATA_SECTION data_section
1779 /* On most machines, read-only variables, constants, and jump tables
1780 are placed in the text section. If this is not the case on your
1781 machine, this macro should be defined to be the name of a function
1782 (either `data_section' or a function defined in `EXTRA_SECTIONS')
1783 that switches to the section to be used for read-only items.
1785 If these items should be placed in the text section, this macro
1786 should not be defined. */
1788 #define JUMP_TABLES_IN_TEXT_SECTION 0
1789 /* Define this macro if jump tables (for `tablejump' insns) should be
1790 output in the text section, along with the assembler instructions.
1791 Otherwise, the readonly data section is used.
1793 This macro is irrelevant if there is no separate readonly data
1796 #define ASM_FILE_START(STREAM) asm_file_start (STREAM)
1797 /* A C expression which outputs to the stdio stream STREAM some
1798 appropriate text to go at the start of an assembler file.
1800 Normally this macro is defined to output a line containing
1801 `#NO_APP', which is a comment that has no effect on most
1802 assemblers but tells the GNU assembler that it can save time by not
1803 checking for certain assembler constructs.
1805 On systems that use SDB, it is necessary to output certain
1806 commands; see `attasm.h'. */
1808 #define ASM_FILE_END(STREAM) asm_file_end (STREAM)
1809 /* A C expression which outputs to the stdio stream STREAM some
1810 appropriate text to go at the end of an assembler file.
1812 If this macro is not defined, the default is to output nothing
1813 special at the end of the file. Most systems don't require any
1816 On systems that use SDB, it is necessary to output certain
1817 commands; see `attasm.h'. */
1819 #define ASM_COMMENT_START " ; "
1820 /* A C string constant describing how to begin a comment in the target
1821 assembler language. The compiler assumes that the comment will
1822 end at the end of the line. */
1824 #define ASM_APP_ON "/* #APP */\n"
1825 /* A C string constant for text to be output before each `asm'
1826 statement or group of consecutive ones. Normally this is
1827 `"#APP"', which is a comment that has no effect on most assemblers
1828 but tells the GNU assembler that it must check the lines that
1829 follow for all valid assembler constructs. */
1831 #define ASM_APP_OFF "/* #NOAPP */\n"
1832 /* A C string constant for text to be output after each `asm'
1833 statement or group of consecutive ones. Normally this is
1834 `"#NO_APP"', which tells the GNU assembler to resume making the
1835 time-saving assumptions that are valid for ordinary compiler
1838 #define ASM_OUTPUT_SOURCE_LINE(STREAM, LINE) fprintf (STREAM,"/* line: %d */\n",LINE)
1839 /* A C statement to output DBX or SDB debugging information before
1840 code for line number LINE of the current source file to the stdio
1843 This macro need not be defined if the standard form of debugging
1844 information for the debugger in use is appropriate. */
1846 /* Switch into a generic section. */
1847 #define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
1849 #define OBJC_PROLOGUE {}
1850 /* A C statement to output any assembler statements which are
1851 required to precede any Objective C object definitions or message
1852 sending. The statement is executed only when compiling an
1853 Objective C program. */
1856 #define ASM_OUTPUT_ASCII(FILE, P, SIZE) gas_output_ascii (FILE,P,SIZE)
1857 /* `ASM_OUTPUT_ASCII (STREAM, PTR, LEN)'
1858 output_ascii (FILE, P, SIZE)
1859 A C statement to output to the stdio stream STREAM an assembler
1860 instruction to assemble a string constant containing the LEN bytes
1861 at PTR. PTR will be a C expression of type `char *' and LEN a C
1862 expression of type `int'.
1864 If the assembler has a `.ascii' pseudo-op as found in the Berkeley
1865 Unix assembler, do not define the macro `ASM_OUTPUT_ASCII'. */
1867 #define IS_ASM_LOGICAL_LINE_SEPARATOR(C) ((C) == '\n' \
1869 /* Define this macro as a C expression which is nonzero if C is used
1870 as a logical line separator by the assembler.
1872 If you do not define this macro, the default is that only the
1873 character `;' is treated as a logical line separator. */
1875 /* These macros are provided by `real.h' for writing the definitions of
1876 `ASM_OUTPUT_DOUBLE' and the like: */
1878 #define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED) \
1880 fputs ("\t.comm ", (STREAM)); \
1881 assemble_name ((STREAM), (NAME)); \
1882 fprintf ((STREAM), ",%d,1\n", (SIZE)); \
1884 /* A C statement (sans semicolon) to output to the stdio stream
1885 STREAM the assembler definition of a common-label named NAME whose
1886 size is SIZE bytes. The variable ROUNDED is the size rounded up
1887 to whatever alignment the caller wants.
1889 Use the expression `assemble_name (STREAM, NAME)' to output the
1890 name itself; before and after that, output the additional
1891 assembler syntax for defining the name, and a newline.
1893 This macro controls how the assembler definitions of uninitialized
1894 common global variables are output. */
1896 #define ASM_OUTPUT_BSS(FILE, DECL, NAME, SIZE, ROUNDED) \
1897 asm_output_bss ((FILE), (DECL), (NAME), (SIZE), (ROUNDED))
1898 /* A C statement (sans semicolon) to output to the stdio stream
1899 STREAM the assembler definition of uninitialized global DECL named
1900 NAME whose size is SIZE bytes. The variable ROUNDED is the size
1901 rounded up to whatever alignment the caller wants. */
1903 #define ASM_OUTPUT_LOCAL(STREAM, NAME, SIZE, ROUNDED) \
1905 fputs ("\t.lcomm ", (STREAM)); \
1906 assemble_name ((STREAM), (NAME)); \
1907 fprintf ((STREAM), ",%d\n", (SIZE)); \
1909 /* A C statement (sans semicolon) to output to the stdio stream
1910 STREAM the assembler definition of a local-common-label named NAME
1911 whose size is SIZE bytes. The variable ROUNDED is the size
1912 rounded up to whatever alignment the caller wants.
1914 Use the expression `assemble_name (STREAM, NAME)' to output the
1915 name itself; before and after that, output the additional
1916 assembler syntax for defining the name, and a newline.
1918 This macro controls how the assembler definitions of uninitialized
1919 static variables are output. */
1921 #define ASM_OUTPUT_LABEL(STREAM, NAME) \
1923 assemble_name (STREAM, NAME); \
1924 fprintf (STREAM, ":\n"); \
1926 /* A C statement (sans semicolon) to output to the stdio stream
1927 STREAM the assembler definition of a label named NAME. Use the
1928 expression `assemble_name (STREAM, NAME)' to output the name
1929 itself; before and after that, output the additional assembler
1930 syntax for defining the name, and a newline. */
1935 #define TYPE_ASM_OP "\t.type\t"
1936 #define SIZE_ASM_OP "\t.size\t"
1937 #define WEAK_ASM_OP "\t.weak\t"
1938 /* Define the strings used for the special svr4 .type and .size directives.
1939 These strings generally do not vary from one system running svr4 to
1940 another, but if a given system (e.g. m88k running svr) needs to use
1941 different pseudo-op names for these, they may be overridden in the
1942 file which includes this one. */
1945 #undef TYPE_OPERAND_FMT
1946 #define TYPE_OPERAND_FMT "@%s"
1947 /* The following macro defines the format used to output the second
1948 operand of the .type assembler directive. Different svr4 assemblers
1949 expect various different forms for this operand. The one given here
1950 is just a default. You may need to override it in your machine-
1951 specific tm.h file (depending upon the particulars of your assembler). */
1953 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
1955 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \
1956 ASM_OUTPUT_LABEL (FILE, NAME); \
1959 /* A C statement (sans semicolon) to output to the stdio stream
1960 STREAM any text necessary for declaring the name NAME of a
1961 function which is being defined. This macro is responsible for
1962 outputting the label definition (perhaps using
1963 `ASM_OUTPUT_LABEL'). The argument DECL is the `FUNCTION_DECL'
1964 tree node representing the function.
1966 If this macro is not defined, then the function name is defined in
1967 the usual manner as a label (by means of `ASM_OUTPUT_LABEL'). */
1969 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
1971 if (!flag_inhibit_size_directive) \
1972 ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME); \
1974 /* A C statement (sans semicolon) to output to the stdio stream
1975 STREAM any text necessary for declaring the size of a function
1976 which is being defined. The argument NAME is the name of the
1977 function. The argument DECL is the `FUNCTION_DECL' tree node
1978 representing the function.
1980 If this macro is not defined, then the function size is not
1983 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
1985 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
1986 size_directive_output = 0; \
1987 if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
1989 size_directive_output = 1; \
1990 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, \
1991 int_size_in_bytes (TREE_TYPE (DECL))); \
1993 ASM_OUTPUT_LABEL(FILE, NAME); \
1995 /* A C statement (sans semicolon) to output to the stdio stream
1996 STREAM any text necessary for declaring the name NAME of an
1997 initialized variable which is being defined. This macro must
1998 output the label definition (perhaps using `ASM_OUTPUT_LABEL').
1999 The argument DECL is the `VAR_DECL' tree node representing the
2002 If this macro is not defined, then the variable name is defined in
2003 the usual manner as a label (by means of `ASM_OUTPUT_LABEL'). */
2005 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
2007 const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
2008 HOST_WIDE_INT size; \
2009 if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
2010 && ! AT_END && TOP_LEVEL \
2011 && DECL_INITIAL (DECL) == error_mark_node \
2012 && !size_directive_output) \
2014 size_directive_output = 1; \
2015 size = int_size_in_bytes (TREE_TYPE (DECL)); \
2016 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size); \
2020 /* A C statement (sans semicolon) to finish up declaring a variable
2021 name once the compiler has processed its initializer fully and
2022 thus has had a chance to determine the size of an array when
2023 controlled by an initializer. This is used on systems where it's
2024 necessary to declare something about the size of the object.
2026 If you don't define this macro, that is equivalent to defining it
2031 "\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\
2032 \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\
2033 \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\
2034 \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\
2035 \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\
2036 \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\
2037 \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\
2038 \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"
2039 /* A table of bytes codes used by the ASM_OUTPUT_ASCII and
2040 ASM_OUTPUT_LIMITED_STRING macros. Each byte in the table
2041 corresponds to a particular byte value [0..255]. For any
2042 given byte value, if the value in the corresponding table
2043 position is zero, the given character can be output directly.
2044 If the table value is 1, the byte must be output as a \ooo
2045 octal escape. If the tables value is anything else, then the
2046 byte value should be output as a \ followed by the value
2047 in the table. Note that we can use standard UN*X escape
2048 sequences for many control characters, but we don't use
2049 \a to represent BEL because some svr4 assemblers (e.g. on
2050 the i386) don't know about that. Also, we don't use \v
2051 since some versions of gas, such as 2.2 did not accept it. */
2053 #define STRING_LIMIT ((unsigned) 64)
2054 #define STRING_ASM_OP "\t.string\t"
2055 /* Some svr4 assemblers have a limit on the number of characters which
2056 can appear in the operand of a .string directive. If your assembler
2057 has such a limitation, you should define STRING_LIMIT to reflect that
2058 limit. Note that at least some svr4 assemblers have a limit on the
2059 actual number of bytes in the double-quoted string, and that they
2060 count each character in an escape sequence as one byte. Thus, an
2061 escape sequence like \377 would count as four bytes.
2063 If your target assembler doesn't support the .string directive, you
2064 should define this to zero. */
2066 #define ASM_GLOBALIZE_LABEL(STREAM, NAME) \
2068 fprintf (STREAM, ".global\t"); \
2069 assemble_name (STREAM, NAME); \
2070 fprintf (STREAM, "\n"); \
2074 /* A C statement (sans semicolon) to output to the stdio stream
2075 STREAM some commands that will make the label NAME global; that
2076 is, available for reference from other files. Use the expression
2077 `assemble_name (STREAM, NAME)' to output the name itself; before
2078 and after that, output the additional assembler syntax for making
2079 that name global, and a newline. */
2081 #define ASM_WEAKEN_LABEL(FILE, NAME) \
2084 fputs ("\t.weak\t", (FILE)); \
2085 assemble_name ((FILE), (NAME)); \
2086 fputc ('\n', (FILE)); \
2090 /* A C statement (sans semicolon) to output to the stdio stream
2091 STREAM some commands that will make the label NAME weak; that is,
2092 available for reference from other files but only used if no other
2093 definition is available. Use the expression `assemble_name
2094 (STREAM, NAME)' to output the name itself; before and after that,
2095 output the additional assembler syntax for making that name weak,
2098 If you don't define this macro, GNU CC will not support weak
2099 symbols and you should not define the `SUPPORTS_WEAK' macro.
2102 #define SUPPORTS_WEAK 1
2103 /* A C expression which evaluates to true if the target supports weak
2106 If you don't define this macro, `defaults.h' provides a default
2107 definition. If `ASM_WEAKEN_LABEL' is defined, the default
2108 definition is `1'; otherwise, it is `0'. Define this macro if you
2109 want to control weak symbol support with a compiler flag such as
2112 `MAKE_DECL_ONE_ONLY'
2113 A C statement (sans semicolon) to mark DECL to be emitted as a
2114 public symbol such that extra copies in multiple translation units
2115 will be discarded by the linker. Define this macro if your object
2116 file format provides support for this concept, such as the `COMDAT'
2117 section flags in the Microsoft Windows PE/COFF format, and this
2118 support requires changes to DECL, such as putting it in a separate
2122 A C expression which evaluates to true if the target supports
2125 If you don't define this macro, `varasm.c' provides a default
2126 definition. If `MAKE_DECL_ONE_ONLY' is defined, the default
2127 definition is `1'; otherwise, it is `0'. Define this macro if you
2128 want to control weak symbol support with a compiler flag, or if
2129 setting the `DECL_ONE_ONLY' flag is enough to mark a declaration to
2130 be emitted as one-only. */
2132 #define ASM_OUTPUT_INTERNAL_LABEL(STREAM, PREFIX, NUM) \
2133 fprintf(STREAM, ".%s%d:\n", PREFIX, NUM)
2134 /* A C statement to output to the stdio stream STREAM a label whose
2135 name is made from the string PREFIX and the number NUM.
2137 It is absolutely essential that these labels be distinct from the
2138 labels used for user-level functions and variables. Otherwise,
2139 certain programs will have name conflicts with internal labels.
2141 It is desirable to exclude internal labels from the symbol table
2142 of the object file. Most assemblers have a naming convention for
2143 labels that should be excluded; on many systems, the letter `L' at
2144 the beginning of a label has this effect. You should find out what
2145 convention your system uses, and follow it.
2147 The usual definition of this macro is as follows:
2149 fprintf (STREAM, "L%s%d:\n", PREFIX, NUM) */
2151 #define ASM_GENERATE_INTERNAL_LABEL(STRING, PREFIX, NUM) \
2152 sprintf (STRING, "*.%s%d", PREFIX, NUM)
2153 /* A C statement to store into the string STRING a label whose name
2154 is made from the string PREFIX and the number NUM.
2156 This string, when output subsequently by `assemble_name', should
2157 produce the output that `ASM_OUTPUT_INTERNAL_LABEL' would produce
2158 with the same PREFIX and NUM.
2160 If the string begins with `*', then `assemble_name' will output
2161 the rest of the string unchanged. It is often convenient for
2162 `ASM_GENERATE_INTERNAL_LABEL' to use `*' in this way. If the
2163 string doesn't start with `*', then `ASM_OUTPUT_LABELREF' gets to
2164 output the string, and may change it. (Of course,
2165 `ASM_OUTPUT_LABELREF' is also part of your machine description, so
2166 you should know what it does on your machine.) */
2168 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
2169 ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
2170 sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
2172 /* A C expression to assign to OUTVAR (which is a variable of type
2173 `char *') a newly allocated string made from the string NAME and
2174 the number NUMBER, with some suitable punctuation added. Use
2175 `alloca' to get space for the string.
2177 The string will be used as an argument to `ASM_OUTPUT_LABELREF' to
2178 produce an assembler label for an internal static variable whose
2179 name is NAME. Therefore, the string must be such as to result in
2180 valid assembler code. The argument NUMBER is different each time
2181 this macro is executed; it prevents conflicts between
2182 similarly-named internal static variables in different scopes.
2184 Ideally this string should not be a valid C identifier, to prevent
2185 any conflict with the user's own symbols. Most assemblers allow
2186 periods or percent signs in assembler symbols; putting at least
2187 one of these between the name and the number will suffice. */
2189 /* `ASM_OUTPUT_WEAK_ALIAS (STREAM, NAME, VALUE)'
2190 A C statement to output to the stdio stream STREAM assembler code
2191 which defines (equates) the weak symbol NAME to have the value
2194 Define this macro if the target only supports weak aliases; define
2195 ASM_OUTPUT_DEF instead if possible. */
2197 #define HAS_INIT_SECTION 1
2198 /* If defined, `main' will not call `__main' as described above.
2199 This macro should be defined for systems that control the contents
2200 of the init section on a symbol-by-symbol basis, such as OSF/1,
2201 and should not be defined explicitly for systems that support
2202 `INIT_SECTION_ASM_OP'. */
2204 #define REGISTER_NAMES { \
2205 "r0","r1","r2","r3","r4","r5","r6","r7", \
2206 "r8","r9","r10","r11","r12","r13","r14","r15", \
2207 "r16","r17","r18","r19","r20","r21","r22","r23", \
2208 "r24","r25","r26","r27","r28","r29","r30","r31", \
2209 "__SPL__","__SPH__","argL","argH"}
2210 /* A C initializer containing the assembler's names for the machine
2211 registers, each one as a C string constant. This is what
2212 translates register numbers in the compiler into assembler
2215 #define FINAL_PRESCAN_INSN(insn, operand, nop) final_prescan_insn (insn, operand,nop)
2216 /* If defined, a C statement to be executed just prior to the output
2217 of assembler code for INSN, to modify the extracted operands so
2218 they will be output differently.
2220 Here the argument OPVEC is the vector containing the operands
2221 extracted from INSN, and NOPERANDS is the number of elements of
2222 the vector which contain meaningful data for this insn. The
2223 contents of this vector are what will be used to convert the insn
2224 template into assembler code, so you can change the assembler
2225 output by changing the contents of the vector.
2227 This macro is useful when various assembler syntaxes share a single
2228 file of instruction patterns; by defining this macro differently,
2229 you can cause a large class of instructions to be output
2230 differently (such as with rearranged operands). Naturally,
2231 variations in assembler syntax affecting individual insn patterns
2232 ought to be handled by writing conditional output routines in
2235 If this macro is not defined, it is equivalent to a null statement. */
2237 #define PRINT_OPERAND(STREAM, X, CODE) print_operand (STREAM, X, CODE)
2238 /* A C compound statement to output to stdio stream STREAM the
2239 assembler syntax for an instruction operand X. X is an RTL
2242 CODE is a value that can be used to specify one of several ways of
2243 printing the operand. It is used when identical operands must be
2244 printed differently depending on the context. CODE comes from the
2245 `%' specification that was used to request printing of the
2246 operand. If the specification was just `%DIGIT' then CODE is 0;
2247 if the specification was `%LTR DIGIT' then CODE is the ASCII code
2250 If X is a register, this macro should print the register's name.
2251 The names can be found in an array `reg_names' whose type is `char
2252 *[]'. `reg_names' is initialized from `REGISTER_NAMES'.
2254 When the machine description has a specification `%PUNCT' (a `%'
2255 followed by a punctuation character), this macro is called with a
2256 null pointer for X and the punctuation character for CODE. */
2258 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) ((CODE) == '~')
2259 /* A C expression which evaluates to true if CODE is a valid
2260 punctuation character for use in the `PRINT_OPERAND' macro. If
2261 `PRINT_OPERAND_PUNCT_VALID_P' is not defined, it means that no
2262 punctuation characters (except for the standard one, `%') are used
2265 #define PRINT_OPERAND_ADDRESS(STREAM, X) print_operand_address(STREAM, X)
2266 /* A C compound statement to output to stdio stream STREAM the
2267 assembler syntax for an instruction operand that is a memory
2268 reference whose address is X. X is an RTL expression. */
2270 #define USER_LABEL_PREFIX ""
2271 /* `LOCAL_LABEL_PREFIX'
2274 If defined, C string expressions to be used for the `%R', `%L',
2275 `%U', and `%I' options of `asm_fprintf' (see `final.c'). These
2276 are useful when a single `md' file must support multiple assembler
2277 formats. In that case, the various `tm.h' files can define these
2278 macros differently. */
2280 #define ASSEMBLER_DIALECT AVR_ENHANCED
2281 /* If your target supports multiple dialects of assembler language
2282 (such as different opcodes), define this macro as a C expression
2283 that gives the numeric index of the assembler language dialect to
2284 use, with zero as the first variant.
2286 If this macro is defined, you may use constructs of the form
2287 `{option0|option1|option2...}' in the output templates of patterns
2288 (*note Output Template::.) or in the first argument of
2289 `asm_fprintf'. This construct outputs `option0', `option1' or
2290 `option2', etc., if the value of `ASSEMBLER_DIALECT' is zero, one
2291 or two, etc. Any special characters within these strings retain
2292 their usual meaning.
2294 If you do not define this macro, the characters `{', `|' and `}'
2295 do not have any special meaning when used in templates or operands
2298 Define the macros `REGISTER_PREFIX', `LOCAL_LABEL_PREFIX',
2299 `USER_LABEL_PREFIX' and `IMMEDIATE_PREFIX' if you can express the
2300 variations in assembler language syntax with that mechanism.
2301 Define `ASSEMBLER_DIALECT' and use the `{option0|option1}' syntax
2302 if the syntax variant are larger and involve such things as
2303 different opcodes or operand order. */
2305 #define ASM_OUTPUT_REG_PUSH(STREAM, REGNO) \
2309 fprintf (STREAM, "\tpush\tr%d", REGNO); \
2311 /* A C expression to output to STREAM some assembler code which will
2312 push hard register number REGNO onto the stack. The code need not
2313 be optimal, since this macro is used only when profiling. */
2315 #define ASM_OUTPUT_REG_POP(STREAM, REGNO) \
2319 fprintf (STREAM, "\tpop\tr%d", REGNO); \
2321 /* A C expression to output to STREAM some assembler code which will
2322 pop hard register number REGNO off of the stack. The code need
2323 not be optimal, since this macro is used only when profiling. */
2325 #define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \
2326 avr_output_addr_vec_elt(STREAM, VALUE)
2327 /* This macro should be provided on machines where the addresses in a
2328 dispatch table are absolute.
2330 The definition should be a C statement to output to the stdio
2331 stream STREAM an assembler pseudo-instruction to generate a
2332 reference to a label. VALUE is the number of an internal label
2333 whose definition is output using `ASM_OUTPUT_INTERNAL_LABEL'. For
2336 fprintf (STREAM, "\t.word L%d\n", VALUE) */
2338 #define ASM_OUTPUT_CASE_LABEL(STREAM, PREFIX, NUM, TABLE) \
2339 progmem_section (), ASM_OUTPUT_INTERNAL_LABEL (STREAM, PREFIX, NUM)
2341 /* `ASM_OUTPUT_CASE_LABEL (STREAM, PREFIX, NUM, TABLE)'
2342 Define this if the label before a jump-table needs to be output
2343 specially. The first three arguments are the same as for
2344 `ASM_OUTPUT_INTERNAL_LABEL'; the fourth argument is the jump-table
2345 which follows (a `jump_insn' containing an `addr_vec' or
2348 This feature is used on system V to output a `swbeg' statement for
2351 If this macro is not defined, these labels are output with
2352 `ASM_OUTPUT_INTERNAL_LABEL'. */
2354 /* `ASM_OUTPUT_CASE_END (STREAM, NUM, TABLE)'
2355 Define this if something special must be output at the end of a
2356 jump-table. The definition should be a C statement to be executed
2357 after the assembler code for the table is written. It should write
2358 the appropriate code to stdio stream STREAM. The argument TABLE
2359 is the jump-table insn, and NUM is the label-number of the
2362 If this macro is not defined, nothing special is output at the end
2363 of the jump-table. */
2365 #define ASM_OUTPUT_SKIP(STREAM, N) \
2366 fprintf (STREAM, "\t.skip %d,0\n", N)
2367 /* A C statement to output to the stdio stream STREAM an assembler
2368 instruction to advance the location counter by NBYTES bytes.
2369 Those bytes should be zero when loaded. NBYTES will be a C
2370 expression of type `int'. */
2372 #define ASM_OUTPUT_ALIGN(STREAM, POWER)
2373 /* A C statement to output to the stdio stream STREAM an assembler
2374 command to advance the location counter to a multiple of 2 to the
2375 POWER bytes. POWER will be a C expression of type `int'. */
2377 #define CASE_VECTOR_MODE HImode
2378 /* An alias for a machine mode name. This is the machine mode that
2379 elements of a jump-table should have. */
2381 extern int avr_case_values_threshold;
2383 #define CASE_VALUES_THRESHOLD avr_case_values_threshold
2384 /* `CASE_VALUES_THRESHOLD'
2385 Define this to be the smallest number of different values for
2386 which it is best to use a jump-table instead of a tree of
2387 conditional branches. The default is four for machines with a
2388 `casesi' instruction and five otherwise. This is best for most
2391 #undef WORD_REGISTER_OPERATIONS
2392 /* Define this macro if operations between registers with integral
2393 mode smaller than a word are always performed on the entire
2394 register. Most RISC machines have this property and most CISC
2398 /* The maximum number of bytes that a single instruction can move
2399 quickly between memory and registers or between two memory
2402 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
2403 /* A C expression which is nonzero if on this machine it is safe to
2404 "convert" an integer of INPREC bits to one of OUTPREC bits (where
2405 OUTPREC is smaller than INPREC) by merely operating on it as if it
2406 had only OUTPREC bits.
2408 On many machines, this expression can be 1.
2410 When `TRULY_NOOP_TRUNCATION' returns 1 for a pair of sizes for
2411 modes for which `MODES_TIEABLE_P' is 0, suboptimal code can result.
2412 If this is the case, making `TRULY_NOOP_TRUNCATION' return 0 in
2413 such cases may improve things. */
2415 #define Pmode HImode
2416 /* An alias for the machine mode for pointers. On most machines,
2417 define this to be the integer mode corresponding to the width of a
2418 hardware pointer; `SImode' on 32-bit machine or `DImode' on 64-bit
2419 machines. On some machines you must define this to be one of the
2420 partial integer modes, such as `PSImode'.
2422 The width of `Pmode' must be at least as large as the value of
2423 `POINTER_SIZE'. If it is not equal, you must define the macro
2424 `POINTERS_EXTEND_UNSIGNED' to specify how pointers are extended to
2427 #define FUNCTION_MODE HImode
2428 /* An alias for the machine mode used for memory references to
2429 functions being called, in `call' RTL expressions. On most
2430 machines this should be `QImode'. */
2432 #define INTEGRATE_THRESHOLD(DECL) (1 + (3 * list_length (DECL_ARGUMENTS (DECL)) / 2))
2434 /* A C expression for the maximum number of instructions above which
2435 the function DECL should not be inlined. DECL is a
2436 `FUNCTION_DECL' node.
2438 The default definition of this macro is 64 plus 8 times the number
2439 of arguments that the function accepts. Some people think a larger
2440 threshold should be used on RISC machines. */
2442 #define DOLLARS_IN_IDENTIFIERS 0
2443 /* Define this macro to control use of the character `$' in identifier
2444 names. 0 means `$' is not allowed by default; 1 means it is
2445 allowed. 1 is the default; there is no need to define this macro
2446 in that case. This macro controls the compiler proper; it does
2447 not affect the preprocessor. */
2449 #define NO_DOLLAR_IN_LABEL 1
2450 /* Define this macro if the assembler does not accept the character
2451 `$' in label names. By default constructors and destructors in
2452 G++ have `$' in the identifiers. If this macro is defined, `.' is
2455 #define MACHINE_DEPENDENT_REORG(INSN) machine_dependent_reorg (INSN)
2456 /* In rare cases, correct code generation requires extra machine
2457 dependent processing between the second jump optimization pass and
2458 delayed branch scheduling. On those machines, define this macro
2459 as a C statement to act on the code starting at INSN. */
2461 #define GIV_SORT_CRITERION(X, Y) \
2462 if (GET_CODE ((X)->add_val) == CONST_INT \
2463 && GET_CODE ((Y)->add_val) == CONST_INT) \
2464 return INTVAL ((X)->add_val) - INTVAL ((Y)->add_val);
2466 /* `GIV_SORT_CRITERION(GIV1, GIV2)'
2467 In some cases, the strength reduction optimization pass can
2468 produce better code if this is defined. This macro controls the
2469 order that induction variables are combined. This macro is
2470 particularly useful if the target has limited addressing modes.
2471 For instance, the SH target has only positive offsets in
2472 addresses. Thus sorting to put the smallest address first allows
2473 the most combinations to be found. */
2475 #define TRAMPOLINE_TEMPLATE(FILE) \
2476 internal_error ("trampolines not supported")
2478 /* Length in units of the trampoline for entering a nested function. */
2480 #define TRAMPOLINE_SIZE 4
2482 /* Emit RTL insns to initialize the variable parts of a trampoline.
2483 FNADDR is an RTX for the address of the function's pure code.
2484 CXT is an RTX for the static chain value for the function. */
2486 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
2488 emit_move_insn (gen_rtx (MEM, HImode, plus_constant ((TRAMP), 2)), CXT); \
2489 emit_move_insn (gen_rtx (MEM, HImode, plus_constant ((TRAMP), 6)), FNADDR); \
2491 /* Store in cc_status the expressions
2492 that the condition codes will describe
2493 after execution of an instruction whose pattern is EXP.
2494 Do not alter them if the instruction would not alter the cc's. */
2496 #define NOTICE_UPDATE_CC(EXP, INSN) notice_update_cc(EXP, INSN)
2498 /* The add insns don't set overflow in a usable way. */
2499 #define CC_OVERFLOW_UNUSABLE 01000
2500 /* The mov,and,or,xor insns don't set carry. That's ok though as the
2501 Z bit is all we need when doing unsigned comparisons on the result of
2502 these insns (since they're always with 0). However, conditions.h has
2503 CC_NO_OVERFLOW defined for this purpose. Rename it to something more
2505 #define CC_NO_CARRY CC_NO_OVERFLOW
2508 /* Output assembler code to FILE to increment profiler label # LABELNO
2509 for profiling a function entry. */
2511 #define FUNCTION_PROFILER(FILE, LABELNO) \
2512 fprintf (FILE, "/* profiler %d */", (LABELNO))
2514 /* `FIRST_INSN_ADDRESS'
2515 When the `length' insn attribute is used, this macro specifies the
2516 value to be assigned to the address of the first insn in a
2517 function. If not specified, 0 is used. */
2519 #define ADJUST_INSN_LENGTH(INSN, LENGTH) (LENGTH =\
2520 adjust_insn_length (INSN, LENGTH))
2521 /* If defined, modifies the length assigned to instruction INSN as a
2522 function of the context in which it is used. LENGTH is an lvalue
2523 that contains the initially computed length of the insn and should
2524 be updated with the correct length of the insn. If updating is
2525 required, INSN must not be a varying-length insn.
2527 This macro will normally not be required. A case in which it is
2528 required is the ROMP. On this machine, the size of an `addr_vec'
2529 insn must be increased by two to compensate for the fact that
2530 alignment may be required. */
2532 #define TARGET_MEM_FUNCTIONS
2533 /* Define this macro if GNU CC should generate calls to the System V
2534 (and ANSI C) library functions `memcpy' and `memset' rather than
2535 the BSD functions `bcopy' and `bzero'. */
2537 #define CPP_SPEC "%{posix:-D_POSIX_SOURCE}"
2539 /* A C string constant that tells the GNU CC driver program options to
2540 pass to CPP. It can also specify how to translate options you
2541 give to GNU CC into options for GNU CC to pass to the CPP.
2543 Do not define this macro if it does not need to do anything. */
2545 #define CC1_SPEC "%{profile:-p}"
2546 /* A C string constant that tells the GNU CC driver program options to
2547 pass to `cc1'. It can also specify how to translate options you
2548 give to GNU CC into options for GNU CC to pass to the `cc1'.
2550 Do not define this macro if it does not need to do anything. */
2552 #define ASM_SPEC "%{mmcu=*:-mmcu=%*}"
2553 /* A C string constant that tells the GNU CC driver program options to
2554 pass to the assembler. It can also specify how to translate
2555 options you give to GNU CC into options for GNU CC to pass to the
2556 assembler. See the file `sun3.h' for an example of this.
2558 Do not define this macro if it does not need to do anything. */
2560 #define ASM_FINAL_SPEC ""
2561 /* A C string constant that tells the GNU CC driver program how to
2562 run any programs which cleanup after the normal assembler.
2563 Normally, this is not needed. See the file `mips.h' for an
2566 Do not define this macro if it does not need to do anything. */
2568 #define LINK_SPEC " %{!mmcu*:-m avr2}\
2569 %{mmcu=at90s1200|mmcu=attiny1*|mmcu=attiny28:-m avr1} \
2570 %{mmcu=attiny22|mmcu=attiny26|mmcu=at90s2*|mmcu=at90s4*|mmcu=at90s8*|mmcu=at90c8*|mmcu=at86rf401:-m avr2}\
2571 %{mmcu=atmega103|mmcu=atmega603|mmcu=at43*|mmcu=at76*:-m avr3}\
2572 %{mmcu=atmega8*:-m avr4}\
2573 %{mmcu=atmega16*|mmcu=atmega32*|mmcu=atmega64|mmcu=atmega128|mmcu=at94k:-m avr5}\
2574 %{mmcu=atmega64|mmcu=atmega128|mmcu=atmega162|mmcu=atmega169: -Tdata 0x800100} "
2576 /* A C string constant that tells the GNU CC driver program options to
2577 pass to the linker. It can also specify how to translate options
2578 you give to GNU CC into options for GNU CC to pass to the linker.
2580 Do not define this macro if it does not need to do anything. */
2583 "%{!mmcu=at90s1*:%{!mmcu=attiny1*:%{!mmcu=attiny28: -lc }}}"
2584 /* Another C string constant used much like `LINK_SPEC'. The
2585 difference between the two is that `LIB_SPEC' is used at the end
2586 of the command given to the linker.
2588 If this macro is not defined, a default is provided that loads the
2589 standard C library from the usual place. See `gcc.c'. */
2591 #define LIBSTDCXX "-lgcc"
2592 /* No libstdc++ for now. Empty string doesn't work. */
2594 #define LIBGCC_SPEC \
2595 "%{!mmcu=at90s1*:%{!mmcu=attiny1*:%{!mmcu=attiny28: -lgcc }}}"
2596 /* Another C string constant that tells the GNU CC driver program how
2597 and when to place a reference to `libgcc.a' into the linker
2598 command line. This constant is placed both before and after the
2599 value of `LIB_SPEC'.
2601 If this macro is not defined, the GNU CC driver provides a default
2602 that passes the string `-lgcc' to the linker unless the `-shared'
2603 option is specified. */
2605 #define STARTFILE_SPEC "%(crt_binutils)"
2606 /* Another C string constant used much like `LINK_SPEC'. The
2607 difference between the two is that `STARTFILE_SPEC' is used at the
2608 very beginning of the command given to the linker.
2610 If this macro is not defined, a default is provided that loads the
2611 standard C startup file from the usual place. See `gcc.c'. */
2613 #define ENDFILE_SPEC ""
2614 /* Another C string constant used much like `LINK_SPEC'. The
2615 difference between the two is that `ENDFILE_SPEC' is used at the
2616 very end of the command given to the linker.
2618 Do not define this macro if it does not need to do anything. */
2620 #define CRT_BINUTILS_SPECS "\
2621 %{mmcu=at90s1200|mmcu=avr1:crts1200.o%s} \
2622 %{mmcu=attiny11:crttn11.o%s} \
2623 %{mmcu=attiny12:crttn12.o%s} \
2624 %{mmcu=attiny15:crttn15.o%s} \
2625 %{mmcu=attiny28:crttn28.o%s} \
2626 %{!mmcu*|mmcu=at90s8515|mmcu=avr2:crts8515.o%s} \
2627 %{mmcu=at90s2313:crts2313.o%s} \
2628 %{mmcu=at90s2323:crts2323.o%s} \
2629 %{mmcu=at90s2333:crts2333.o%s} \
2630 %{mmcu=at90s2343:crts2343.o%s} \
2631 %{mmcu=attiny22:crttn22.o%s} \
2632 %{mmcu=attiny26:crttn26.o%s} \
2633 %{mmcu=at90s4433:crts4433.o%s} \
2634 %{mmcu=at90s4414:crts4414.o%s} \
2635 %{mmcu=at90s4434:crts4434.o%s} \
2636 %{mmcu=at90c8534:crtc8534.o%s} \
2637 %{mmcu=at90s8535:crts8535.o%s} \
2638 %{mmcu=at86rf401:crt86401.o%s} \
2639 %{mmcu=atmega103|mmcu=avr3:crtm103.o%s} \
2640 %{mmcu=atmega603:crtm603.o%s} \
2641 %{mmcu=at43usb320:crt43320.o%s} \
2642 %{mmcu=at43usb355:crt43355.o%s} \
2643 %{mmcu=at76c711:crt76711.o%s} \
2644 %{mmcu=atmega8|mmcu=avr4:crtm8.o%s} \
2645 %{mmcu=atmega8515:crtm8515.o%s} \
2646 %{mmcu=atmega8535:crtm8535.o%s} \
2647 %{mmcu=atmega16:crtm16.o%s} \
2648 %{mmcu=atmega161|mmcu=avr5:crtm161.o%s} \
2649 %{mmcu=atmega162:crtm162.o%s} \
2650 %{mmcu=atmega163:crtm163.o%s} \
2651 %{mmcu=atmega169:crtm169.o%s} \
2652 %{mmcu=atmega32:crtm32.o%s} \
2653 %{mmcu=atmega323:crtm323.o%s} \
2654 %{mmcu=atmega64:crtm64.o%s} \
2655 %{mmcu=atmega128:crtm128.o%s} \
2656 %{mmcu=at94k:crtat94k.o%s}"
2658 #define EXTRA_SPECS {"crt_binutils", CRT_BINUTILS_SPECS},
2660 /* Define this macro to provide additional specifications to put in
2661 the `specs' file that can be used in various specifications like
2664 /* This is the default without any -mmcu=* option (AT90S*). */
2665 #define MULTILIB_DEFAULTS { "mmcu=avr2" }
2667 /* This is undefined macro for collect2 disabling */
2668 #define LINKER_NAME "ld"
2670 #define TEST_HARD_REG_CLASS(CLASS, REGNO) \
2671 TEST_HARD_REG_BIT (reg_class_contents[ (int) (CLASS)], REGNO)
2673 /* Note that the other files fail to use these
2674 in some of the places where they should. */
2676 #if defined(__STDC__) || defined(ALMOST_STDC)
2677 #define AS2(a,b,c) #a " " #b "," #c
2678 #define AS2C(b,c) " " #b "," #c
2679 #define AS3(a,b,c,d) #a " " #b "," #c "," #d
2680 #define AS1(a,b) #a " " #b
2682 #define AS1(a,b) "a b"
2683 #define AS2(a,b,c) "a b,c"
2684 #define AS2C(b,c) " b,c"
2685 #define AS3(a,b,c,d) "a b,c,d"
2687 #define OUT_AS1(a,b) output_asm_insn (AS1(a,b), operands)
2688 #define OUT_AS2(a,b,c) output_asm_insn (AS2(a,b,c), operands)
2689 #define CR_TAB "\n\t"
2691 /* Define this macro as a C statement that declares additional library
2692 routines renames existing ones. `init_optabs' calls this macro
2693 after initializing all the normal library routines. */
2695 #define INIT_TARGET_OPTABS \
2700 /* Temporary register r0 */
2703 /* zero register r1 */
2704 #define ZERO_REGNO 1
2706 /* Temporary register which used for load immediate values to r0-r15 */
2707 #define LDI_REG_REGNO 31
2709 extern struct rtx_def *tmp_reg_rtx;
2710 extern struct rtx_def *zero_reg_rtx;
2711 extern struct rtx_def *ldi_reg_rtx;
2713 #define TARGET_FLOAT_FORMAT IEEE_FLOAT_FORMAT
2715 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
2717 /* Get the standard ELF stabs definitions. */