aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnatoly Sokolov <aesok@post.ru>2009-07-12 00:26:54 +0400
committerAnatoly Sokolov <aesok@gcc.gnu.org>2009-07-12 00:26:54 +0400
commit97c281dacf21dcec5ed4f75f089960c8bfa81b0a (patch)
tree52d7b6b41bad4c5c40993dfc3fc86b018e7e5d4b
parent7635b357c483c931e88e9394d8c785d1fae8489b (diff)
downloadgcc-97c281dacf21dcec5ed4f75f089960c8bfa81b0a.zip
gcc-97c281dacf21dcec5ed4f75f089960c8bfa81b0a.tar.gz
gcc-97c281dacf21dcec5ed4f75f089960c8bfa81b0a.tar.bz2
avr.h (TARGET_CPU_CPP_BUILTINS): Redefine.
* config/avr/avr.h (TARGET_CPU_CPP_BUILTINS): Redefine. (avr_extra_arch_macro) Remove declatation. * config/avr/avr.c (avr_cpu_cpp_builtins): New function. (avr_extra_arch_macro) Declare as static. * config/avr/avr-protos.h (avr_cpu_cpp_builtins): Dclare. From-SVN: r149519
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/config/avr/avr-protos.h1
-rw-r--r--gcc/config/avr/avr.c49
-rw-r--r--gcc/config/avr/avr.h47
4 files changed, 58 insertions, 47 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5bdc4be..4356b5a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2009-07-11 Anatoly Sokolov <aesok@post.ru>
+
+ * config/avr/avr.h (TARGET_CPU_CPP_BUILTINS): Redefine.
+ (avr_extra_arch_macro) Remove declatation.
+ * config/avr/avr.c (avr_cpu_cpp_builtins): New function.
+ (avr_extra_arch_macro) Declare as static.
+ * config/avr/avr-protos.h (avr_cpu_cpp_builtins): Dclare.
+
2009-07-11 Jan Hubicka <jh@suse.cz>
PR middle-end/48388
diff --git a/gcc/config/avr/avr-protos.h b/gcc/config/avr/avr-protos.h
index c2d199d..719829d 100644
--- a/gcc/config/avr/avr-protos.h
+++ b/gcc/config/avr/avr-protos.h
@@ -24,6 +24,7 @@
extern int function_arg_regno_p (int r);
extern void avr_init_once (void);
extern void avr_override_options (void);
+extern void avr_cpu_cpp_builtins (struct cpp_reader * pfile);
extern void avr_optimization_options (int level, int size);
extern char *avr_change_section (char *sect_name);
extern int avr_ret_register (void);
diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c
index 7dd2a6f..e715e39 100644
--- a/gcc/config/avr/avr.c
+++ b/gcc/config/avr/avr.c
@@ -107,7 +107,7 @@ static const char *const avr_regnames[] = REGISTER_NAMES;
static int last_insn_address = 0;
/* Preprocessor macros to define depending on MCU type. */
-const char *avr_extra_arch_macro;
+static const char *avr_extra_arch_macro;
/* Current architecture. */
const struct base_arch_s *avr_current_arch;
@@ -222,6 +222,53 @@ 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 (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 97e3e2a..7375246 100644
--- a/gcc/config/avr/avr.h
+++ b/gcc/config/avr/avr.h
@@ -102,52 +102,7 @@ extern const struct mcu_type_s *avr_current_device;
extern const struct mcu_type_s avr_mcu_types[];
extern const struct base_arch_s avr_arch_types[];
-#define TARGET_CPU_CPP_BUILTINS() \
- do \
- { \
- builtin_define_std ("AVR"); \
- if (avr_current_arch->macro) \
- builtin_define (avr_current_arch->macro); \
- if (avr_extra_arch_macro) \
- builtin_define (avr_extra_arch_macro); \
- if (avr_current_arch->have_elpm) \
- builtin_define ("__AVR_HAVE_RAMPZ__"); \
- if (avr_current_arch->have_elpm) \
- builtin_define ("__AVR_HAVE_ELPM__"); \
- if (avr_current_arch->have_elpmx) \
- builtin_define ("__AVR_HAVE_ELPMX__"); \
- if (avr_current_arch->have_movw_lpmx) \
- { \
- builtin_define ("__AVR_HAVE_MOVW__"); \
- builtin_define ("__AVR_HAVE_LPMX__"); \
- } \
- if (avr_current_arch->asm_only) \
- builtin_define ("__AVR_ASM_ONLY__"); \
- if (avr_current_arch->have_mul) \
- { \
- builtin_define ("__AVR_ENHANCED__"); \
- builtin_define ("__AVR_HAVE_MUL__"); \
- } \
- if (avr_current_arch->have_jmp_call) \
- { \
- builtin_define ("__AVR_MEGA__"); \
- builtin_define ("__AVR_HAVE_JMP_CALL__"); \
- } \
- if (avr_current_arch->have_eijmp_eicall) \
- { \
- builtin_define ("__AVR_HAVE_EIJMP_EICALL__"); \
- builtin_define ("__AVR_3_BYTE_PC__"); \
- } \
- else \
- { \
- builtin_define ("__AVR_2_BYTE_PC__"); \
- } \
- if (TARGET_NO_INTERRUPTS) \
- builtin_define ("__NO_INTERRUPTS__"); \
- } \
- while (0)
-
-extern const char *avr_extra_arch_macro;
+#define TARGET_CPU_CPP_BUILTINS() avr_cpu_cpp_builtins (pfile)
#if !defined(IN_LIBGCC2) && !defined(IN_TARGET_LIBS)
extern GTY(()) section *progmem_section;