Revision: 21935
Author:   [email protected]
Date:     Mon Jun 23 12:19:54 2014 UTC
Log:      [Arm]: Simplify compile-time Arm feature detection.

Simplify the compile time feature detection on Arm:
 - Define CAN_USE_XXX definitions unconditionally for all target/host
   toolchain combinations
 - Rename arm_test / ARM_TEST to arm_test_noprob / ARM_TEST_NO_FEATURE_PROBE
 - Don't set ARM_TEST_NO_FEATURE_PROBE implicitly on the simulator to make
   make simulator / native more consistent
 - Unify CpuFeatures::PrintTarget for simulator and native builds
- Remove unecessary CAN_USE_VFP_INSTRUCTIONS definition for android (this is
   the default for arm_fpu=default)
- Add a CpuFeatures::Probe() before calling CpuFeatures::PrintFeatures() in PrintHelp
    to ensure we have probed features before printing them.

BUG=384474
LOG=N
[email protected]

Review URL: https://codereview.chromium.org/340373002
http://code.google.com/p/v8/source/detail?r=21935

Modified:
 /branches/bleeding_edge/Makefile
 /branches/bleeding_edge/build/toolchain.gypi
 /branches/bleeding_edge/src/arm/assembler-arm.cc
 /branches/bleeding_edge/src/flag-definitions.h
 /branches/bleeding_edge/src/flags.cc
 /branches/bleeding_edge/tools/gyp/v8.gyp

=======================================
--- /branches/bleeding_edge/Makefile    Fri Jun 20 07:35:48 2014 UTC
+++ /branches/bleeding_edge/Makefile    Mon Jun 23 12:19:54 2014 UTC
@@ -191,15 +191,14 @@
   GYPFLAGS += -Darm_thumb=1
 endif
 endif
-# armtest=on
+# arm_test_noprobe=on
 # With this flag set, by default v8 will only use features implied
 # by the compiler (no probe). This is done by modifying the default
 # values of enable_armv7, enable_vfp3, enable_32dregs and enable_neon.
 # Modifying these flags when launching v8 will enable the probing for
 # the specified values.
-# When using the simulator, this flag is implied.
-ifeq ($(armtest), on)
-  GYPFLAGS += -Darm_test=on
+ifeq ($(arm_test_noprobe), on)
+  GYPFLAGS += -Darm_test_noprobe=on
 endif

 # ----------------- available targets: --------------------
=======================================
--- /branches/bleeding_edge/build/toolchain.gypi Mon Jun 2 11:39:44 2014 UTC +++ /branches/bleeding_edge/build/toolchain.gypi Mon Jun 23 12:19:54 2014 UTC
@@ -47,7 +47,7 @@
# these registers in the snapshot and use CPU feature probing when running
     # on the target.
     'v8_can_use_vfp32dregs%': 'false',
-    'arm_test%': 'off',
+    'arm_test_noprobe%': 'off',

     # Similar to vfp but on MIPS.
     'v8_can_use_fpu_instructions%': 'true',
@@ -89,6 +89,36 @@
         'defines': [
           'V8_TARGET_ARCH_ARM',
         ],
+        'conditions': [
+          [ 'arm_version==7 or arm_version=="default"', {
+            'defines': [
+              'CAN_USE_ARMV7_INSTRUCTIONS',
+            ],
+          }],
+          [ 'arm_fpu=="vfpv3-d16" or arm_fpu=="default"', {
+            'defines': [
+              'CAN_USE_VFP3_INSTRUCTIONS',
+            ],
+          }],
+          [ 'arm_fpu=="vfpv3"', {
+            'defines': [
+              'CAN_USE_VFP3_INSTRUCTIONS',
+              'CAN_USE_VFP32DREGS',
+            ],
+          }],
+          [ 'arm_fpu=="neon"', {
+            'defines': [
+              'CAN_USE_VFP3_INSTRUCTIONS',
+              'CAN_USE_VFP32DREGS',
+              'CAN_USE_NEON',
+            ],
+          }],
+          [ 'arm_test_noprobe=="on"', {
+            'defines': [
+              'ARM_TEST_NO_FEATURE_PROBE',
+            ],
+          }],
+        ],
         'target_conditions': [
           ['_toolset=="host"', {
             'variables': {
@@ -116,45 +146,10 @@
                   [ 'arm_thumb==0', {
                     'cflags': ['-marm',],
                   }],
-                  [ 'arm_test=="on"', {
-                    'defines': [
-                      'ARM_TEST',
-                    ],
-                  }],
                 ],
               }, {
                 # armcompiler=="no"
                 'conditions': [
-                  [ 'arm_version==7 or arm_version=="default"', {
-                    'defines': [
-                      'CAN_USE_ARMV7_INSTRUCTIONS=1',
-                    ],
-                    'conditions': [
-                      [ 'arm_fpu=="default"', {
-                        'defines': [
-                          'CAN_USE_VFP3_INSTRUCTIONS',
-                        ],
-                      }],
-                      [ 'arm_fpu=="vfpv3-d16"', {
-                        'defines': [
-                          'CAN_USE_VFP3_INSTRUCTIONS',
-                        ],
-                      }],
-                      [ 'arm_fpu=="vfpv3"', {
-                        'defines': [
-                          'CAN_USE_VFP3_INSTRUCTIONS',
-                          'CAN_USE_VFP32DREGS',
-                        ],
-                      }],
-                      [ 'arm_fpu=="neon"', {
-                        'defines': [
-                          'CAN_USE_VFP3_INSTRUCTIONS',
-                          'CAN_USE_VFP32DREGS',
-                          'CAN_USE_NEON',
-                        ],
-                      }],
-                    ],
-                  }],
                   [ 'arm_float_abi=="hard"', {
                     'defines': [
                       'USE_EABI_HARDFLOAT=1',
@@ -166,9 +161,6 @@
                     ],
                   }],
                 ],
-                'defines': [
-                  'ARM_TEST',
-                ],
               }],
             ],
           }],  # _toolset=="host"
@@ -198,67 +190,10 @@
                   [ 'arm_thumb==0', {
                     'cflags': ['-marm',],
                   }],
-                  [ 'arm_test=="on"', {
-                    'defines': [
-                      'ARM_TEST',
-                    ],
-                    'conditions': [
-                      [ 'arm_fpu=="vfpv3-d16"', {
-                        'defines': [
-                          'CAN_USE_VFP3_INSTRUCTIONS',
-                        ],
-                      }],
-                      [ 'arm_fpu=="vfpv3"', {
-                        'defines': [
-                          'CAN_USE_VFP3_INSTRUCTIONS',
-                          'CAN_USE_VFP32DREGS',
-                        ],
-                      }],
-                      [ 'arm_fpu=="neon"', {
-                        'defines': [
-                          'CAN_USE_VFP3_INSTRUCTIONS',
-                          'CAN_USE_VFP32DREGS',
-                          'CAN_USE_NEON',
-                        ],
-                      }],
-                    ],
-                  }],
                 ],
               }, {
                 # armcompiler=="no"
                 'conditions': [
-                  [ 'arm_version==7 or arm_version=="default"', {
-                    'defines': [
-                      'CAN_USE_ARMV7_INSTRUCTIONS=1',
-                    ],
-                    'conditions': [
-                      [ 'arm_fpu=="default"', {
-                        'defines': [
-                          'CAN_USE_VFP3_INSTRUCTIONS',
-                          'CAN_USE_VFP32DREGS',
-                          'CAN_USE_NEON',
-                        ],
-                      }],
-                      [ 'arm_fpu=="vfpv3-d16"', {
-                        'defines': [
-                          'CAN_USE_VFP3_INSTRUCTIONS',
-                        ],
-                      }],
-                      [ 'arm_fpu=="vfpv3"', {
-                        'defines': [
-                          'CAN_USE_VFP3_INSTRUCTIONS',
-                          'CAN_USE_VFP32DREGS',
-                        ],
-                      }],
-                      [ 'arm_fpu=="neon"', {
-                        'defines': [
-                          'CAN_USE_VFP3_INSTRUCTIONS',
-                          'CAN_USE_VFP32DREGS',
-                          'CAN_USE_NEON',
-                        ],
-                      }],
-                    ],
-                  }],
                   [ 'arm_float_abi=="hard"', {
                     'defines': [
                       'USE_EABI_HARDFLOAT=1',
@@ -270,9 +205,6 @@
                     ],
                   }],
                 ],
-                'defines': [
-                  'ARM_TEST',
-                ],
               }],
             ],
           }],  # _toolset=="target"
=======================================
--- /branches/bleeding_edge/src/arm/assembler-arm.cc Mon Jun 23 11:27:24 2014 UTC +++ /branches/bleeding_edge/src/arm/assembler-arm.cc Mon Jun 23 12:19:54 2014 UTC
@@ -129,56 +129,53 @@

 void CpuFeatures::PrintTarget() {
   const char* arm_arch = NULL;
-  const char* arm_test = "";
+  const char* arm_target_type = "";
+  const char* arm_no_probe = "";
   const char* arm_fpu = "";
   const char* arm_thumb = "";
   const char* arm_float_abi = NULL;

+#if !defined __arm__
+  arm_target_type = " simulator";
+#endif
+
+#if defined ARM_TEST_NO_FEATURE_PROBE
+  arm_no_probe = " noprobe";
+#endif
+
 #if defined CAN_USE_ARMV7_INSTRUCTIONS
   arm_arch = "arm v7";
 #else
   arm_arch = "arm v6";
 #endif

-#ifdef __arm__
-
-# ifdef ARM_TEST
-  arm_test = " test";
-# endif
-# if defined __ARM_NEON__
+#if defined CAN_USE_NEON
   arm_fpu = " neon";
-# elif defined CAN_USE_VFP3_INSTRUCTIONS
-  arm_fpu = " vfp3";
-# else
-  arm_fpu = " vfp2";
-# endif
-# if (defined __thumb__) || (defined __thumb2__)
-  arm_thumb = " thumb";
-# endif
-  arm_float_abi = OS::ArmUsingHardFloat() ? "hard" : "softfp";
-
-#else  // __arm__
-
-  arm_test = " simulator";
-# if defined CAN_USE_VFP3_INSTRUCTIONS
+#elif defined CAN_USE_VFP3_INSTRUCTIONS
 #  if defined CAN_USE_VFP32DREGS
   arm_fpu = " vfp3";
 #  else
   arm_fpu = " vfp3-d16";
 #  endif
-# else
+#else
   arm_fpu = " vfp2";
-# endif
-# if USE_EABI_HARDFLOAT == 1
+#endif
+
+#ifdef __arm__
+  arm_float_abi = OS::ArmUsingHardFloat() ? "hard" : "softfp";
+#elif USE_EABI_HARDFLOAT
   arm_float_abi = "hard";
-# else
+#else
   arm_float_abi = "softfp";
-# endif
+#endif

-#endif  // __arm__
+#if defined __arm__ && (defined __thumb__) || (defined __thumb2__)
+  arm_thumb = " thumb";
+#endif

-  printf("target%s %s%s%s %s\n",
-         arm_test, arm_arch, arm_fpu, arm_thumb, arm_float_abi);
+  printf("target%s%s %s%s%s %s\n",
+         arm_target_type, arm_no_probe, arm_arch, arm_fpu, arm_thumb,
+         arm_float_abi);
 }


=======================================
--- /branches/bleeding_edge/src/flag-definitions.h Fri Jun 20 07:35:48 2014 UTC +++ /branches/bleeding_edge/src/flag-definitions.h Mon Jun 23 12:19:54 2014 UTC
@@ -105,22 +105,22 @@
 };
 #endif

-#if (defined CAN_USE_VFP3_INSTRUCTIONS) || !(defined ARM_TEST)
+#if (defined CAN_USE_VFP3_INSTRUCTIONS) || !(defined ARM_TEST_NO_FEATURE_PROBE)
 # define ENABLE_VFP3_DEFAULT true
 #else
 # define ENABLE_VFP3_DEFAULT false
 #endif
-#if (defined CAN_USE_ARMV7_INSTRUCTIONS) || !(defined ARM_TEST)
+#if (defined CAN_USE_ARMV7_INSTRUCTIONS) || !(defined ARM_TEST_NO_FEATURE_PROBE)
 # define ENABLE_ARMV7_DEFAULT true
 #else
 # define ENABLE_ARMV7_DEFAULT false
 #endif
-#if (defined CAN_USE_VFP32DREGS) || !(defined ARM_TEST)
+#if (defined CAN_USE_VFP32DREGS) || !(defined ARM_TEST_NO_FEATURE_PROBE)
 # define ENABLE_32DREGS_DEFAULT true
 #else
 # define ENABLE_32DREGS_DEFAULT false
 #endif
-#if (defined CAN_USE_NEON) || !(defined ARM_TEST)
+#if (defined CAN_USE_NEON) || !(defined ARM_TEST_NO_FEATURE_PROBE)
 # define ENABLE_NEON_DEFAULT true
 #else
 # define ENABLE_NEON_DEFAULT false
=======================================
--- /branches/bleeding_edge/src/flags.cc        Fri Jun 20 08:40:11 2014 UTC
+++ /branches/bleeding_edge/src/flags.cc        Mon Jun 23 12:19:54 2014 UTC
@@ -517,6 +517,7 @@

 // static
 void FlagList::PrintHelp() {
+  CpuFeatures::Probe(false);
   CpuFeatures::PrintTarget();
   CpuFeatures::PrintFeatures();

=======================================
--- /branches/bleeding_edge/tools/gyp/v8.gyp    Wed Jun 18 11:01:54 2014 UTC
+++ /branches/bleeding_edge/tools/gyp/v8.gyp    Mon Jun 23 12:19:54 2014 UTC
@@ -837,9 +837,6 @@
           }
         ],
         ['OS=="android"', {
-            'defines': [
-              'CAN_USE_VFP_INSTRUCTIONS',
-            ],
             'sources': [
               '../../src/platform-posix.cc'
             ],

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to