Commit 97c281da by Anatoly Sokolov Committed by Anatoly Sokolov

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
parent 7635b357
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> 2009-07-11 Jan Hubicka <jh@suse.cz>
PR middle-end/48388 PR middle-end/48388
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
extern int function_arg_regno_p (int r); extern int function_arg_regno_p (int r);
extern void avr_init_once (void); extern void avr_init_once (void);
extern void avr_override_options (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 void avr_optimization_options (int level, int size);
extern char *avr_change_section (char *sect_name); extern char *avr_change_section (char *sect_name);
extern int avr_ret_register (void); extern int avr_ret_register (void);
......
...@@ -107,7 +107,7 @@ static const char *const avr_regnames[] = REGISTER_NAMES; ...@@ -107,7 +107,7 @@ static const char *const avr_regnames[] = REGISTER_NAMES;
static int last_insn_address = 0; static int last_insn_address = 0;
/* Preprocessor macros to define depending on MCU type. */ /* Preprocessor macros to define depending on MCU type. */
const char *avr_extra_arch_macro; static const char *avr_extra_arch_macro;
/* Current architecture. */ /* Current architecture. */
const struct base_arch_s *avr_current_arch; const struct base_arch_s *avr_current_arch;
...@@ -222,6 +222,53 @@ avr_override_options (void) ...@@ -222,6 +222,53 @@ avr_override_options (void)
init_machine_status = avr_init_machine_status; 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. */ /* return register class from register number. */
static const enum reg_class reg_class_tab[]={ static const enum reg_class reg_class_tab[]={
......
...@@ -102,52 +102,7 @@ extern const struct mcu_type_s *avr_current_device; ...@@ -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 mcu_type_s avr_mcu_types[];
extern const struct base_arch_s avr_arch_types[]; extern const struct base_arch_s avr_arch_types[];
#define TARGET_CPU_CPP_BUILTINS() \ #define TARGET_CPU_CPP_BUILTINS() avr_cpu_cpp_builtins (pfile)
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;
#if !defined(IN_LIBGCC2) && !defined(IN_TARGET_LIBS) #if !defined(IN_LIBGCC2) && !defined(IN_TARGET_LIBS)
extern GTY(()) section *progmem_section; extern GTY(()) section *progmem_section;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment