Debian Codegraph @

gcc/config/avr/avr.h

raw
1 /* Definitions of target machine for GNU compiler,
2 for AVR 8-bit microcontrollers.
3 Copyright (C) 1998-2025 Free Software Foundation, Inc.
4 Contributed by Denis Chertykov ([email protected])
5
6 This file is part of GCC.
7
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 3, or (at your option)
11 any later version.
12
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.
17
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
21
22 typedef struct
23 {
24 /* Id of the address space as used in c_register_addr_space */
25 unsigned char id;
26
27 /* Flavour of memory: 0 = RAM, 1 = Flash */
28 int memory_class;
29
30 /* Width of pointer (in bytes) */
31 int pointer_size;
32
33 /* Name of the address space as visible to the user */
34 const char *name;
35
36 /* Segment (i.e. 64k memory chunk) number. */
37 int segment;
38
39 /* Section prefix, e.g. ".progmem1.data" */
40 const char *section_name;
41 } avr_addrspace_t;
42
43 extern const avr_addrspace_t avr_addrspace[];
44
45 /* Known address spaces */
46
47 enum
48 {
49 ADDR_SPACE_RAM, /* ADDR_SPACE_GENERIC */
50 ADDR_SPACE_FLASH,
51 ADDR_SPACE_FLASH1,
52 ADDR_SPACE_FLASH2,
53 ADDR_SPACE_FLASH3,
54 ADDR_SPACE_FLASH4,
55 ADDR_SPACE_FLASH5,
56 ADDR_SPACE_FLASHX,
57 ADDR_SPACE_MEMX,
58 /* Sentinel */
59 ADDR_SPACE_COUNT
60 };
61
62 #define TARGET_CPU_CPP_BUILTINS() avr_cpu_cpp_builtins (pfile)
63
64 #define AVR_SHORT_CALLS (TARGET_SHORT_CALLS \
65 && avr_arch == &avr_arch_types[ARCH_AVRXMEGA3])
66 #define AVR_HAVE_JMP_CALL (avr_arch->have_jmp_call && ! AVR_SHORT_CALLS)
67 #define AVR_HAVE_MUL (avr_arch->have_mul)
68 #define AVR_HAVE_MOVW (avr_arch->have_movw_lpmx)
69 #define AVR_HAVE_ADIW (!AVR_TINY)
70 #define AVR_HAVE_LPM (!AVR_TINY)
71 #define AVR_HAVE_LPMX (avr_arch->have_movw_lpmx)
72 #define AVR_HAVE_ELPM (avr_arch->have_elpm)
73 #define AVR_HAVE_ELPMX (avr_arch->have_elpmx)
74 #define AVR_HAVE_RAMPD (avr_arch->have_rampd)
75 #define AVR_HAVE_RAMPX (avr_arch->have_rampd)
76 #define AVR_HAVE_RAMPY (avr_arch->have_rampd)
77 #define AVR_HAVE_RAMPZ (avr_arch->have_elpm \
78 || avr_arch->have_rampd)
79 #define AVR_HAVE_EIJMP_EICALL (avr_arch->have_eijmp_eicall)
80
81 /* Handling of 8-bit SP versus 16-bit SP is as follows:
82
83 FIXME: DRIVER_SELF_SPECS has changed.
84 -msp8 is used internally to select the right multilib for targets with
85 8-bit SP. -msp8 is set automatically by DRIVER_SELF_SPECS for devices
86 with 8-bit SP or by multilib generation machinery. If a frame pointer is
87 needed and SP is only 8 bits wide, SP is zero-extended to get FP.
88
89 TARGET_TINY_STACK is triggered by -mtiny-stack which is a user option.
90 This option has no effect on multilib selection. It serves to save some
91 bytes on 16-bit SP devices by only changing SP_L and leaving SP_H alone.
92
93 These two properties are reflected by built-in macros __AVR_SP8__ resp.
94 __AVR_HAVE_8BIT_SP__ and __AVR_HAVE_16BIT_SP__. During multilib generation
95 there is always __AVR_SP8__ == __AVR_HAVE_8BIT_SP__. */
96
97 #define AVR_HAVE_8BIT_SP \
98 (TARGET_TINY_STACK || avropt_sp8)
99
100 #define AVR_HAVE_SPH (!avropt_sp8)
101
102 #define AVR_2_BYTE_PC (!AVR_HAVE_EIJMP_EICALL)
103 #define AVR_3_BYTE_PC (AVR_HAVE_EIJMP_EICALL)
104
105 #define AVR_XMEGA (avr_arch->xmega_p)
106 #define AVR_TINY (avr_arch->tiny_p)
107
108 #define BITS_BIG_ENDIAN 0
109 #define BYTES_BIG_ENDIAN 0
110 #define WORDS_BIG_ENDIAN 0
111
112 #define FLOAT_LIB_COMPARE_RETURNS_BOOL(mode, comparison) \
113 avr_float_lib_compare_returns_bool (mode, comparison)
114
115 #ifdef IN_LIBGCC2
116 /* This is to get correct SI and DI modes in libgcc2.c (32 and 64 bits). */
117 #define UNITS_PER_WORD 4
118 #else
119 /* Width of a word, in units (bytes). */
120 #define UNITS_PER_WORD 1
121 #endif
122
123 #define POINTER_SIZE 16
124
125
126 /* Maximum sized of reasonable data type
127 DImode or Dfmode ... */
128 #define MAX_FIXED_MODE_SIZE 32
129
130 #define PARM_BOUNDARY 8
131
132 #define FUNCTION_BOUNDARY 8
133
134 #define EMPTY_FIELD_BOUNDARY 8
135
136 /* No data type wants to be aligned rounder than this. */
137 #define BIGGEST_ALIGNMENT 8
138
139 #define TARGET_VTABLE_ENTRY_ALIGN 8
140
141 #define STRICT_ALIGNMENT 0
142
143 #define INT_TYPE_SIZE (TARGET_INT8 ? 8 : 16)
144 #define SHORT_TYPE_SIZE (INT_TYPE_SIZE == 8 ? INT_TYPE_SIZE : 16)
145 #define LONG_TYPE_SIZE (INT_TYPE_SIZE == 8 ? 16 : 32)
146 #define LONG_LONG_TYPE_SIZE (INT_TYPE_SIZE == 8 ? 32 : 64)
147
148 #define LONG_LONG_ACCUM_TYPE_SIZE 64
149
150 #define DEFAULT_SIGNED_CHAR 1
151
152 #define SIZE_TYPE (INT_TYPE_SIZE == 8 ? "long unsigned int" : "unsigned int")
153 #define PTRDIFF_TYPE (INT_TYPE_SIZE == 8 ? "long int" :"int")
154
155 #define WCHAR_TYPE_SIZE 16
156
157 #define FIRST_PSEUDO_REGISTER 37
158
159 #define GENERAL_REGNO_P(N) IN_RANGE (N, 2, 31)
160 #define GENERAL_REG_P(X) (REG_P (X) && GENERAL_REGNO_P (REGNO (X)))
161
162 #define FIXED_REGISTERS {\
163 1,1,/* r0 r1 */\
164 0,0,/* r2 r3 */\
165 0,0,/* r4 r5 */\
166 0,0,/* r6 r7 */\
167 0,0,/* r8 r9 */\
168 0,0,/* r10 r11 */\
169 0,0,/* r12 r13 */\
170 0,0,/* r14 r15 */\
171 0,0,/* r16 r17 */\
172 0,0,/* r18 r19 */\
173 0,0,/* r20 r21 */\
174 0,0,/* r22 r23 */\
175 0,0,/* r24 r25 */\
176 0,0,/* r26 r27 */\
177 0,0,/* r28 r29 */\
178 0,0,/* r30 r31 */\
179 1,1,/* STACK */\
180 1,1, /* arg pointer */ \
181 1 /* CC */ }
182
183 #define CALL_USED_REGISTERS { \
184 1,1,/* r0 r1 */ \
185 0,0,/* r2 r3 */ \
186 0,0,/* r4 r5 */ \
187 0,0,/* r6 r7 */ \
188 0,0,/* r8 r9 */ \
189 0,0,/* r10 r11 */ \
190 0,0,/* r12 r13 */ \
191 0,0,/* r14 r15 */ \
192 0,0,/* r16 r17 */ \
193 1,1,/* r18 r19 */ \
194 1,1,/* r20 r21 */ \
195 1,1,/* r22 r23 */ \
196 1,1,/* r24 r25 */ \
197 1,1,/* r26 r27 */ \
198 0,0,/* r28 r29 */ \
199 1,1,/* r30 r31 */ \
200 1,1,/* STACK */ \
201 1,1, /* arg pointer */ \
202 1 /* CC */ }
203
204 #define REG_ALLOC_ORDER { \
205 24,25, \
206 18,19, \
207 20,21, \
208 22,23, \
209 30,31, \
210 26,27, \
211 28,29, \
212 17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2, \
213 0,1, \
214 32,33,34,35,36 \
215 }
216
217 #define ADJUST_REG_ALLOC_ORDER avr_adjust_reg_alloc_order()
218
219
220 enum reg_class {
221 NO_REGS,
222 R0_REG, /* r0 */
223 POINTER_X_REGS, /* r26 - r27 */
224 POINTER_Y_REGS, /* r28 - r29 */
225 POINTER_Z_REGS, /* r30 - r31 */
226 STACK_REG, /* STACK */
227 BASE_POINTER_REGS, /* r28 - r31 */
228 POINTER_REGS, /* r26 - r31 */
229 ADDW_REGS, /* r24 - r31 */
230 SIMPLE_LD_REGS, /* r16 - r23 */
231 LD_REGS, /* r16 - r31 */
232 NO_LD_REGS, /* r0 - r15 */
233 GENERAL_REGS, /* r0 - r31 */
234 CC_REG, /* CC */
235 ALL_REGS, LIM_REG_CLASSES
236 };
237
238
239 #define N_REG_CLASSES (int)LIM_REG_CLASSES
240
241 #define REG_CLASS_NAMES { \
242 "NO_REGS", \
243 "R0_REG", /* r0 */ \
244 "POINTER_X_REGS", /* r26 - r27 */ \
245 "POINTER_Y_REGS", /* r28 - r29 */ \
246 "POINTER_Z_REGS", /* r30 - r31 */ \
247 "STACK_REG", /* STACK */ \
248 "BASE_POINTER_REGS", /* r28 - r31 */ \
249 "POINTER_REGS", /* r26 - r31 */ \
250 "ADDW_REGS", /* r24 - r31 */ \
251 "SIMPLE_LD_REGS", /* r16 - r23 */ \
252 "LD_REGS", /* r16 - r31 */ \
253 "NO_LD_REGS", /* r0 - r15 */ \
254 "GENERAL_REGS", /* r0 - r31 */ \
255 "CC_REG", /* CC */ \
256 "ALL_REGS" }
257
258 #define REG_CLASS_CONTENTS { \
259 {0x00000000,0x00000000}, /* NO_REGS */ \
260 {0x00000001,0x00000000}, /* R0_REG */ \
261 {3u << REG_X,0x00000000}, /* POINTER_X_REGS, r26 - r27 */ \
262 {3u << REG_Y,0x00000000}, /* POINTER_Y_REGS, r28 - r29 */ \
263 {3u << REG_Z,0x00000000}, /* POINTER_Z_REGS, r30 - r31 */ \
264 {0x00000000,0x00000003}, /* STACK_REG, STACK */ \
265 {(3u << REG_Y) | (3u << REG_Z), \
266 0x00000000}, /* BASE_POINTER_REGS, r28 - r31 */ \
267 {(3u << REG_X) | (3u << REG_Y) | (3u << REG_Z), \
268 0x00000000}, /* POINTER_REGS, r26 - r31 */ \
269 {(3u << REG_X) | (3u << REG_Y) | (3u << REG_Z) | (3u << REG_W), \
270 0x00000000}, /* ADDW_REGS, r24 - r31 */ \
271 {0x00ff0000,0x00000000}, /* SIMPLE_LD_REGS r16 - r23 */ \
272 {(3u << REG_X)|(3u << REG_Y)|(3u << REG_Z)|(3u << REG_W)|(0xffu << 16),\
273 0x00000000}, /* LD_REGS, r16 - r31 */ \
274 {0x0000ffff,0x00000000}, /* NO_LD_REGS r0 - r15 */ \
275 {0xffffffff,0x00000000}, /* GENERAL_REGS, r0 - r31 */ \
276 {0x00000000,0x00000010}, /* CC */ \
277 {0xffffffff,0x00000013} /* ALL_REGS */ \
278 }
279
280 #define REGNO_REG_CLASS(R) avr_regno_reg_class(R)
281
282 #define MODE_CODE_BASE_REG_CLASS(mode, as, outer_code, index_code) \
283 avr_mode_code_base_reg_class (mode, as, outer_code, index_code)
284
285 #define INDEX_REG_CLASS NO_REGS
286
287 #define REGNO_MODE_CODE_OK_FOR_BASE_P(num, mode, as, outer_code, index_code) \
288 avr_regno_mode_code_ok_for_base_p (num, mode, as, outer_code, index_code)
289
290 #define REGNO_OK_FOR_INDEX_P(NUM) 0
291
292 #define TARGET_SMALL_REGISTER_CLASSES_FOR_MODE_P hook_bool_mode_true
293
294 #define STACK_PUSH_CODE POST_DEC
295
296 #define STACK_GROWS_DOWNWARD 1
297
298 #define STACK_POINTER_OFFSET 1
299
300 #define FIRST_PARM_OFFSET(FUNDECL) 0
301
302 #define STACK_BOUNDARY 8
303
304 #define STACK_POINTER_REGNUM 32
305
306 #define FRAME_POINTER_REGNUM REG_Y
307
308 #define ARG_POINTER_REGNUM 34
309
310 #define STATIC_CHAIN_REGNUM ((AVR_TINY) ? 18 :2)
311
312 #define RELOAD_ELIMINABLE_REGS { \
313 { ARG_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
314 { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM }, \
315 { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
316 { FRAME_POINTER_REGNUM + 1, STACK_POINTER_REGNUM + 1 } }
317
318 #define ELIMINABLE_REGS \
319 { \
320 { ARG_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
321 { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM }, \
322 { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM } \
323 }
324
325 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
326 OFFSET = avr_initial_elimination_offset (FROM, TO)
327
328 #define RETURN_ADDR_RTX(count, tem) avr_return_addr_rtx (count, tem)
329
330 /* Don't use Push rounding. expr.cc: emit_single_push_insn is broken
331 for POST_DEC targets (PR27386). */
332 /*#define PUSH_ROUNDING(NPUSHED) (NPUSHED)*/
333
334 typedef struct avr_args
335 {
336 /* # Registers available for passing */
337 int nregs;
338
339 /* Next available register number */
340 int regno;
341
342 /* Whether some of the arguments are passed on the stack,
343 and hence an arg pointer is needed. */
344 bool has_stack_args;
345 } CUMULATIVE_ARGS;
346
347 #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, FNDECL, N_NAMED_ARGS) \
348 avr_init_cumulative_args (&(CUM), FNTYPE, LIBNAME, FNDECL)
349
350 #define FUNCTION_ARG_REGNO_P(r) avr_function_arg_regno_p(r)
351
352 #define DEFAULT_PCC_STRUCT_RETURN 0
353
354 #define EPILOGUE_USES(REGNO) avr_epilogue_uses(REGNO)
355
356 #define HAVE_POST_INCREMENT 1
357 #define HAVE_PRE_DECREMENT 1
358
359 #define MAX_REGS_PER_ADDRESS 1
360
361 #define LEGITIMIZE_RELOAD_ADDRESS(X,MODE,OPNUM,TYPE,IND_L,WIN) \
362 do { \
363 rtx new_x = avr_legitimize_reload_address (&(X), MODE, OPNUM, TYPE, \
364 ADDR_TYPE (TYPE), \
365 IND_L, make_memloc); \
366 if (new_x) \
367 { \
368 X = new_x; \
369 goto WIN; \
370 } \
371 } while (0)
372
373 /* We increase branch costs after reload in order to keep basic-block
374 reordering from introducing out-of-line jumps and to prefer fall-through
375 edges instead. The default branch costs are 0, mainly because otherwise
376 do_store_flag might come up with bloated code. */
377 #define BRANCH_COST(speed_p, predictable_p) \
378 (avropt_branch_cost + (reload_completed ? 4 : 0))
379
380 #define SLOW_BYTE_ACCESS 0
381
382 #define NO_FUNCTION_CSE 1
383
384 #define REGISTER_TARGET_PRAGMAS() \
385 do { \
386 avr_register_target_pragmas(); \
387 } while (0)
388
389 #define TEXT_SECTION_ASM_OP "\t.text"
390
391 #define DATA_SECTION_ASM_OP "\t.data"
392
393 #define BSS_SECTION_ASM_OP "\t.section .bss"
394
395 /* Define the pseudo-ops used to switch to the .ctors and .dtors sections.
396 There are no shared libraries on this target, and these sections are
397 placed in the read-only program memory, so they are not writable. */
398
399 #undef CTORS_SECTION_ASM_OP
400 #define CTORS_SECTION_ASM_OP "\t.section .ctors,\"a\",@progbits"
401
402 #undef DTORS_SECTION_ASM_OP
403 #define DTORS_SECTION_ASM_OP "\t.section .dtors,\"a\",@progbits"
404
405 #define TARGET_ASM_CONSTRUCTOR avr_asm_out_ctor
406
407 #define TARGET_ASM_DESTRUCTOR avr_asm_out_dtor
408
409 #define SUPPORTS_INIT_PRIORITY 0
410
411 /* We pretend jump tables are in text section because otherwise,
412 final.cc will switch to .rodata before jump tables and thereby
413 triggers __do_copy_data. As we implement ASM_OUTPUT_ADDR_VEC,
414 we still have full control over the jump tables themselves. */
415 #define JUMP_TABLES_IN_TEXT_SECTION 1
416
417 #define ASM_COMMENT_START " ; "
418
419 #define ASM_APP_ON "/* #APP */\n"
420
421 #define ASM_APP_OFF "/* #NOAPP */\n"
422
423 #define IS_ASM_LOGICAL_LINE_SEPARATOR(C, STR) ((C) == '\n' || ((C) == '$'))
424
425 #define ASM_OUTPUT_ALIGNED_DECL_COMMON(STREAM, DECL, NAME, SIZE, ALIGN) \
426 avr_asm_output_aligned_decl_common (STREAM, DECL, NAME, SIZE, ALIGN, false)
427
428 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
429 avr_asm_asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN, \
430 asm_output_aligned_bss)
431
432 #define ASM_OUTPUT_ALIGNED_DECL_LOCAL(STREAM, DECL, NAME, SIZE, ALIGN) \
433 avr_asm_output_aligned_decl_common (STREAM, DECL, NAME, SIZE, ALIGN, true)
434
435 /* Globalizing directive for a label. */
436 #define GLOBAL_ASM_OP ".global\t"
437
438 #define SUPPORTS_WEAK 1
439
440 #define HAS_INIT_SECTION 1
441
442 #define REGISTER_NAMES { \
443 "r0","r1","r2","r3","r4","r5","r6","r7", \
444 "r8","r9","r10","r11","r12","r13","r14","r15", \
445 "r16","r17","r18","r19","r20","r21","r22","r23", \
446 "r24","r25","r26","r27","r28","r29","r30","r31", \
447 "__SP_L__","__SP_H__","argL","argH", "cc"}
448
449 #define FINAL_PRESCAN_INSN(insn, operand, nop) \
450 avr_final_prescan_insn (insn, operand,nop)
451
452 #define ASM_OUTPUT_REG_PUSH(STREAM, REGNO) \
453 { \
454 gcc_assert (REGNO < 32); \
455 fprintf (STREAM, "\tpush\tr%d", REGNO); \
456 }
457
458 #define ASM_OUTPUT_REG_POP(STREAM, REGNO) \
459 { \
460 gcc_assert (REGNO < 32); \
461 fprintf (STREAM, "\tpop\tr%d", REGNO); \
462 }
463
464 #define ASM_OUTPUT_ADDR_VEC(TLABEL, TDATA) \
465 avr_output_addr_vec (TLABEL, TDATA)
466
467 #define ASM_OUTPUT_ALIGN(STREAM, POWER) \
468 do { \
469 if ((POWER) > 0) \
470 fprintf (STREAM, "\t.p2align\t%d\n", POWER); \
471 } while (0)
472
473 #define CASE_VECTOR_MODE HImode
474
475 #undef WORD_REGISTER_OPERATIONS
476
477 /* Can move only a single byte from memory to reg in a
478 single instruction. */
479
480 #define MOVE_MAX 1
481
482 /* Allow upto two bytes moves to occur using by_pieces
483 infrastructure */
484
485 #define MOVE_MAX_PIECES 2
486
487 /* Set MOVE_RATIO to 3 to allow memory moves upto 4 bytes to happen
488 by pieces when optimizing for speed, like it did when MOVE_MAX_PIECES
489 was 4. When optimizing for size, allow memory moves upto 2 bytes.
490 Also see avr_use_by_pieces_infrastructure_p. */
491
492 #define MOVE_RATIO(speed) ((speed) ? 3 : 2)
493
494 #define Pmode HImode
495
496 #define FUNCTION_MODE HImode
497
498 #define DOLLARS_IN_IDENTIFIERS 0
499
500 #define TRAMPOLINE_SIZE 4
501
502 /* Output assembler code to FILE to increment profiler label # LABELNO
503 for profiling a function entry. */
504
505 #define FUNCTION_PROFILER(FILE, LABELNO) \
506 fprintf (FILE, "/* profiler %d */", (LABELNO))
507
508 #define ADJUST_INSN_LENGTH(INSN, LENGTH) \
509 (LENGTH = avr_adjust_insn_length (INSN, LENGTH))
510
511 extern const char *avr_devicespecs_file (int, const char**);
512 extern const char *avr_double_lib (int, const char**);
513 extern const char *avr_no_devlib (int, const char**);
514
515 #define EXTRA_SPEC_FUNCTIONS \
516 { "double-lib", avr_double_lib }, \
517 { "no-devlib", avr_no_devlib }, \
518 { "device-specs-file", avr_devicespecs_file },
519
520 /* Driver self specs has lmited functionality w.r.t. '%s' for dynamic specs.
521 Apply '%s' to a static string to inflate the file (directory) name which
522 is used to diagnose problems with reading the specs file. */
523
524 #undef DRIVER_SELF_SPECS
525 #define DRIVER_SELF_SPECS \
526 " %:double-lib(%{m*:m%*})" \
527 " %:device-specs-file(device-specs%s %{mmcu=*:%*})"
528
529 /* No libstdc++ for now. Empty string doesn't work. */
530 #define LIBSTDCXX "gcc"
531
532 /* This is the default without any -mmcu=* option. */
533 #define MULTILIB_DEFAULTS { "mmcu=" AVR_MMCU_DEFAULT }
534
535 #define TEST_HARD_REG_CLASS(CLASS, REGNO) \
536 TEST_HARD_REG_BIT (reg_class_contents[ (int) (CLASS)], REGNO)
537
538 #define CR_TAB "\n\t"
539
540 #define DWARF2_ADDR_SIZE 4
541
542 #define INCOMING_RETURN_ADDR_RTX avr_incoming_return_addr_rtx ()
543 #define INCOMING_FRAME_SP_OFFSET (AVR_3_BYTE_PC ? 3 : 2)
544
545 /* The caller's stack pointer value immediately before the call
546 is one byte below the first argument. */
547 #define ARG_POINTER_CFA_OFFSET(FNDECL) -1
548
549 #define HARD_REGNO_RENAME_OK(OLD_REG, NEW_REG) \
550 avr_hard_regno_rename_ok (OLD_REG, NEW_REG)
551
552 /* A C structure for machine-specific, per-function data.
553 This is added to the cfun structure. */
554 struct GTY(()) machine_function
555 {
556 /* 'true' - if current function is a naked function. */
557 bool is_naked;
558
559 /* 0 when no "interrupt" attribute is present.
560 1 when an "interrupt" attribute without arguments is present (and
561 perhaps also "interrupt" attributes with argument(s)).
562 -1 when "interrupt" attribute(s) with arguments are present but none
563 without argument. */
564 int is_interrupt;
565
566 /* 0 when no "signal" attribute is present.
567 1 when a "signal" attribute without arguments is present (and
568 perhaps also "signal" attributes with argument(s)).
569 -1 when "signal" attribute(s) with arguments are present but none
570 without argument. */
571 int is_signal;
572
573 /* 'true' - if current function is a non-blocking interrupt service
574 routine as specified by the "isr_noblock" attribute. */
575 bool is_noblock;
576
577 /* 'true' - if current function is a 'task' function
578 as specified by the "OS_task" attribute. */
579 bool is_OS_task;
580
581 /* 'true' - if current function is a 'main' function
582 as specified by the "OS_main" attribute. */
583 bool is_OS_main;
584
585 /* Current function stack size. */
586 int stack_usage;
587
588 /* 'true' if a callee might be tail called */
589 bool sibcall_fails;
590
591 /* 'true' if the above is_foo predicates are sanity-checked to avoid
592 multiple diagnose for the same function. */
593 bool attributes_checked_p;
594
595 /* 'true' - if current function shall not use '__gcc_isr' pseudo
596 instructions as specified by the "no_gccisr" attribute. */
597 bool is_no_gccisr;
598
599 /* Used for `__gcc_isr' pseudo instruction handling of
600 non-naked ISR prologue / epilogue(s). */
601 struct
602 {
603 /* 'true' if this function actually uses "*gasisr" insns. */
604 bool yes;
605 /* 'true' if this function is allowed to use "*gasisr" insns. */
606 bool maybe;
607 /* The register numer as printed by the Done chunk. */
608 int regno;
609 } gasisr;
610
611 /* 'true' if this function references .L__stack_usage like with
612 __builtin_return_address. */
613 bool use_L__stack_usage;
614
615 /* Counts how many times the execute() method of the avr-fuse-add pass
616 has been invoked. The count is even increased when the optimization
617 itself is not run. The purpose of this variable is to provide
618 information about where in the pass sequence we are.
619 It is used in insn / split conditions. */
620 int n_avr_fuse_add_executed;
621 };
622
623 /* AVR does not round pushes, but the existence of this macro is
624 required in order for pushes to be generated. */
625 #define PUSH_ROUNDING(X) (X)
626
627 /* Define prototype here to avoid build warning. Some files using
628 ACCUMULATE_OUTGOING_ARGS (directly or indirectly) include
629 tm.h but not tm_p.h. */
630 extern int avr_accumulate_outgoing_args (void);
631 #define ACCUMULATE_OUTGOING_ARGS avr_accumulate_outgoing_args()
632
633 #define INIT_EXPANDERS avr_init_expanders()
634
635 /* Flags used for io and address attributes. */
636 #define SYMBOL_FLAG_IO_LOW (SYMBOL_FLAG_MACH_DEP << 4)
637 #define SYMBOL_FLAG_IO (SYMBOL_FLAG_MACH_DEP << 5)
638 #define SYMBOL_FLAG_ADDRESS (SYMBOL_FLAG_MACH_DEP << 6)