Merged trunk at revision 161680 into branch.
[official-gcc.git] / gcc / config / avr / avr-c.c
blob22724c1de6352317eacdd66657cad92396d4b437
1 /* Copyright (C) 2009
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__");