From 9d3f9aa3a56dcce4ce7f84ec34ef3d7178c917e1 Mon Sep 17 00:00:00 2001 From: Bernd Schmidt Date: Thu, 12 Apr 2007 13:21:01 +0000 Subject: bfin.opt (msim): New option. 2007-02-11 Jie Zhang * config/bfin/bfin.opt (msim): New option. (mcpu=): New option. * config/bfin/bfin-protos.h (enum bfin_cpu): New. (bfin_cpu_t): Typedef of enum bfin_cpu. (bfin_cpu_type): New declaration. * config/bfin/elf.h (STARTFILE_SPEC): Add support for -msim and -mcpu= options. (LIB_SPEC): Likewise. * config/bfin/bfin.c (bfin_cpu_type): Define. (bfin_handle_option): Handle -mcpu= option. * config/bfin/bfin.h (DEFAULT_CPU_TYPE): Define as BFIN_CPU_BF532. (TARGET_CPU_CPP_BUILTINS): Define __ADSPBF531__, __ADSPBF532__, __ADSPBF533__ or __ADSPBF537__ according to the cpu type. From-SVN: r123747 --- gcc/ChangeLog | 15 +++++++++++++++ gcc/config/bfin/bfin-protos.h | 12 ++++++++++++ gcc/config/bfin/bfin.c | 16 ++++++++++++++++ gcc/config/bfin/bfin.h | 22 ++++++++++++++++++++++ gcc/config/bfin/bfin.opt | 8 ++++++++ gcc/config/bfin/elf.h | 14 +++++++++++++- 6 files changed, 86 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7d19530..07f8a5b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -17,6 +17,21 @@ (flag_macinit1hi): Tighten constraints. (flag_mul_macv2hi_parts_acconly): New pattern. + 2007-02-11 Jie Zhang + * config/bfin/bfin.opt (msim): New option. + (mcpu=): New option. + * config/bfin/bfin-protos.h (enum bfin_cpu): New. + (bfin_cpu_t): Typedef of enum bfin_cpu. + (bfin_cpu_type): New declaration. + * config/bfin/elf.h (STARTFILE_SPEC): Add support for + -msim and -mcpu= options. + (LIB_SPEC): Likewise. + * config/bfin/bfin.c (bfin_cpu_type): Define. + (bfin_handle_option): Handle -mcpu= option. + * config/bfin/bfin.h (DEFAULT_CPU_TYPE): Define as BFIN_CPU_BF532. + (TARGET_CPU_CPP_BUILTINS): Define __ADSPBF531__, __ADSPBF532__, + __ADSPBF533__ or __ADSPBF537__ according to the cpu type. + 2007-04-12 Richard Sandiford * config.gcc (*-*-vxworks*): Don't add to tm_files in this stanza. diff --git a/gcc/config/bfin/bfin-protos.h b/gcc/config/bfin/bfin-protos.h index 549d55a..99151fa 100644 --- a/gcc/config/bfin/bfin-protos.h +++ b/gcc/config/bfin/bfin-protos.h @@ -23,6 +23,18 @@ #ifndef GCC_BFIN_PROTOS_H #define GCC_BFIN_PROTOS_H +/* CPU type. */ +typedef enum bfin_cpu +{ + BFIN_CPU_BF531, + BFIN_CPU_BF532, + BFIN_CPU_BF533, + BFIN_CPU_BF537 +} bfin_cpu_t; + +/* Value of -mcpu= */ +extern bfin_cpu_t bfin_cpu_type; + #define Mmode enum machine_mode extern rtx function_arg (CUMULATIVE_ARGS *, Mmode, tree, int); diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c index ecadb57..16b4096 100644 --- a/gcc/config/bfin/bfin.c +++ b/gcc/config/bfin/bfin.c @@ -92,6 +92,9 @@ static int bfin_flag_schedule_insns2; reorganization. */ static int bfin_flag_var_tracking; +/* -mcpu support */ +bfin_cpu_t bfin_cpu_type = DEFAULT_CPU_TYPE; + int splitting_for_sched; static void @@ -2058,6 +2061,19 @@ bfin_handle_option (size_t code, const char *arg, int value) bfin_lib_id_given = 1; return true; + case OPT_mcpu_: + if (strcmp (arg, "bf531") == 0) + bfin_cpu_type = BFIN_CPU_BF531; + else if (strcmp (arg, "bf532") == 0) + bfin_cpu_type = BFIN_CPU_BF532; + else if (strcmp (arg, "bf533") == 0) + bfin_cpu_type = BFIN_CPU_BF533; + else if (strcmp (arg, "bf537") == 0) + bfin_cpu_type = BFIN_CPU_BF537; + else + return false; + return true; + default: return true; } diff --git a/gcc/config/bfin/bfin.h b/gcc/config/bfin/bfin.h index 2c67bef..3c7f012 100644 --- a/gcc/config/bfin/bfin.h +++ b/gcc/config/bfin/bfin.h @@ -34,6 +34,10 @@ extern int target_flags; +#ifndef DEFAULT_CPU_TYPE +#define DEFAULT_CPU_TYPE BFIN_CPU_BF532 +#endif + /* Predefinition in the preprocessor for this target machine */ #ifndef TARGET_CPU_CPP_BUILTINS #define TARGET_CPU_CPP_BUILTINS() \ @@ -42,6 +46,24 @@ extern int target_flags; builtin_define_std ("bfin"); \ builtin_define_std ("BFIN"); \ builtin_define ("__ADSPBLACKFIN__"); \ + builtin_define ("__ADSPLPBLACKFIN__"); \ + \ + switch (bfin_cpu_type) \ + { \ + case BFIN_CPU_BF531: \ + builtin_define ("__ADSPBF531__"); \ + break; \ + case BFIN_CPU_BF532: \ + builtin_define ("__ADSPBF532__"); \ + break; \ + case BFIN_CPU_BF533: \ + builtin_define ("__ADSPBF533__"); \ + break; \ + case BFIN_CPU_BF537: \ + builtin_define ("__ADSPBF537__"); \ + break; \ + } \ + \ if (TARGET_FDPIC) \ builtin_define ("__BFIN_FDPIC__"); \ if (TARGET_ID_SHARED_LIBRARY) \ diff --git a/gcc/config/bfin/bfin.opt b/gcc/config/bfin/bfin.opt index 6c044f4..f30f3e6 100644 --- a/gcc/config/bfin/bfin.opt +++ b/gcc/config/bfin/bfin.opt @@ -19,6 +19,14 @@ ; Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA ; 02110-1301, USA. +msim +Target RejectNegative +Use simulator runtime + +mcpu= +Target RejectNegative Joined +Specify the name of the target CPU + momit-leaf-frame-pointer Target Report Mask(OMIT_LEAF_FRAME_POINTER) Omit frame pointer for leaf functions diff --git a/gcc/config/bfin/elf.h b/gcc/config/bfin/elf.h index 39d0688..5148c30 100644 --- a/gcc/config/bfin/elf.h +++ b/gcc/config/bfin/elf.h @@ -7,11 +7,23 @@ sprintf (LABEL, "*%s%s$%d", LOCAL_LABEL_PREFIX, PREFIX, (int) NUM) #undef STARTFILE_SPEC -#define STARTFILE_SPEC "%{!shared: crt0%O%s} crti%O%s crtbegin%O%s crtlibid%O%s" +#define STARTFILE_SPEC "\ +%{msim:%{!shared:crt0%O%s}} \ +%{!msim:%{mcpu=bf531|mcpu=bf532|mcpu=bf533 \ + |mcpu=bf534|mcpu=bf536|mcpu=bf537:crt532%O%s} \ + %{!mcpu=*:crt532%O%s}} \ +crti%O%s crtbegin%O%s crtlibid%O%s" #undef ENDFILE_SPEC #define ENDFILE_SPEC "crtend%O%s crtn%O%s" +#undef LIB_SPEC +#define LIB_SPEC "--start-group -lc %{msim:-lsim}%{!msim:-lnosys} --end-group \ +%{!T*:%{!msim:%{mcpu=bf531:-Tbf531.ld}%{mcpu=bf532:-Tbf532.ld} \ + %{mcpu=bf533:-Tbf533.ld}%{mcpu=bf534:-Tbf534.ld} \ + %{mcpu=bf536:-Tbf536.ld}%{mcpu=bf537:-Tbf537.ld} \ + %{!mcpu=*:-Tbf532.ld}}}" + #undef USER_LABEL_PREFIX #define USER_LABEL_PREFIX "_" -- cgit v1.1