[AArch64][2/14] Refactor arches handling, add arch enum identifier
authorKyrylo Tkachov <kyrylo.tkachov@arm.com>
Tue, 4 Aug 2015 09:47:49 +0000 (09:47 +0000)
committerKyrylo Tkachov <ktkachov@gcc.gnu.org>
Tue, 4 Aug 2015 09:47:49 +0000 (09:47 +0000)
* config/aarch64/aarch64.h (TARGET_CPU_CPP_BUILTINS): Define
__ARM_ARCH_8A directly rather than with cpp_define_formatted.
* config/aarch64/aarch64.c (struct processor): Add arch field.
(all_architectures): Handle above, move above all_cores.
(all_cores): Handle above.
(aarch64_parse_arch): Handle above changes.
* config/aarch64/aarch64-arches.def (armv8-a): Extend according to
above.  Update comments.
(armv8.1-a): Likewise.
* config/aarch64/aarch64-cores.def: Update according to above.
* config/aarch64/aarch64-opts.h (aarch64_arch): New enum.
* config/aarch64/driver-aarch64.c (struct aarch64_arch): Rename to
aarch64_arch_driver_info.

From-SVN: r226553

gcc/ChangeLog
gcc/config/aarch64/aarch64-arches.def
gcc/config/aarch64/aarch64-cores.def
gcc/config/aarch64/aarch64-opts.h
gcc/config/aarch64/aarch64.c
gcc/config/aarch64/aarch64.h
gcc/config/aarch64/driver-aarch64.c

index cf83542ece144ac07132639d72397d0d7e95d180..c890ddd25d0b54a6472b43b062d89409bb34567a 100644 (file)
@@ -1,3 +1,19 @@
+2015-08-04  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
+
+       * config/aarch64/aarch64.h (TARGET_CPU_CPP_BUILTINS): Define
+       __ARM_ARCH_8A directly rather than with cpp_define_formatted.
+       * config/aarch64/aarch64.c (struct processor): Add arch field.
+       (all_architectures): Handle above, move above all_cores.
+       (all_cores): Handle above.
+       (aarch64_parse_arch): Handle above changes.
+       * config/aarch64/aarch64-arches.def (armv8-a): Extend according to
+       above.  Update comments.
+       (armv8.1-a): Likewise.
+       * config/aarch64/aarch64-cores.def: Update according to above.
+       * config/aarch64/aarch64-opts.h (aarch64_arch): New enum.
+       * config/aarch64/driver-aarch64.c (struct aarch64_arch): Rename to
+       aarch64_arch_driver_info.
+
 2015-08-04  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        * config/aarch64/aarch64.c (struct processor): Add ident field.
index abbfce66bfe99f29ee1897030360131757aefccf..3b4fb73316c251d121effe552af1cd3f226cb033 100644 (file)
 
 /* Before using #include to read this file, define a macro:
 
-      AARCH64_ARCH(NAME, CORE, ARCH, FLAGS)
+      AARCH64_ARCH(NAME, CORE, ARCH_IDENT, ARCH_REV, FLAGS)
 
    The NAME is the name of the architecture, represented as a string
    constant.  The CORE is the identifier for a core representative of
-   this architecture.  ARCH is the architecture revision.  FLAGS are
-   the flags implied by the architecture.  */
+   this architecture.  ARCH_IDENT is the architecture identifier.  It must be
+   unique and be syntactically valid to appear as part of an enum identifier.
+   ARCH_REV is an integer specifying the architecture major revision.
+   FLAGS are the flags implied by the architecture.
+   Due to the assumptions about the positions of these fields in config.gcc,
+   the NAME should be kept as the first argument and FLAGS as the last.  */
+
+AARCH64_ARCH("armv8-a",              generic,       8A,        8,  AARCH64_FL_FOR_ARCH8)
+AARCH64_ARCH("armv8.1-a",     generic,      8_1A,      8,  AARCH64_FL_FOR_ARCH8_1)
 
-AARCH64_ARCH("armv8-a",              generic,       8,  AARCH64_FL_FOR_ARCH8)
-AARCH64_ARCH("armv8.1-a",     generic,      8,  AARCH64_FL_FOR_ARCH8_1)
index c4e22fef3758fe7b068f4e733ff474f8e33acb4a..0ab1ca839e2ee9cacd7ad4f996176307318f4de2 100644 (file)
 
    Before using #include to read this file, define a macro:
 
-      AARCH64_CORE(CORE_NAME, CORE_IDENT, SCHEDULER_IDENT, ARCH, FLAGS, COSTS, IMP, PART)
+      AARCH64_CORE(CORE_NAME, CORE_IDENT, SCHEDULER_IDENT, ARCH_IDENT, FLAGS, COSTS, IMP, PART)
 
    The CORE_NAME is the name of the core, represented as a string constant.
    The CORE_IDENT is the name of the core, represented as an identifier.
    The SCHEDULER_IDENT is the name of the core for which scheduling decisions
    will be made, represented as an identifier.
-   ARCH is the architecture revision implemented by the chip.
+   ARCH_IDENT is the architecture implemented by the chip as specified in
+   aarch64-arches.def.
    FLAGS are the bitwise-or of the traits that apply to that core.
    This need not include flags implied by the architecture.
    COSTS is the name of the rtx_costs routine to use.
 
 /* V8 Architecture Processors.  */
 
-AARCH64_CORE("cortex-a53",  cortexa53, cortexa53, 8,  AARCH64_FL_FOR_ARCH8 | AARCH64_FL_CRC, cortexa53, "0x41", "0xd03")
-AARCH64_CORE("cortex-a57",  cortexa57, cortexa57, 8,  AARCH64_FL_FOR_ARCH8 | AARCH64_FL_CRC, cortexa57, "0x41", "0xd07")
-AARCH64_CORE("cortex-a72",  cortexa72, cortexa57, 8,  AARCH64_FL_FOR_ARCH8 | AARCH64_FL_CRC, cortexa72, "0x41", "0xd08")
-AARCH64_CORE("exynos-m1",   exynosm1,  cortexa57, 8,  AARCH64_FL_FOR_ARCH8 | AARCH64_FL_CRC | AARCH64_FL_CRYPTO, cortexa72, "0x53", "0x001")
-AARCH64_CORE("thunderx",    thunderx,  thunderx,  8,  AARCH64_FL_FOR_ARCH8 | AARCH64_FL_CRC | AARCH64_FL_CRYPTO, thunderx,  "0x43", "0x0a1")
-AARCH64_CORE("xgene1",      xgene1,    xgene1,    8,  AARCH64_FL_FOR_ARCH8, xgene1, "0x50", "0x000")
+AARCH64_CORE("cortex-a53",  cortexa53, cortexa53, 8A,  AARCH64_FL_FOR_ARCH8 | AARCH64_FL_CRC, cortexa53, "0x41", "0xd03")
+AARCH64_CORE("cortex-a57",  cortexa57, cortexa57, 8A,  AARCH64_FL_FOR_ARCH8 | AARCH64_FL_CRC, cortexa57, "0x41", "0xd07")
+AARCH64_CORE("cortex-a72",  cortexa72, cortexa57, 8A,  AARCH64_FL_FOR_ARCH8 | AARCH64_FL_CRC, cortexa72, "0x41", "0xd08")
+AARCH64_CORE("exynos-m1",   exynosm1,  cortexa57, 8A,  AARCH64_FL_FOR_ARCH8 | AARCH64_FL_CRC | AARCH64_FL_CRYPTO, cortexa72, "0x53", "0x001")
+AARCH64_CORE("thunderx",    thunderx,  thunderx,  8A,  AARCH64_FL_FOR_ARCH8 | AARCH64_FL_CRC | AARCH64_FL_CRYPTO, thunderx,  "0x43", "0x0a1")
+AARCH64_CORE("xgene1",      xgene1,    xgene1,    8A,  AARCH64_FL_FOR_ARCH8, xgene1, "0x50", "0x000")
 
 /* V8 big.LITTLE implementations.  */
 
-AARCH64_CORE("cortex-a57.cortex-a53",  cortexa57cortexa53, cortexa53, 8,  AARCH64_FL_FOR_ARCH8 | AARCH64_FL_CRC, cortexa57, "0x41", "0xd07.0xd03")
-AARCH64_CORE("cortex-a72.cortex-a53",  cortexa72cortexa53, cortexa53, 8,  AARCH64_FL_FOR_ARCH8 | AARCH64_FL_CRC, cortexa72, "0x41", "0xd08.0xd03")
+AARCH64_CORE("cortex-a57.cortex-a53",  cortexa57cortexa53, cortexa53, 8A,  AARCH64_FL_FOR_ARCH8 | AARCH64_FL_CRC, cortexa57, "0x41", "0xd07.0xd03")
+AARCH64_CORE("cortex-a72.cortex-a53",  cortexa72cortexa53, cortexa53, 8A,  AARCH64_FL_FOR_ARCH8 | AARCH64_FL_CRC, cortexa72, "0x41", "0xd08.0xd03")
+
index 24bfd9fd1506abf64478e3cf7abb29c573861435..bf6bb7b8f4edbcc92122228d87e443d67f270342 100644 (file)
@@ -35,6 +35,15 @@ enum aarch64_processor
   aarch64_none
 };
 
+enum aarch64_arch
+{
+#define AARCH64_ARCH(NAME, CORE, ARCH_IDENT, ARCH_REV, FLAGS) \
+  AARCH64_ARCH_##ARCH_IDENT,
+#include "aarch64-arches.def"
+#undef AARCH64_ARCH
+  aarch64_no_arch
+};
+
 /* TLS types.  */
 enum aarch64_tls_type {
   TLS_TRADITIONAL,
index 1867e4c317d45c5c4d470ccb8e30a1e5a77be842..f36aee4043db4e90f8cdc643303b9885a992bf17 100644 (file)
@@ -500,33 +500,36 @@ struct processor
   const char *const name;
   enum aarch64_processor ident;
   enum aarch64_processor sched_core;
-  const char *arch;
+  enum aarch64_arch arch;
   unsigned architecture_version;
   const unsigned long flags;
   const struct tune_params *const tune;
 };
 
+/* Architectures implementing AArch64.  */
+static const struct processor all_architectures[] =
+{
+#define AARCH64_ARCH(NAME, CORE, ARCH_IDENT, ARCH_REV, FLAGS) \
+  {NAME, CORE, CORE, AARCH64_ARCH_##ARCH_IDENT, ARCH_REV, FLAGS, NULL},
+#include "aarch64-arches.def"
+#undef AARCH64_ARCH
+  {NULL, aarch64_none, aarch64_none, aarch64_no_arch, 0, 0, NULL}
+};
+
 /* Processor cores implementing AArch64.  */
 static const struct processor all_cores[] =
 {
 #define AARCH64_CORE(NAME, IDENT, SCHED, ARCH, FLAGS, COSTS, IMP, PART) \
-  {NAME, IDENT, SCHED, #ARCH, ARCH, FLAGS, &COSTS##_tunings},
+  {NAME, IDENT, SCHED, AARCH64_ARCH_##ARCH,                            \
+  all_architectures[AARCH64_ARCH_##ARCH].architecture_version, \
+  FLAGS, &COSTS##_tunings},
 #include "aarch64-cores.def"
 #undef AARCH64_CORE
-  {"generic", generic, cortexa53, "8", 8,
-   AARCH64_FL_FOR_ARCH8, &generic_tunings},
-  {NULL, aarch64_none, aarch64_none, NULL, 0, 0, NULL}
+  {"generic", generic, cortexa53, AARCH64_ARCH_8A, 8,
+    AARCH64_FL_FOR_ARCH8, &generic_tunings},
+  {NULL, aarch64_none, aarch64_none, aarch64_no_arch, 0, 0, NULL}
 };
 
-/* Architectures implementing AArch64.  */
-static const struct processor all_architectures[] =
-{
-#define AARCH64_ARCH(NAME, CORE, ARCH, FLAGS) \
-  {NAME, CORE, CORE, #ARCH, ARCH, FLAGS, NULL},
-#include "aarch64-arches.def"
-#undef AARCH64_ARCH
-  {NULL, aarch64_none, aarch64_none, NULL, 0, 0, NULL}
-};
 
 /* Target specification.  These are populated as commandline arguments
    are processed, or NULL if not specified.  */
@@ -7216,10 +7219,11 @@ aarch64_parse_arch (void)
              aarch64_parse_extension (ext);
            }
 
-         if (strcmp (selected_arch->arch, selected_cpu->arch))
+         if (selected_arch->arch != selected_cpu->arch)
            {
              warning (0, "switch -mcpu=%s conflicts with -march=%s switch",
-                      selected_cpu->name, selected_arch->name);
+                      all_architectures[selected_cpu->arch].name,
+                      selected_arch->name);
            }
 
          return;
index 535695c4f450cf4d362e631a2864379283ae1fc6..80a239c6cee358a6b41f548d0c2f9f78dd520639 100644 (file)
@@ -34,8 +34,7 @@
         ("__ARM_ALIGN_MAX_STACK_PWR", 16);              \
       builtin_define_with_int_value                     \
         ("__ARM_ARCH", aarch64_architecture_version);   \
-      cpp_define_formatted                                              \
-        (parse_in, "__ARM_ARCH_%dA", aarch64_architecture_version);     \
+      builtin_define ("__ARM_ARCH_8A");                   \
       builtin_define ("__ARM_ARCH_ISA_A64");            \
       builtin_define_with_int_value                     \
         ("__ARM_ARCH_PROFILE", 'A');                    \
index d0be6db477cfb493c58c092cb0686ebbd3ff8aca..ae4d5a00ec52a516f2736e7141d96494bb1cbdf9 100644 (file)
@@ -54,16 +54,16 @@ static struct aarch64_core_data cpu_data [] =
 
 #undef AARCH64_CORE
 
-struct aarch64_arch
+struct aarch64_arch_driver_info
 {
   const char* id;
   const char* name;
 };
 
-#define AARCH64_ARCH(NAME, CORE, ARCH, FLAGS) \
-  { #ARCH, NAME  },
+#define AARCH64_ARCH(NAME, CORE, ARCH_IDENT, ARCH_REV, FLAGS) \
+  { #ARCH_IDENT, NAME  },
 
-static struct aarch64_arch aarch64_arches [] =
+static struct aarch64_arch_driver_info aarch64_arches [] =
 {
 #include "aarch64-arches.def"
   {NULL, NULL}