[llvm-commits] [llvm-gcc-4.2] r118374 - in /llvm-gcc-4.2/trunk/gcc/config/arm: arm.c arm.h

Eric Christopher echristo at apple.com
Sun Nov 7 03:09:37 PST 2010


Author: echristo
Date: Sun Nov  7 05:09:37 2010
New Revision: 118374

URL: http://llvm.org/viewvc/llvm-project?rev=118374&view=rev
Log:
Reapply r118233 with some fixes for arm-linux .cpu handling output.

Tested by Anton on arm-none-linux-gnueabi.

Modified:
    llvm-gcc-4.2/trunk/gcc/config/arm/arm.c
    llvm-gcc-4.2/trunk/gcc/config/arm/arm.h

Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/arm.c?rev=118374&r1=118373&r2=118374&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/arm/arm.c (original)
+++ llvm-gcc-4.2/trunk/gcc/config/arm/arm.c Sun Nov  7 05:09:37 2010
@@ -551,6 +551,10 @@
 /* The processor for which instructions should be scheduled.  */
 enum processor_type arm_tune = arm_none;
 
+/* LLVM LOCAL global arch value */
+enum processor_type arm_arch = arm_none;
+enum processor_type arm_cpu = arm_none;
+
 /* APPLE LOCAL begin v7 support. Merge from mainline */
 /* The default processor used if not overriden by commandline.  */
 static enum processor_type arm_default_cpu = arm_none;
@@ -1289,12 +1293,13 @@
   unsigned i;
 /* APPLE LOCAL v7 support. Merge from Codesourcery */
   int len;
-  enum processor_type target_arch_cpu = arm_none;
+  /* LLVM LOCAL global arch value */
+  /* Moved arm_arch to arm.h as arm_arch and arm_cpu */
 
   /* Set up the flags based on the cpu/architecture selected by the user.  */
   for (i = ARRAY_SIZE (arm_select); i--;)
     {
-      struct arm_cpu_select * ptr = arm_select + i;
+      struct arm_cpu_select * ptr = &arm_select[i];
 
       if (ptr->string != NULL && ptr->string[0] != '\0')
         {
@@ -1325,8 +1330,14 @@
 		   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 (/* -mcpu is a sensible default.  */
+		    i == ARM_OPT_SET_CPU
+		    /* But -march= overrides -mcpu.  */
+		    || i == ARM_OPT_SET_ARCH)
+		  arm_arch = (enum processor_type) (sel - ptr->processors);
+
+		if (i == ARM_OPT_SET_CPU)
+		  arm_cpu = (enum processor_type) (sel - ptr->processors);
 
 		if (i != ARM_OPT_SET_TUNE)
 		  {
@@ -1360,7 +1371,7 @@
 
   /* Guess the tuning options from the architecture if necessary.  */
   if (arm_tune == arm_none)
-    arm_tune = target_arch_cpu;
+    arm_tune = arm_arch;
 
   /* If the user did not specify a processor, choose one for them.  */
   if (insn_flags == 0)
@@ -1454,6 +1465,8 @@
       arm_default_cpu = (enum processor_type) (sel - all_cores);
       if (arm_tune == arm_none)
 	arm_tune = arm_default_cpu;
+      if (arm_cpu == arm_none)
+	arm_cpu = arm_default_cpu;
 /* APPLE LOCAL end v7 support. Merge from Codesourcery */
     }
 

Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/arm.h?rev=118374&r1=118373&r2=118374&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/arm/arm.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/arm/arm.h Sun Nov  7 05:09:37 2010
@@ -149,6 +149,10 @@
 /* The processor for which instructions should be scheduled.  */
 extern enum processor_type arm_tune;
 
+/* LLVM LOCAL global arch value */
+extern enum processor_type arm_arch;
+extern enum processor_type arm_cpu;
+
 typedef enum arm_cond_code
 {
   ARM_EQ = 0, ARM_NE, ARM_CS, ARM_CC, ARM_MI, ARM_PL, ARM_VS, ARM_VC,
@@ -3456,7 +3460,7 @@
 /* Turn -march=xx into a CPU type.
  */
 #define LLVM_SET_SUBTARGET_FEATURES(F) \
-  { switch (arm_tune) { \
+  { switch (arm_cpu) { \
     case arm8:          F.setCPU("arm8"); break;\
     case arm810:        F.setCPU("arm810"); break;\
     case strongarm:     F.setCPU("strongarm"); break;\





More information about the llvm-commits mailing list