]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/avr/avr.h
b0c1b49486ec28ebd577a2bcdab7e3d42063bdf9
[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 avr_asm_named_section
464
465 #define ASM_OUTPUT_ASCII(FILE, P, SIZE) gas_output_ascii (FILE,P,SIZE)
466
467 #define IS_ASM_LOGICAL_LINE_SEPARATOR(C, STR) ((C) == '\n' || ((C) == '$'))
468
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)
471
472 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
473 asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
474
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)
477
478 #undef TYPE_ASM_OP
479 #undef SIZE_ASM_OP
480 #undef WEAK_ASM_OP
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. */
489
490
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). */
498
499 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
500 avr_asm_declare_function_name ((FILE), (NAME), (DECL))
501
502 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
503 do { \
504 if (!flag_inhibit_size_directive) \
505 ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME); \
506 } while (0)
507
508 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
509 do { \
510 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
511 size_directive_output = 0; \
512 if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
513 { \
514 size_directive_output = 1; \
515 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, \
516 int_size_in_bytes (TREE_TYPE (DECL))); \
517 } \
518 ASM_OUTPUT_LABEL(FILE, NAME); \
519 } while (0)
520
521 #undef ASM_FINISH_DECLARE_OBJECT
522 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
523 do { \
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) \
530 { \
531 size_directive_output = 1; \
532 size = int_size_in_bytes (TREE_TYPE (DECL)); \
533 ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size); \
534 } \
535 } while (0)
536
537
538 #define ESCAPES \
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. */
560
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.
570
571 If your target assembler doesn't support the .string directive, you
572 should define this to zero. */
573
574 /* Globalizing directive for a label. */
575 #define GLOBAL_ASM_OP ".global\t"
576
577 #define SET_ASM_OP "\t.set\t"
578
579 #define ASM_WEAKEN_LABEL(FILE, NAME) \
580 do \
581 { \
582 fputs ("\t.weak\t", (FILE)); \
583 assemble_name ((FILE), (NAME)); \
584 fputc ('\n', (FILE)); \
585 } \
586 while (0)
587
588 #define SUPPORTS_WEAK 1
589
590 #define ASM_GENERATE_INTERNAL_LABEL(STRING, PREFIX, NUM) \
591 sprintf (STRING, "*.%s%lu", PREFIX, (unsigned long)(NUM))
592
593 #define HAS_INIT_SECTION 1
594
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"}
601
602 #define FINAL_PRESCAN_INSN(insn, operand, nop) final_prescan_insn (insn, operand,nop)
603
604 #define PRINT_OPERAND(STREAM, X, CODE) print_operand (STREAM, X, CODE)
605
606 #define PRINT_OPERAND_PUNCT_VALID_P(CODE) ((CODE) == '~' || (CODE) == '!')
607
608 #define PRINT_OPERAND_ADDRESS(STREAM, X) print_operand_address(STREAM, X)
609
610 #define USER_LABEL_PREFIX ""
611
612 #define ASSEMBLER_DIALECT AVR_HAVE_MOVW
613
614 #define ASM_OUTPUT_REG_PUSH(STREAM, REGNO) \
615 { \
616 gcc_assert (REGNO < 32); \
617 fprintf (STREAM, "\tpush\tr%d", REGNO); \
618 }
619
620 #define ASM_OUTPUT_REG_POP(STREAM, REGNO) \
621 { \
622 gcc_assert (REGNO < 32); \
623 fprintf (STREAM, "\tpop\tr%d", REGNO); \
624 }
625
626 #define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \
627 avr_output_addr_vec_elt(STREAM, VALUE)
628
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))
632
633 #define ASM_OUTPUT_SKIP(STREAM, N) \
634 fprintf (STREAM, "\t.skip %lu,0\n", (unsigned long)(N))
635
636 #define ASM_OUTPUT_ALIGN(STREAM, POWER) \
637 do { \
638 if ((POWER) > 1) \
639 fprintf (STREAM, "\t.p2align\t%d\n", POWER); \
640 } while (0)
641
642 #define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
643 default_elf_asm_output_external (FILE, DECL, NAME)
644
645 #define CASE_VECTOR_MODE HImode
646
647 #undef WORD_REGISTER_OPERATIONS
648
649 #define MOVE_MAX 4
650
651 #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
652
653 #define Pmode HImode
654
655 #define FUNCTION_MODE HImode
656
657 #define DOLLARS_IN_IDENTIFIERS 0
658
659 #define NO_DOLLAR_IN_LABEL 1
660
661 #define TRAMPOLINE_SIZE 4
662
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. */
667
668 #define NOTICE_UPDATE_CC(EXP, INSN) notice_update_cc(EXP, INSN)
669
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
676 understandable. */
677 #define CC_NO_CARRY CC_NO_OVERFLOW
678
679
680 /* Output assembler code to FILE to increment profiler label # LABELNO
681 for profiling a function entry. */
682
683 #define FUNCTION_PROFILER(FILE, LABELNO) \
684 fprintf (FILE, "/* profiler %d */", (LABELNO))
685
686 #define ADJUST_INSN_LENGTH(INSN, LENGTH) (LENGTH =\
687 adjust_insn_length (INSN, LENGTH))
688
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);
693
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 },
699
700 #define CPP_SPEC ""
701
702 #define CC1_SPEC ""
703
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'. */
709
710 #define ASM_SPEC "%{mmcu=avr25:-mmcu=avr2;mmcu=avr35:-mmcu=avr3;mmcu=avr31:-mmcu=avr3;mmcu=avr51:-mmcu=avr5;\
711 mmcu=*:-mmcu=%*}"
712
713 #define LINK_SPEC "\
714 %{mrelax:--relax\
715 %{mpmem-wrap-around:%{mmcu=at90usb8*:--pmem-wrap-around=8k}\
716 %{mmcu=atmega16*:--pmem-wrap-around=16k}\
717 %{mmcu=atmega32*|\
718 mmcu=at90can32*:--pmem-wrap-around=32k}\
719 %{mmcu=atmega64*|\
720 mmcu=at90can64*|\
721 mmcu=at90usb64*:--pmem-wrap-around=64k}}}\
722 %:device_to_arch(%{mmcu=*:%*})\
723 %:device_to_data_start(%{mmcu=*:%*})"
724
725 #define LIB_SPEC \
726 "%{!mmcu=at90s1*:%{!mmcu=attiny11:%{!mmcu=attiny12:%{!mmcu=attiny15:%{!mmcu=attiny28: -lc }}}}}"
727
728 #define LIBSTDCXX "gcc"
729 /* No libstdc++ for now. Empty string doesn't work. */
730
731 #define LIBGCC_SPEC \
732 "%{!mmcu=at90s1*:%{!mmcu=attiny11:%{!mmcu=attiny12:%{!mmcu=attiny15:%{!mmcu=attiny28: -lgcc }}}}}"
733
734 #define STARTFILE_SPEC "%:device_to_startfile(%{mmcu=*:%*})"
735
736 #define ENDFILE_SPEC ""
737
738 /* This is the default without any -mmcu=* option (AT90S*). */
739 #define MULTILIB_DEFAULTS { "mmcu=avr2" }
740
741 #define TEST_HARD_REG_CLASS(CLASS, REGNO) \
742 TEST_HARD_REG_BIT (reg_class_contents[ (int) (CLASS)], REGNO)
743
744 /* Note that the other files fail to use these
745 in some of the places where they should. */
746
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
752 #else
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"
757 #endif
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"
761
762 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
763
764 #define DWARF2_DEBUGGING_INFO 1
765
766 #define DWARF2_ADDR_SIZE 4
767
768 #define OBJECT_FORMAT_ELF
769
770 #define INCOMING_RETURN_ADDR_RTX avr_incoming_return_addr_rtx ()
771 #define INCOMING_FRAME_SP_OFFSET (AVR_3_BYTE_PC ? 3 : 2)
772
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
776
777 #define HARD_REGNO_RENAME_OK(OLD_REG, NEW_REG) \
778 avr_hard_regno_rename_ok (OLD_REG, NEW_REG)
779
780 /* A C structure for machine-specific, per-function data.
781 This is added to the cfun structure. */
782 struct GTY(()) machine_function
783 {
784 /* 'true' - if current function is a naked function. */
785 int is_naked;
786
787 /* 'true' - if current function is an interrupt function
788 as specified by the "interrupt" attribute. */
789 int is_interrupt;
790
791 /* 'true' - if current function is a signal function
792 as specified by the "signal" attribute. */
793 int is_signal;
794
795 /* 'true' - if current function is a 'task' function
796 as specified by the "OS_task" attribute. */
797 int is_OS_task;
798
799 /* 'true' - if current function is a 'main' function
800 as specified by the "OS_main" attribute. */
801 int is_OS_main;
802
803 /* Current function stack size. */
804 int stack_usage;
805
806 /* 'true' if a callee might be tail called */
807 int sibcall_fails;
808 };