summaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authorhutchinsonandy <hutchinsonandy@138bc75d-0d04-0410-961f-82ee72b054a4>2009-12-24 20:32:38 +0000
committerhutchinsonandy <hutchinsonandy@138bc75d-0d04-0410-961f-82ee72b054a4>2009-12-24 20:32:38 +0000
commit33169f9757cdd37069e626cb200f4b0e1baaece5 (patch)
treef3766a748d40c25efaa5e5b03771c0e217cd6996 /gcc/config
parent310f64db267a87bff6febbcb2df9ec6ae37ae125 (diff)
downloadgcc-33169f9757cdd37069e626cb200f4b0e1baaece5.tar.gz
2009-12-24 Andy Hutchinson <hutchinsonandy@gcc.gnu.org>
PR target/42457 * config/avr/avr.c (avr_extra_arch_macro): Remove static. (avr_cpu_cpp_builtins): Remove. * config/avr/avr.h (avr_extra_arch_macro): Add prototype. * config/avr/avr-c.c: New File. (avr_cpu_cpp_builtins) : Add. * config/avr/t-avr: Add make information for avr-c. * config.gcc (avr-*-*): Include avr-c.o as c and cpp object. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155460 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/avr/avr-c.c85
-rw-r--r--gcc/config/avr/avr.c55
-rw-r--r--gcc/config/avr/avr.h2
-rw-r--r--gcc/config/avr/t-avr7
4 files changed, 95 insertions, 54 deletions
diff --git a/gcc/config/avr/avr-c.c b/gcc/config/avr/avr-c.c
new file mode 100644
index 00000000000..05c94962f95
--- /dev/null
+++ b/gcc/config/avr/avr-c.c
@@ -0,0 +1,85 @@
+/* Copyright (C) 2009
+ Free Software Foundation, Inc.
+ Contributed by Anatoly Sokolov (aesok@post.ru)
+
+ This file is part of GCC.
+
+ GCC is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ GCC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3. If not see
+ <http://www.gnu.org/licenses/>. */
+
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "tm_p.h"
+#include "regs.h"
+#include "c-common.h"
+
+
+/* Not included in avr.c since this requires C front end. */
+
+/* Worker function for TARGET_CPU_CPP_BUILTINS. */
+
+void
+avr_cpu_cpp_builtins (struct cpp_reader *pfile)
+{
+ builtin_define_std ("AVR");
+
+ if (avr_current_arch->macro)
+ cpp_define (pfile, avr_current_arch->macro);
+ if (avr_extra_arch_macro)
+ cpp_define (pfile, avr_extra_arch_macro);
+ if (avr_current_arch->have_elpm)
+ cpp_define (pfile, "__AVR_HAVE_RAMPZ__");
+ if (avr_current_arch->have_elpm)
+ cpp_define (pfile, "__AVR_HAVE_ELPM__");
+ if (avr_current_arch->have_elpmx)
+ cpp_define (pfile, "__AVR_HAVE_ELPMX__");
+ if (avr_current_arch->have_movw_lpmx)
+ {
+ cpp_define (pfile, "__AVR_HAVE_MOVW__");
+ cpp_define (pfile, "__AVR_HAVE_LPMX__");
+ }
+ if (avr_current_arch->asm_only)
+ cpp_define (pfile, "__AVR_ASM_ONLY__");
+ if (avr_current_arch->have_mul)
+ {
+ cpp_define (pfile, "__AVR_ENHANCED__");
+ cpp_define (pfile, "__AVR_HAVE_MUL__");
+ }
+ if (avr_current_arch->have_jmp_call)
+ {
+ cpp_define (pfile, "__AVR_MEGA__");
+ cpp_define (pfile, "__AVR_HAVE_JMP_CALL__");
+ }
+ if (avr_current_arch->have_eijmp_eicall)
+ {
+ cpp_define (pfile, "__AVR_HAVE_EIJMP_EICALL__");
+ cpp_define (pfile, "__AVR_3_BYTE_PC__");
+ }
+ else
+ {
+ cpp_define (pfile, "__AVR_2_BYTE_PC__");
+ }
+
+ if (avr_current_device->short_sp)
+ cpp_define (pfile, "__AVR_HAVE_8BIT_SP__");
+ else
+ cpp_define (pfile, "__AVR_HAVE_16BIT_SP__");
+
+ if (TARGET_NO_INTERRUPTS)
+ cpp_define (pfile, "__NO_INTERRUPTS__");
+}
+
diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c
index eff2179b93d..83ee0efe0cc 100644
--- a/gcc/config/avr/avr.c
+++ b/gcc/config/avr/avr.c
@@ -105,7 +105,7 @@ static GTY(()) rtx zero_reg_rtx;
static const char *const avr_regnames[] = REGISTER_NAMES;
/* Preprocessor macros to define depending on MCU type. */
-static const char *avr_extra_arch_macro;
+const char *avr_extra_arch_macro;
/* Current architecture. */
const struct base_arch_s *avr_current_arch;
@@ -223,59 +223,6 @@ avr_override_options (void)
init_machine_status = avr_init_machine_status;
}
-/* Worker function for TARGET_CPU_CPP_BUILTINS. */
-
-void
-avr_cpu_cpp_builtins (struct cpp_reader *pfile)
-{
- builtin_define_std ("AVR");
-
- if (avr_current_arch->macro)
- cpp_define (pfile, avr_current_arch->macro);
- if (avr_extra_arch_macro)
- cpp_define (pfile, avr_extra_arch_macro);
- if (avr_current_arch->have_elpm)
- cpp_define (pfile, "__AVR_HAVE_RAMPZ__");
- if (avr_current_arch->have_elpm)
- cpp_define (pfile, "__AVR_HAVE_ELPM__");
- if (avr_current_arch->have_elpmx)
- cpp_define (pfile, "__AVR_HAVE_ELPMX__");
- if (avr_current_arch->have_movw_lpmx)
- {
- cpp_define (pfile, "__AVR_HAVE_MOVW__");
- cpp_define (pfile, "__AVR_HAVE_LPMX__");
- }
- if (avr_current_arch->asm_only)
- cpp_define (pfile, "__AVR_ASM_ONLY__");
- if (avr_current_arch->have_mul)
- {
- cpp_define (pfile, "__AVR_ENHANCED__");
- cpp_define (pfile, "__AVR_HAVE_MUL__");
- }
- if (avr_current_arch->have_jmp_call)
- {
- cpp_define (pfile, "__AVR_MEGA__");
- cpp_define (pfile, "__AVR_HAVE_JMP_CALL__");
- }
- if (avr_current_arch->have_eijmp_eicall)
- {
- cpp_define (pfile, "__AVR_HAVE_EIJMP_EICALL__");
- cpp_define (pfile, "__AVR_3_BYTE_PC__");
- }
- else
- {
- cpp_define (pfile, "__AVR_2_BYTE_PC__");
- }
-
- if (avr_current_device->short_sp)
- cpp_define (pfile, "__AVR_HAVE_8BIT_SP__");
- else
- cpp_define (pfile, "__AVR_HAVE_16BIT_SP__");
-
- if (TARGET_NO_INTERRUPTS)
- cpp_define (pfile, "__NO_INTERRUPTS__");
-}
-
/* return register class from register number. */
static const enum reg_class reg_class_tab[]={
diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h
index 2e885604333..265c16155f3 100644
--- a/gcc/config/avr/avr.h
+++ b/gcc/config/avr/avr.h
@@ -97,6 +97,8 @@ struct mcu_type_s {
const char *const library_name;
};
+/* Preprocessor macros to define depending on MCU type. */
+extern const char *avr_extra_arch_macro;
extern const struct base_arch_s *avr_current_arch;
extern const struct mcu_type_s *avr_current_device;
extern const struct mcu_type_s avr_mcu_types[];
diff --git a/gcc/config/avr/t-avr b/gcc/config/avr/t-avr
index 58656179b8a..91d1fe86fbc 100644
--- a/gcc/config/avr/t-avr
+++ b/gcc/config/avr/t-avr
@@ -24,6 +24,13 @@ driver-avr.o: $(srcdir)/config/avr/driver-avr.c \
avr-devices.o: $(srcdir)/config/avr/avr-devices.c \
$(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H)
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
+
+
+avr-c.o: $(srcdir)/config/avr/avr-c.c \
+ $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H)
+ $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
+
+
LIB1ASMSRC = avr/libgcc.S
LIB1ASMFUNCS = \