1 /* Copyright (C) 2009 2 Free Software Foundation, Inc. 3 Contributed by Anatoly Sokolov (aesok@post.ru) 4 5 This file is part of GCC. 6 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. 11 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. 16 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/>. */ 20 21 22 #include "config.h" 23 #include "system.h" 24 #include "coretypes.h" 25 #include "tm.h" 26 #include "tm_p.h" 27 #include "regs.h" 28 #include "c-common.h" 29 30 31 /* Not included in avr.c since this requires C front end. */ 32 33 /* Worker function for TARGET_CPU_CPP_BUILTINS. */ 34 35 void 36 avr_cpu_cpp_builtins (struct cpp_reader *pfile) 37 { 38 builtin_define_std ("AVR"); 39 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) 51 { 52 cpp_define (pfile, "__AVR_HAVE_MOVW__"); 53 cpp_define (pfile, "__AVR_HAVE_LPMX__"); 54 } 55 if (avr_current_arch->asm_only) 56 cpp_define (pfile, "__AVR_ASM_ONLY__"); 57 if (avr_current_arch->have_mul) 58 { 59 cpp_define (pfile, "__AVR_ENHANCED__"); 60 cpp_define (pfile, "__AVR_HAVE_MUL__"); 61 } 62 if (avr_current_arch->have_jmp_call) 63 { 64 cpp_define (pfile, "__AVR_MEGA__"); 65 cpp_define (pfile, "__AVR_HAVE_JMP_CALL__"); 66 } 67 if (avr_current_arch->have_eijmp_eicall) 68 { 69 cpp_define (pfile, "__AVR_HAVE_EIJMP_EICALL__"); 70 cpp_define (pfile, "__AVR_3_BYTE_PC__"); 71 } 72 else 73 { 74 cpp_define (pfile, "__AVR_2_BYTE_PC__"); 75 } 76 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__"); 81 82 if (TARGET_NO_INTERRUPTS) 83 cpp_define (pfile, "__NO_INTERRUPTS__"); 84 } 85 86