* config/avr/avr.h (mcu_type_s): Add errata_skip field.
[official-gcc.git] / gcc / config / avr / avr-c.c
blobabe25ab590e080fa22f5467fcbd78a36fad9ba91
1 /* Copyright (C) 2009, 2010
2 Free Software Foundation, Inc.
3 Contributed by Anatoly Sokolov (aesok@post.ru)
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
10 any later version.
12 GCC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
22 #include "config.h"
23 #include "system.h"
24 #include "coretypes.h"
25 #include "tm.h"
26 #include "tm_p.h"
27 #include "cpplib.h"
28 #include "tree.h"
29 #include "c-family/c-common.h"
31 /* Not included in avr.c since this requires C front end. */
33 /* Worker function for TARGET_CPU_CPP_BUILTINS. */
35 void
36 avr_cpu_cpp_builtins (struct cpp_reader *pfile)
38 builtin_define_std ("AVR");
40 if (avr_current_arch->macro)
41 cpp_define (pfile, avr_current_arch->macro);
42 if (avr_extra_arch_macro)
43 cpp_define (pfile, avr_extra_arch_macro);
44 if (avr_current_arch->have_elpm)
45 cpp_define (pfile, "__AVR_HAVE_RAMPZ__");
46 if (avr_current_arch->have_elpm)
47 cpp_define (pfile, "__AVR_HAVE_ELPM__");
48 if (avr_current_arch->have_elpmx)
49 cpp_define (pfile, "__AVR_HAVE_ELPMX__");
50 if (avr_current_arch->have_movw_lpmx)
52 cpp_define (pfile, "__AVR_HAVE_MOVW__");
53 cpp_define (pfile, "__AVR_HAVE_LPMX__");
55 if (avr_current_arch->asm_only)
56 cpp_define (pfile, "__AVR_ASM_ONLY__");
57 if (avr_current_arch->have_mul)
59 cpp_define (pfile, "__AVR_ENHANCED__");
60 cpp_define (pfile, "__AVR_HAVE_MUL__");
62 if (avr_current_arch->have_jmp_call)
64 cpp_define (pfile, "__AVR_MEGA__");
65 cpp_define (pfile, "__AVR_HAVE_JMP_CALL__");
67 if (avr_current_arch->have_eijmp_eicall)
69 cpp_define (pfile, "__AVR_HAVE_EIJMP_EICALL__");
70 cpp_define (pfile, "__AVR_3_BYTE_PC__");
72 else
74 cpp_define (pfile, "__AVR_2_BYTE_PC__");
77 if (avr_current_device->short_sp)
78 cpp_define (pfile, "__AVR_HAVE_8BIT_SP__");
79 else
80 cpp_define (pfile, "__AVR_HAVE_16BIT_SP__");
82 if (TARGET_NO_INTERRUPTS)
83 cpp_define (pfile, "__NO_INTERRUPTS__");
85 if (avr_current_device->errata_skip)
87 cpp_define (pfile, "__AVR_ERRATA_SKIP__");
89 if (avr_current_arch->have_jmp_call)
90 cpp_define (pfile, "__AVR_ERRATA_SKIP_JMP_CALL__");
93 /* Define builtin macros so that the user can
94 easily query if or if not a specific builtin
95 is available. */
97 cpp_define (pfile, "__BUILTIN_AVR_NOP");
98 cpp_define (pfile, "__BUILTIN_AVR_SEI");
99 cpp_define (pfile, "__BUILTIN_AVR_CLI");
100 cpp_define (pfile, "__BUILTIN_AVR_WDR");
101 cpp_define (pfile, "__BUILTIN_AVR_SLEEP");
102 cpp_define (pfile, "__BUILTIN_AVR_SWAP");
103 cpp_define (pfile, "__BUILTIN_AVR_DELAY_CYCLES");
105 cpp_define (pfile, "__BUILTIN_AVR_FMUL");
106 cpp_define (pfile, "__BUILTIN_AVR_FMULS");
107 cpp_define (pfile, "__BUILTIN_AVR_FMULSU");