OSDN Git Service

2007-02-11 Jie Zhang <jie.zhang@analog.com>
authorbernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 12 Apr 2007 13:21:01 +0000 (13:21 +0000)
committerbernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 12 Apr 2007 13:21:01 +0000 (13:21 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@123747 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/bfin/bfin-protos.h
gcc/config/bfin/bfin.c
gcc/config/bfin/bfin.h
gcc/config/bfin/bfin.opt
gcc/config/bfin/elf.h

index 7d19530..07f8a5b 100644 (file)
        (flag_macinit1hi): Tighten constraints.
        (flag_mul_macv2hi_parts_acconly): New pattern.
 
+       2007-02-11  Jie Zhang  <jie.zhang@analog.com>
+       * 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  <richard@codesourcery.com>
 
        * config.gcc (*-*-vxworks*): Don't add to tm_files in this stanza.
index 549d55a..99151fa 100644 (file)
 #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);
index ecadb57..16b4096 100644 (file)
@@ -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;
     }
index 2c67bef..3c7f012 100644 (file)
 
 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)            \
index 6c044f4..f30f3e6 100644 (file)
 ; 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
index 39d0688..5148c30 100644 (file)
@@ -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 "_"