mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-05 16:51:13 +08:00
avr.c (avr_current_arch): New variable.
* config/avr/avr.c (avr_current_arch): New variable. (avr_arch_types): Add 'avr31' and 'avr51' entries. (avr_arch): Add 'ARCH_AVR31' and 'ARCH_AVR51'. (avr_mcu_types): Add 'avr31' and 'avr51' architectures. (avr_override_options): Init 'avr_current_arch'. (base_arch_s): Move from here... * config/avr/avr.h (base_arch_s): ... here. Add new members 'have_elpm', 'have_elpmx', 'have_eijmp_eicall', 'reserved'. Rename 'mega' to 'have_jmp_call'. (TARGET_CPU_CPP_BUILTINS): Define "__AVR_HAVE_JMP_CALL__", "__AVR_HAVE_RAMPZ__", "__AVR_HAVE_ELPM__" and "__AVR_HAVE_ELPMX__" macros. (LINK_SPEC, CRT_BINUTILS_SPECS, ASM_SPEC): Add 'avr31' and 'avr51' architectures. * config/avr/t-avr (MULTILIB_OPTIONS, MULTILIB_DIRNAMES, MULTILIB_MATCHES): (Ditto.). From-SVN: r131759
This commit is contained in:
parent
b86b3ea354
commit
19298da4bd
@ -1,3 +1,22 @@
|
||||
2008-01-23 Anatoly Sokolov <aesok@post.ru>
|
||||
|
||||
* config/avr/avr.c (avr_current_arch): New variable.
|
||||
(avr_arch_types): Add 'avr31' and 'avr51' entries.
|
||||
(avr_arch): Add 'ARCH_AVR31' and 'ARCH_AVR51'.
|
||||
(avr_mcu_types): Add 'avr31' and 'avr51' architectures.
|
||||
(avr_override_options): Init 'avr_current_arch'.
|
||||
(base_arch_s): Move from here...
|
||||
* config/avr/avr.h (base_arch_s): ... here. Add new members
|
||||
'have_elpm', 'have_elpmx', 'have_eijmp_eicall', 'reserved'. Rename
|
||||
'mega' to 'have_jmp_call'.
|
||||
(TARGET_CPU_CPP_BUILTINS): Define "__AVR_HAVE_JMP_CALL__",
|
||||
"__AVR_HAVE_RAMPZ__", "__AVR_HAVE_ELPM__" and "__AVR_HAVE_ELPMX__"
|
||||
macros.
|
||||
(LINK_SPEC, CRT_BINUTILS_SPECS, ASM_SPEC): Add 'avr31' and 'avr51'
|
||||
architectures.
|
||||
* config/avr/t-avr (MULTILIB_OPTIONS, MULTILIB_DIRNAMES,
|
||||
MULTILIB_MATCHES): (Ditto.).
|
||||
|
||||
2008-01-23 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
PR middle-end/31529
|
||||
|
@ -100,6 +100,9 @@ static int last_insn_address = 0;
|
||||
const char *avr_base_arch_macro;
|
||||
const char *avr_extra_arch_macro;
|
||||
|
||||
/* Current architecture. */
|
||||
const struct base_arch_s *avr_current_arch;
|
||||
|
||||
section *progmem_section;
|
||||
|
||||
/* More than 8K of program memory: use "call" and "jmp". */
|
||||
@ -114,23 +117,17 @@ int avr_asm_only_p = 0;
|
||||
/* Core have 'MOVW' and 'LPM Rx,Z' instructions. */
|
||||
int avr_have_movw_lpmx_p = 0;
|
||||
|
||||
struct base_arch_s {
|
||||
int asm_only;
|
||||
int have_mul;
|
||||
int mega;
|
||||
int have_movw_lpmx;
|
||||
const char *const macro;
|
||||
};
|
||||
|
||||
static const struct base_arch_s avr_arch_types[] = {
|
||||
{ 1, 0, 0, 0, NULL }, /* unknown device specified */
|
||||
{ 1, 0, 0, 0, "__AVR_ARCH__=1" },
|
||||
{ 0, 0, 0, 0, "__AVR_ARCH__=2" },
|
||||
{ 0, 0, 0, 1, "__AVR_ARCH__=25"},
|
||||
{ 0, 0, 1, 0, "__AVR_ARCH__=3" },
|
||||
{ 0, 0, 1, 1, "__AVR_ARCH__=35"},
|
||||
{ 0, 1, 0, 1, "__AVR_ARCH__=4" },
|
||||
{ 0, 1, 1, 1, "__AVR_ARCH__=5" }
|
||||
{ 1, 0, 0, 0, 0, 0, 0, 0, NULL }, /* unknown device specified */
|
||||
{ 1, 0, 0, 0, 0, 0, 0, 0, "__AVR_ARCH__=1" },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, "__AVR_ARCH__=2" },
|
||||
{ 0, 0, 0, 1, 0, 0, 0, 0, "__AVR_ARCH__=25" },
|
||||
{ 0, 0, 1, 0, 0, 0, 0, 0, "__AVR_ARCH__=3" },
|
||||
{ 0, 0, 1, 0, 1, 0, 0, 0, "__AVR_ARCH__=31" },
|
||||
{ 0, 0, 1, 1, 0, 0, 0, 0, "__AVR_ARCH__=35" },
|
||||
{ 0, 1, 0, 1, 0, 0, 0, 0, "__AVR_ARCH__=4" },
|
||||
{ 0, 1, 1, 1, 0, 0, 0, 0, "__AVR_ARCH__=5" },
|
||||
{ 0, 1, 1, 1, 1, 1, 0, 0, "__AVR_ARCH__=51" }
|
||||
};
|
||||
|
||||
/* These names are used as the index into the avr_arch_types[] table
|
||||
@ -143,9 +140,11 @@ enum avr_arch
|
||||
ARCH_AVR2,
|
||||
ARCH_AVR25,
|
||||
ARCH_AVR3,
|
||||
ARCH_AVR31,
|
||||
ARCH_AVR35,
|
||||
ARCH_AVR4,
|
||||
ARCH_AVR5
|
||||
ARCH_AVR5,
|
||||
ARCH_AVR51
|
||||
};
|
||||
|
||||
struct mcu_type_s {
|
||||
@ -195,12 +194,14 @@ static const struct mcu_type_s avr_mcu_types[] = {
|
||||
{ "attiny48", ARCH_AVR25, "__AVR_ATtiny48__" },
|
||||
{ "attiny88", ARCH_AVR25, "__AVR_ATtiny88__" },
|
||||
{ "at86rf401", ARCH_AVR25, "__AVR_AT86RF401__" },
|
||||
/* Classic, > 8K. */
|
||||
/* Classic, > 8K, <= 64K. */
|
||||
{ "avr3", ARCH_AVR3, NULL },
|
||||
{ "atmega103", ARCH_AVR3, "__AVR_ATmega103__" },
|
||||
{ "at43usb320", ARCH_AVR3, "__AVR_AT43USB320__" },
|
||||
{ "at43usb355", ARCH_AVR3, "__AVR_AT43USB355__" },
|
||||
{ "at76c711", ARCH_AVR3, "__AVR_AT76C711__" },
|
||||
/* Classic, == 128K. */
|
||||
{ "avr31", ARCH_AVR31, NULL },
|
||||
{ "atmega103", ARCH_AVR3, "__AVR_ATmega103__" },
|
||||
/* Classic + MOVW + JMP/CALL. */
|
||||
{ "avr35", ARCH_AVR35, NULL },
|
||||
{ "at90usb82", ARCH_AVR35, "__AVR_AT90USB82__" },
|
||||
@ -220,7 +221,7 @@ static const struct mcu_type_s avr_mcu_types[] = {
|
||||
{ "at90pwm2b", ARCH_AVR4, "__AVR_AT90PWM2B__" },
|
||||
{ "at90pwm3", ARCH_AVR4, "__AVR_AT90PWM3__" },
|
||||
{ "at90pwm3b", ARCH_AVR4, "__AVR_AT90PWM3B__" },
|
||||
/* Enhanced, > 8K. */
|
||||
/* Enhanced, > 8K, <= 64K. */
|
||||
{ "avr5", ARCH_AVR5, NULL },
|
||||
{ "atmega16", ARCH_AVR5, "__AVR_ATmega16__" },
|
||||
{ "atmega161", ARCH_AVR5, "__AVR_ATmega161__" },
|
||||
@ -255,21 +256,23 @@ static const struct mcu_type_s avr_mcu_types[] = {
|
||||
{ "atmega6450", ARCH_AVR5, "__AVR_ATmega6450__" },
|
||||
{ "atmega649", ARCH_AVR5, "__AVR_ATmega649__" },
|
||||
{ "atmega6490", ARCH_AVR5, "__AVR_ATmega6490__" },
|
||||
{ "atmega128", ARCH_AVR5, "__AVR_ATmega128__" },
|
||||
{ "atmega1280", ARCH_AVR5, "__AVR_ATmega1280__" },
|
||||
{ "atmega1281", ARCH_AVR5, "__AVR_ATmega1281__" },
|
||||
{ "atmega1284p", ARCH_AVR5, "__AVR_ATmega1284P__" },
|
||||
{ "atmega16hva", ARCH_AVR5, "__AVR_ATmega16HVA__" },
|
||||
{ "at90can32", ARCH_AVR5, "__AVR_AT90CAN32__" },
|
||||
{ "at90can64", ARCH_AVR5, "__AVR_AT90CAN64__" },
|
||||
{ "at90can128", ARCH_AVR5, "__AVR_AT90CAN128__" },
|
||||
{ "at90pwm216", ARCH_AVR5, "__AVR_AT90PWM216__" },
|
||||
{ "at90pwm316", ARCH_AVR5, "__AVR_AT90PWM316__" },
|
||||
{ "at90usb646", ARCH_AVR5, "__AVR_AT90USB646__" },
|
||||
{ "at90usb647", ARCH_AVR5, "__AVR_AT90USB647__" },
|
||||
{ "at90usb1286", ARCH_AVR5, "__AVR_AT90USB1286__" },
|
||||
{ "at90usb1287", ARCH_AVR5, "__AVR_AT90USB1287__" },
|
||||
{ "at94k", ARCH_AVR5, "__AVR_AT94K__" },
|
||||
/* Enhanced, == 128K. */
|
||||
{ "avr51", ARCH_AVR51, NULL },
|
||||
{ "atmega128", ARCH_AVR51, "__AVR_ATmega128__" },
|
||||
{ "atmega1280", ARCH_AVR51, "__AVR_ATmega1280__" },
|
||||
{ "atmega1281", ARCH_AVR51, "__AVR_ATmega1281__" },
|
||||
{ "atmega1284p", ARCH_AVR51, "__AVR_ATmega1284P__" },
|
||||
{ "at90can128", ARCH_AVR51, "__AVR_AT90CAN128__" },
|
||||
{ "at90usb1286", ARCH_AVR51, "__AVR_AT90USB1286__" },
|
||||
{ "at90usb1287", ARCH_AVR51, "__AVR_AT90USB1287__" },
|
||||
/* Assembler only. */
|
||||
{ "avr1", ARCH_AVR1, NULL },
|
||||
{ "at90s1200", ARCH_AVR1, "__AVR_AT90S1200__" },
|
||||
@ -347,10 +350,11 @@ avr_override_options (void)
|
||||
fprintf (stderr," %s\n", t->name);
|
||||
}
|
||||
|
||||
avr_current_arch = &avr_arch_types[t->arch];
|
||||
base = &avr_arch_types[t->arch];
|
||||
avr_asm_only_p = base->asm_only;
|
||||
avr_have_mul_p = base->have_mul;
|
||||
avr_mega_p = base->mega;
|
||||
avr_mega_p = base->have_jmp_call;
|
||||
avr_have_movw_lpmx_p = base->have_movw_lpmx;
|
||||
avr_base_arch_macro = base->macro;
|
||||
avr_extra_arch_macro = t->macro;
|
||||
|
@ -22,6 +22,36 @@ along with GCC; see the file COPYING3. If not see
|
||||
|
||||
/* Names to predefine in the preprocessor for this target machine. */
|
||||
|
||||
struct base_arch_s {
|
||||
/* Assembler only. */
|
||||
int asm_only;
|
||||
|
||||
/* Core have 'MUL*' instructions. */
|
||||
int have_mul;
|
||||
|
||||
/* Core have 'CALL' and 'JMP' instructions. */
|
||||
int have_jmp_call;
|
||||
|
||||
/* Core have 'MOVW' and 'LPM Rx,Z' instructions. */
|
||||
int have_movw_lpmx;
|
||||
|
||||
/* Core have 'ELPM' instructions. */
|
||||
int have_elpm;
|
||||
|
||||
/* Core have 'ELPM Rx,Z' instructions. */
|
||||
int have_elpmx;
|
||||
|
||||
/* Core have 'EICALL' and 'EIJMP' instructions. */
|
||||
int have_eijmp_eicall;
|
||||
|
||||
/* Reserved. */
|
||||
int reserved;
|
||||
|
||||
const char *const macro;
|
||||
};
|
||||
|
||||
extern const struct base_arch_s *avr_current_arch;
|
||||
|
||||
#define TARGET_CPU_CPP_BUILTINS() \
|
||||
do \
|
||||
{ \
|
||||
@ -30,6 +60,12 @@ along with GCC; see the file COPYING3. If not see
|
||||
builtin_define (avr_base_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_have_movw_lpmx_p) \
|
||||
builtin_define ("__AVR_HAVE_MOVW__"); \
|
||||
if (avr_have_movw_lpmx_p) \
|
||||
@ -40,8 +76,10 @@ along with GCC; see the file COPYING3. If not see
|
||||
builtin_define ("__AVR_ENHANCED__"); \
|
||||
if (avr_have_mul_p) \
|
||||
builtin_define ("__AVR_HAVE_MUL__"); \
|
||||
if (avr_mega_p) \
|
||||
if (avr_current_arch->have_jmp_call) \
|
||||
builtin_define ("__AVR_MEGA__"); \
|
||||
if (avr_current_arch->have_jmp_call) \
|
||||
builtin_define ("__AVR_HAVE_JMP_CALL__"); \
|
||||
if (TARGET_NO_INTERRUPTS) \
|
||||
builtin_define ("__NO_INTERRUPTS__"); \
|
||||
} \
|
||||
@ -734,7 +772,7 @@ extern int avr_case_values_threshold;
|
||||
/* A C string constant that tells the GCC driver program options to
|
||||
pass to `cc1plus'. */
|
||||
|
||||
#define ASM_SPEC "%{mmcu=avr25:-mmcu=avr2;mmcu=avr35:-mmcu=avr3;\
|
||||
#define ASM_SPEC "%{mmcu=avr25:-mmcu=avr2;mmcu=avr35:-mmcu=avr3;mmcu=avr31:-mmcu=avr3;mmcu=avr51:-mmcu=avr5;\
|
||||
mmcu=*:-mmcu=%*}"
|
||||
|
||||
#define LINK_SPEC "\
|
||||
@ -865,10 +903,10 @@ mmcu=*:-mmcu=%*}"
|
||||
%{mmcu=attiny43u:crttn43u.o%s} \
|
||||
%{mmcu=attiny48:crttn48.o%s} \
|
||||
%{mmcu=attiny88:crttn88.o%s} \
|
||||
%{mmcu=atmega103|mmcu=avr3:crtm103.o%s} \
|
||||
%{mmcu=at43usb320:crt43320.o%s} \
|
||||
%{mmcu=at43usb320|mmcu=avr3:crt43320.o%s} \
|
||||
%{mmcu=at43usb355:crt43355.o%s} \
|
||||
%{mmcu=at76c711:crt76711.o%s} \
|
||||
%{mmcu=atmega103|mmcu=avr31:crtm103.o%s} \
|
||||
%{mmcu=at90usb162|mmcu=avr35:crtusb162.o%s} \
|
||||
%{mmcu=at90usb82:crtusb82.o%s} \
|
||||
%{mmcu=atmega8|mmcu=avr4:crtm8.o%s} \
|
||||
@ -916,22 +954,22 @@ mmcu=*:-mmcu=%*}"
|
||||
%{mmcu=atmega6450:crtm6450.o%s} \
|
||||
%{mmcu=atmega649:crtm649.o%s} \
|
||||
%{mmcu=atmega6490:crtm6490.o%s} \
|
||||
%{mmcu=atmega128:crtm128.o%s} \
|
||||
%{mmcu=atmega1280:crtm1280.o%s} \
|
||||
%{mmcu=atmega1281:crtm1281.o%s} \
|
||||
%{mmcu=atmega1284p:crtm1284p.o%s} \
|
||||
%{mmcu=atmega8hva:crtm8hva.o%s} \
|
||||
%{mmcu=atmega16hva:crtm16hva.o%s} \
|
||||
%{mmcu=at90can32:crtcan32.o%s} \
|
||||
%{mmcu=at90can64:crtcan64.o%s} \
|
||||
%{mmcu=at90can128:crtcan128.o%s} \
|
||||
%{mmcu=at90pwm216:crt90pwm216.o%s} \
|
||||
%{mmcu=at90pwm316:crt90pwm316.o%s} \
|
||||
%{mmcu=at90usb646:crtusb646.o%s} \
|
||||
%{mmcu=at90usb647:crtusb647.o%s} \
|
||||
%{mmcu=at94k:crtat94k.o%s} \
|
||||
%{mmcu=atmega128|mmcu=avr51:crtm128.o%s} \
|
||||
%{mmcu=atmega1280:crtm1280.o%s} \
|
||||
%{mmcu=atmega1281:crtm1281.o%s} \
|
||||
%{mmcu=atmega1284p:crtm1284p.o%s} \
|
||||
%{mmcu=at90can128:crtcan128.o%s} \
|
||||
%{mmcu=at90usb1286:crtusb1286.o%s} \
|
||||
%{mmcu=at90usb1287:crtusb1287.o%s} \
|
||||
%{mmcu=at94k:crtat94k.o%s}"
|
||||
%{mmcu=at90usb1287:crtusb1287.o%s}"
|
||||
|
||||
#define EXTRA_SPECS {"crt_binutils", CRT_BINUTILS_SPECS},
|
||||
|
||||
|
@ -37,8 +37,8 @@ fp-bit.c: $(srcdir)/config/fp-bit.c $(srcdir)/config/avr/t-avr
|
||||
|
||||
FPBIT = fp-bit.c
|
||||
|
||||
MULTILIB_OPTIONS = mmcu=avr2/mmcu=avr25/mmcu=avr3/mmcu=avr35/mmcu=avr4/mmcu=avr5
|
||||
MULTILIB_DIRNAMES = avr2 avr25 avr3 avr35 avr4 avr5
|
||||
MULTILIB_OPTIONS = mmcu=avr2/mmcu=avr25/mmcu=avr3/mmcu=avr31/mmcu=avr35/mmcu=avr4/mmcu=avr5/mmcu=avr51
|
||||
MULTILIB_DIRNAMES = avr2 avr25 avr3 avr31 avr35 avr4 avr5 avr51
|
||||
|
||||
# The many avr2 matches are not listed here - this is the default.
|
||||
MULTILIB_MATCHES = \
|
||||
@ -57,10 +57,10 @@ MULTILIB_MATCHES = \
|
||||
mmcu?avr25=mmcu?attiny48 \
|
||||
mmcu?avr25=mmcu?attiny88 \
|
||||
mmcu?avr25=mmcu?at86rf401 \
|
||||
mmcu?avr3=mmcu?atmega103 \
|
||||
mmcu?avr3=mmcu?at43usb320 \
|
||||
mmcu?avr3=mmcu?at43usb355 \
|
||||
mmcu?avr3=mmcu?at76c711 \
|
||||
mmcu?avr31=mmcu?atmega103 \
|
||||
mmcu?avr35=mmcu?at90usb82 \
|
||||
mmcu?avr35=mmcu?at90usb162 \
|
||||
mmcu?avr4=mmcu?atmega48 \
|
||||
@ -109,21 +109,21 @@ MULTILIB_MATCHES = \
|
||||
mmcu?avr5=mmcu?atmega6450 \
|
||||
mmcu?avr5=mmcu?atmega649 \
|
||||
mmcu?avr5=mmcu?atmega6490 \
|
||||
mmcu?avr5=mmcu?atmega128 \
|
||||
mmcu?avr5=mmcu?atmega1280 \
|
||||
mmcu?avr5=mmcu?atmega1281 \
|
||||
mmcu?avr5=mmcu?atmega1284p \
|
||||
mmcu?avr5=mmcu?atmega16hva \
|
||||
mmcu?avr5=mmcu?at90can32 \
|
||||
mmcu?avr5=mmcu?at90can64 \
|
||||
mmcu?avr5=mmcu?at90can128 \
|
||||
mmcu?avr5=mmcu?at90pwm216 \
|
||||
mmcu?avr5=mmcu?at90pwm316 \
|
||||
mmcu?avr5=mmcu?at90usb646 \
|
||||
mmcu?avr5=mmcu?at90usb647 \
|
||||
mmcu?avr5=mmcu?at90usb1286 \
|
||||
mmcu?avr5=mmcu?at90usb1287 \
|
||||
mmcu?avr5=mmcu?at94k
|
||||
mmcu?avr5=mmcu?at94k \
|
||||
mmcu?avr51=mmcu?atmega128 \
|
||||
mmcu?avr51=mmcu?atmega1280 \
|
||||
mmcu?avr51=mmcu?atmega1281 \
|
||||
mmcu?avr51=mmcu?atmega1284p \
|
||||
mmcu?avr51=mmcu?at90can128 \
|
||||
mmcu?avr51=mmcu?at90usb1286 \
|
||||
mmcu?avr51=mmcu?at90usb1287
|
||||
|
||||
MULTILIB_EXCEPTIONS =
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user