[ARM] Rework CPU feature selection in the disassembler
authorMatthew Wahab <matthew.wahab@arm.com>
Tue, 2 Jun 2015 11:24:24 +0000 (12:24 +0100)
committerJiong Wang <jiong.wang@arm.com>
Tue, 2 Jun 2015 11:24:24 +0000 (12:24 +0100)
include/opcode/
* arm.h (ARM_FEATURE_ALL): New.

opcodes/
* arm-dis.c (select_arm_features): Rework to avoid used of
redefined macros.

include/opcode/ChangeLog
include/opcode/arm.h
opcodes/ChangeLog
opcodes/arm-dis.c

index febe24f..5b9eb5d 100644 (file)
@@ -1,5 +1,9 @@
 2015-06-02  Matthew Wahab  <matthew.wahab@arm.com>
 
+       * arm.h (ARM_FEATURE_ALL): New.
+
+2015-06-02  Matthew Wahab  <matthew.wahab@arm.com>
+
        * aarch64.h (AARCH64_FEATURE_RDMA): New.
 
 2015-06-02  Matthew Wahab  <matthew.wahab@arm.com>
index 1bf6b3c..cbe9e7d 100644 (file)
 #define ARM_ARCH_NONE  ARM_FEATURE_LOW (0, 0)
 #define FPU_NONE       ARM_FEATURE_LOW (0, 0)
 #define ARM_ANY                ARM_FEATURE (-1, -1, 0) /* Any basic core.  */
+#define ARM_FEATURE_ALL        ARM_FEATURE (-1, -1, -1)/* All CPU and FPU features.  */
 #define FPU_ANY_HARD   ARM_FEATURE_COPROC (FPU_FPA | FPU_VFP_HARD | FPU_MAVERICK)
 #define ARM_ARCH_THUMB2 ARM_FEATURE_CORE_LOW (ARM_EXT_V6T2 | ARM_EXT_V7 \
                                              | ARM_EXT_V7A | ARM_EXT_V7R \
index 7e8e5d8..05fc116 100644 (file)
@@ -1,5 +1,10 @@
 2015-06-02  Matthew Wahab  <matthew.wahab@arm.com>
 
+       * arm-dis.c (select_arm_features): Rework to avoid used of redefined
+       macros.
+
+2015-06-02  Matthew Wahab  <matthew.wahab@arm.com>
+
        * aarch64-tbl.h (aarch64_feature_rdma): New.
        (RDMA): New.
        (aarch64_opcode_table): Add "sqrmlah" and "sqrdmlsh" instructions.
index 1585a4f..9c2665d 100644 (file)
@@ -6026,43 +6026,40 @@ static void
 select_arm_features (unsigned long mach,
                     arm_feature_set * features)
 {
-#undef  ARM_FEATURE_LOW
-#define ARM_FEATURE_LOW(ARCH1,CEXT) \
-  features->core[0] = (ARCH1); \
-  features->core[1] = 0; \
-  features->coproc = (CEXT) | FPU_FPA; \
-  return
-
-#undef  ARM_FEATURE_CORE_LOW
-#define ARM_FEATURE_CORE_LOW(ARCH1) \
-  features->core[0] = (ARCH1); \
-  features->core[1] = 0; \
-  features->coproc = FPU_FPA; \
-  return
+#undef ARM_SET_FEATURES
+#define ARM_SET_FEATURES(FSET) \
+  {                                                    \
+    const arm_feature_set fset = FSET;                 \
+    arm_feature_set tmp = ARM_FEATURE (0, 0, FPU_FPA) ;        \
+    ARM_MERGE_FEATURE_SETS (*features, tmp, fset);     \
+  }
 
   switch (mach)
     {
-    case bfd_mach_arm_2:       ARM_ARCH_V2;
-    case bfd_mach_arm_2a:      ARM_ARCH_V2S;
-    case bfd_mach_arm_3:       ARM_ARCH_V3;
-    case bfd_mach_arm_3M:      ARM_ARCH_V3M;
-    case bfd_mach_arm_4:       ARM_ARCH_V4;
-    case bfd_mach_arm_4T:      ARM_ARCH_V4T;
-    case bfd_mach_arm_5:       ARM_ARCH_V5;
-    case bfd_mach_arm_5T:      ARM_ARCH_V5T;
-    case bfd_mach_arm_5TE:     ARM_ARCH_V5TE;
-    case bfd_mach_arm_XScale:  ARM_ARCH_XSCALE;
-    case bfd_mach_arm_ep9312:  ARM_FEATURE_LOW (ARM_AEXT_V4T, \
-                                               ARM_CEXT_MAVERICK \
-                                               | FPU_MAVERICK);
-    case bfd_mach_arm_iWMMXt:  ARM_ARCH_IWMMXT;
-    case bfd_mach_arm_iWMMXt2: ARM_ARCH_IWMMXT2;
+    case bfd_mach_arm_2:       ARM_SET_FEATURES (ARM_ARCH_V2); break;
+    case bfd_mach_arm_2a:      ARM_SET_FEATURES (ARM_ARCH_V2S); break;
+    case bfd_mach_arm_3:       ARM_SET_FEATURES (ARM_ARCH_V3); break;
+    case bfd_mach_arm_3M:      ARM_SET_FEATURES (ARM_ARCH_V3M); break;
+    case bfd_mach_arm_4:       ARM_SET_FEATURES (ARM_ARCH_V4); break;
+    case bfd_mach_arm_4T:      ARM_SET_FEATURES (ARM_ARCH_V4T); break;
+    case bfd_mach_arm_5:       ARM_SET_FEATURES (ARM_ARCH_V5); break;
+    case bfd_mach_arm_5T:      ARM_SET_FEATURES (ARM_ARCH_V5T); break;
+    case bfd_mach_arm_5TE:     ARM_SET_FEATURES (ARM_ARCH_V5TE); break;
+    case bfd_mach_arm_XScale:  ARM_SET_FEATURES (ARM_ARCH_XSCALE); break;
+    case bfd_mach_arm_ep9312:
+      ARM_SET_FEATURES (ARM_FEATURE_LOW (ARM_AEXT_V4T,
+                                        ARM_CEXT_MAVERICK | FPU_MAVERICK));
+       break;
+    case bfd_mach_arm_iWMMXt:  ARM_SET_FEATURES (ARM_ARCH_IWMMXT); break;
+    case bfd_mach_arm_iWMMXt2: ARM_SET_FEATURES (ARM_ARCH_IWMMXT2); break;
       /* If the machine type is unknown allow all
         architecture types and all extensions.  */
-    case bfd_mach_arm_unknown: ARM_FEATURE_LOW (-1UL, -1UL);
+    case bfd_mach_arm_unknown: ARM_SET_FEATURES (ARM_FEATURE_ALL); break;
     default:
       abort ();
     }
+
+#undef ARM_SET_FEATURES
 }