OSDN Git Service

PR target/21397
authorrearnsha <rearnsha@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 9 May 2005 14:15:47 +0000 (14:15 +0000)
committerrearnsha <rearnsha@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 9 May 2005 14:15:47 +0000 (14:15 +0000)
* arm.c (ARM_OPT_SET_CPU, ARM_OPT_SET_ARCH, ARM_OPT_SET_TUNE): Define.
(arm_override_options): Use them instead of manifest constants.  Don't
allow -march to override the -mtune setting.

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

gcc/ChangeLog
gcc/config/arm/arm.c

index 0a92374..33aae28 100644 (file)
@@ -1,3 +1,10 @@
+2005-05-09  Richard Earnshaw  <rearnsha@arm.com>
+
+       PR target/21397
+       * arm.c (ARM_OPT_SET_CPU, ARM_OPT_SET_ARCH, ARM_OPT_SET_TUNE): Define.
+       (arm_override_options): Use them instead of manifest constants.  Don't
+       allow -march to override the -mtune setting.
+
 2005-05-09  Nathan Sidwell  <nathan@codesourcery.com>
 
        * config/iq2000/iq2000.c (abort_with_insn): Use fancy_abort.
 2005-05-09  Nathan Sidwell  <nathan@codesourcery.com>
 
        * config/iq2000/iq2000.c (abort_with_insn): Use fancy_abort.
index 4a71420..1743980 100644 (file)
@@ -596,6 +596,10 @@ static struct arm_cpu_select arm_select[] =
   { NULL,      "-mtune=",      all_cores }
 };
 
   { NULL,      "-mtune=",      all_cores }
 };
 
+/* Defines representing the indexes into the above table.  */
+#define ARM_OPT_SET_CPU 0
+#define ARM_OPT_SET_ARCH 1
+#define ARM_OPT_SET_TUNE 2
 
 /* The name of the proprocessor macro to define for this architecture.  */
 
 
 /* The name of the proprocessor macro to define for this architecture.  */
 
@@ -852,6 +856,7 @@ void
 arm_override_options (void)
 {
   unsigned i;
 arm_override_options (void)
 {
   unsigned i;
+  enum processor_type target_arch_cpu = arm_none;
 
   /* Set up the flags based on the cpu/architecture selected by the user.  */
   for (i = ARRAY_SIZE (arm_select); i--;)
 
   /* Set up the flags based on the cpu/architecture selected by the user.  */
   for (i = ARRAY_SIZE (arm_select); i--;)
@@ -866,22 +871,25 @@ arm_override_options (void)
             if (streq (ptr->string, sel->name))
               {
                /* Set the architecture define.  */
             if (streq (ptr->string, sel->name))
               {
                /* Set the architecture define.  */
-               if (i != 2)
+               if (i != ARM_OPT_SET_TUNE)
                  sprintf (arm_arch_name, "__ARM_ARCH_%s__", sel->arch);
 
                /* Determine the processor core for which we should
                   tune code-generation.  */
                if (/* -mcpu= is a sensible default.  */
                  sprintf (arm_arch_name, "__ARM_ARCH_%s__", sel->arch);
 
                /* Determine the processor core for which we should
                   tune code-generation.  */
                if (/* -mcpu= is a sensible default.  */
-                   i == 0
-                   /* If -march= is used, and -mcpu= has not been used,
-                      assume that we should tune for a representative
-                      CPU from that architecture.  */
-                   || i == 1
+                   i == ARM_OPT_SET_CPU
                    /* -mtune= overrides -mcpu= and -march=.  */
                    /* -mtune= overrides -mcpu= and -march=.  */
-                   || i == 2)
+                   || i == ARM_OPT_SET_TUNE)
                  arm_tune = (enum processor_type) (sel - ptr->processors);
 
                  arm_tune = (enum processor_type) (sel - ptr->processors);
 
-               if (i != 2)
+               /* Remember the CPU associated with this architecture.
+                  If no other option is used to set the CPU type,
+                  we'll use this to guess the most suitable tuning
+                  options.  */
+               if (i == ARM_OPT_SET_ARCH)
+                 target_arch_cpu = sel->core;
+               
+               if (i != ARM_OPT_SET_TUNE)
                  {
                    /* If we have been given an architecture and a processor
                       make sure that they are compatible.  We only generate
                  {
                    /* If we have been given an architecture and a processor
                       make sure that they are compatible.  We only generate
@@ -902,6 +910,10 @@ arm_override_options (void)
         }
     }
 
         }
     }
 
+  /* Guess the tuning options from the architecture if necessary.  */
+  if (arm_tune == arm_none)
+    arm_tune = target_arch_cpu;
+
   /* If the user did not specify a processor, choose one for them.  */
   if (insn_flags == 0)
     {
   /* If the user did not specify a processor, choose one for them.  */
   if (insn_flags == 0)
     {