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)
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/>. */
24 #include "coretypes.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. */
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__");
74 cpp_define (pfile, "__AVR_2_BYTE_PC__");
77 if (avr_current_device->short_sp)
78 cpp_define (pfile, "__AVR_HAVE_8BIT_SP__");
80 cpp_define (pfile, "__AVR_HAVE_16BIT_SP__");
82 if (TARGET_NO_INTERRUPTS)
83 cpp_define (pfile, "__NO_INTERRUPTS__");
85 /* Define builtin macros so that the user can
86 easily query if or if not a specific builtin
89 cpp_define (pfile, "__BUILTIN_AVR_NOP");
90 cpp_define (pfile, "__BUILTIN_AVR_SEI");
91 cpp_define (pfile, "__BUILTIN_AVR_CLI");
92 cpp_define (pfile, "__BUILTIN_AVR_WDR");
93 cpp_define (pfile, "__BUILTIN_AVR_SLEEP");
94 cpp_define (pfile, "__BUILTIN_AVR_SWAP");
95 cpp_define (pfile, "__BUILTIN_AVR_DELAY_CYCLES");
97 cpp_define (pfile, "__BUILTIN_AVR_FMUL");
98 cpp_define (pfile, "__BUILTIN_AVR_FMULS");
99 cpp_define (pfile, "__BUILTIN_AVR_FMULSU");