]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/avr/avr.h
re PR target/47109 (m68k-netbsdelf: collect2 build fails with undefined reference...
[thirdparty/gcc.git] / gcc / config / avr / avr.h
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,
4 2008, 2009, 2010, 2011
5 Free Software Foundation, Inc.
6 Contributed by Denis Chertykov (chertykov@gmail.com)
7
8 This file is part of GCC.
9
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)
13 any later version.
14
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.
19
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/>. */
23
24 /* Names to predefine in the preprocessor for this target machine. */
25
26 struct base_arch_s {
27 /* Assembler only. */
28 int asm_only;
29
30 /* Core have 'MUL*' instructions. */
31 int have_mul;
32
33 /* Core have 'CALL' and 'JMP' instructions. */
34 int have_jmp_call;
35
36 /* Core have 'MOVW' and 'LPM Rx,Z' instructions. */
37 int have_movw_lpmx;
38
39 /* Core have 'ELPM' instructions. */
40 int have_elpm;
41
42 /* Core have 'ELPM Rx,Z' instructions. */
43 int have_elpmx;
44
45 /* Core have 'EICALL' and 'EIJMP' instructions. */
46 int have_eijmp_eicall;
47
48 /* Reserved for xmega architecture. */
49 int reserved;
50
51 /* Reserved for xmega architecture. */
52 int reserved2;
53
54 /* Default start of data section address for architecture. */
55 int default_data_section_start;
56
57 const char *const macro;
58
59 /* Architecture name. */
60 const char *const arch_name;
61 };
62
63 /* These names are used as the index into the avr_arch_types[] table
64 above. */
65
66 enum avr_arch
67 {
68 ARCH_UNKNOWN,
69 ARCH_AVR1,
70 ARCH_AVR2,
71 ARCH_AVR25,
72 ARCH_AVR3,
73 ARCH_AVR31,
74 ARCH_AVR35,
75 ARCH_AVR4,
76 ARCH_AVR5,
77 ARCH_AVR51,
78 ARCH_AVR6
79 };
80
81 struct mcu_type_s {
82 /* Device name. */
83 const char *const name;
84
85 /* Index in avr_arch_types[]. */
86 int arch;
87
88 /* Must lie outside user's namespace. NULL == no macro. */
89 const char *const macro;
90
91 /* Stack pointer have 8 bits width. */
92 int short_sp;
93
94 /* Start of data section. */
95 int data_section_start;
96
97 /* Name of device library. */
98 const char *const library_name;
99 };
100
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[];
107
108 #define TARGET_CPU_CPP_BUILTINS() avr_cpu_cpp_builtins (pfile)
109
110 #if !defined(IN_LIBGCC2) && !defined(IN_TARGET_LIBS)
111 extern GTY(()) section *progmem_section;
112 #endif
113
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)
121
122 #define AVR_2_BYTE_PC (!AVR_HAVE_EIJMP_EICALL)
123 #define AVR_3_BYTE_PC (AVR_HAVE_EIJMP_EICALL)
124
125 #define BITS_BIG_ENDIAN 0
126 #define BYTES_BIG_ENDIAN 0
127 #define WORDS_BIG_ENDIAN 0
128
129 #ifdef IN_LIBGCC2
130 /* This is to get correct SI and DI modes in libgcc2.c (32 and 64 bits). */
131 #define UNITS_PER_WORD 4
132 #else
133 /* Width of a word, in units (bytes). */
134 #define UNITS_PER_WORD 1
135 #endif
136
137 #define POINTER_SIZE 16
138
139
140 /* Maximum sized of reasonable data type
141 DImode or Dfmode ... */
142 #define MAX_FIXED_MODE_SIZE 32
143
144 #define PARM_BOUNDARY 8
145
146 #define FUNCTION_BOUNDARY 8
147
148 #define EMPTY_FIELD_BOUNDARY 8
149
150 /* No data type wants to be aligned rounder than this. */
151 #define BIGGEST_ALIGNMENT 8
152
153 #define MAX_OFILE_ALIGNMENT (32768 * 8)
154
155 #define TARGET_VTABLE_ENTRY_ALIGN 8
156
157 #define STRICT_ALIGNMENT 0
158
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
166
167 #define DEFAULT_SIGNED_CHAR 1
168
169 #define SIZE_TYPE (INT_TYPE_SIZE == 8 ? "long unsigned int" : "unsigned int")
170 #define PTRDIFF_TYPE (INT_TYPE_SIZE == 8 ? "long int" :"int")
171
172 #define WCHAR_TYPE_SIZE 16
173
174 #define FIRST_PSEUDO_REGISTER 36
175
176 #define FIXED_REGISTERS {\
177 1,1,/* r0 r1 */\
178 0,0,/* r2 r3 */\
179 0,0,/* r4 r5 */\
180 0,0,/* r6 r7 */\
181 0,0,/* r8 r9 */\
182 0,0,/* r10 r11 */\
183 0,0,/* r12 r13 */\
184 0,0,/* r14 r15 */\
185 0,0,/* r16 r17 */\
186 0,0,/* r18 r19 */\
187 0,0,/* r20 r21 */\
188 0,0,/* r22 r23 */\
189 0,0,/* r24 r25 */\
190 0,0,/* r26 r27 */\
191 0,0,/* r28 r29 */\
192 0,0,/* r30 r31 */\
193 1,1,/* STACK */\
194 1,1 /* arg pointer */ }
195
196 #define CALL_USED_REGISTERS { \
197 1,1,/* r0 r1 */ \
198 0,0,/* r2 r3 */ \
199 0,0,/* r4 r5 */ \
200 0,0,/* r6 r7 */ \
201 0,0,/* r8 r9 */ \
202 0,0,/* r10 r11 */ \
203 0,0,/* r12 r13 */ \
204 0,0,/* r14 r15 */ \
205 0,0,/* r16 r17 */ \
206 1,1,/* r18 r19 */ \
207 1,1,/* r20 r21 */ \
208 1,1,/* r22 r23 */ \
209 1,1,/* r24 r25 */ \
210 1,1,/* r26 r27 */ \
211 0,0,/* r28 r29 */ \
212 1,1,/* r30 r31 */ \
213 1,1,/* STACK */ \
214 1,1 /* arg pointer */ }
215
216 #define REG_ALLOC_ORDER { \
217 24,25, \
218 18,19, \
219 20,21, \
220 22,23, \
221 30,31, \
222 26,27, \
223 28,29, \
224 17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2, \
225 0,1, \
226 32,33,34,35 \
227 }
228
229 #define ADJUST_REG_ALLOC_ORDER order_regs_for_local_alloc ()
230
231
232 #define HARD_REGNO_NREGS(REGNO, MODE) ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
233
234 #define HARD_REGNO_MODE_OK(REGNO, MODE) avr_hard_regno_mode_ok(REGNO, MODE)
235
236 #define MODES_TIEABLE_P(MODE1, MODE2) 1
237
238 enum reg_class {
239 NO_REGS,
240 R0_REG, /* r0 */
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
253 };
254
255
256 #define N_REG_CLASSES (int)LIM_REG_CLASSES
257
258 #define REG_CLASS_NAMES { \
259 "NO_REGS", \
260 "R0_REG", /* r0 */ \
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 */ \
272 "ALL_REGS" }
273
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 */ \
293 }
294
295 #define REGNO_REG_CLASS(R) avr_regno_reg_class(R)
296
297 #define BASE_REG_CLASS (reload_completed ? BASE_POINTER_REGS : POINTER_REGS)
298
299 #define INDEX_REG_CLASS NO_REGS
300
301 #define REGNO_OK_FOR_BASE_P(r) (((r) < FIRST_PSEUDO_REGISTER \
302 && ((r) == REG_X \
303 || (r) == REG_Y \
304 || (r) == REG_Z \
305 || (r) == ARG_POINTER_REGNUM)) \
306 || (reg_renumber \
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))))
312
313 #define REGNO_OK_FOR_INDEX_P(NUM) 0
314
315 #define TARGET_SMALL_REGISTER_CLASSES_FOR_MODE_P hook_bool_mode_true
316
317 #define CLASS_MAX_NREGS(CLASS, MODE) class_max_nregs (CLASS, MODE)
318
319 #define STACK_PUSH_CODE POST_DEC
320
321 #define STACK_GROWS_DOWNWARD
322
323 #define STARTING_FRAME_OFFSET 1
324
325 #define STACK_POINTER_OFFSET 1
326
327 #define FIRST_PARM_OFFSET(FUNDECL) 0
328
329 #define STACK_BOUNDARY 8
330
331 #define STACK_POINTER_REGNUM 32
332
333 #define FRAME_POINTER_REGNUM REG_Y
334
335 #define ARG_POINTER_REGNUM 34
336
337 #define STATIC_CHAIN_REGNUM 2
338
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}}
343
344 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
345 OFFSET = avr_initial_elimination_offset (FROM, TO)
346
347 #define RETURN_ADDR_RTX(count, tem) avr_return_addr_rtx (count, tem)
348
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)*/
352
353 typedef struct avr_args {
354 int nregs; /* # registers available for passing */
355 int regno; /* next available register number */
356 } CUMULATIVE_ARGS;
357
358 #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, FNDECL, N_NAMED_ARGS) \
359 init_cumulative_args (&(CUM), FNTYPE, LIBNAME, FNDECL)
360
361 #define FUNCTION_ARG_REGNO_P(r) function_arg_regno_p(r)
362
363 extern int avr_reg_order[];
364
365 #define DEFAULT_PCC_STRUCT_RETURN 0
366
367 #define EPILOGUE_USES(REGNO) avr_epilogue_uses(REGNO)
368
369 #define HAVE_POST_INCREMENT 1
370 #define HAVE_PRE_DECREMENT 1
371
372 #define MAX_REGS_PER_ADDRESS 1
373
374 #define REG_OK_FOR_BASE_NOSTRICT_P(X) \
375 (REGNO (X) >= FIRST_PSEUDO_REGISTER || REG_OK_FOR_BASE_STRICT_P(X))
376
377 #define REG_OK_FOR_BASE_STRICT_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
378
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. */
382
383 #define LEGITIMIZE_RELOAD_ADDRESS(X, MODE, OPNUM, TYPE, IND_LEVELS, WIN) \
384 do { \
385 if (1&&(GET_CODE (X) == POST_INC || GET_CODE (X) == PRE_DEC)) \
386 { \
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); \
390 goto WIN; \
391 } \
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) \
397 { \
398 int fit = INTVAL (XEXP (X, 1)) <= (64 - GET_MODE_SIZE (MODE)); \
399 if (fit) \
400 { \
401 if (reg_equiv_address (REGNO (XEXP (X, 0))) != 0) \
402 { \
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, \
410 OPNUM, TYPE); \
411 goto WIN; \
412 } \
413 } \
414 else if (! (frame_pointer_needed && XEXP (X,0) == frame_pointer_rtx)) \
415 { \
416 push_reload (X, NULL_RTX, &X, NULL, \
417 POINTER_REGS, GET_MODE (X), VOIDmode, 0, 0, \
418 OPNUM, TYPE); \
419 goto WIN; \
420 } \
421 } \
422 } while(0)
423
424 #define LEGITIMATE_CONSTANT_P(X) 1
425
426 #define BRANCH_COST(speed_p, predictable_p) 0
427
428 #define SLOW_BYTE_ACCESS 0
429
430 #define NO_FUNCTION_CSE
431
432 #define TEXT_SECTION_ASM_OP "\t.text"
433
434 #define DATA_SECTION_ASM_OP "\t.data"
435
436 #define BSS_SECTION_ASM_OP "\t.section .bss"
437
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. */
441
442 #undef CTORS_SECTION_ASM_OP
443 #define CTORS_SECTION_ASM_OP "\t.section .ctors,\"a\",@progbits"
444
445 #undef DTORS_SECTION_ASM_OP
446 #define DTORS_SECTION_ASM_OP "\t.section .dtors,\"a\",@progbits"
447
448 #define TARGET_ASM_CONSTRUCTOR avr_asm_out_ctor
449
450 #define TARGET_ASM_DESTRUCTOR avr_asm_out_dtor
451
452 #define SUPPORTS_INIT_PRIORITY 0
453
454 #define JUMP_TABLES_IN_TEXT_SECTION 0
455
456 #define ASM_COMMENT_START " ; "
457
458 #define ASM_APP_ON "/* #APP */\n"
459
460 #define ASM_APP_OFF "/* #NOAPP */\n"
461
462 /* Switch into a generic section. */
463 #define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
464 #define TARGET_ASM_INIT_SECTIONS avr_asm_init_sections
465
466 #define ASM_OUTPUT_ASCII(FILE, P, SIZE) gas_output_ascii (FILE,P,SIZE)
467
468 #define IS_ASM_LOGICAL_LINE_SEPARATOR(C, STR) ((C) == '\n' || ((C) == '$'))
469
470 #define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED) \
471 do { \
472 fputs ("\t.comm ", (STREAM)); \
473 assemble_name ((STREAM), (NAME)); \
474 fprintf ((STREAM), ",%lu,1\n", (unsigned long)(SIZE)); \
475 } while (0)
476
477 #define ASM_OUTPUT_BSS(FILE, DECL, NAME, SIZE, ROUNDED) \
478 asm_output_bss ((FILE), (DECL), (NAME), (SIZE), (ROUNDED))
479
480 #define ASM_OUTPUT_LOCAL(STREAM, NAME, SIZE, ROUNDED) \
481 do { \
482 fputs ("\t.lcomm ", (STREAM)); \
483 assemble_name ((STREAM), (NAME)); \
484 fprintf ((STREAM), ",%d\n", (int)(SIZE)); \
485 } while (0)
486
487 #undef TYPE_ASM_OP
488 #undef SIZE_ASM_OP
489 #undef WEAK_ASM_OP
490 #define TYPE_ASM_OP "\t.type\t"
491 #define SIZE_ASM_OP "\t.size\t"
492 #define WEAK_ASM_OP "\t.weak\t"
493 /* Define the strings used for the special svr4 .type and .size directives.
494 These strings generally do not vary from one system running svr4 to
495 another, but if a given system (e.g. m88k running svr) needs to use
496 different pseudo-op names for these, they may be overridden in the
497 file which includes this one. */
498
499
500 #undef TYPE_OPERAND_FMT
501 #define TYPE_OPERAND_FMT "@%s"
502 /* The following macro defines the format used to output the second
503 operand of the .type assembler directive. Different svr4 assemblers
504 expect various different forms for this operand. The one given here
505 is just a default. You may need to override it in your machine-
506 specific tm.h file (depending upon the particulars of your assembler). */
507
508 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
509 avr_asm_declare_function_name ((FILE), (NAME), (DECL))
510
511 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
512 do { \
513 if (!flag_inhibit_size_directive) \
514 ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME); \
515 } while (0)
516
517 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
518 do { \
519 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
520 size_directive_output = 0; \
521 if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
522 { \
523 size_directive_output = 1; \
524 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, \
525 int_size_in_bytes (TREE_TYPE (DECL))); \
526 } \
527 ASM_OUTPUT_LABEL(FILE, NAME); \
528 } while (0)
529
530 #undef ASM_FINISH_DECLARE_OBJECT
531 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
532 do { \
533 const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
534 HOST_WIDE_INT size; \
535 if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
536 && ! AT_END && TOP_LEVEL \
537 && DECL_INITIAL (DECL) == error_mark_node \
538 && !size_directive_output) \
539 { \
540 size_directive_output = 1; \
541 size = int_size_in_bytes (TREE_TYPE (DECL)); \
542 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size); \
543 } \
544 } while (0)
545
546
547 #define ESCAPES \
548 "\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\
549 \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\
550 \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\
551 \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\
552 \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\
553 \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\
554 \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\
555 \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"
556 /* A table of bytes codes used by the ASM_OUTPUT_ASCII and
557 ASM_OUTPUT_LIMITED_STRING macros. Each byte in the table
558 corresponds to a particular byte value [0..255]. For any
559 given byte value, if the value in the corresponding table
560 position is zero, the given character can be output directly.
561 If the table value is 1, the byte must be output as a \ooo
562 octal escape. If the tables value is anything else, then the
563 byte value should be output as a \ followed by the value
564 in the table. Note that we can use standard UN*X escape
565 sequences for many control characters, but we don't use
566 \a to represent BEL because some svr4 assemblers (e.g. on
567 the i386) don't know about that. Also, we don't use \v
568 since some versions of gas, such as 2.2 did not accept it. */
569
570 #define STRING_LIMIT ((unsigned) 64)
571 #define STRING_ASM_OP "\t.string\t"
572 /* Some svr4 assemblers have a limit on the number of characters which
573 can appear in the operand of a .string directive. If your assembler
574 has such a limitation, you should define STRING_LIMIT to reflect that
575 limit. Note that at least some svr4 assemblers have a limit on the
576 actual number of bytes in the double-quoted string, and that they
577 count each character in an escape sequence as one byte. Thus, an
578 escape sequence like \377 would count as four bytes.
579
580 If your target assembler doesn't support the .string directive, you
581 should define this to zero. */
582
583 /* Globalizing directive for a label. */
584 #define GLOBAL_ASM_OP ".global\t"
585
586 #define SET_ASM_OP "\t.set\t"
587
588 #define ASM_WEAKEN_LABEL(FILE, NAME) \
589 do \
590 { \
591 fputs ("\t.weak\t", (FILE)); \
592 assemble_name ((FILE), (NAME)); \
593 fputc ('\n', (FILE)); \
594 } \
595 while (0)
596
597 #define SUPPORTS_WEAK 1
598
599 #define ASM_GENERATE_INTERNAL_LABEL(STRING, PREFIX, NUM) \
600 sprintf (STRING, "*.%s%lu", PREFIX, (unsigned long)(NUM))
601
602 #define HAS_INIT_SECTION 1
603
604 #define REGISTER_NAMES { \
605 "r0","r1","r2","r3","r4","r5","r6","r7", \
606 "r8","r9","r10","r11","r12","r13","r14","r15", \
607 "r16","r17","r18","r19","r20","r21","r22","r23", \
608 "r24","r25","r26","r27","r28","r29","r30","r31", \
609 "__SP_L__","__SP_H__","argL","argH"}
610
611 #define FINAL_PRESCAN_INSN(insn, operand, nop) final_prescan_insn (insn, operand,nop)
612
613 #define PRINT_OPERAND(STREAM, X, CODE) print_operand (STREAM, X, CODE)
614
615 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) ((CODE) == '~' || (CODE) == '!')
616
617 #define PRINT_OPERAND_ADDRESS(STREAM, X) print_operand_address(STREAM, X)
618
619 #define USER_LABEL_PREFIX ""
620
621 #define ASSEMBLER_DIALECT AVR_HAVE_MOVW
622
623 #define ASM_OUTPUT_REG_PUSH(STREAM, REGNO) \
624 { \
625 gcc_assert (REGNO < 32); \
626 fprintf (STREAM, "\tpush\tr%d", REGNO); \
627 }
628
629 #define ASM_OUTPUT_REG_POP(STREAM, REGNO) \
630 { \
631 gcc_assert (REGNO < 32); \
632 fprintf (STREAM, "\tpop\tr%d", REGNO); \
633 }
634
635 #define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \
636 avr_output_addr_vec_elt(STREAM, VALUE)
637
638 #define ASM_OUTPUT_CASE_LABEL(STREAM, PREFIX, NUM, TABLE) \
639 (switch_to_section (progmem_section), \
640 (*targetm.asm_out.internal_label) (STREAM, PREFIX, NUM))
641
642 #define ASM_OUTPUT_SKIP(STREAM, N) \
643 fprintf (STREAM, "\t.skip %lu,0\n", (unsigned long)(N))
644
645 #define ASM_OUTPUT_ALIGN(STREAM, POWER) \
646 do { \
647 if ((POWER) > 1) \
648 fprintf (STREAM, "\t.p2align\t%d\n", POWER); \
649 } while (0)
650
651 #define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
652 default_elf_asm_output_external (FILE, DECL, NAME)
653
654 #define CASE_VECTOR_MODE HImode
655
656 #undef WORD_REGISTER_OPERATIONS
657
658 #define MOVE_MAX 4
659
660 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
661
662 #define Pmode HImode
663
664 #define FUNCTION_MODE HImode
665
666 #define DOLLARS_IN_IDENTIFIERS 0
667
668 #define NO_DOLLAR_IN_LABEL 1
669
670 #define TRAMPOLINE_SIZE 4
671
672 /* Store in cc_status the expressions
673 that the condition codes will describe
674 after execution of an instruction whose pattern is EXP.
675 Do not alter them if the instruction would not alter the cc's. */
676
677 #define NOTICE_UPDATE_CC(EXP, INSN) notice_update_cc(EXP, INSN)
678
679 /* The add insns don't set overflow in a usable way. */
680 #define CC_OVERFLOW_UNUSABLE 01000
681 /* The mov,and,or,xor insns don't set carry. That's ok though as the
682 Z bit is all we need when doing unsigned comparisons on the result of
683 these insns (since they're always with 0). However, conditions.h has
684 CC_NO_OVERFLOW defined for this purpose. Rename it to something more
685 understandable. */
686 #define CC_NO_CARRY CC_NO_OVERFLOW
687
688
689 /* Output assembler code to FILE to increment profiler label # LABELNO
690 for profiling a function entry. */
691
692 #define FUNCTION_PROFILER(FILE, LABELNO) \
693 fprintf (FILE, "/* profiler %d */", (LABELNO))
694
695 #define ADJUST_INSN_LENGTH(INSN, LENGTH) (LENGTH =\
696 adjust_insn_length (INSN, LENGTH))
697
698 extern const char *avr_device_to_arch (int argc, const char **argv);
699 extern const char *avr_device_to_data_start (int argc, const char **argv);
700 extern const char *avr_device_to_startfiles (int argc, const char **argv);
701 extern const char *avr_device_to_devicelib (int argc, const char **argv);
702
703 #define EXTRA_SPEC_FUNCTIONS \
704 { "device_to_arch", avr_device_to_arch }, \
705 { "device_to_data_start", avr_device_to_data_start }, \
706 { "device_to_startfile", avr_device_to_startfiles }, \
707 { "device_to_devicelib", avr_device_to_devicelib },
708
709 #define CPP_SPEC ""
710
711 #define CC1_SPEC ""
712
713 #define CC1PLUS_SPEC "%{!frtti:-fno-rtti} \
714 %{!fenforce-eh-specs:-fno-enforce-eh-specs} \
715 %{!fexceptions:-fno-exceptions}"
716 /* A C string constant that tells the GCC driver program options to
717 pass to `cc1plus'. */
718
719 #define ASM_SPEC "%{mmcu=avr25:-mmcu=avr2;mmcu=avr35:-mmcu=avr3;mmcu=avr31:-mmcu=avr3;mmcu=avr51:-mmcu=avr5;\
720 mmcu=*:-mmcu=%*}"
721
722 #define LINK_SPEC "\
723 %{mrelax:--relax\
724 %{mpmem-wrap-around:%{mmcu=at90usb8*:--pmem-wrap-around=8k}\
725 %{mmcu=atmega16*:--pmem-wrap-around=16k}\
726 %{mmcu=atmega32*|\
727 mmcu=at90can32*:--pmem-wrap-around=32k}\
728 %{mmcu=atmega64*|\
729 mmcu=at90can64*|\
730 mmcu=at90usb64*:--pmem-wrap-around=64k}}}\
731 %:device_to_arch(%{mmcu=*:%*})\
732 %:device_to_data_start(%{mmcu=*:%*})"
733
734 #define LIB_SPEC \
735 "%{!mmcu=at90s1*:%{!mmcu=attiny11:%{!mmcu=attiny12:%{!mmcu=attiny15:%{!mmcu=attiny28: -lc }}}}}"
736
737 #define LIBSTDCXX "gcc"
738 /* No libstdc++ for now. Empty string doesn't work. */
739
740 #define LIBGCC_SPEC \
741 "%{!mmcu=at90s1*:%{!mmcu=attiny11:%{!mmcu=attiny12:%{!mmcu=attiny15:%{!mmcu=attiny28: -lgcc }}}}}"
742
743 #define STARTFILE_SPEC "%:device_to_startfile(%{mmcu=*:%*})"
744
745 #define ENDFILE_SPEC ""
746
747 /* This is the default without any -mmcu=* option (AT90S*). */
748 #define MULTILIB_DEFAULTS { "mmcu=avr2" }
749
750 #define TEST_HARD_REG_CLASS(CLASS, REGNO) \
751 TEST_HARD_REG_BIT (reg_class_contents[ (int) (CLASS)], REGNO)
752
753 /* Note that the other files fail to use these
754 in some of the places where they should. */
755
756 #if defined(__STDC__) || defined(ALMOST_STDC)
757 #define AS2(a,b,c) #a " " #b "," #c
758 #define AS2C(b,c) " " #b "," #c
759 #define AS3(a,b,c,d) #a " " #b "," #c "," #d
760 #define AS1(a,b) #a " " #b
761 #else
762 #define AS1(a,b) "a b"
763 #define AS2(a,b,c) "a b,c"
764 #define AS2C(b,c) " b,c"
765 #define AS3(a,b,c,d) "a b,c,d"
766 #endif
767 #define OUT_AS1(a,b) output_asm_insn (AS1(a,b), operands)
768 #define OUT_AS2(a,b,c) output_asm_insn (AS2(a,b,c), operands)
769 #define CR_TAB "\n\t"
770
771 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
772
773 #define DWARF2_DEBUGGING_INFO 1
774
775 #define DWARF2_ADDR_SIZE 4
776
777 #define OBJECT_FORMAT_ELF
778
779 #define INCOMING_RETURN_ADDR_RTX avr_incoming_return_addr_rtx ()
780 #define INCOMING_FRAME_SP_OFFSET (AVR_3_BYTE_PC ? 3 : 2)
781
782 /* The caller's stack pointer value immediately before the call
783 is one byte below the first argument. */
784 #define ARG_POINTER_CFA_OFFSET(FNDECL) -1
785
786 #define HARD_REGNO_RENAME_OK(OLD_REG, NEW_REG) \
787 avr_hard_regno_rename_ok (OLD_REG, NEW_REG)
788
789 /* A C structure for machine-specific, per-function data.
790 This is added to the cfun structure. */
791 struct GTY(()) machine_function
792 {
793 /* 'true' - if current function is a naked function. */
794 int is_naked;
795
796 /* 'true' - if current function is an interrupt function
797 as specified by the "interrupt" attribute. */
798 int is_interrupt;
799
800 /* 'true' - if current function is a signal function
801 as specified by the "signal" attribute. */
802 int is_signal;
803
804 /* 'true' - if current function is a 'task' function
805 as specified by the "OS_task" attribute. */
806 int is_OS_task;
807
808 /* 'true' - if current function is a 'main' function
809 as specified by the "OS_main" attribute. */
810 int is_OS_main;
811
812 /* Current function stack size. */
813 int stack_usage;
814
815 /* 'true' if a callee might be tail called */
816 int sibcall_fails;
817 };