avr.h (TARGET_CPU_CPP_BUILTINS): Redefine.
authorAnatoly Sokolov <aesok@post.ru>
Sat, 11 Jul 2009 20:26:54 +0000 (00:26 +0400)
committerAnatoly Sokolov <aesok@gcc.gnu.org>
Sat, 11 Jul 2009 20:26:54 +0000 (00:26 +0400)
* 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

gcc/ChangeLog
gcc/config/avr/avr-protos.h
gcc/config/avr/avr.c
gcc/config/avr/avr.h

index 5bdc4be4272bb735559f131bb9162b4ac993a4cc..4356b5a185a71ebb693061e58414cff1f59f9a35 100644 (file)
@@ -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
index c2d199d0dc7c7adc65cfd6e789c5bc944e32020f..719829d431f6a636192b36347db6a16e9a8f3f8e 100644 (file)
@@ -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);
index 7dd2a6f8bfdb7960c960e9ba3dd1b765fdb54577..e715e39fe382d79fc3a3fc6f51187641040c8cbb 100644 (file)
@@ -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[]={
index 97e3e2a2f687685b6c1afc86818f7197fcf81e09..73752467e086428d48fc08d6fd919ded57501cbf 100644 (file)
@@ -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;