2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / config / avr / avr.h
blob0d5cd7c145c7ff5c874894994eca42215fd15f8e
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, 2003 Free Software Foundation, Inc.
4 Contributed by Denis Chertykov (denisc@overta.ru)
6 This file is part of GCC.
8 GCC 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)
11 any later version.
13 GCC 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 GCC; 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() \
26 do \
27 { \
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); \
33 if (avr_asm_only_p) \
34 builtin_define ("__AVR_ASM_ONLY__"); \
35 if (avr_enhanced_p) \
36 builtin_define ("__AVR_ENHANCED__"); \
37 if (avr_mega_p) \
38 builtin_define ("__AVR_MEGA__"); \
39 if (TARGET_NO_INTERRUPTS) \
40 builtin_define ("__NO_INTERRUPTS__"); \
41 } \
42 while (0)
44 /* This declaration should be present. */
45 extern int target_flags;
47 #define MASK_ALL_DEBUG 0x00000FE0
48 #define MASK_ORDER_1 0x00001000
49 #define MASK_INSN_SIZE_DUMP 0x00002000
50 #define MASK_ORDER_2 0x00004000
51 #define MASK_NO_TABLEJUMP 0x00008000
52 #define MASK_INT8 0x00010000
53 #define MASK_NO_INTERRUPTS 0x00020000
54 #define MASK_CALL_PROLOGUES 0x00040000
55 #define MASK_TINY_STACK 0x00080000
56 #define MASK_SHORT_CALLS 0x00100000
58 #define TARGET_ORDER_1 (target_flags & MASK_ORDER_1)
59 #define TARGET_ORDER_2 (target_flags & MASK_ORDER_2)
60 #define TARGET_INT8 (target_flags & MASK_INT8)
61 #define TARGET_NO_INTERRUPTS (target_flags & MASK_NO_INTERRUPTS)
62 #define TARGET_INSN_SIZE_DUMP (target_flags & MASK_INSN_SIZE_DUMP)
63 #define TARGET_CALL_PROLOGUES (target_flags & MASK_CALL_PROLOGUES)
64 #define TARGET_TINY_STACK (target_flags & MASK_TINY_STACK)
65 #define TARGET_NO_TABLEJUMP (target_flags & MASK_NO_TABLEJUMP)
66 #define TARGET_SHORT_CALLS (target_flags & MASK_SHORT_CALLS)
67 #define TARGET_ALL_DEBUG (target_flags & MASK_ALL_DEBUG)
69 #define TARGET_SWITCHES { \
70 { "order1", MASK_ORDER_1, NULL }, \
71 { "order2", MASK_ORDER_2, NULL }, \
72 { "int8", MASK_INT8, N_("Assume int to be 8 bit integer") }, \
73 { "no-interrupts", MASK_NO_INTERRUPTS, \
74 N_("Change the stack pointer without disabling interrupts") }, \
75 { "call-prologues", MASK_CALL_PROLOGUES, \
76 N_("Use subroutines for function prologue/epilogue") }, \
77 { "tiny-stack", MASK_TINY_STACK, \
78 N_("Change only the low 8 bits of the stack pointer") }, \
79 { "no-tablejump", MASK_NO_TABLEJUMP, \
80 N_("Do not generate tablejump insns") }, \
81 { "short-calls", MASK_SHORT_CALLS, \
82 N_("Use rjmp/rcall (limited range) on >8K devices") }, \
83 { "size", MASK_INSN_SIZE_DUMP, \
84 N_("Output instruction sizes to the asm file") }, \
85 { "deb", MASK_ALL_DEBUG, NULL }, \
86 { "", 0, NULL } }
88 extern const char *avr_init_stack;
89 extern const char *avr_mcu_name;
91 extern const char *avr_base_arch_macro;
92 extern const char *avr_extra_arch_macro;
93 extern int avr_mega_p;
94 extern int avr_enhanced_p;
95 extern int avr_asm_only_p;
97 #define AVR_MEGA (avr_mega_p && !TARGET_SHORT_CALLS)
98 #define AVR_ENHANCED (avr_enhanced_p)
100 #define TARGET_OPTIONS { \
101 { "init-stack=", &avr_init_stack, N_("Specify the initial stack address"), 0}, \
102 { "mcu=", &avr_mcu_name, N_("Specify the MCU name"), 0} }
104 #define TARGET_VERSION fprintf (stderr, " (GNU assembler syntax)");
105 /* This macro is a C statement to print on `stderr' a string
106 describing the particular machine description choice. Every
107 machine description should define `TARGET_VERSION'. For example:
109 #ifdef MOTOROLA
110 #define TARGET_VERSION \
111 fprintf (stderr, " (68k, Motorola syntax)");
112 #else
113 #define TARGET_VERSION \
114 fprintf (stderr, " (68k, MIT syntax)");
115 #endif */
117 #define OVERRIDE_OPTIONS avr_override_options ()
118 /* `OVERRIDE_OPTIONS'
119 Sometimes certain combinations of command options do not make
120 sense on a particular target machine. You can define a macro
121 `OVERRIDE_OPTIONS' to take account of this. This macro, if
122 defined, is executed once just after all the command options have
123 been parsed.
125 Don't use this macro to turn on various extra optimizations for
126 `-O'. That is what `OPTIMIZATION_OPTIONS' is for. */
128 #define CAN_DEBUG_WITHOUT_FP
129 /* Define this macro if debugging can be performed even without a
130 frame pointer. If this macro is defined, GCC will turn on the
131 `-fomit-frame-pointer' option whenever `-O' is specified. */
133 /* Define this if most significant byte of a word is the lowest numbered. */
134 #define BITS_BIG_ENDIAN 0
136 /* Define this if most significant byte of a word is the lowest numbered. */
137 #define BYTES_BIG_ENDIAN 0
139 /* Define this if most significant word of a multiword number is the lowest
140 numbered. */
141 #define WORDS_BIG_ENDIAN 0
143 #ifdef IN_LIBGCC2
144 /* This is to get correct SI and DI modes in libgcc2.c (32 and 64 bits). */
145 #define UNITS_PER_WORD 4
146 #else
147 /* Width of a word, in units (bytes). */
148 #define UNITS_PER_WORD 1
149 #endif
151 /* Width in bits of a pointer.
152 See also the macro `Pmode' defined below. */
153 #define POINTER_SIZE 16
156 /* Maximum sized of reasonable data type
157 DImode or Dfmode ... */
158 #define MAX_FIXED_MODE_SIZE 32
160 /* Allocation boundary (in *bits*) for storing arguments in argument list. */
161 #define PARM_BOUNDARY 8
163 /* Allocation boundary (in *bits*) for the code of a function. */
164 #define FUNCTION_BOUNDARY 8
166 /* Alignment of field after `int : 0' in a structure. */
167 #define EMPTY_FIELD_BOUNDARY 8
169 /* No data type wants to be aligned rounder than this. */
170 #define BIGGEST_ALIGNMENT 8
173 /* Define this if move instructions will actually fail to work
174 when given unaligned data. */
175 #define STRICT_ALIGNMENT 0
177 /* A C expression for the size in bits of the type `int' on the
178 target machine. If you don't define this, the default is one word. */
179 #define INT_TYPE_SIZE (TARGET_INT8 ? 8 : 16)
182 /* A C expression for the size in bits of the type `short' on the
183 target machine. If you don't define this, the default is half a
184 word. (If this would be less than one storage unit, it is rounded
185 up to one unit.) */
186 #define SHORT_TYPE_SIZE (INT_TYPE_SIZE == 8 ? INT_TYPE_SIZE : 16)
188 /* A C expression for the size in bits of the type `long' on the
189 target machine. If you don't define this, the default is one word. */
190 #define LONG_TYPE_SIZE (INT_TYPE_SIZE == 8 ? 16 : 32)
192 #define MAX_LONG_TYPE_SIZE 32
193 /* Maximum number for the size in bits of the type `long' on the
194 target machine. If this is undefined, the default is
195 `LONG_TYPE_SIZE'. Otherwise, it is the constant value that is the
196 largest value that `LONG_TYPE_SIZE' can have at run-time. This is
197 used in `cpp'. */
200 #define LONG_LONG_TYPE_SIZE 64
201 /* A C expression for the size in bits of the type `long long' on the
202 target machine. If you don't define this, the default is two
203 words. If you want to support GNU Ada on your machine, the value
204 of macro must be at least 64. */
207 #define FLOAT_TYPE_SIZE 32
208 /* A C expression for the size in bits of the type `float' on the
209 target machine. If you don't define this, the default is one word. */
211 #define DOUBLE_TYPE_SIZE 32
212 /* A C expression for the size in bits of the type `double' on the
213 target machine. If you don't define this, the default is two
214 words. */
217 #define LONG_DOUBLE_TYPE_SIZE 32
218 /* A C expression for the size in bits of the type `long double' on
219 the target machine. If you don't define this, the default is two
220 words. */
222 #define DEFAULT_SIGNED_CHAR 1
223 /* An expression whose value is 1 or 0, according to whether the type
224 `char' should be signed or unsigned by default. The user can
225 always override this default with the options `-fsigned-char' and
226 `-funsigned-char'. */
228 /* `DEFAULT_SHORT_ENUMS'
229 A C expression to determine whether to give an `enum' type only as
230 many bytes as it takes to represent the range of possible values
231 of that type. A nonzero value means to do that; a zero value
232 means all `enum' types should be allocated like `int'.
234 If you don't define the macro, the default is 0. */
236 #define SIZE_TYPE (INT_TYPE_SIZE == 8 ? "long unsigned int" : "unsigned int")
237 /* A C expression for a string describing the name of the data type
238 to use for size values. The typedef name `size_t' is defined
239 using the contents of the string.
241 The string can contain more than one keyword. If so, separate
242 them with spaces, and write first any length keyword, then
243 `unsigned' if appropriate, and finally `int'. The string must
244 exactly match one of the data type names defined in the function
245 `init_decl_processing' in the file `c-decl.c'. You may not omit
246 `int' or change the order--that would cause the compiler to crash
247 on startup.
249 If you don't define this macro, the default is `"long unsigned
250 int"'. */
252 #define PTRDIFF_TYPE (INT_TYPE_SIZE == 8 ? "long int" :"int")
253 /* A C expression for a string describing the name of the data type
254 to use for the result of subtracting two pointers. The typedef
255 name `ptrdiff_t' is defined using the contents of the string. See
256 `SIZE_TYPE' above for more information.
258 If you don't define this macro, the default is `"long int"'. */
261 #define WCHAR_TYPE_SIZE 16
262 /* A C expression for the size in bits of the data type for wide
263 characters. This is used in `cpp', which cannot make use of
264 `WCHAR_TYPE'. */
266 #define FIRST_PSEUDO_REGISTER 36
267 /* Number of hardware registers known to the compiler. They receive
268 numbers 0 through `FIRST_PSEUDO_REGISTER-1'; thus, the first
269 pseudo register's number really is assigned the number
270 `FIRST_PSEUDO_REGISTER'. */
272 #define FIXED_REGISTERS {\
273 1,1,/* r0 r1 */\
274 0,0,/* r2 r3 */\
275 0,0,/* r4 r5 */\
276 0,0,/* r6 r7 */\
277 0,0,/* r8 r9 */\
278 0,0,/* r10 r11 */\
279 0,0,/* r12 r13 */\
280 0,0,/* r14 r15 */\
281 0,0,/* r16 r17 */\
282 0,0,/* r18 r19 */\
283 0,0,/* r20 r21 */\
284 0,0,/* r22 r23 */\
285 0,0,/* r24 r25 */\
286 0,0,/* r26 r27 */\
287 0,0,/* r28 r29 */\
288 0,0,/* r30 r31 */\
289 1,1,/* STACK */\
290 1,1 /* arg pointer */ }
291 /* An initializer that says which registers are used for fixed
292 purposes all throughout the compiled code and are therefore not
293 available for general allocation. These would include the stack
294 pointer, the frame pointer (except on machines where that can be
295 used as a general register when no frame pointer is needed), the
296 program counter on machines where that is considered one of the
297 addressable registers, and any other numbered register with a
298 standard use.
300 This information is expressed as a sequence of numbers, separated
301 by commas and surrounded by braces. The Nth number is 1 if
302 register N is fixed, 0 otherwise.
304 The table initialized from this macro, and the table initialized by
305 the following one, may be overridden at run time either
306 automatically, by the actions of the macro
307 `CONDITIONAL_REGISTER_USAGE', or by the user with the command
308 options `-ffixed-REG', `-fcall-used-REG' and `-fcall-saved-REG'. */
310 #define CALL_USED_REGISTERS { \
311 1,1,/* r0 r1 */ \
312 0,0,/* r2 r3 */ \
313 0,0,/* r4 r5 */ \
314 0,0,/* r6 r7 */ \
315 0,0,/* r8 r9 */ \
316 0,0,/* r10 r11 */ \
317 0,0,/* r12 r13 */ \
318 0,0,/* r14 r15 */ \
319 0,0,/* r16 r17 */ \
320 1,1,/* r18 r19 */ \
321 1,1,/* r20 r21 */ \
322 1,1,/* r22 r23 */ \
323 1,1,/* r24 r25 */ \
324 1,1,/* r26 r27 */ \
325 0,0,/* r28 r29 */ \
326 1,1,/* r30 r31 */ \
327 1,1,/* STACK */ \
328 1,1 /* arg pointer */ }
329 /* Like `FIXED_REGISTERS' but has 1 for each register that is
330 clobbered (in general) by function calls as well as for fixed
331 registers. This macro therefore identifies the registers that are
332 not available for general allocation of values that must live
333 across function calls.
335 If a register has 0 in `CALL_USED_REGISTERS', the compiler
336 automatically saves it on function entry and restores it on
337 function exit, if the register is used within the function. */
339 #define NON_SAVING_SETJMP 0
340 /* If this macro is defined and has a nonzero value, it means that
341 `setjmp' and related functions fail to save the registers, or that
342 `longjmp' fails to restore them. To compensate, the compiler
343 avoids putting variables in registers in functions that use
344 `setjmp'. */
346 #define REG_ALLOC_ORDER { \
347 24,25, \
348 18,19, \
349 20,21, \
350 22,23, \
351 30,31, \
352 26,27, \
353 28,29, \
354 17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2, \
355 0,1, \
356 32,33,34,35 \
358 /* If defined, an initializer for a vector of integers, containing the
359 numbers of hard registers in the order in which GCC should
360 prefer to use them (from most preferred to least).
362 If this macro is not defined, registers are used lowest numbered
363 first (all else being equal).
365 One use of this macro is on machines where the highest numbered
366 registers must always be saved and the save-multiple-registers
367 instruction supports only sequences of consecutive registers. On
368 such machines, define `REG_ALLOC_ORDER' to be an initializer that
369 lists the highest numbered allocatable register first. */
371 #define ORDER_REGS_FOR_LOCAL_ALLOC order_regs_for_local_alloc ()
372 /* ORDER_REGS_FOR_LOCAL_ALLOC'
373 A C statement (sans semicolon) to choose the order in which to
374 allocate hard registers for pseudo-registers local to a basic
375 block.
377 Store the desired register order in the array `reg_alloc_order'.
378 Element 0 should be the register to allocate first; element 1, the
379 next register; and so on.
381 The macro body should not assume anything about the contents of
382 `reg_alloc_order' before execution of the macro.
384 On most machines, it is not necessary to define this macro. */
387 #define HARD_REGNO_NREGS(REGNO, MODE) ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
389 /* A C expression for the number of consecutive hard registers,
390 starting at register number REGNO, required to hold a value of mode
391 MODE.
393 On a machine where all registers are exactly one word, a suitable
394 definition of this macro is
396 #define HARD_REGNO_NREGS(REGNO, MODE) \
397 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) \
398 / UNITS_PER_WORD)) */
400 #define HARD_REGNO_MODE_OK(REGNO, MODE) avr_hard_regno_mode_ok(REGNO, MODE)
401 /* A C expression that is nonzero if it is permissible to store a
402 value of mode MODE in hard register number REGNO (or in several
403 registers starting with that one). For a machine where all
404 registers are equivalent, a suitable definition is
406 #define HARD_REGNO_MODE_OK(REGNO, MODE) 1
408 It is not necessary for this macro to check for the numbers of
409 fixed registers, because the allocation mechanism considers them
410 to be always occupied.
412 On some machines, double-precision values must be kept in even/odd
413 register pairs. The way to implement that is to define this macro
414 to reject odd register numbers for such modes.
416 The minimum requirement for a mode to be OK in a register is that
417 the `movMODE' instruction pattern support moves between the
418 register and any other hard register for which the mode is OK; and
419 that moving a value into the register and back out not alter it.
421 Since the same instruction used to move `SImode' will work for all
422 narrower integer modes, it is not necessary on any machine for
423 `HARD_REGNO_MODE_OK' to distinguish between these modes, provided
424 you define patterns `movhi', etc., to take advantage of this. This
425 is useful because of the interaction between `HARD_REGNO_MODE_OK'
426 and `MODES_TIEABLE_P'; it is very desirable for all integer modes
427 to be tieable.
429 Many machines have special registers for floating point arithmetic.
430 Often people assume that floating point machine modes are allowed
431 only in floating point registers. This is not true. Any
432 registers that can hold integers can safely *hold* a floating
433 point machine mode, whether or not floating arithmetic can be done
434 on it in those registers. Integer move instructions can be used
435 to move the values.
437 On some machines, though, the converse is true: fixed-point machine
438 modes may not go in floating registers. This is true if the
439 floating registers normalize any value stored in them, because
440 storing a non-floating value there would garble it. In this case,
441 `HARD_REGNO_MODE_OK' should reject fixed-point machine modes in
442 floating registers. But if the floating registers do not
443 automatically normalize, if you can store any bit pattern in one
444 and retrieve it unchanged without a trap, then any machine mode
445 may go in a floating register, so you can define this macro to say
448 The primary significance of special floating registers is rather
449 that they are the registers acceptable in floating point arithmetic
450 instructions. However, this is of no concern to
451 `HARD_REGNO_MODE_OK'. You handle it by writing the proper
452 constraints for those instructions.
454 On some machines, the floating registers are especially slow to
455 access, so that it is better to store a value in a stack frame
456 than in such a register if floating point arithmetic is not being
457 done. As long as the floating registers are not in class
458 `GENERAL_REGS', they will not be used unless some pattern's
459 constraint asks for one. */
461 #define MODES_TIEABLE_P(MODE1, MODE2) 0
462 /* A C expression that is nonzero if it is desirable to choose
463 register allocation so as to avoid move instructions between a
464 value of mode MODE1 and a value of mode MODE2.
466 If `HARD_REGNO_MODE_OK (R, MODE1)' and `HARD_REGNO_MODE_OK (R,
467 MODE2)' are ever different for any R, then `MODES_TIEABLE_P (MODE1,
468 MODE2)' must be zero. */
470 enum reg_class {
471 NO_REGS,
472 R0_REG, /* r0 */
473 POINTER_X_REGS, /* r26 - r27 */
474 POINTER_Y_REGS, /* r28 - r29 */
475 POINTER_Z_REGS, /* r30 - r31 */
476 STACK_REG, /* STACK */
477 BASE_POINTER_REGS, /* r28 - r31 */
478 POINTER_REGS, /* r26 - r31 */
479 ADDW_REGS, /* r24 - r31 */
480 SIMPLE_LD_REGS, /* r16 - r23 */
481 LD_REGS, /* r16 - r31 */
482 NO_LD_REGS, /* r0 - r15 */
483 GENERAL_REGS, /* r0 - r31 */
484 ALL_REGS, LIM_REG_CLASSES
486 /* An enumeral type that must be defined with all the register class
487 names as enumeral values. `NO_REGS' must be first. `ALL_REGS'
488 must be the last register class, followed by one more enumeral
489 value, `LIM_REG_CLASSES', which is not a register class but rather
490 tells how many classes there are.
492 Each register class has a number, which is the value of casting
493 the class name to type `int'. The number serves as an index in
494 many of the tables described below. */
497 #define N_REG_CLASSES (int)LIM_REG_CLASSES
498 /* The number of distinct register classes, defined as follows:
500 #define N_REG_CLASSES (int) LIM_REG_CLASSES */
502 #define REG_CLASS_NAMES { \
503 "NO_REGS", \
504 "R0_REG", /* r0 */ \
505 "POINTER_X_REGS", /* r26 - r27 */ \
506 "POINTER_Y_REGS", /* r28 - r29 */ \
507 "POINTER_Z_REGS", /* r30 - r31 */ \
508 "STACK_REG", /* STACK */ \
509 "BASE_POINTER_REGS", /* r28 - r31 */ \
510 "POINTER_REGS", /* r26 - r31 */ \
511 "ADDW_REGS", /* r24 - r31 */ \
512 "SIMPLE_LD_REGS", /* r16 - r23 */ \
513 "LD_REGS", /* r16 - r31 */ \
514 "NO_LD_REGS", /* r0 - r15 */ \
515 "GENERAL_REGS", /* r0 - r31 */ \
516 "ALL_REGS" }
517 /* An initializer containing the names of the register classes as C
518 string constants. These names are used in writing some of the
519 debugging dumps. */
521 #define REG_X 26
522 #define REG_Y 28
523 #define REG_Z 30
524 #define REG_W 24
526 #define REG_CLASS_CONTENTS { \
527 {0x00000000,0x00000000}, /* NO_REGS */ \
528 {0x00000001,0x00000000}, /* R0_REG */ \
529 {3 << REG_X,0x00000000}, /* POINTER_X_REGS, r26 - r27 */ \
530 {3 << REG_Y,0x00000000}, /* POINTER_Y_REGS, r28 - r29 */ \
531 {3 << REG_Z,0x00000000}, /* POINTER_Z_REGS, r30 - r31 */ \
532 {0x00000000,0x00000003}, /* STACK_REG, STACK */ \
533 {(3 << REG_Y) | (3 << REG_Z), \
534 0x00000000}, /* BASE_POINTER_REGS, r28 - r31 */ \
535 {(3 << REG_X) | (3 << REG_Y) | (3 << REG_Z), \
536 0x00000000}, /* POINTER_REGS, r26 - r31 */ \
537 {(3 << REG_X) | (3 << REG_Y) | (3 << REG_Z) | (3 << REG_W), \
538 0x00000000}, /* ADDW_REGS, r24 - r31 */ \
539 {0x00ff0000,0x00000000}, /* SIMPLE_LD_REGS r16 - r23 */ \
540 {(3 << REG_X)|(3 << REG_Y)|(3 << REG_Z)|(3 << REG_W)|(0xff << 16), \
541 0x00000000}, /* LD_REGS, r16 - r31 */ \
542 {0x0000ffff,0x00000000}, /* NO_LD_REGS r0 - r15 */ \
543 {0xffffffff,0x00000000}, /* GENERAL_REGS, r0 - r31 */ \
544 {0xffffffff,0x00000003} /* ALL_REGS */ \
546 /* An initializer containing the contents of the register classes, as
547 integers which are bit masks. The Nth integer specifies the
548 contents of class N. The way the integer MASK is interpreted is
549 that register R is in the class if `MASK & (1 << R)' is 1.
551 When the machine has more than 32 registers, an integer does not
552 suffice. Then the integers are replaced by sub-initializers,
553 braced groupings containing several integers. Each
554 sub-initializer must be suitable as an initializer for the type
555 `HARD_REG_SET' which is defined in `hard-reg-set.h'. */
557 #define REGNO_REG_CLASS(R) avr_regno_reg_class(R)
558 /* A C expression whose value is a register class containing hard
559 register REGNO. In general there is more than one such class;
560 choose a class which is "minimal", meaning that no smaller class
561 also contains the register. */
563 #define BASE_REG_CLASS POINTER_REGS
564 /* A macro whose definition is the name of the class to which a valid
565 base register must belong. A base register is one used in an
566 address which is the register value plus a displacement. */
568 #define INDEX_REG_CLASS NO_REGS
569 /* A macro whose definition is the name of the class to which a valid
570 index register must belong. An index register is one used in an
571 address where its value is either multiplied by a scale factor or
572 added to another register (as well as added to a displacement). */
574 #define REG_CLASS_FROM_LETTER(C) avr_reg_class_from_letter(C)
575 /* A C expression which defines the machine-dependent operand
576 constraint letters for register classes. If CHAR is such a
577 letter, the value should be the register class corresponding to
578 it. Otherwise, the value should be `NO_REGS'. The register
579 letter `r', corresponding to class `GENERAL_REGS', will not be
580 passed to this macro; you do not need to handle it. */
582 #define REGNO_OK_FOR_BASE_P(r) (((r) < FIRST_PSEUDO_REGISTER \
583 && ((r) == REG_X \
584 || (r) == REG_Y \
585 || (r) == REG_Z \
586 || (r) == ARG_POINTER_REGNUM)) \
587 || (reg_renumber \
588 && (reg_renumber[r] == REG_X \
589 || reg_renumber[r] == REG_Y \
590 || reg_renumber[r] == REG_Z \
591 || (reg_renumber[r] \
592 == ARG_POINTER_REGNUM))))
593 /* A C expression which is nonzero if register number NUM is suitable
594 for use as a base register in operand addresses. It may be either
595 a suitable hard register or a pseudo register that has been
596 allocated such a hard register. */
598 /* #define REGNO_MODE_OK_FOR_BASE_P(r, m) regno_mode_ok_for_base_p(r, m)
599 A C expression that is just like `REGNO_OK_FOR_BASE_P', except that
600 that expression may examine the mode of the memory reference in
601 MODE. You should define this macro if the mode of the memory
602 reference affects whether a register may be used as a base
603 register. If you define this macro, the compiler will use it
604 instead of `REGNO_OK_FOR_BASE_P'. */
606 #define REGNO_OK_FOR_INDEX_P(NUM) 0
607 /* A C expression which is nonzero if register number NUM is suitable
608 for use as an index register in operand addresses. It may be
609 either a suitable hard register or a pseudo register that has been
610 allocated such a hard register.
612 The difference between an index register and a base register is
613 that the index register may be scaled. If an address involves the
614 sum of two registers, neither one of them scaled, then either one
615 may be labeled the "base" and the other the "index"; but whichever
616 labeling is used must fit the machine's constraints of which
617 registers may serve in each capacity. The compiler will try both
618 labelings, looking for one that is valid, and will reload one or
619 both registers only if neither labeling works. */
621 #define PREFERRED_RELOAD_CLASS(X, CLASS) preferred_reload_class(X,CLASS)
622 /* A C expression that places additional restrictions on the register
623 class to use when it is necessary to copy value X into a register
624 in class CLASS. The value is a register class; perhaps CLASS, or
625 perhaps another, smaller class. On many machines, the following
626 definition is safe:
628 #define PREFERRED_RELOAD_CLASS(X,CLASS) CLASS
630 Sometimes returning a more restrictive class makes better code.
631 For example, on the 68000, when X is an integer constant that is
632 in range for a `moveq' instruction, the value of this macro is
633 always `DATA_REGS' as long as CLASS includes the data registers.
634 Requiring a data register guarantees that a `moveq' will be used.
636 If X is a `const_double', by returning `NO_REGS' you can force X
637 into a memory constant. This is useful on certain machines where
638 immediate floating values cannot be loaded into certain kinds of
639 registers. */
640 /* `PREFERRED_OUTPUT_RELOAD_CLASS (X, CLASS)'
641 Like `PREFERRED_RELOAD_CLASS', but for output reloads instead of
642 input reloads. If you don't define this macro, the default is to
643 use CLASS, unchanged. */
645 /* `LIMIT_RELOAD_CLASS (MODE, CLASS)'
646 A C expression that places additional restrictions on the register
647 class to use when it is necessary to be able to hold a value of
648 mode MODE in a reload register for which class CLASS would
649 ordinarily be used.
651 Unlike `PREFERRED_RELOAD_CLASS', this macro should be used when
652 there are certain modes that simply can't go in certain reload
653 classes.
655 The value is a register class; perhaps CLASS, or perhaps another,
656 smaller class.
658 Don't define this macro unless the target machine has limitations
659 which require the macro to do something nontrivial. */
661 /* SECONDARY_INPUT_RELOAD_CLASS(CLASS, MODE, X)
662 `SECONDARY_RELOAD_CLASS (CLASS, MODE, X)'
663 `SECONDARY_OUTPUT_RELOAD_CLASS (CLASS, MODE, X)'
664 Many machines have some registers that cannot be copied directly
665 to or from memory or even from other types of registers. An
666 example is the `MQ' register, which on most machines, can only be
667 copied to or from general registers, but not memory. Some
668 machines allow copying all registers to and from memory, but
669 require a scratch register for stores to some memory locations
670 (e.g., those with symbolic address on the RT, and those with
671 certain symbolic address on the SPARC when compiling PIC). In
672 some cases, both an intermediate and a scratch register are
673 required.
675 You should define these macros to indicate to the reload phase
676 that it may need to allocate at least one register for a reload in
677 addition to the register to contain the data. Specifically, if
678 copying X to a register CLASS in MODE requires an intermediate
679 register, you should define `SECONDARY_INPUT_RELOAD_CLASS' to
680 return the largest register class all of whose registers can be
681 used as intermediate registers or scratch registers.
683 If copying a register CLASS in MODE to X requires an intermediate
684 or scratch register, `SECONDARY_OUTPUT_RELOAD_CLASS' should be
685 defined to return the largest register class required. If the
686 requirements for input and output reloads are the same, the macro
687 `SECONDARY_RELOAD_CLASS' should be used instead of defining both
688 macros identically.
690 The values returned by these macros are often `GENERAL_REGS'.
691 Return `NO_REGS' if no spare register is needed; i.e., if X can be
692 directly copied to or from a register of CLASS in MODE without
693 requiring a scratch register. Do not define this macro if it
694 would always return `NO_REGS'.
696 If a scratch register is required (either with or without an
697 intermediate register), you should define patterns for
698 `reload_inM' or `reload_outM', as required (*note Standard
699 Names::.. These patterns, which will normally be implemented with
700 a `define_expand', should be similar to the `movM' patterns,
701 except that operand 2 is the scratch register.
703 Define constraints for the reload register and scratch register
704 that contain a single register class. If the original reload
705 register (whose class is CLASS) can meet the constraint given in
706 the pattern, the value returned by these macros is used for the
707 class of the scratch register. Otherwise, two additional reload
708 registers are required. Their classes are obtained from the
709 constraints in the insn pattern.
711 X might be a pseudo-register or a `subreg' of a pseudo-register,
712 which could either be in a hard register or in memory. Use
713 `true_regnum' to find out; it will return -1 if the pseudo is in
714 memory and the hard register number if it is in a register.
716 These macros should not be used in the case where a particular
717 class of registers can only be copied to memory and not to another
718 class of registers. In that case, secondary reload registers are
719 not needed and would not be helpful. Instead, a stack location
720 must be used to perform the copy and the `movM' pattern should use
721 memory as an intermediate storage. This case often occurs between
722 floating-point and general registers. */
724 /* `SECONDARY_MEMORY_NEEDED (CLASS1, CLASS2, M)'
725 Certain machines have the property that some registers cannot be
726 copied to some other registers without using memory. Define this
727 macro on those machines to be a C expression that is nonzero if
728 objects of mode M in registers of CLASS1 can only be copied to
729 registers of class CLASS2 by storing a register of CLASS1 into
730 memory and loading that memory location into a register of CLASS2.
732 Do not define this macro if its value would always be zero.
734 `SECONDARY_MEMORY_NEEDED_RTX (MODE)'
735 Normally when `SECONDARY_MEMORY_NEEDED' is defined, the compiler
736 allocates a stack slot for a memory location needed for register
737 copies. If this macro is defined, the compiler instead uses the
738 memory location defined by this macro.
740 Do not define this macro if you do not define
741 `SECONDARY_MEMORY_NEEDED'. */
743 #define SMALL_REGISTER_CLASSES 1
744 /* Normally the compiler avoids choosing registers that have been
745 explicitly mentioned in the rtl as spill registers (these
746 registers are normally those used to pass parameters and return
747 values). However, some machines have so few registers of certain
748 classes that there would not be enough registers to use as spill
749 registers if this were done.
751 Define `SMALL_REGISTER_CLASSES' to be an expression with a nonzero
752 value on these machines. When this macro has a nonzero value, the
753 compiler allows registers explicitly used in the rtl to be used as
754 spill registers but avoids extending the lifetime of these
755 registers.
757 It is always safe to define this macro with a nonzero value, but
758 if you unnecessarily define it, you will reduce the amount of
759 optimizations that can be performed in some cases. If you do not
760 define this macro with a nonzero value when it is required, the
761 compiler will run out of spill registers and print a fatal error
762 message. For most machines, you should not define this macro at
763 all. */
765 #define CLASS_LIKELY_SPILLED_P(c) class_likely_spilled_p(c)
766 /* A C expression whose value is nonzero if pseudos that have been
767 assigned to registers of class CLASS would likely be spilled
768 because registers of CLASS are needed for spill registers.
770 The default value of this macro returns 1 if CLASS has exactly one
771 register and zero otherwise. On most machines, this default
772 should be used. Only define this macro to some other expression
773 if pseudo allocated by `local-alloc.c' end up in memory because
774 their hard registers were needed for spill registers. If this
775 macro returns nonzero for those classes, those pseudos will only
776 be allocated by `global.c', which knows how to reallocate the
777 pseudo to another register. If there would not be another
778 register available for reallocation, you should not change the
779 definition of this macro since the only effect of such a
780 definition would be to slow down register allocation. */
782 #define CLASS_MAX_NREGS(CLASS, MODE) class_max_nregs (CLASS, MODE)
783 /* A C expression for the maximum number of consecutive registers of
784 class CLASS needed to hold a value of mode MODE.
786 This is closely related to the macro `HARD_REGNO_NREGS'. In fact,
787 the value of the macro `CLASS_MAX_NREGS (CLASS, MODE)' should be
788 the maximum value of `HARD_REGNO_NREGS (REGNO, MODE)' for all
789 REGNO values in the class CLASS.
791 This macro helps control the handling of multiple-word values in
792 the reload pass. */
794 #define CONST_OK_FOR_LETTER_P(VALUE, C) \
795 ((C) == 'I' ? (VALUE) >= 0 && (VALUE) <= 63 : \
796 (C) == 'J' ? (VALUE) <= 0 && (VALUE) >= -63: \
797 (C) == 'K' ? (VALUE) == 2 : \
798 (C) == 'L' ? (VALUE) == 0 : \
799 (C) == 'M' ? (VALUE) >= 0 && (VALUE) <= 0xff : \
800 (C) == 'N' ? (VALUE) == -1: \
801 (C) == 'O' ? (VALUE) == 8 || (VALUE) == 16 || (VALUE) == 24: \
802 (C) == 'P' ? (VALUE) == 1 : \
805 /* A C expression that defines the machine-dependent operand
806 constraint letters (`I', `J', `K', ... `P') that specify
807 particular ranges of integer values. If C is one of those
808 letters, the expression should check that VALUE, an integer, is in
809 the appropriate range and return 1 if so, 0 otherwise. If C is
810 not one of those letters, the value should be 0 regardless of
811 VALUE. */
813 #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
814 ((C) == 'G' ? (VALUE) == CONST0_RTX (SFmode) \
815 : 0)
816 /* `CONST_DOUBLE_OK_FOR_LETTER_P (VALUE, C)'
817 A C expression that defines the machine-dependent operand
818 constraint letters that specify particular ranges of
819 `const_double' values (`G' or `H').
821 If C is one of those letters, the expression should check that
822 VALUE, an RTX of code `const_double', is in the appropriate range
823 and return 1 if so, 0 otherwise. If C is not one of those
824 letters, the value should be 0 regardless of VALUE.
826 `const_double' is used for all floating-point constants and for
827 `DImode' fixed-point constants. A given letter can accept either
828 or both kinds of values. It can use `GET_MODE' to distinguish
829 between these kinds. */
831 #define EXTRA_CONSTRAINT(x, c) extra_constraint(x, c)
832 /* A C expression that defines the optional machine-dependent
833 constraint letters (``Q', `R', `S', `T', `U') that can'
834 be used to segregate specific types of operands, usually memory
835 references, for the target machine. Normally this macro will not
836 be defined. If it is required for a particular target machine, it
837 should return 1 if VALUE corresponds to the operand type
838 represented by the constraint letter C. If C is not defined as an
839 extra constraint, the value returned should be 0 regardless of
840 VALUE.
842 For example, on the ROMP, load instructions cannot have their
843 output in r0 if the memory reference contains a symbolic address.
844 Constraint letter `Q' is defined as representing a memory address
845 that does *not* contain a symbolic address. An alternative is
846 specified with a `Q' constraint on the input and `r' on the
847 output. The next alternative specifies `m' on the input and a
848 register class that does not include r0 on the output. */
850 /* This is an undocumented variable which describes
851 how GCC will push a data */
852 #define STACK_PUSH_CODE POST_DEC
854 #define STACK_GROWS_DOWNWARD
855 /* Define this macro if pushing a word onto the stack moves the stack
856 pointer to a smaller address.
858 When we say, "define this macro if ...," it means that the
859 compiler checks this macro only with `#ifdef' so the precise
860 definition used does not matter. */
862 #define STARTING_FRAME_OFFSET 1
863 /* Offset from the frame pointer to the first local variable slot to
864 be allocated.
866 If `FRAME_GROWS_DOWNWARD', find the next slot's offset by
867 subtracting the first slot's length from `STARTING_FRAME_OFFSET'.
868 Otherwise, it is found by adding the length of the first slot to
869 the value `STARTING_FRAME_OFFSET'. */
871 #define STACK_POINTER_OFFSET 1
872 /* Offset from the stack pointer register to the first location at
873 which outgoing arguments are placed. If not specified, the
874 default value of zero is used. This is the proper value for most
875 machines.
877 If `ARGS_GROW_DOWNWARD', this is the offset to the location above
878 the first location at which outgoing arguments are placed. */
880 #define FIRST_PARM_OFFSET(FUNDECL) 0
881 /* Offset from the argument pointer register to the first argument's
882 address. On some machines it may depend on the data type of the
883 function.
885 If `ARGS_GROW_DOWNWARD', this is the offset to the location above
886 the first argument's address. */
888 /* `STACK_DYNAMIC_OFFSET (FUNDECL)'
889 Offset from the stack pointer register to an item dynamically
890 allocated on the stack, e.g., by `alloca'.
892 The default value for this macro is `STACK_POINTER_OFFSET' plus the
893 length of the outgoing arguments. The default is correct for most
894 machines. See `function.c' for details. */
896 #define STACK_BOUNDARY 8
897 /* Define this macro if there is a guaranteed alignment for the stack
898 pointer on this machine. The definition is a C expression for the
899 desired alignment (measured in bits). This value is used as a
900 default if PREFERRED_STACK_BOUNDARY is not defined. */
902 #define STACK_POINTER_REGNUM 32
903 /* The register number of the stack pointer register, which must also
904 be a fixed register according to `FIXED_REGISTERS'. On most
905 machines, the hardware determines which register this is. */
907 #define FRAME_POINTER_REGNUM REG_Y
908 /* The register number of the frame pointer register, which is used to
909 access automatic variables in the stack frame. On some machines,
910 the hardware determines which register this is. On other
911 machines, you can choose any register you wish for this purpose. */
913 #define ARG_POINTER_REGNUM 34
914 /* The register number of the arg pointer register, which is used to
915 access the function's argument list. On some machines, this is
916 the same as the frame pointer register. On some machines, the
917 hardware determines which register this is. On other machines,
918 you can choose any register you wish for this purpose. If this is
919 not the same register as the frame pointer register, then you must
920 mark it as a fixed register according to `FIXED_REGISTERS', or
921 arrange to be able to eliminate it (*note Elimination::.). */
923 #define STATIC_CHAIN_REGNUM 2
924 /* Register numbers used for passing a function's static chain
925 pointer. If register windows are used, the register number as
926 seen by the called function is `STATIC_CHAIN_INCOMING_REGNUM',
927 while the register number as seen by the calling function is
928 `STATIC_CHAIN_REGNUM'. If these registers are the same,
929 `STATIC_CHAIN_INCOMING_REGNUM' need not be defined.
931 The static chain register need not be a fixed register.
933 If the static chain is passed in memory, these macros should not be
934 defined; instead, the next two macros should be defined. */
936 #define FRAME_POINTER_REQUIRED frame_pointer_required_p()
937 /* A C expression which is nonzero if a function must have and use a
938 frame pointer. This expression is evaluated in the reload pass.
939 If its value is nonzero the function will have a frame pointer.
941 The expression can in principle examine the current function and
942 decide according to the facts, but on most machines the constant 0
943 or the constant 1 suffices. Use 0 when the machine allows code to
944 be generated with no frame pointer, and doing so saves some time
945 or space. Use 1 when there is no possible advantage to avoiding a
946 frame pointer.
948 In certain cases, the compiler does not know how to produce valid
949 code without a frame pointer. The compiler recognizes those cases
950 and automatically gives the function a frame pointer regardless of
951 what `FRAME_POINTER_REQUIRED' says. You don't need to worry about
952 them.
954 In a function that does not require a frame pointer, the frame
955 pointer register can be allocated for ordinary usage, unless you
956 mark it as a fixed register. See `FIXED_REGISTERS' for more
957 information. */
959 #define ELIMINABLE_REGS { \
960 {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
961 {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM} \
962 ,{FRAME_POINTER_REGNUM+1,STACK_POINTER_REGNUM+1}}
963 /* If defined, this macro specifies a table of register pairs used to
964 eliminate unneeded registers that point into the stack frame. If
965 it is not defined, the only elimination attempted by the compiler
966 is to replace references to the frame pointer with references to
967 the stack pointer.
969 The definition of this macro is a list of structure
970 initializations, each of which specifies an original and
971 replacement register.
973 On some machines, the position of the argument pointer is not
974 known until the compilation is completed. In such a case, a
975 separate hard register must be used for the argument pointer.
976 This register can be eliminated by replacing it with either the
977 frame pointer or the argument pointer, depending on whether or not
978 the frame pointer has been eliminated.
980 In this case, you might specify:
981 #define ELIMINABLE_REGS \
982 {{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
983 {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
984 {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
986 Note that the elimination of the argument pointer with the stack
987 pointer is specified first since that is the preferred elimination. */
989 #define CAN_ELIMINATE(FROM, TO) (((FROM) == ARG_POINTER_REGNUM \
990 && (TO) == FRAME_POINTER_REGNUM) \
991 || (((FROM) == FRAME_POINTER_REGNUM \
992 || (FROM) == FRAME_POINTER_REGNUM+1) \
993 && ! FRAME_POINTER_REQUIRED \
995 /* A C expression that returns nonzero if the compiler is allowed to
996 try to replace register number FROM-REG with register number
997 TO-REG. This macro need only be defined if `ELIMINABLE_REGS' is
998 defined, and will usually be the constant 1, since most of the
999 cases preventing register elimination are things that the compiler
1000 already knows about. */
1002 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
1003 OFFSET = initial_elimination_offset (FROM, TO)
1004 /* This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'. It
1005 specifies the initial difference between the specified pair of
1006 registers. This macro must be defined if `ELIMINABLE_REGS' is
1007 defined. */
1009 #define RETURN_ADDR_RTX(count, x) \
1010 gen_rtx_MEM (Pmode, memory_address (Pmode, plus_constant (tem, 1)))
1012 #define PUSH_ROUNDING(NPUSHED) (NPUSHED)
1013 /* A C expression that is the number of bytes actually pushed onto the
1014 stack when an instruction attempts to push NPUSHED bytes.
1016 If the target machine does not have a push instruction, do not
1017 define this macro. That directs GCC to use an alternate
1018 strategy: to allocate the entire argument block and then store the
1019 arguments into it.
1021 On some machines, the definition
1023 #define PUSH_ROUNDING(BYTES) (BYTES)
1025 will suffice. But on other machines, instructions that appear to
1026 push one byte actually push two bytes in an attempt to maintain
1027 alignment. Then the definition should be
1029 #define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & ~1) */
1031 #define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, STACK_SIZE) 0
1032 /* A C expression that should indicate the number of bytes of its own
1033 arguments that a function pops on returning, or 0 if the function
1034 pops no arguments and the caller must therefore pop them all after
1035 the function returns.
1037 FUNDECL is a C variable whose value is a tree node that describes
1038 the function in question. Normally it is a node of type
1039 `FUNCTION_DECL' that describes the declaration of the function.
1040 From this you can obtain the DECL_ATTRIBUTES of the
1041 function.
1043 FUNTYPE is a C variable whose value is a tree node that describes
1044 the function in question. Normally it is a node of type
1045 `FUNCTION_TYPE' that describes the data type of the function.
1046 From this it is possible to obtain the data types of the value and
1047 arguments (if known).
1049 When a call to a library function is being considered, FUNDECL
1050 will contain an identifier node for the library function. Thus, if
1051 you need to distinguish among various library functions, you can
1052 do so by their names. Note that "library function" in this
1053 context means a function used to perform arithmetic, whose name is
1054 known specially in the compiler and was not mentioned in the C
1055 code being compiled.
1057 STACK-SIZE is the number of bytes of arguments passed on the
1058 stack. If a variable number of bytes is passed, it is zero, and
1059 argument popping will always be the responsibility of the calling
1060 function.
1062 On the VAX, all functions always pop their arguments, so the
1063 definition of this macro is STACK-SIZE. On the 68000, using the
1064 standard calling convention, no functions pop their arguments, so
1065 the value of the macro is always 0 in this case. But an
1066 alternative calling convention is available in which functions
1067 that take a fixed number of arguments pop them but other functions
1068 (such as `printf') pop nothing (the caller pops all). When this
1069 convention is in use, FUNTYPE is examined to determine whether a
1070 function takes a fixed number of arguments. */
1072 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) (function_arg (&(CUM), MODE, TYPE, NAMED))
1073 /* A C expression that controls whether a function argument is passed
1074 in a register, and which register.
1076 The arguments are CUM, which summarizes all the previous
1077 arguments; MODE, the machine mode of the argument; TYPE, the data
1078 type of the argument as a tree node or 0 if that is not known
1079 (which happens for C support library functions); and NAMED, which
1080 is 1 for an ordinary argument and 0 for nameless arguments that
1081 correspond to `...' in the called function's prototype.
1083 The value of the expression is usually either a `reg' RTX for the
1084 hard register in which to pass the argument, or zero to pass the
1085 argument on the stack.
1087 For machines like the VAX and 68000, where normally all arguments
1088 are pushed, zero suffices as a definition.
1090 The value of the expression can also be a `parallel' RTX. This is
1091 used when an argument is passed in multiple locations. The mode
1092 of the of the `parallel' should be the mode of the entire
1093 argument. The `parallel' holds any number of `expr_list' pairs;
1094 each one describes where part of the argument is passed. In each
1095 `expr_list', the first operand can be either a `reg' RTX for the
1096 hard register in which to pass this part of the argument, or zero
1097 to pass the argument on the stack. If this operand is a `reg',
1098 then the mode indicates how large this part of the argument is.
1099 The second operand of the `expr_list' is a `const_int' which gives
1100 the offset in bytes into the entire argument where this part
1101 starts.
1103 The usual way to make the ANSI library `stdarg.h' work on a machine
1104 where some arguments are usually passed in registers, is to cause
1105 nameless arguments to be passed on the stack instead. This is done
1106 by making `FUNCTION_ARG' return 0 whenever NAMED is 0.
1108 You may use the macro `MUST_PASS_IN_STACK (MODE, TYPE)' in the
1109 definition of this macro to determine if this argument is of a
1110 type that must be passed in the stack. If `REG_PARM_STACK_SPACE'
1111 is not defined and `FUNCTION_ARG' returns nonzero for such an
1112 argument, the compiler will abort. If `REG_PARM_STACK_SPACE' is
1113 defined, the argument will be computed in the stack and then
1114 loaded into a register. */
1116 typedef struct avr_args {
1117 int nregs; /* # registers available for passing */
1118 int regno; /* next available register number */
1119 } CUMULATIVE_ARGS;
1120 /* A C type for declaring a variable that is used as the first
1121 argument of `FUNCTION_ARG' and other related values. For some
1122 target machines, the type `int' suffices and can hold the number
1123 of bytes of argument so far.
1125 There is no need to record in `CUMULATIVE_ARGS' anything about the
1126 arguments that have been passed on the stack. The compiler has
1127 other variables to keep track of that. For target machines on
1128 which all arguments are passed on the stack, there is no need to
1129 store anything in `CUMULATIVE_ARGS'; however, the data structure
1130 must exist and should not be empty, so use `int'. */
1132 #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, FNDECL) init_cumulative_args (&(CUM), FNTYPE, LIBNAME, FNDECL)
1134 /* A C statement (sans semicolon) for initializing the variable CUM
1135 for the state at the beginning of the argument list. The variable
1136 has type `CUMULATIVE_ARGS'. The value of FNTYPE is the tree node
1137 for the data type of the function which will receive the args, or 0
1138 if the args are to a compiler support library function. The value
1139 of INDIRECT is nonzero when processing an indirect call, for
1140 example a call through a function pointer. The value of INDIRECT
1141 is zero for a call to an explicitly named function, a library
1142 function call, or when `INIT_CUMULATIVE_ARGS' is used to find
1143 arguments for the function being compiled.
1145 When processing a call to a compiler support library function,
1146 LIBNAME identifies which one. It is a `symbol_ref' rtx which
1147 contains the name of the function, as a string. LIBNAME is 0 when
1148 an ordinary C function call is being processed. Thus, each time
1149 this macro is called, either LIBNAME or FNTYPE is nonzero, but
1150 never both of them at once. */
1152 #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
1153 (function_arg_advance (&CUM, MODE, TYPE, NAMED))
1155 /* A C statement (sans semicolon) to update the summarizer variable
1156 CUM to advance past an argument in the argument list. The values
1157 MODE, TYPE and NAMED describe that argument. Once this is done,
1158 the variable CUM is suitable for analyzing the *following*
1159 argument with `FUNCTION_ARG', etc.
1161 This macro need not do anything if the argument in question was
1162 passed on the stack. The compiler knows how to track the amount
1163 of stack space used for arguments without any special help. */
1165 #define FUNCTION_ARG_REGNO_P(r) function_arg_regno_p(r)
1166 /* A C expression that is nonzero if REGNO is the number of a hard
1167 register in which function arguments are sometimes passed. This
1168 does *not* include implicit arguments such as the static chain and
1169 the structure-value address. On many machines, no registers can be
1170 used for this purpose since all function arguments are pushed on
1171 the stack. */
1173 extern int avr_reg_order[];
1175 #define RET_REGISTER avr_ret_register ()
1177 #define FUNCTION_VALUE(VALTYPE, FUNC) avr_function_value (VALTYPE, FUNC)
1178 /* A C expression to create an RTX representing the place where a
1179 function returns a value of data type VALTYPE. VALTYPE is a tree
1180 node representing a data type. Write `TYPE_MODE (VALTYPE)' to get
1181 the machine mode used to represent that type. On many machines,
1182 only the mode is relevant. (Actually, on most machines, scalar
1183 values are returned in the same place regardless of mode).
1185 The value of the expression is usually a `reg' RTX for the hard
1186 register where the return value is stored. The value can also be a
1187 `parallel' RTX, if the return value is in multiple places. See
1188 `FUNCTION_ARG' for an explanation of the `parallel' form.
1190 If `PROMOTE_FUNCTION_RETURN' is defined, you must apply the same
1191 promotion rules specified in `PROMOTE_MODE' if VALTYPE is a scalar
1192 type.
1194 If the precise function being called is known, FUNC is a tree node
1195 (`FUNCTION_DECL') for it; otherwise, FUNC is a null pointer. This
1196 makes it possible to use a different value-returning convention
1197 for specific functions when all their calls are known.
1199 `FUNCTION_VALUE' is not used for return vales with aggregate data
1200 types, because these are returned in another way. See
1201 `STRUCT_VALUE_REGNUM' and related macros, below. */
1203 #define LIBCALL_VALUE(MODE) avr_libcall_value (MODE)
1204 /* A C expression to create an RTX representing the place where a
1205 library function returns a value of mode MODE. If the precise
1206 function being called is known, FUNC is a tree node
1207 (`FUNCTION_DECL') for it; otherwise, FUNC is a null pointer. This
1208 makes it possible to use a different value-returning convention
1209 for specific functions when all their calls are known.
1211 Note that "library function" in this context means a compiler
1212 support routine, used to perform arithmetic, whose name is known
1213 specially by the compiler and was not mentioned in the C code being
1214 compiled.
1216 The definition of `LIBRARY_VALUE' need not be concerned aggregate
1217 data types, because none of the library functions returns such
1218 types. */
1220 #define FUNCTION_VALUE_REGNO_P(N) ((int) (N) == RET_REGISTER)
1221 /* A C expression that is nonzero if REGNO is the number of a hard
1222 register in which the values of called function may come back.
1224 A register whose use for returning values is limited to serving as
1225 the second of a pair (for a value of type `double', say) need not
1226 be recognized by this macro. So for most machines, this definition
1227 suffices:
1229 #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
1231 If the machine has register windows, so that the caller and the
1232 called function use different registers for the return value, this
1233 macro should recognize only the caller's register numbers. */
1235 #define RETURN_IN_MEMORY(TYPE) ((TYPE_MODE (TYPE) == BLKmode) \
1236 ? int_size_in_bytes (TYPE) > 8 \
1237 : 0)
1238 /* A C expression which can inhibit the returning of certain function
1239 values in registers, based on the type of value. A nonzero value
1240 says to return the function value in memory, just as large
1241 structures are always returned. Here TYPE will be a C expression
1242 of type `tree', representing the data type of the value.
1244 Note that values of mode `BLKmode' must be explicitly handled by
1245 this macro. Also, the option `-fpcc-struct-return' takes effect
1246 regardless of this macro. On most systems, it is possible to
1247 leave the macro undefined; this causes a default definition to be
1248 used, whose value is the constant 1 for `BLKmode' values, and 0
1249 otherwise.
1251 Do not use this macro to indicate that structures and unions
1252 should always be returned in memory. You should instead use
1253 `DEFAULT_PCC_STRUCT_RETURN' to indicate this. */
1255 #define DEFAULT_PCC_STRUCT_RETURN 0
1256 /* Define this macro to be 1 if all structure and union return values
1257 must be in memory. Since this results in slower code, this should
1258 be defined only if needed for compatibility with other compilers
1259 or with an ABI. If you define this macro to be 0, then the
1260 conventions used for structure and union return values are decided
1261 by the `RETURN_IN_MEMORY' macro.
1263 If not defined, this defaults to the value 1. */
1265 #define STRUCT_VALUE 0
1266 /* If the structure value address is not passed in a register, define
1267 `STRUCT_VALUE' as an expression returning an RTX for the place
1268 where the address is passed. If it returns 0, the address is
1269 passed as an "invisible" first argument. */
1271 #define STRUCT_VALUE_INCOMING 0
1272 /* If the incoming location is not a register, then you should define
1273 `STRUCT_VALUE_INCOMING' as an expression for an RTX for where the
1274 called function should find the value. If it should find the
1275 value on the stack, define this to create a `mem' which refers to
1276 the frame pointer. A definition of 0 means that the address is
1277 passed as an "invisible" first argument. */
1279 #define EPILOGUE_USES(REGNO) 0
1280 /* Define this macro as a C expression that is nonzero for registers
1281 are used by the epilogue or the `return' pattern. The stack and
1282 frame pointer registers are already be assumed to be used as
1283 needed. */
1285 #define STRICT_ARGUMENT_NAMING 1
1286 /* Define this macro if the location where a function argument is
1287 passed depends on whether or not it is a named argument.
1289 This macro controls how the NAMED argument to `FUNCTION_ARG' is
1290 set for varargs and stdarg functions. With this macro defined,
1291 the NAMED argument is always true for named arguments, and false
1292 for unnamed arguments. If this is not defined, but
1293 `SETUP_INCOMING_VARARGS' is defined, then all arguments are
1294 treated as named. Otherwise, all named arguments except the last
1295 are treated as named. */
1298 #define HAVE_POST_INCREMENT 1
1299 /* Define this macro if the machine supports post-increment
1300 addressing. */
1302 #define HAVE_PRE_DECREMENT 1
1303 /* Similar for other kinds of addressing. */
1305 #define CONSTANT_ADDRESS_P(X) CONSTANT_P (X)
1306 /* A C expression that is 1 if the RTX X is a constant which is a
1307 valid address. On most machines, this can be defined as
1308 `CONSTANT_P (X)', but a few machines are more restrictive in which
1309 constant addresses are supported.
1311 `CONSTANT_P' accepts integer-values expressions whose values are
1312 not explicitly known, such as `symbol_ref', `label_ref', and
1313 `high' expressions and `const' arithmetic expressions, in addition
1314 to `const_int' and `const_double' expressions. */
1316 #define MAX_REGS_PER_ADDRESS 1
1317 /* A number, the maximum number of registers that can appear in a
1318 valid memory address. Note that it is up to you to specify a
1319 value equal to the maximum number that `GO_IF_LEGITIMATE_ADDRESS'
1320 would ever accept. */
1322 #ifdef REG_OK_STRICT
1323 # define GO_IF_LEGITIMATE_ADDRESS(mode, operand, ADDR) \
1325 if (legitimate_address_p (mode, operand, 1)) \
1326 goto ADDR; \
1328 # else
1329 # define GO_IF_LEGITIMATE_ADDRESS(mode, operand, ADDR) \
1331 if (legitimate_address_p (mode, operand, 0)) \
1332 goto ADDR; \
1334 #endif
1335 /* A C compound statement with a conditional `goto LABEL;' executed
1336 if X (an RTX) is a legitimate memory address on the target machine
1337 for a memory operand of mode MODE. */
1339 /* `REG_OK_FOR_BASE_P (X)'
1340 A C expression that is nonzero if X (assumed to be a `reg' RTX) is
1341 valid for use as a base register. For hard registers, it should
1342 always accept those which the hardware permits and reject the
1343 others. Whether the macro accepts or rejects pseudo registers
1344 must be controlled by `REG_OK_STRICT' as described above. This
1345 usually requires two variant definitions, of which `REG_OK_STRICT'
1346 controls the one actually used. */
1348 #define REG_OK_FOR_BASE_NOSTRICT_P(X) \
1349 (REGNO (X) >= FIRST_PSEUDO_REGISTER || REG_OK_FOR_BASE_STRICT_P(X))
1351 #define REG_OK_FOR_BASE_STRICT_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
1353 #ifdef REG_OK_STRICT
1354 # define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_STRICT_P (X)
1355 #else
1356 # define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_NOSTRICT_P (X)
1357 #endif
1359 /* A C expression that is just like `REG_OK_FOR_BASE_P', except that
1360 that expression may examine the mode of the memory reference in
1361 MODE. You should define this macro if the mode of the memory
1362 reference affects whether a register may be used as a base
1363 register. If you define this macro, the compiler will use it
1364 instead of `REG_OK_FOR_BASE_P'. */
1365 #define REG_OK_FOR_INDEX_P(X) 0
1366 /* A C expression that is nonzero if X (assumed to be a `reg' RTX) is
1367 valid for use as an index register.
1369 The difference between an index register and a base register is
1370 that the index register may be scaled. If an address involves the
1371 sum of two registers, neither one of them scaled, then either one
1372 may be labeled the "base" and the other the "index"; but whichever
1373 labeling is used must fit the machine's constraints of which
1374 registers may serve in each capacity. The compiler will try both
1375 labelings, looking for one that is valid, and will reload one or
1376 both registers only if neither labeling works. */
1378 #define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
1380 (X) = legitimize_address (X, OLDX, MODE); \
1381 if (memory_address_p (MODE, X)) \
1382 goto WIN; \
1384 /* A C compound statement that attempts to replace X with a valid
1385 memory address for an operand of mode MODE. WIN will be a C
1386 statement label elsewhere in the code; the macro definition may use
1388 GO_IF_LEGITIMATE_ADDRESS (MODE, X, WIN);
1390 to avoid further processing if the address has become legitimate.
1392 X will always be the result of a call to `break_out_memory_refs',
1393 and OLDX will be the operand that was given to that function to
1394 produce X.
1396 The code generated by this macro should not alter the substructure
1397 of X. If it transforms X into a more legitimate form, it should
1398 assign X (which will always be a C variable) a new value.
1400 It is not necessary for this macro to come up with a legitimate
1401 address. The compiler has standard ways of doing so in all cases.
1402 In fact, it is safe for this macro to do nothing. But often a
1403 machine-dependent strategy can generate better code. */
1405 #define XEXP_(X,Y) (X)
1406 #define LEGITIMIZE_RELOAD_ADDRESS(X, MODE, OPNUM, TYPE, IND_LEVELS, WIN) \
1407 do { \
1408 if (1&&(GET_CODE (X) == POST_INC || GET_CODE (X) == PRE_DEC)) \
1410 push_reload (XEXP (X,0), XEXP (X,0), &XEXP (X,0), &XEXP (X,0), \
1411 POINTER_REGS, GET_MODE (X),GET_MODE (X) , 0, 0, \
1412 OPNUM, RELOAD_OTHER); \
1413 goto WIN; \
1415 if (GET_CODE (X) == PLUS \
1416 && REG_P (XEXP (X, 0)) \
1417 && GET_CODE (XEXP (X, 1)) == CONST_INT \
1418 && INTVAL (XEXP (X, 1)) >= 1) \
1420 int fit = INTVAL (XEXP (X, 1)) <= (64 - GET_MODE_SIZE (MODE)); \
1421 if (fit) \
1423 if (reg_equiv_address[REGNO (XEXP (X, 0))] != 0) \
1425 int regno = REGNO (XEXP (X, 0)); \
1426 rtx mem = make_memloc (X, regno); \
1427 push_reload (XEXP (mem,0), NULL, &XEXP (mem,0), NULL, \
1428 POINTER_REGS, Pmode, VOIDmode, 0, 0, \
1429 1, ADDR_TYPE (TYPE)); \
1430 push_reload (mem, NULL_RTX, &XEXP (X, 0), NULL, \
1431 BASE_POINTER_REGS, GET_MODE (X), VOIDmode, 0, 0, \
1432 OPNUM, TYPE); \
1433 goto WIN; \
1435 push_reload (XEXP (X, 0), NULL_RTX, &XEXP (X, 0), NULL, \
1436 BASE_POINTER_REGS, GET_MODE (X), VOIDmode, 0, 0, \
1437 OPNUM, TYPE); \
1438 goto WIN; \
1440 else if (! (frame_pointer_needed && XEXP (X,0) == frame_pointer_rtx)) \
1442 push_reload (X, NULL_RTX, &X, NULL, \
1443 POINTER_REGS, GET_MODE (X), VOIDmode, 0, 0, \
1444 OPNUM, TYPE); \
1445 goto WIN; \
1448 } while(0)
1449 /* A C compound statement that attempts to replace X, which is an
1450 address that needs reloading, with a valid memory address for an
1451 operand of mode MODE. WIN will be a C statement label elsewhere
1452 in the code. It is not necessary to define this macro, but it
1453 might be useful for performance reasons.
1455 For example, on the i386, it is sometimes possible to use a single
1456 reload register instead of two by reloading a sum of two pseudo
1457 registers into a register. On the other hand, for number of RISC
1458 processors offsets are limited so that often an intermediate
1459 address needs to be generated in order to address a stack slot.
1460 By defining LEGITIMIZE_RELOAD_ADDRESS appropriately, the
1461 intermediate addresses generated for adjacent some stack slots can
1462 be made identical, and thus be shared.
1464 *Note*: This macro should be used with caution. It is necessary
1465 to know something of how reload works in order to effectively use
1466 this, and it is quite easy to produce macros that build in too
1467 much knowledge of reload internals.
1469 *Note*: This macro must be able to reload an address created by a
1470 previous invocation of this macro. If it fails to handle such
1471 addresses then the compiler may generate incorrect code or abort.
1473 The macro definition should use `push_reload' to indicate parts
1474 that need reloading; OPNUM, TYPE and IND_LEVELS are usually
1475 suitable to be passed unaltered to `push_reload'.
1477 The code generated by this macro must not alter the substructure of
1478 X. If it transforms X into a more legitimate form, it should
1479 assign X (which will always be a C variable) a new value. This
1480 also applies to parts that you change indirectly by calling
1481 `push_reload'.
1483 The macro definition may use `strict_memory_address_p' to test if
1484 the address has become legitimate.
1486 If you want to change only a part of X, one standard way of doing
1487 this is to use `copy_rtx'. Note, however, that is unshares only a
1488 single level of rtl. Thus, if the part to be changed is not at the
1489 top level, you'll need to replace first the top leve It is not
1490 necessary for this macro to come up with a legitimate address;
1491 but often a machine-dependent strategy can generate better code. */
1493 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) \
1494 if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == PRE_DEC) \
1495 goto LABEL
1496 /* A C statement or compound statement with a conditional `goto
1497 LABEL;' executed if memory address X (an RTX) can have different
1498 meanings depending on the machine mode of the memory reference it
1499 is used for or if the address is valid for some modes but not
1500 others.
1502 Autoincrement and autodecrement addresses typically have
1503 mode-dependent effects because the amount of the increment or
1504 decrement is the size of the operand being addressed. Some
1505 machines have other mode-dependent addresses. Many RISC machines
1506 have no mode-dependent addresses.
1508 You may assume that ADDR is a valid address for the machine. */
1510 #define LEGITIMATE_CONSTANT_P(X) 1
1511 /* A C expression that is nonzero if X is a legitimate constant for
1512 an immediate operand on the target machine. You can assume that X
1513 satisfies `CONSTANT_P', so you need not check this. In fact, `1'
1514 is a suitable definition for this macro on machines where anything
1515 `CONSTANT_P' is valid. */
1517 #define REGISTER_MOVE_COST(MODE, FROM, TO) ((FROM) == STACK_REG ? 6 \
1518 : (TO) == STACK_REG ? 12 \
1519 : 2)
1520 /* A C expression for the cost of moving data from a register in class
1521 FROM to one in class TO. The classes are expressed using the
1522 enumeration values such as `GENERAL_REGS'. A value of 2 is the
1523 default; other values are interpreted relative to that.
1525 It is not required that the cost always equal 2 when FROM is the
1526 same as TO; on some machines it is expensive to move between
1527 registers if they are not general registers.
1529 If reload sees an insn consisting of a single `set' between two
1530 hard registers, and if `REGISTER_MOVE_COST' applied to their
1531 classes returns a value of 2, reload does not check to ensure that
1532 the constraints of the insn are met. Setting a cost of other than
1533 2 will allow reload to verify that the constraints are met. You
1534 should do this if the `movM' pattern's constraints do not allow
1535 such copying. */
1537 #define MEMORY_MOVE_COST(MODE,CLASS,IN) ((MODE)==QImode ? 2 : \
1538 (MODE)==HImode ? 4 : \
1539 (MODE)==SImode ? 8 : \
1540 (MODE)==SFmode ? 8 : 16)
1541 /* A C expression for the cost of moving data of mode M between a
1542 register and memory. A value of 4 is the default; this cost is
1543 relative to those in `REGISTER_MOVE_COST'.
1545 If moving between registers and memory is more expensive than
1546 between two registers, you should define this macro to express the
1547 relative cost. */
1549 #define BRANCH_COST 0
1550 /* A C expression for the cost of a branch instruction. A value of 1
1551 is the default; other values are interpreted relative to that.
1553 Here are additional macros which do not specify precise relative
1554 costs, but only that certain actions are more expensive than GCC would
1555 ordinarily expect. */
1557 #define SLOW_BYTE_ACCESS 0
1558 /* Define this macro as a C expression which is nonzero if accessing
1559 less than a word of memory (i.e. a `char' or a `short') is no
1560 faster than accessing a word of memory, i.e., if such access
1561 require more than one instruction or if there is no difference in
1562 cost between byte and (aligned) word loads.
1564 When this macro is not defined, the compiler will access a field by
1565 finding the smallest containing object; when it is defined, a
1566 fullword load will be used if alignment permits. Unless bytes
1567 accesses are faster than word accesses, using word accesses is
1568 preferable since it may eliminate subsequent memory access if
1569 subsequent accesses occur to other fields in the same word of the
1570 structure, but to different bytes.
1572 `SLOW_UNALIGNED_ACCESS'
1573 Define this macro to be the value 1 if unaligned accesses have a
1574 cost many times greater than aligned accesses, for example if they
1575 are emulated in a trap handler.
1577 When this macro is nonzero, the compiler will act as if
1578 `STRICT_ALIGNMENT' were nonzero when generating code for block
1579 moves. This can cause significantly more instructions to be
1580 produced. Therefore, do not set this macro nonzero if unaligned
1581 accesses only add a cycle or two to the time for a memory access.
1583 If the value of this macro is always zero, it need not be defined.
1585 `MOVE_RATIO'
1586 The number of scalar move insns which should be generated instead
1587 of a string move insn or a library call. Increasing the value
1588 will always make code faster, but eventually incurs high cost in
1589 increased code size.
1591 If you don't define this, a reasonable default is used. */
1593 #define NO_FUNCTION_CSE
1594 /* Define this macro if it is as good or better to call a constant
1595 function address than to call an address kept in a register. */
1597 #define NO_RECURSIVE_FUNCTION_CSE
1598 /* Define this macro if it is as good or better for a function to call
1599 itself with an explicit address than to call an address kept in a
1600 register. */
1602 #define TEXT_SECTION_ASM_OP "\t.text"
1603 /* A C expression whose value is a string containing the assembler
1604 operation that should precede instructions and read-only data.
1605 Normally `"\t.text"' is right. */
1607 #define DATA_SECTION_ASM_OP "\t.data"
1608 /* A C expression whose value is a string containing the assembler
1609 operation to identify the following data as writable initialized
1610 data. Normally `"\t.data"' is right. */
1612 #define BSS_SECTION_ASM_OP "\t.section .bss"
1613 /* If defined, a C expression whose value is a string, including
1614 spacing, containing the assembler operation to identify the
1615 following data as uninitialized global data. If not defined, and
1616 neither `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined,
1617 uninitialized global data will be output in the data section if
1618 `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be
1619 used. */
1621 /* Define the pseudo-ops used to switch to the .ctors and .dtors sections.
1622 There are no shared libraries on this target, and these sections are
1623 placed in the read-only program memory, so they are not writable. */
1625 #undef CTORS_SECTION_ASM_OP
1626 #define CTORS_SECTION_ASM_OP "\t.section .ctors,\"a\",@progbits"
1628 #undef DTORS_SECTION_ASM_OP
1629 #define DTORS_SECTION_ASM_OP "\t.section .dtors,\"a\",@progbits"
1631 #define TARGET_ASM_CONSTRUCTOR avr_asm_out_ctor
1632 /* If defined, a function that outputs assembler code to arrange to
1633 call the function referenced by SYMBOL at initialization time. */
1635 #define TARGET_ASM_DESTRUCTOR avr_asm_out_dtor
1636 /* This is like `TARGET_ASM_CONSTRUCTOR' but used for termination
1637 functions rather than initialization functions. */
1639 #define EXTRA_SECTIONS in_progmem
1640 /* A list of names for sections other than the standard two, which are
1641 `in_text' and `in_data'. You need not define this macro on a
1642 system with no other sections (that GCC needs to use). */
1644 #define EXTRA_SECTION_FUNCTIONS \
1646 void \
1647 progmem_section (void) \
1649 if (in_section != in_progmem) \
1651 fprintf (asm_out_file, \
1652 "\t.section .progmem.gcc_sw_table, \"%s\", @progbits\n", \
1653 AVR_MEGA ? "a" : "ax"); \
1654 /* Should already be aligned, this is just to be safe if it isn't. */ \
1655 fprintf (asm_out_file, "\t.p2align 1\n"); \
1656 in_section = in_progmem; \
1659 /* `EXTRA_SECTION_FUNCTIONS'
1660 One or more functions to be defined in `varasm.c'. These
1661 functions should do jobs analogous to those of `text_section' and
1662 `data_section', for your additional sections. Do not define this
1663 macro if you do not define `EXTRA_SECTIONS'. */
1665 #define READONLY_DATA_SECTION data_section
1666 /* On most machines, read-only variables, constants, and jump tables
1667 are placed in the text section. If this is not the case on your
1668 machine, this macro should be defined to be the name of a function
1669 (either `data_section' or a function defined in `EXTRA_SECTIONS')
1670 that switches to the section to be used for read-only items.
1672 If these items should be placed in the text section, this macro
1673 should not be defined. */
1675 #define JUMP_TABLES_IN_TEXT_SECTION 0
1676 /* Define this macro if jump tables (for `tablejump' insns) should be
1677 output in the text section, along with the assembler instructions.
1678 Otherwise, the readonly data section is used.
1680 This macro is irrelevant if there is no separate readonly data
1681 section. */
1683 #define ASM_COMMENT_START " ; "
1684 /* A C string constant describing how to begin a comment in the target
1685 assembler language. The compiler assumes that the comment will
1686 end at the end of the line. */
1688 #define ASM_APP_ON "/* #APP */\n"
1689 /* A C string constant for text to be output before each `asm'
1690 statement or group of consecutive ones. Normally this is
1691 `"#APP"', which is a comment that has no effect on most assemblers
1692 but tells the GNU assembler that it must check the lines that
1693 follow for all valid assembler constructs. */
1695 #define ASM_APP_OFF "/* #NOAPP */\n"
1696 /* A C string constant for text to be output after each `asm'
1697 statement or group of consecutive ones. Normally this is
1698 `"#NO_APP"', which tells the GNU assembler to resume making the
1699 time-saving assumptions that are valid for ordinary compiler
1700 output. */
1702 #define ASM_OUTPUT_SOURCE_LINE(STREAM, LINE, COUNTER) \
1703 fprintf (STREAM,"/* line: %d */\n",LINE)
1704 /* A C statement to output DBX or SDB debugging information before
1705 code for line number LINE of the current source file to the stdio
1706 stream STREAM.
1708 This macro need not be defined if the standard form of debugging
1709 information for the debugger in use is appropriate. */
1711 /* Switch into a generic section. */
1712 #define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
1714 #define ASM_OUTPUT_ASCII(FILE, P, SIZE) gas_output_ascii (FILE,P,SIZE)
1715 /* `ASM_OUTPUT_ASCII (STREAM, PTR, LEN)'
1716 output_ascii (FILE, P, SIZE)
1717 A C statement to output to the stdio stream STREAM an assembler
1718 instruction to assemble a string constant containing the LEN bytes
1719 at PTR. PTR will be a C expression of type `char *' and LEN a C
1720 expression of type `int'.
1722 If the assembler has a `.ascii' pseudo-op as found in the Berkeley
1723 Unix assembler, do not define the macro `ASM_OUTPUT_ASCII'. */
1725 #define IS_ASM_LOGICAL_LINE_SEPARATOR(C) ((C) == '\n' \
1726 || ((C) == '$'))
1727 /* Define this macro as a C expression which is nonzero if C is used
1728 as a logical line separator by the assembler.
1730 If you do not define this macro, the default is that only the
1731 character `;' is treated as a logical line separator. */
1733 /* These macros are provided by `real.h' for writing the definitions of
1734 `ASM_OUTPUT_DOUBLE' and the like: */
1736 #define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED) \
1737 do { \
1738 fputs ("\t.comm ", (STREAM)); \
1739 assemble_name ((STREAM), (NAME)); \
1740 fprintf ((STREAM), ",%lu,1\n", (unsigned long)(SIZE)); \
1741 } while (0)
1742 /* A C statement (sans semicolon) to output to the stdio stream
1743 STREAM the assembler definition of a common-label named NAME whose
1744 size is SIZE bytes. The variable ROUNDED is the size rounded up
1745 to whatever alignment the caller wants.
1747 Use the expression `assemble_name (STREAM, NAME)' to output the
1748 name itself; before and after that, output the additional
1749 assembler syntax for defining the name, and a newline.
1751 This macro controls how the assembler definitions of uninitialized
1752 common global variables are output. */
1754 #define ASM_OUTPUT_BSS(FILE, DECL, NAME, SIZE, ROUNDED) \
1755 asm_output_bss ((FILE), (DECL), (NAME), (SIZE), (ROUNDED))
1756 /* A C statement (sans semicolon) to output to the stdio stream
1757 STREAM the assembler definition of uninitialized global DECL named
1758 NAME whose size is SIZE bytes. The variable ROUNDED is the size
1759 rounded up to whatever alignment the caller wants. */
1761 #define ASM_OUTPUT_LOCAL(STREAM, NAME, SIZE, ROUNDED) \
1762 do { \
1763 fputs ("\t.lcomm ", (STREAM)); \
1764 assemble_name ((STREAM), (NAME)); \
1765 fprintf ((STREAM), ",%d\n", (int)(SIZE)); \
1766 } while (0)
1767 /* A C statement (sans semicolon) to output to the stdio stream
1768 STREAM the assembler definition of a local-common-label named NAME
1769 whose size is SIZE bytes. The variable ROUNDED is the size
1770 rounded up to whatever alignment the caller wants.
1772 Use the expression `assemble_name (STREAM, NAME)' to output the
1773 name itself; before and after that, output the additional
1774 assembler syntax for defining the name, and a newline.
1776 This macro controls how the assembler definitions of uninitialized
1777 static variables are output. */
1779 #undef TYPE_ASM_OP
1780 #undef SIZE_ASM_OP
1781 #undef WEAK_ASM_OP
1782 #define TYPE_ASM_OP "\t.type\t"
1783 #define SIZE_ASM_OP "\t.size\t"
1784 #define WEAK_ASM_OP "\t.weak\t"
1785 /* Define the strings used for the special svr4 .type and .size directives.
1786 These strings generally do not vary from one system running svr4 to
1787 another, but if a given system (e.g. m88k running svr) needs to use
1788 different pseudo-op names for these, they may be overridden in the
1789 file which includes this one. */
1792 #undef TYPE_OPERAND_FMT
1793 #define TYPE_OPERAND_FMT "@%s"
1794 /* The following macro defines the format used to output the second
1795 operand of the .type assembler directive. Different svr4 assemblers
1796 expect various different forms for this operand. The one given here
1797 is just a default. You may need to override it in your machine-
1798 specific tm.h file (depending upon the particulars of your assembler). */
1800 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
1801 do { \
1802 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \
1803 ASM_OUTPUT_LABEL (FILE, NAME); \
1804 } while (0)
1806 /* A C statement (sans semicolon) to output to the stdio stream
1807 STREAM any text necessary for declaring the name NAME of a
1808 function which is being defined. This macro is responsible for
1809 outputting the label definition (perhaps using
1810 `ASM_OUTPUT_LABEL'). The argument DECL is the `FUNCTION_DECL'
1811 tree node representing the function.
1813 If this macro is not defined, then the function name is defined in
1814 the usual manner as a label (by means of `ASM_OUTPUT_LABEL'). */
1816 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
1817 do { \
1818 if (!flag_inhibit_size_directive) \
1819 ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME); \
1820 } while (0)
1821 /* A C statement (sans semicolon) to output to the stdio stream
1822 STREAM any text necessary for declaring the size of a function
1823 which is being defined. The argument NAME is the name of the
1824 function. The argument DECL is the `FUNCTION_DECL' tree node
1825 representing the function.
1827 If this macro is not defined, then the function size is not
1828 defined. */
1830 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
1831 do { \
1832 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
1833 size_directive_output = 0; \
1834 if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
1836 size_directive_output = 1; \
1837 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, \
1838 int_size_in_bytes (TREE_TYPE (DECL))); \
1840 ASM_OUTPUT_LABEL(FILE, NAME); \
1841 } while (0)
1842 /* A C statement (sans semicolon) to output to the stdio stream
1843 STREAM any text necessary for declaring the name NAME of an
1844 initialized variable which is being defined. This macro must
1845 output the label definition (perhaps using `ASM_OUTPUT_LABEL').
1846 The argument DECL is the `VAR_DECL' tree node representing the
1847 variable.
1849 If this macro is not defined, then the variable name is defined in
1850 the usual manner as a label (by means of `ASM_OUTPUT_LABEL'). */
1852 #undef ASM_FINISH_DECLARE_OBJECT
1853 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
1854 do { \
1855 const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
1856 HOST_WIDE_INT size; \
1857 if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
1858 && ! AT_END && TOP_LEVEL \
1859 && DECL_INITIAL (DECL) == error_mark_node \
1860 && !size_directive_output) \
1862 size_directive_output = 1; \
1863 size = int_size_in_bytes (TREE_TYPE (DECL)); \
1864 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size); \
1866 } while (0)
1868 /* A C statement (sans semicolon) to finish up declaring a variable
1869 name once the compiler has processed its initializer fully and
1870 thus has had a chance to determine the size of an array when
1871 controlled by an initializer. This is used on systems where it's
1872 necessary to declare something about the size of the object.
1874 If you don't define this macro, that is equivalent to defining it
1875 to do nothing. */
1878 #define ESCAPES \
1879 "\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\
1880 \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\
1881 \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\
1882 \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\
1883 \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\
1884 \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\
1885 \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\
1886 \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"
1887 /* A table of bytes codes used by the ASM_OUTPUT_ASCII and
1888 ASM_OUTPUT_LIMITED_STRING macros. Each byte in the table
1889 corresponds to a particular byte value [0..255]. For any
1890 given byte value, if the value in the corresponding table
1891 position is zero, the given character can be output directly.
1892 If the table value is 1, the byte must be output as a \ooo
1893 octal escape. If the tables value is anything else, then the
1894 byte value should be output as a \ followed by the value
1895 in the table. Note that we can use standard UN*X escape
1896 sequences for many control characters, but we don't use
1897 \a to represent BEL because some svr4 assemblers (e.g. on
1898 the i386) don't know about that. Also, we don't use \v
1899 since some versions of gas, such as 2.2 did not accept it. */
1901 #define STRING_LIMIT ((unsigned) 64)
1902 #define STRING_ASM_OP "\t.string\t"
1903 /* Some svr4 assemblers have a limit on the number of characters which
1904 can appear in the operand of a .string directive. If your assembler
1905 has such a limitation, you should define STRING_LIMIT to reflect that
1906 limit. Note that at least some svr4 assemblers have a limit on the
1907 actual number of bytes in the double-quoted string, and that they
1908 count each character in an escape sequence as one byte. Thus, an
1909 escape sequence like \377 would count as four bytes.
1911 If your target assembler doesn't support the .string directive, you
1912 should define this to zero. */
1914 /* Globalizing directive for a label. */
1915 #define GLOBAL_ASM_OP ".global\t"
1917 #define ASM_WEAKEN_LABEL(FILE, NAME) \
1918 do \
1920 fputs ("\t.weak\t", (FILE)); \
1921 assemble_name ((FILE), (NAME)); \
1922 fputc ('\n', (FILE)); \
1924 while (0)
1926 /* A C statement (sans semicolon) to output to the stdio stream
1927 STREAM some commands that will make the label NAME weak; that is,
1928 available for reference from other files but only used if no other
1929 definition is available. Use the expression `assemble_name
1930 (STREAM, NAME)' to output the name itself; before and after that,
1931 output the additional assembler syntax for making that name weak,
1932 and a newline.
1934 If you don't define this macro, GCC will not support weak
1935 symbols and you should not define the `SUPPORTS_WEAK' macro.
1938 #define SUPPORTS_WEAK 1
1939 /* A C expression which evaluates to true if the target supports weak
1940 symbols.
1942 If you don't define this macro, `defaults.h' provides a default
1943 definition. If `ASM_WEAKEN_LABEL' is defined, the default
1944 definition is `1'; otherwise, it is `0'. Define this macro if you
1945 want to control weak symbol support with a compiler flag such as
1946 `-melf'.
1948 `MAKE_DECL_ONE_ONLY'
1949 A C statement (sans semicolon) to mark DECL to be emitted as a
1950 public symbol such that extra copies in multiple translation units
1951 will be discarded by the linker. Define this macro if your object
1952 file format provides support for this concept, such as the `COMDAT'
1953 section flags in the Microsoft Windows PE/COFF format, and this
1954 support requires changes to DECL, such as putting it in a separate
1955 section.
1957 `SUPPORTS_WEAK'
1958 A C expression which evaluates to true if the target supports
1959 one-only semantics.
1961 If you don't define this macro, `varasm.c' provides a default
1962 definition. If `MAKE_DECL_ONE_ONLY' is defined, the default
1963 definition is `1'; otherwise, it is `0'. Define this macro if you
1964 want to control weak symbol support with a compiler flag, or if
1965 setting the `DECL_ONE_ONLY' flag is enough to mark a declaration to
1966 be emitted as one-only. */
1968 #define ASM_GENERATE_INTERNAL_LABEL(STRING, PREFIX, NUM) \
1969 sprintf (STRING, "*.%s%lu", PREFIX, (unsigned long)(NUM))
1970 /* A C statement to store into the string STRING a label whose name
1971 is made from the string PREFIX and the number NUM.
1973 This string, when output subsequently by `assemble_name', should
1974 produce the output that `(*targetm.asm_out.internal_label)' would produce
1975 with the same PREFIX and NUM.
1977 If the string begins with `*', then `assemble_name' will output
1978 the rest of the string unchanged. It is often convenient for
1979 `ASM_GENERATE_INTERNAL_LABEL' to use `*' in this way. If the
1980 string doesn't start with `*', then `ASM_OUTPUT_LABELREF' gets to
1981 output the string, and may change it. (Of course,
1982 `ASM_OUTPUT_LABELREF' is also part of your machine description, so
1983 you should know what it does on your machine.) */
1985 /* `ASM_OUTPUT_WEAK_ALIAS (STREAM, NAME, VALUE)'
1986 A C statement to output to the stdio stream STREAM assembler code
1987 which defines (equates) the weak symbol NAME to have the value
1988 VALUE.
1990 Define this macro if the target only supports weak aliases; define
1991 ASM_OUTPUT_DEF instead if possible. */
1993 #define HAS_INIT_SECTION 1
1994 /* If defined, `main' will not call `__main' as described above.
1995 This macro should be defined for systems that control the contents
1996 of the init section on a symbol-by-symbol basis, such as OSF/1,
1997 and should not be defined explicitly for systems that support
1998 `INIT_SECTION_ASM_OP'. */
2000 #define REGISTER_NAMES { \
2001 "r0","r1","r2","r3","r4","r5","r6","r7", \
2002 "r8","r9","r10","r11","r12","r13","r14","r15", \
2003 "r16","r17","r18","r19","r20","r21","r22","r23", \
2004 "r24","r25","r26","r27","r28","r29","r30","r31", \
2005 "__SPL__","__SPH__","argL","argH"}
2006 /* A C initializer containing the assembler's names for the machine
2007 registers, each one as a C string constant. This is what
2008 translates register numbers in the compiler into assembler
2009 language. */
2011 #define FINAL_PRESCAN_INSN(insn, operand, nop) final_prescan_insn (insn, operand,nop)
2012 /* If defined, a C statement to be executed just prior to the output
2013 of assembler code for INSN, to modify the extracted operands so
2014 they will be output differently.
2016 Here the argument OPVEC is the vector containing the operands
2017 extracted from INSN, and NOPERANDS is the number of elements of
2018 the vector which contain meaningful data for this insn. The
2019 contents of this vector are what will be used to convert the insn
2020 template into assembler code, so you can change the assembler
2021 output by changing the contents of the vector.
2023 This macro is useful when various assembler syntaxes share a single
2024 file of instruction patterns; by defining this macro differently,
2025 you can cause a large class of instructions to be output
2026 differently (such as with rearranged operands). Naturally,
2027 variations in assembler syntax affecting individual insn patterns
2028 ought to be handled by writing conditional output routines in
2029 those patterns.
2031 If this macro is not defined, it is equivalent to a null statement. */
2033 #define PRINT_OPERAND(STREAM, X, CODE) print_operand (STREAM, X, CODE)
2034 /* A C compound statement to output to stdio stream STREAM the
2035 assembler syntax for an instruction operand X. X is an RTL
2036 expression.
2038 CODE is a value that can be used to specify one of several ways of
2039 printing the operand. It is used when identical operands must be
2040 printed differently depending on the context. CODE comes from the
2041 `%' specification that was used to request printing of the
2042 operand. If the specification was just `%DIGIT' then CODE is 0;
2043 if the specification was `%LTR DIGIT' then CODE is the ASCII code
2044 for LTR.
2046 If X is a register, this macro should print the register's name.
2047 The names can be found in an array `reg_names' whose type is `char
2048 *[]'. `reg_names' is initialized from `REGISTER_NAMES'.
2050 When the machine description has a specification `%PUNCT' (a `%'
2051 followed by a punctuation character), this macro is called with a
2052 null pointer for X and the punctuation character for CODE. */
2054 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) ((CODE) == '~')
2055 /* A C expression which evaluates to true if CODE is a valid
2056 punctuation character for use in the `PRINT_OPERAND' macro. If
2057 `PRINT_OPERAND_PUNCT_VALID_P' is not defined, it means that no
2058 punctuation characters (except for the standard one, `%') are used
2059 in this way. */
2061 #define PRINT_OPERAND_ADDRESS(STREAM, X) print_operand_address(STREAM, X)
2062 /* A C compound statement to output to stdio stream STREAM the
2063 assembler syntax for an instruction operand that is a memory
2064 reference whose address is X. X is an RTL expression. */
2066 #define USER_LABEL_PREFIX ""
2067 /* `LOCAL_LABEL_PREFIX'
2068 `REGISTER_PREFIX'
2069 `IMMEDIATE_PREFIX'
2070 If defined, C string expressions to be used for the `%R', `%L',
2071 `%U', and `%I' options of `asm_fprintf' (see `final.c'). These
2072 are useful when a single `md' file must support multiple assembler
2073 formats. In that case, the various `tm.h' files can define these
2074 macros differently. */
2076 #define ASSEMBLER_DIALECT AVR_ENHANCED
2077 /* If your target supports multiple dialects of assembler language
2078 (such as different opcodes), define this macro as a C expression
2079 that gives the numeric index of the assembler language dialect to
2080 use, with zero as the first variant.
2082 If this macro is defined, you may use constructs of the form
2083 `{option0|option1|option2...}' in the output templates of patterns
2084 (*note Output Template::.) or in the first argument of
2085 `asm_fprintf'. This construct outputs `option0', `option1' or
2086 `option2', etc., if the value of `ASSEMBLER_DIALECT' is zero, one
2087 or two, etc. Any special characters within these strings retain
2088 their usual meaning.
2090 If you do not define this macro, the characters `{', `|' and `}'
2091 do not have any special meaning when used in templates or operands
2092 to `asm_fprintf'.
2094 Define the macros `REGISTER_PREFIX', `LOCAL_LABEL_PREFIX',
2095 `USER_LABEL_PREFIX' and `IMMEDIATE_PREFIX' if you can express the
2096 variations in assembler language syntax with that mechanism.
2097 Define `ASSEMBLER_DIALECT' and use the `{option0|option1}' syntax
2098 if the syntax variant are larger and involve such things as
2099 different opcodes or operand order. */
2101 #define ASM_OUTPUT_REG_PUSH(STREAM, REGNO) \
2103 if (REGNO > 31) \
2104 abort (); \
2105 fprintf (STREAM, "\tpush\tr%d", REGNO); \
2107 /* A C expression to output to STREAM some assembler code which will
2108 push hard register number REGNO onto the stack. The code need not
2109 be optimal, since this macro is used only when profiling. */
2111 #define ASM_OUTPUT_REG_POP(STREAM, REGNO) \
2113 if (REGNO > 31) \
2114 abort (); \
2115 fprintf (STREAM, "\tpop\tr%d", REGNO); \
2117 /* A C expression to output to STREAM some assembler code which will
2118 pop hard register number REGNO off of the stack. The code need
2119 not be optimal, since this macro is used only when profiling. */
2121 #define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \
2122 avr_output_addr_vec_elt(STREAM, VALUE)
2123 /* This macro should be provided on machines where the addresses in a
2124 dispatch table are absolute.
2126 The definition should be a C statement to output to the stdio
2127 stream STREAM an assembler pseudo-instruction to generate a
2128 reference to a label. VALUE is the number of an internal label
2129 whose definition is output using `(*targetm.asm_out.internal_label)'. For
2130 example,
2132 fprintf (STREAM, "\t.word L%d\n", VALUE) */
2134 #define ASM_OUTPUT_CASE_LABEL(STREAM, PREFIX, NUM, TABLE) \
2135 progmem_section (), (*targetm.asm_out.internal_label) (STREAM, PREFIX, NUM)
2137 /* `ASM_OUTPUT_CASE_LABEL (STREAM, PREFIX, NUM, TABLE)'
2138 Define this if the label before a jump-table needs to be output
2139 specially. The first three arguments are the same as for
2140 `(*targetm.asm_out.internal_label)'; the fourth argument is the jump-table
2141 which follows (a `jump_insn' containing an `addr_vec' or
2142 `addr_diff_vec').
2144 This feature is used on system V to output a `swbeg' statement for
2145 the table.
2147 If this macro is not defined, these labels are output with
2148 `(*targetm.asm_out.internal_label)'. */
2150 /* `ASM_OUTPUT_CASE_END (STREAM, NUM, TABLE)'
2151 Define this if something special must be output at the end of a
2152 jump-table. The definition should be a C statement to be executed
2153 after the assembler code for the table is written. It should write
2154 the appropriate code to stdio stream STREAM. The argument TABLE
2155 is the jump-table insn, and NUM is the label-number of the
2156 preceding label.
2158 If this macro is not defined, nothing special is output at the end
2159 of the jump-table. */
2161 #define ASM_OUTPUT_SKIP(STREAM, N) \
2162 fprintf (STREAM, "\t.skip %lu,0\n", (unsigned long)(N))
2163 /* A C statement to output to the stdio stream STREAM an assembler
2164 instruction to advance the location counter by NBYTES bytes.
2165 Those bytes should be zero when loaded. NBYTES will be a C
2166 expression of type `int'. */
2168 #define ASM_OUTPUT_ALIGN(STREAM, POWER)
2169 /* A C statement to output to the stdio stream STREAM an assembler
2170 command to advance the location counter to a multiple of 2 to the
2171 POWER bytes. POWER will be a C expression of type `int'. */
2173 #define CASE_VECTOR_MODE HImode
2174 /* An alias for a machine mode name. This is the machine mode that
2175 elements of a jump-table should have. */
2177 extern int avr_case_values_threshold;
2179 #define CASE_VALUES_THRESHOLD avr_case_values_threshold
2180 /* `CASE_VALUES_THRESHOLD'
2181 Define this to be the smallest number of different values for
2182 which it is best to use a jump-table instead of a tree of
2183 conditional branches. The default is four for machines with a
2184 `casesi' instruction and five otherwise. This is best for most
2185 machines. */
2187 #undef WORD_REGISTER_OPERATIONS
2188 /* Define this macro if operations between registers with integral
2189 mode smaller than a word are always performed on the entire
2190 register. Most RISC machines have this property and most CISC
2191 machines do not. */
2193 #define MOVE_MAX 4
2194 /* The maximum number of bytes that a single instruction can move
2195 quickly between memory and registers or between two memory
2196 locations. */
2198 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
2199 /* A C expression which is nonzero if on this machine it is safe to
2200 "convert" an integer of INPREC bits to one of OUTPREC bits (where
2201 OUTPREC is smaller than INPREC) by merely operating on it as if it
2202 had only OUTPREC bits.
2204 On many machines, this expression can be 1.
2206 When `TRULY_NOOP_TRUNCATION' returns 1 for a pair of sizes for
2207 modes for which `MODES_TIEABLE_P' is 0, suboptimal code can result.
2208 If this is the case, making `TRULY_NOOP_TRUNCATION' return 0 in
2209 such cases may improve things. */
2211 #define Pmode HImode
2212 /* An alias for the machine mode for pointers. On most machines,
2213 define this to be the integer mode corresponding to the width of a
2214 hardware pointer; `SImode' on 32-bit machine or `DImode' on 64-bit
2215 machines. On some machines you must define this to be one of the
2216 partial integer modes, such as `PSImode'.
2218 The width of `Pmode' must be at least as large as the value of
2219 `POINTER_SIZE'. If it is not equal, you must define the macro
2220 `POINTERS_EXTEND_UNSIGNED' to specify how pointers are extended to
2221 `Pmode'. */
2223 #define FUNCTION_MODE HImode
2224 /* An alias for the machine mode used for memory references to
2225 functions being called, in `call' RTL expressions. On most
2226 machines this should be `QImode'. */
2227 /* 1 3 */
2228 #define INTEGRATE_THRESHOLD(DECL) (1 + (3 * list_length (DECL_ARGUMENTS (DECL)) / 2))
2230 /* A C expression for the maximum number of instructions above which
2231 the function DECL should not be inlined. DECL is a
2232 `FUNCTION_DECL' node.
2234 The default definition of this macro is 64 plus 8 times the number
2235 of arguments that the function accepts. Some people think a larger
2236 threshold should be used on RISC machines. */
2238 #define DOLLARS_IN_IDENTIFIERS 0
2239 /* Define this macro to control use of the character `$' in identifier
2240 names. 0 means `$' is not allowed by default; 1 means it is
2241 allowed. 1 is the default; there is no need to define this macro
2242 in that case. This macro controls the compiler proper; it does
2243 not affect the preprocessor. */
2245 #define NO_DOLLAR_IN_LABEL 1
2246 /* Define this macro if the assembler does not accept the character
2247 `$' in label names. By default constructors and destructors in
2248 G++ have `$' in the identifiers. If this macro is defined, `.' is
2249 used instead. */
2251 #define GIV_SORT_CRITERION(X, Y) \
2252 if (GET_CODE ((X)->add_val) == CONST_INT \
2253 && GET_CODE ((Y)->add_val) == CONST_INT) \
2254 return INTVAL ((X)->add_val) - INTVAL ((Y)->add_val);
2256 /* `GIV_SORT_CRITERION(GIV1, GIV2)'
2257 In some cases, the strength reduction optimization pass can
2258 produce better code if this is defined. This macro controls the
2259 order that induction variables are combined. This macro is
2260 particularly useful if the target has limited addressing modes.
2261 For instance, the SH target has only positive offsets in
2262 addresses. Thus sorting to put the smallest address first allows
2263 the most combinations to be found. */
2265 #define TRAMPOLINE_TEMPLATE(FILE) \
2266 internal_error ("trampolines not supported")
2268 /* Length in units of the trampoline for entering a nested function. */
2270 #define TRAMPOLINE_SIZE 4
2272 /* Emit RTL insns to initialize the variable parts of a trampoline.
2273 FNADDR is an RTX for the address of the function's pure code.
2274 CXT is an RTX for the static chain value for the function. */
2276 #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
2278 emit_move_insn (gen_rtx (MEM, HImode, plus_constant ((TRAMP), 2)), CXT); \
2279 emit_move_insn (gen_rtx (MEM, HImode, plus_constant ((TRAMP), 6)), FNADDR); \
2281 /* Store in cc_status the expressions
2282 that the condition codes will describe
2283 after execution of an instruction whose pattern is EXP.
2284 Do not alter them if the instruction would not alter the cc's. */
2286 #define NOTICE_UPDATE_CC(EXP, INSN) notice_update_cc(EXP, INSN)
2288 /* The add insns don't set overflow in a usable way. */
2289 #define CC_OVERFLOW_UNUSABLE 01000
2290 /* The mov,and,or,xor insns don't set carry. That's ok though as the
2291 Z bit is all we need when doing unsigned comparisons on the result of
2292 these insns (since they're always with 0). However, conditions.h has
2293 CC_NO_OVERFLOW defined for this purpose. Rename it to something more
2294 understandable. */
2295 #define CC_NO_CARRY CC_NO_OVERFLOW
2298 /* Output assembler code to FILE to increment profiler label # LABELNO
2299 for profiling a function entry. */
2301 #define FUNCTION_PROFILER(FILE, LABELNO) \
2302 fprintf (FILE, "/* profiler %d */", (LABELNO))
2304 /* `FIRST_INSN_ADDRESS'
2305 When the `length' insn attribute is used, this macro specifies the
2306 value to be assigned to the address of the first insn in a
2307 function. If not specified, 0 is used. */
2309 #define ADJUST_INSN_LENGTH(INSN, LENGTH) (LENGTH =\
2310 adjust_insn_length (INSN, LENGTH))
2311 /* If defined, modifies the length assigned to instruction INSN as a
2312 function of the context in which it is used. LENGTH is an lvalue
2313 that contains the initially computed length of the insn and should
2314 be updated with the correct length of the insn. If updating is
2315 required, INSN must not be a varying-length insn.
2317 This macro will normally not be required. A case in which it is
2318 required is the ROMP. On this machine, the size of an `addr_vec'
2319 insn must be increased by two to compensate for the fact that
2320 alignment may be required. */
2322 #define TARGET_MEM_FUNCTIONS
2323 /* Define this macro if GCC should generate calls to the System V
2324 (and ANSI C) library functions `memcpy' and `memset' rather than
2325 the BSD functions `bcopy' and `bzero'. */
2327 #define CPP_SPEC "%{posix:-D_POSIX_SOURCE}"
2329 /* A C string constant that tells the GCC driver program options to
2330 pass to CPP. It can also specify how to translate options you
2331 give to GCC into options for GCC to pass to the CPP.
2333 Do not define this macro if it does not need to do anything. */
2335 #define CC1_SPEC "%{profile:-p}"
2336 /* A C string constant that tells the GCC driver program options to
2337 pass to `cc1'. It can also specify how to translate options you
2338 give to GCC into options for GCC to pass to the `cc1'.
2340 Do not define this macro if it does not need to do anything. */
2342 #define CC1PLUS_SPEC "%{!frtti:-fno-rtti} \
2343 %{!fenforce-eh-specs:-fno-enforce-eh-specs} \
2344 %{!fexceptions:-fno-exceptions}"
2345 /* A C string constant that tells the GCC drvier program options to
2346 pass to `cc1plus'. */
2348 #define ASM_SPEC "%{mmcu=*:-mmcu=%*}"
2349 /* A C string constant that tells the GCC driver program how to
2350 run any programs which cleanup after the normal assembler.
2351 Normally, this is not needed. See the file `mips.h' for an
2352 example of this.
2354 Do not define this macro if it does not need to do anything. */
2356 #define LINK_SPEC " %{!mmcu*:-m avr2}\
2357 %{mmcu=at90s1200|mmcu=attiny1*|mmcu=attiny28:-m avr1} \
2358 %{mmcu=attiny22|mmcu=attiny26|mmcu=at90s2*|mmcu=at90s4*|mmcu=at90s8*|mmcu=at90c8*|mmcu=at86rf401:-m avr2}\
2359 %{mmcu=atmega103|mmcu=atmega603|mmcu=at43*|mmcu=at76*:-m avr3}\
2360 %{mmcu=atmega8*:-m avr4}\
2361 %{mmcu=atmega16*|mmcu=atmega32*|mmcu=atmega64|mmcu=atmega128|mmcu=at94k:-m avr5}\
2362 %{mmcu=atmega64|mmcu=atmega128|mmcu=atmega162|mmcu=atmega169: -Tdata 0x800100} "
2364 /* A C string constant that tells the GCC driver program options to
2365 pass to the linker. It can also specify how to translate options
2366 you give to GCC into options for GCC to pass to the linker.
2368 Do not define this macro if it does not need to do anything. */
2370 #define LIB_SPEC \
2371 "%{!mmcu=at90s1*:%{!mmcu=attiny1*:%{!mmcu=attiny28: -lc }}}"
2372 /* Another C string constant used much like `LINK_SPEC'. The
2373 difference between the two is that `LIB_SPEC' is used at the end
2374 of the command given to the linker.
2376 If this macro is not defined, a default is provided that loads the
2377 standard C library from the usual place. See `gcc.c'. */
2379 #define LIBSTDCXX "-lgcc"
2380 /* No libstdc++ for now. Empty string doesn't work. */
2382 #define LIBGCC_SPEC \
2383 "%{!mmcu=at90s1*:%{!mmcu=attiny1*:%{!mmcu=attiny28: -lgcc }}}"
2384 /* Another C string constant that tells the GCC driver program how
2385 and when to place a reference to `libgcc.a' into the linker
2386 command line. This constant is placed both before and after the
2387 value of `LIB_SPEC'.
2389 If this macro is not defined, the GCC driver provides a default
2390 that passes the string `-lgcc' to the linker unless the `-shared'
2391 option is specified. */
2393 #define STARTFILE_SPEC "%(crt_binutils)"
2394 /* Another C string constant used much like `LINK_SPEC'. The
2395 difference between the two is that `STARTFILE_SPEC' is used at the
2396 very beginning of the command given to the linker.
2398 If this macro is not defined, a default is provided that loads the
2399 standard C startup file from the usual place. See `gcc.c'. */
2401 #define ENDFILE_SPEC ""
2402 /* Another C string constant used much like `LINK_SPEC'. The
2403 difference between the two is that `ENDFILE_SPEC' is used at the
2404 very end of the command given to the linker.
2406 Do not define this macro if it does not need to do anything. */
2408 #define CRT_BINUTILS_SPECS "\
2409 %{mmcu=at90s1200|mmcu=avr1:crts1200.o%s} \
2410 %{mmcu=attiny11:crttn11.o%s} \
2411 %{mmcu=attiny12:crttn12.o%s} \
2412 %{mmcu=attiny15:crttn15.o%s} \
2413 %{mmcu=attiny28:crttn28.o%s} \
2414 %{!mmcu*|mmcu=at90s8515|mmcu=avr2:crts8515.o%s} \
2415 %{mmcu=at90s2313:crts2313.o%s} \
2416 %{mmcu=at90s2323:crts2323.o%s} \
2417 %{mmcu=at90s2333:crts2333.o%s} \
2418 %{mmcu=at90s2343:crts2343.o%s} \
2419 %{mmcu=attiny22:crttn22.o%s} \
2420 %{mmcu=attiny26:crttn26.o%s} \
2421 %{mmcu=at90s4433:crts4433.o%s} \
2422 %{mmcu=at90s4414:crts4414.o%s} \
2423 %{mmcu=at90s4434:crts4434.o%s} \
2424 %{mmcu=at90c8534:crtc8534.o%s} \
2425 %{mmcu=at90s8535:crts8535.o%s} \
2426 %{mmcu=at86rf401:crt86401.o%s} \
2427 %{mmcu=atmega103|mmcu=avr3:crtm103.o%s} \
2428 %{mmcu=atmega603:crtm603.o%s} \
2429 %{mmcu=at43usb320:crt43320.o%s} \
2430 %{mmcu=at43usb355:crt43355.o%s} \
2431 %{mmcu=at76c711:crt76711.o%s} \
2432 %{mmcu=atmega8|mmcu=avr4:crtm8.o%s} \
2433 %{mmcu=atmega8515:crtm8515.o%s} \
2434 %{mmcu=atmega8535:crtm8535.o%s} \
2435 %{mmcu=atmega16:crtm16.o%s} \
2436 %{mmcu=atmega161|mmcu=avr5:crtm161.o%s} \
2437 %{mmcu=atmega162:crtm162.o%s} \
2438 %{mmcu=atmega163:crtm163.o%s} \
2439 %{mmcu=atmega169:crtm169.o%s} \
2440 %{mmcu=atmega32:crtm32.o%s} \
2441 %{mmcu=atmega323:crtm323.o%s} \
2442 %{mmcu=atmega64:crtm64.o%s} \
2443 %{mmcu=atmega128:crtm128.o%s} \
2444 %{mmcu=at94k:crtat94k.o%s}"
2446 #define EXTRA_SPECS {"crt_binutils", CRT_BINUTILS_SPECS},
2448 /* Define this macro to provide additional specifications to put in
2449 the `specs' file that can be used in various specifications like
2450 `CC1_SPEC'. */
2452 /* This is the default without any -mmcu=* option (AT90S*). */
2453 #define MULTILIB_DEFAULTS { "mmcu=avr2" }
2455 /* This is undefined macro for collect2 disabling */
2456 #define LINKER_NAME "ld"
2458 #define TEST_HARD_REG_CLASS(CLASS, REGNO) \
2459 TEST_HARD_REG_BIT (reg_class_contents[ (int) (CLASS)], REGNO)
2461 /* Note that the other files fail to use these
2462 in some of the places where they should. */
2464 #if defined(__STDC__) || defined(ALMOST_STDC)
2465 #define AS2(a,b,c) #a " " #b "," #c
2466 #define AS2C(b,c) " " #b "," #c
2467 #define AS3(a,b,c,d) #a " " #b "," #c "," #d
2468 #define AS1(a,b) #a " " #b
2469 #else
2470 #define AS1(a,b) "a b"
2471 #define AS2(a,b,c) "a b,c"
2472 #define AS2C(b,c) " b,c"
2473 #define AS3(a,b,c,d) "a b,c,d"
2474 #endif
2475 #define OUT_AS1(a,b) output_asm_insn (AS1(a,b), operands)
2476 #define OUT_AS2(a,b,c) output_asm_insn (AS2(a,b,c), operands)
2477 #define CR_TAB "\n\t"
2479 /* Temporary register r0 */
2480 #define TMP_REGNO 0
2482 /* zero register r1 */
2483 #define ZERO_REGNO 1
2485 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG