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, 2004, 2005, 2006, 2007,
5 Free Software Foundation, Inc.
6 Contributed by Denis Chertykov (chertykov@gmail.com)
8 This file is part of GCC.
10 GCC is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 3, or (at your option)
15 GCC is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with GCC; see the file COPYING3. If not see
22 <http://www.gnu.org/licenses/>. */
24 /* Names to predefine in the preprocessor for this target machine. */
30 /* Core have 'MUL*' instructions. */
33 /* Core have 'CALL' and 'JMP' instructions. */
36 /* Core have 'MOVW' and 'LPM Rx,Z' instructions. */
39 /* Core have 'ELPM' instructions. */
42 /* Core have 'ELPM Rx,Z' instructions. */
45 /* Core have 'EICALL' and 'EIJMP' instructions. */
46 int have_eijmp_eicall
;
48 /* Reserved for xmega architecture. */
51 /* Reserved for xmega architecture. */
54 /* Default start of data section address for architecture. */
55 int default_data_section_start
;
57 const char *const macro
;
59 /* Architecture name. */
60 const char *const arch_name
;
63 /* These names are used as the index into the avr_arch_types[] table
83 const char *const name
;
85 /* Index in avr_arch_types[]. */
88 /* Must lie outside user's namespace. NULL == no macro. */
89 const char *const macro
;
91 /* Stack pointer have 8 bits width. */
94 /* Start of data section. */
95 int data_section_start
;
97 /* Name of device library. */
98 const char *const library_name
;
101 /* Preprocessor macros to define depending on MCU type. */
102 extern const char *avr_extra_arch_macro
;
103 extern const struct base_arch_s
*avr_current_arch
;
104 extern const struct mcu_type_s
*avr_current_device
;
105 extern const struct mcu_type_s avr_mcu_types
[];
106 extern const struct base_arch_s avr_arch_types
[];
108 #define TARGET_CPU_CPP_BUILTINS() avr_cpu_cpp_builtins (pfile)
110 #if !defined(IN_LIBGCC2) && !defined(IN_TARGET_LIBS)
111 extern GTY(()) section
*progmem_section
;
114 #define AVR_HAVE_JMP_CALL (avr_current_arch->have_jmp_call && !TARGET_SHORT_CALLS)
115 #define AVR_HAVE_MUL (avr_current_arch->have_mul)
116 #define AVR_HAVE_MOVW (avr_current_arch->have_movw_lpmx)
117 #define AVR_HAVE_LPMX (avr_current_arch->have_movw_lpmx)
118 #define AVR_HAVE_RAMPZ (avr_current_arch->have_elpm)
119 #define AVR_HAVE_EIJMP_EICALL (avr_current_arch->have_eijmp_eicall)
120 #define AVR_HAVE_8BIT_SP (avr_current_device->short_sp || TARGET_TINY_STACK)
122 #define AVR_2_BYTE_PC (!AVR_HAVE_EIJMP_EICALL)
123 #define AVR_3_BYTE_PC (AVR_HAVE_EIJMP_EICALL)
125 #define BITS_BIG_ENDIAN 0
126 #define BYTES_BIG_ENDIAN 0
127 #define WORDS_BIG_ENDIAN 0
130 /* This is to get correct SI and DI modes in libgcc2.c (32 and 64 bits). */
131 #define UNITS_PER_WORD 4
133 /* Width of a word, in units (bytes). */
134 #define UNITS_PER_WORD 1
137 #define POINTER_SIZE 16
140 /* Maximum sized of reasonable data type
141 DImode or Dfmode ... */
142 #define MAX_FIXED_MODE_SIZE 32
144 #define PARM_BOUNDARY 8
146 #define FUNCTION_BOUNDARY 8
148 #define EMPTY_FIELD_BOUNDARY 8
150 /* No data type wants to be aligned rounder than this. */
151 #define BIGGEST_ALIGNMENT 8
153 #define MAX_OFILE_ALIGNMENT (32768 * 8)
155 #define TARGET_VTABLE_ENTRY_ALIGN 8
157 #define STRICT_ALIGNMENT 0
159 #define INT_TYPE_SIZE (TARGET_INT8 ? 8 : 16)
160 #define SHORT_TYPE_SIZE (INT_TYPE_SIZE == 8 ? INT_TYPE_SIZE : 16)
161 #define LONG_TYPE_SIZE (INT_TYPE_SIZE == 8 ? 16 : 32)
162 #define LONG_LONG_TYPE_SIZE (INT_TYPE_SIZE == 8 ? 32 : 64)
163 #define FLOAT_TYPE_SIZE 32
164 #define DOUBLE_TYPE_SIZE 32
165 #define LONG_DOUBLE_TYPE_SIZE 32
167 #define DEFAULT_SIGNED_CHAR 1
169 #define SIZE_TYPE (INT_TYPE_SIZE == 8 ? "long unsigned int" : "unsigned int")
170 #define PTRDIFF_TYPE (INT_TYPE_SIZE == 8 ? "long int" :"int")
172 #define WCHAR_TYPE_SIZE 16
174 #define FIRST_PSEUDO_REGISTER 36
176 #define FIXED_REGISTERS {\
194 1,1 /* arg pointer */ }
196 #define CALL_USED_REGISTERS { \
214 1,1 /* arg pointer */ }
216 #define REG_ALLOC_ORDER { \
224 17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2, \
229 #define ADJUST_REG_ALLOC_ORDER order_regs_for_local_alloc ()
232 #define HARD_REGNO_NREGS(REGNO, MODE) ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
234 #define HARD_REGNO_MODE_OK(REGNO, MODE) avr_hard_regno_mode_ok(REGNO, MODE)
236 #define MODES_TIEABLE_P(MODE1, MODE2) 1
241 POINTER_X_REGS
, /* r26 - r27 */
242 POINTER_Y_REGS
, /* r28 - r29 */
243 POINTER_Z_REGS
, /* r30 - r31 */
244 STACK_REG
, /* STACK */
245 BASE_POINTER_REGS
, /* r28 - r31 */
246 POINTER_REGS
, /* r26 - r31 */
247 ADDW_REGS
, /* r24 - r31 */
248 SIMPLE_LD_REGS
, /* r16 - r23 */
249 LD_REGS
, /* r16 - r31 */
250 NO_LD_REGS
, /* r0 - r15 */
251 GENERAL_REGS
, /* r0 - r31 */
252 ALL_REGS
, LIM_REG_CLASSES
256 #define N_REG_CLASSES (int)LIM_REG_CLASSES
258 #define REG_CLASS_NAMES { \
261 "POINTER_X_REGS", /* r26 - r27 */ \
262 "POINTER_Y_REGS", /* r28 - r29 */ \
263 "POINTER_Z_REGS", /* r30 - r31 */ \
264 "STACK_REG", /* STACK */ \
265 "BASE_POINTER_REGS", /* r28 - r31 */ \
266 "POINTER_REGS", /* r26 - r31 */ \
267 "ADDW_REGS", /* r24 - r31 */ \
268 "SIMPLE_LD_REGS", /* r16 - r23 */ \
269 "LD_REGS", /* r16 - r31 */ \
270 "NO_LD_REGS", /* r0 - r15 */ \
271 "GENERAL_REGS", /* r0 - r31 */ \
274 #define REG_CLASS_CONTENTS { \
275 {0x00000000,0x00000000}, /* NO_REGS */ \
276 {0x00000001,0x00000000}, /* R0_REG */ \
277 {3 << REG_X,0x00000000}, /* POINTER_X_REGS, r26 - r27 */ \
278 {3 << REG_Y,0x00000000}, /* POINTER_Y_REGS, r28 - r29 */ \
279 {3 << REG_Z,0x00000000}, /* POINTER_Z_REGS, r30 - r31 */ \
280 {0x00000000,0x00000003}, /* STACK_REG, STACK */ \
281 {(3 << REG_Y) | (3 << REG_Z), \
282 0x00000000}, /* BASE_POINTER_REGS, r28 - r31 */ \
283 {(3 << REG_X) | (3 << REG_Y) | (3 << REG_Z), \
284 0x00000000}, /* POINTER_REGS, r26 - r31 */ \
285 {(3 << REG_X) | (3 << REG_Y) | (3 << REG_Z) | (3 << REG_W), \
286 0x00000000}, /* ADDW_REGS, r24 - r31 */ \
287 {0x00ff0000,0x00000000}, /* SIMPLE_LD_REGS r16 - r23 */ \
288 {(3 << REG_X)|(3 << REG_Y)|(3 << REG_Z)|(3 << REG_W)|(0xff << 16), \
289 0x00000000}, /* LD_REGS, r16 - r31 */ \
290 {0x0000ffff,0x00000000}, /* NO_LD_REGS r0 - r15 */ \
291 {0xffffffff,0x00000000}, /* GENERAL_REGS, r0 - r31 */ \
292 {0xffffffff,0x00000003} /* ALL_REGS */ \
295 #define REGNO_REG_CLASS(R) avr_regno_reg_class(R)
297 #define BASE_REG_CLASS (reload_completed ? BASE_POINTER_REGS : POINTER_REGS)
299 #define INDEX_REG_CLASS NO_REGS
301 #define REGNO_OK_FOR_BASE_P(r) (((r) < FIRST_PSEUDO_REGISTER \
305 || (r) == ARG_POINTER_REGNUM)) \
307 && (reg_renumber[r] == REG_X \
308 || reg_renumber[r] == REG_Y \
309 || reg_renumber[r] == REG_Z \
310 || (reg_renumber[r] \
311 == ARG_POINTER_REGNUM))))
313 #define REGNO_OK_FOR_INDEX_P(NUM) 0
315 #define TARGET_SMALL_REGISTER_CLASSES_FOR_MODE_P hook_bool_mode_true
317 #define CLASS_MAX_NREGS(CLASS, MODE) class_max_nregs (CLASS, MODE)
319 #define STACK_PUSH_CODE POST_DEC
321 #define STACK_GROWS_DOWNWARD
323 #define STARTING_FRAME_OFFSET 1
325 #define STACK_POINTER_OFFSET 1
327 #define FIRST_PARM_OFFSET(FUNDECL) 0
329 #define STACK_BOUNDARY 8
331 #define STACK_POINTER_REGNUM 32
333 #define FRAME_POINTER_REGNUM REG_Y
335 #define ARG_POINTER_REGNUM 34
337 #define STATIC_CHAIN_REGNUM 2
339 #define ELIMINABLE_REGS { \
340 {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
341 {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM} \
342 ,{FRAME_POINTER_REGNUM+1,STACK_POINTER_REGNUM+1}}
344 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
345 OFFSET = avr_initial_elimination_offset (FROM, TO)
347 #define RETURN_ADDR_RTX(count, tem) avr_return_addr_rtx (count, tem)
349 /* Don't use Push rounding. expr.c: emit_single_push_insn is broken
350 for POST_DEC targets (PR27386). */
351 /*#define PUSH_ROUNDING(NPUSHED) (NPUSHED)*/
353 typedef struct avr_args
{
354 int nregs
; /* # registers available for passing */
355 int regno
; /* next available register number */
358 #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, FNDECL, N_NAMED_ARGS) \
359 init_cumulative_args (&(CUM), FNTYPE, LIBNAME, FNDECL)
361 #define FUNCTION_ARG_REGNO_P(r) function_arg_regno_p(r)
363 extern int avr_reg_order
[];
365 #define DEFAULT_PCC_STRUCT_RETURN 0
367 #define EPILOGUE_USES(REGNO) avr_epilogue_uses(REGNO)
369 #define HAVE_POST_INCREMENT 1
370 #define HAVE_PRE_DECREMENT 1
372 #define MAX_REGS_PER_ADDRESS 1
374 #define REG_OK_FOR_BASE_NOSTRICT_P(X) \
375 (REGNO (X) >= FIRST_PSEUDO_REGISTER || REG_OK_FOR_BASE_STRICT_P(X))
377 #define REG_OK_FOR_BASE_STRICT_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
379 /* LEGITIMIZE_RELOAD_ADDRESS will allow register R26/27 to be used, where it
380 is no worse than normal base pointers R28/29 and R30/31. For example:
381 If base offset is greater than 63 bytes or for R++ or --R addressing. */
383 #define LEGITIMIZE_RELOAD_ADDRESS(X, MODE, OPNUM, TYPE, IND_LEVELS, WIN) \
385 if (1&&(GET_CODE (X) == POST_INC || GET_CODE (X) == PRE_DEC)) \
387 push_reload (XEXP (X,0), XEXP (X,0), &XEXP (X,0), &XEXP (X,0), \
388 POINTER_REGS, GET_MODE (X),GET_MODE (X) , 0, 0, \
389 OPNUM, RELOAD_OTHER); \
392 if (GET_CODE (X) == PLUS \
393 && REG_P (XEXP (X, 0)) \
394 && (reg_equiv_constant (REGNO (XEXP (X, 0))) == 0) \
395 && GET_CODE (XEXP (X, 1)) == CONST_INT \
396 && INTVAL (XEXP (X, 1)) >= 1) \
398 int fit = INTVAL (XEXP (X, 1)) <= (64 - GET_MODE_SIZE (MODE)); \
401 if (reg_equiv_address (REGNO (XEXP (X, 0))) != 0) \
403 int regno = REGNO (XEXP (X, 0)); \
404 rtx mem = make_memloc (X, regno); \
405 push_reload (XEXP (mem,0), NULL, &XEXP (mem,0), NULL, \
406 POINTER_REGS, Pmode, VOIDmode, 0, 0, \
407 1, ADDR_TYPE (TYPE)); \
408 push_reload (mem, NULL_RTX, &XEXP (X, 0), NULL, \
409 BASE_POINTER_REGS, GET_MODE (X), VOIDmode, 0, 0, \
414 else if (! (frame_pointer_needed && XEXP (X,0) == frame_pointer_rtx)) \
416 push_reload (X, NULL_RTX, &X, NULL, \
417 POINTER_REGS, GET_MODE (X), VOIDmode, 0, 0, \
424 #define LEGITIMATE_CONSTANT_P(X) 1
426 #define BRANCH_COST(speed_p, predictable_p) 0
428 #define SLOW_BYTE_ACCESS 0
430 #define NO_FUNCTION_CSE
432 #define TEXT_SECTION_ASM_OP "\t.text"
434 #define DATA_SECTION_ASM_OP "\t.data"
436 #define BSS_SECTION_ASM_OP "\t.section .bss"
438 /* Define the pseudo-ops used to switch to the .ctors and .dtors sections.
439 There are no shared libraries on this target, and these sections are
440 placed in the read-only program memory, so they are not writable. */
442 #undef CTORS_SECTION_ASM_OP
443 #define CTORS_SECTION_ASM_OP "\t.section .ctors,\"a\",@progbits"
445 #undef DTORS_SECTION_ASM_OP
446 #define DTORS_SECTION_ASM_OP "\t.section .dtors,\"a\",@progbits"
448 #define TARGET_ASM_CONSTRUCTOR avr_asm_out_ctor
450 #define TARGET_ASM_DESTRUCTOR avr_asm_out_dtor
452 #define SUPPORTS_INIT_PRIORITY 0
454 #define JUMP_TABLES_IN_TEXT_SECTION 0
456 #define ASM_COMMENT_START " ; "
458 #define ASM_APP_ON "/* #APP */\n"
460 #define ASM_APP_OFF "/* #NOAPP */\n"
462 /* Switch into a generic section. */
463 #define TARGET_ASM_NAMED_SECTION avr_asm_named_section
465 #define ASM_OUTPUT_ASCII(FILE, P, SIZE) gas_output_ascii (FILE,P,SIZE)
467 #define IS_ASM_LOGICAL_LINE_SEPARATOR(C, STR) ((C) == '\n' || ((C) == '$'))
469 #define ASM_OUTPUT_ALIGNED_DECL_COMMON(STREAM, DECL, NAME, SIZE, ALIGN) \
470 avr_asm_output_aligned_decl_common (STREAM, DECL, NAME, SIZE, ALIGN, false)
472 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
473 asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
475 #define ASM_OUTPUT_ALIGNED_DECL_LOCAL(STREAM, DECL, NAME, SIZE, ALIGN) \
476 avr_asm_output_aligned_decl_common (STREAM, DECL, NAME, SIZE, ALIGN, true)
481 #define TYPE_ASM_OP "\t.type\t"
482 #define SIZE_ASM_OP "\t.size\t"
483 #define WEAK_ASM_OP "\t.weak\t"
484 /* Define the strings used for the special svr4 .type and .size directives.
485 These strings generally do not vary from one system running svr4 to
486 another, but if a given system (e.g. m88k running svr) needs to use
487 different pseudo-op names for these, they may be overridden in the
488 file which includes this one. */
491 #undef TYPE_OPERAND_FMT
492 #define TYPE_OPERAND_FMT "@%s"
493 /* The following macro defines the format used to output the second
494 operand of the .type assembler directive. Different svr4 assemblers
495 expect various different forms for this operand. The one given here
496 is just a default. You may need to override it in your machine-
497 specific tm.h file (depending upon the particulars of your assembler). */
499 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
500 avr_asm_declare_function_name ((FILE), (NAME), (DECL))
502 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
504 if (!flag_inhibit_size_directive) \
505 ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME); \
508 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
510 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
511 size_directive_output = 0; \
512 if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
514 size_directive_output = 1; \
515 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, \
516 int_size_in_bytes (TREE_TYPE (DECL))); \
518 ASM_OUTPUT_LABEL(FILE, NAME); \
521 #undef ASM_FINISH_DECLARE_OBJECT
522 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
524 const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
525 HOST_WIDE_INT size; \
526 if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
527 && ! AT_END && TOP_LEVEL \
528 && DECL_INITIAL (DECL) == error_mark_node \
529 && !size_directive_output) \
531 size_directive_output = 1; \
532 size = int_size_in_bytes (TREE_TYPE (DECL)); \
533 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size); \
539 "\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\
540 \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\
541 \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\
542 \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\
543 \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\
544 \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\
545 \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\
546 \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"
547 /* A table of bytes codes used by the ASM_OUTPUT_ASCII and
548 ASM_OUTPUT_LIMITED_STRING macros. Each byte in the table
549 corresponds to a particular byte value [0..255]. For any
550 given byte value, if the value in the corresponding table
551 position is zero, the given character can be output directly.
552 If the table value is 1, the byte must be output as a \ooo
553 octal escape. If the tables value is anything else, then the
554 byte value should be output as a \ followed by the value
555 in the table. Note that we can use standard UN*X escape
556 sequences for many control characters, but we don't use
557 \a to represent BEL because some svr4 assemblers (e.g. on
558 the i386) don't know about that. Also, we don't use \v
559 since some versions of gas, such as 2.2 did not accept it. */
561 #define STRING_LIMIT ((unsigned) 64)
562 #define STRING_ASM_OP "\t.string\t"
563 /* Some svr4 assemblers have a limit on the number of characters which
564 can appear in the operand of a .string directive. If your assembler
565 has such a limitation, you should define STRING_LIMIT to reflect that
566 limit. Note that at least some svr4 assemblers have a limit on the
567 actual number of bytes in the double-quoted string, and that they
568 count each character in an escape sequence as one byte. Thus, an
569 escape sequence like \377 would count as four bytes.
571 If your target assembler doesn't support the .string directive, you
572 should define this to zero. */
574 /* Globalizing directive for a label. */
575 #define GLOBAL_ASM_OP ".global\t"
577 #define SET_ASM_OP "\t.set\t"
579 #define ASM_WEAKEN_LABEL(FILE, NAME) \
582 fputs ("\t.weak\t", (FILE)); \
583 assemble_name ((FILE), (NAME)); \
584 fputc ('\n', (FILE)); \
588 #define SUPPORTS_WEAK 1
590 #define ASM_GENERATE_INTERNAL_LABEL(STRING, PREFIX, NUM) \
591 sprintf (STRING, "*.%s%lu", PREFIX, (unsigned long)(NUM))
593 #define HAS_INIT_SECTION 1
595 #define REGISTER_NAMES { \
596 "r0","r1","r2","r3","r4","r5","r6","r7", \
597 "r8","r9","r10","r11","r12","r13","r14","r15", \
598 "r16","r17","r18","r19","r20","r21","r22","r23", \
599 "r24","r25","r26","r27","r28","r29","r30","r31", \
600 "__SP_L__","__SP_H__","argL","argH"}
602 #define FINAL_PRESCAN_INSN(insn, operand, nop) final_prescan_insn (insn, operand,nop)
604 #define PRINT_OPERAND(STREAM, X, CODE) print_operand (STREAM, X, CODE)
606 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) ((CODE) == '~' || (CODE) == '!')
608 #define PRINT_OPERAND_ADDRESS(STREAM, X) print_operand_address(STREAM, X)
610 #define USER_LABEL_PREFIX ""
612 #define ASSEMBLER_DIALECT AVR_HAVE_MOVW
614 #define ASM_OUTPUT_REG_PUSH(STREAM, REGNO) \
616 gcc_assert (REGNO < 32); \
617 fprintf (STREAM, "\tpush\tr%d", REGNO); \
620 #define ASM_OUTPUT_REG_POP(STREAM, REGNO) \
622 gcc_assert (REGNO < 32); \
623 fprintf (STREAM, "\tpop\tr%d", REGNO); \
626 #define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \
627 avr_output_addr_vec_elt(STREAM, VALUE)
629 #define ASM_OUTPUT_CASE_LABEL(STREAM, PREFIX, NUM, TABLE) \
630 (switch_to_section (progmem_section), \
631 (*targetm.asm_out.internal_label) (STREAM, PREFIX, NUM))
633 #define ASM_OUTPUT_SKIP(STREAM, N) \
634 fprintf (STREAM, "\t.skip %lu,0\n", (unsigned long)(N))
636 #define ASM_OUTPUT_ALIGN(STREAM, POWER) \
639 fprintf (STREAM, "\t.p2align\t%d\n", POWER); \
642 #define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
643 default_elf_asm_output_external (FILE, DECL, NAME)
645 #define CASE_VECTOR_MODE HImode
647 #undef WORD_REGISTER_OPERATIONS
651 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
655 #define FUNCTION_MODE HImode
657 #define DOLLARS_IN_IDENTIFIERS 0
659 #define NO_DOLLAR_IN_LABEL 1
661 #define TRAMPOLINE_SIZE 4
663 /* Store in cc_status the expressions
664 that the condition codes will describe
665 after execution of an instruction whose pattern is EXP.
666 Do not alter them if the instruction would not alter the cc's. */
668 #define NOTICE_UPDATE_CC(EXP, INSN) notice_update_cc(EXP, INSN)
670 /* The add insns don't set overflow in a usable way. */
671 #define CC_OVERFLOW_UNUSABLE 01000
672 /* The mov,and,or,xor insns don't set carry. That's ok though as the
673 Z bit is all we need when doing unsigned comparisons on the result of
674 these insns (since they're always with 0). However, conditions.h has
675 CC_NO_OVERFLOW defined for this purpose. Rename it to something more
677 #define CC_NO_CARRY CC_NO_OVERFLOW
680 /* Output assembler code to FILE to increment profiler label # LABELNO
681 for profiling a function entry. */
683 #define FUNCTION_PROFILER(FILE, LABELNO) \
684 fprintf (FILE, "/* profiler %d */", (LABELNO))
686 #define ADJUST_INSN_LENGTH(INSN, LENGTH) (LENGTH =\
687 adjust_insn_length (INSN, LENGTH))
689 extern const char *avr_device_to_arch (int argc
, const char **argv
);
690 extern const char *avr_device_to_data_start (int argc
, const char **argv
);
691 extern const char *avr_device_to_startfiles (int argc
, const char **argv
);
692 extern const char *avr_device_to_devicelib (int argc
, const char **argv
);
694 #define EXTRA_SPEC_FUNCTIONS \
695 { "device_to_arch", avr_device_to_arch }, \
696 { "device_to_data_start", avr_device_to_data_start }, \
697 { "device_to_startfile", avr_device_to_startfiles }, \
698 { "device_to_devicelib", avr_device_to_devicelib },
704 #define CC1PLUS_SPEC "%{!frtti:-fno-rtti} \
705 %{!fenforce-eh-specs:-fno-enforce-eh-specs} \
706 %{!fexceptions:-fno-exceptions}"
707 /* A C string constant that tells the GCC driver program options to
708 pass to `cc1plus'. */
710 #define ASM_SPEC "%{mmcu=avr25:-mmcu=avr2;mmcu=avr35:-mmcu=avr3;mmcu=avr31:-mmcu=avr3;mmcu=avr51:-mmcu=avr5;\
715 %{mpmem-wrap-around:%{mmcu=at90usb8*:--pmem-wrap-around=8k}\
716 %{mmcu=atmega16*:--pmem-wrap-around=16k}\
718 mmcu=at90can32*:--pmem-wrap-around=32k}\
721 mmcu=at90usb64*:--pmem-wrap-around=64k}}}\
722 %:device_to_arch(%{mmcu=*:%*})\
723 %:device_to_data_start(%{mmcu=*:%*})"
726 "%{!mmcu=at90s1*:%{!mmcu=attiny11:%{!mmcu=attiny12:%{!mmcu=attiny15:%{!mmcu=attiny28: -lc }}}}}"
728 #define LIBSTDCXX "gcc"
729 /* No libstdc++ for now. Empty string doesn't work. */
731 #define LIBGCC_SPEC \
732 "%{!mmcu=at90s1*:%{!mmcu=attiny11:%{!mmcu=attiny12:%{!mmcu=attiny15:%{!mmcu=attiny28: -lgcc }}}}}"
734 #define STARTFILE_SPEC "%:device_to_startfile(%{mmcu=*:%*})"
736 #define ENDFILE_SPEC ""
738 /* This is the default without any -mmcu=* option (AT90S*). */
739 #define MULTILIB_DEFAULTS { "mmcu=avr2" }
741 #define TEST_HARD_REG_CLASS(CLASS, REGNO) \
742 TEST_HARD_REG_BIT (reg_class_contents[ (int) (CLASS)], REGNO)
744 /* Note that the other files fail to use these
745 in some of the places where they should. */
747 #if defined(__STDC__) || defined(ALMOST_STDC)
748 #define AS2(a,b,c) #a " " #b "," #c
749 #define AS2C(b,c) " " #b "," #c
750 #define AS3(a,b,c,d) #a " " #b "," #c "," #d
751 #define AS1(a,b) #a " " #b
753 #define AS1(a,b) "a b"
754 #define AS2(a,b,c) "a b,c"
755 #define AS2C(b,c) " b,c"
756 #define AS3(a,b,c,d) "a b,c,d"
758 #define OUT_AS1(a,b) output_asm_insn (AS1(a,b), operands)
759 #define OUT_AS2(a,b,c) output_asm_insn (AS2(a,b,c), operands)
760 #define CR_TAB "\n\t"
762 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
764 #define DWARF2_DEBUGGING_INFO 1
766 #define DWARF2_ADDR_SIZE 4
768 #define OBJECT_FORMAT_ELF
770 #define INCOMING_RETURN_ADDR_RTX avr_incoming_return_addr_rtx ()
771 #define INCOMING_FRAME_SP_OFFSET (AVR_3_BYTE_PC ? 3 : 2)
773 /* The caller's stack pointer value immediately before the call
774 is one byte below the first argument. */
775 #define ARG_POINTER_CFA_OFFSET(FNDECL) -1
777 #define HARD_REGNO_RENAME_OK(OLD_REG, NEW_REG) \
778 avr_hard_regno_rename_ok (OLD_REG, NEW_REG)
780 /* A C structure for machine-specific, per-function data.
781 This is added to the cfun structure. */
782 struct GTY(()) machine_function
784 /* 'true' - if current function is a naked function. */
787 /* 'true' - if current function is an interrupt function
788 as specified by the "interrupt" attribute. */
791 /* 'true' - if current function is a signal function
792 as specified by the "signal" attribute. */
795 /* 'true' - if current function is a 'task' function
796 as specified by the "OS_task" attribute. */
799 /* 'true' - if current function is a 'main' function
800 as specified by the "OS_main" attribute. */
803 /* Current function stack size. */
806 /* 'true' if a callee might be tail called */