This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH][AArch64][1/14] Add ident field to struct processor


Hi all,

This first patch adds a field to the processor structure that uniquely identifies that processor.
Note that the current 'core' field is actually just the core for which to schedule the instructions.
With this patch we get the nice property that we can reference a processor struct by just indexing
the all_cores at the index specified by the value of the 'ident' enum.
It's not hard to implement either, since we already construct the required enum values in
aarch64-opts.h and aarch64-cores.def already specifies the correct values for each core!

Thus, to implement the 'back up and restore' functionality we need for SWITCHABLE_TARGET the only thing we'd need
to save and restore on the tuning side is an aarch64_processor enum value.

Bootstrapped with and without LTO and tested on aarch64 as part of series.

Ok for trunk?

Thanks,
Kyrill

2015-07-16  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

    * config/aarch64/aarch64.c (struct processor): Add ident field.
    Rename core sched_core.
    (all_cores): Handle above changes.
    (all_architectures): Likewise.
    (aarch64_parse_arch): Likewise.
    (aarch64_override_options): Likewise.
commit 458da15dab42b6bf0e668be78230989694d7973d
Author: Kyrylo Tkachov <kyrylo.tkachov@arm.com>
Date:   Tue May 12 09:36:28 2015 +0100

    [AArch64][1/N] Add ident field to struct processor

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 020f63c..75e0d70 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -498,7 +498,8 @@ aarch64_tuning_override_functions[] =
 struct processor
 {
   const char *const name;
-  enum aarch64_processor core;
+  enum aarch64_processor ident;
+  enum aarch64_processor sched_core;
   const char *arch;
   unsigned architecture_version;
   const unsigned long flags;
@@ -509,21 +510,22 @@ struct processor
 static const struct processor all_cores[] =
 {
 #define AARCH64_CORE(NAME, IDENT, SCHED, ARCH, FLAGS, COSTS, IMP, PART) \
-  {NAME, SCHED, #ARCH, ARCH, FLAGS, &COSTS##_tunings},
+  {NAME, IDENT, SCHED, #ARCH, ARCH, FLAGS, &COSTS##_tunings},
 #include "aarch64-cores.def"
 #undef AARCH64_CORE
-  {"generic", cortexa53, "8", 8, AARCH64_FL_FOR_ARCH8, &generic_tunings},
-  {NULL, aarch64_none, NULL, 0, 0, NULL}
+  {"generic", generic, cortexa53, "8", 8,
+   AARCH64_FL_FOR_ARCH8, &generic_tunings},
+  {NULL, aarch64_none, aarch64_none, NULL, 0, 0, NULL}
 };
 
 /* Architectures implementing AArch64.  */
 static const struct processor all_architectures[] =
 {
 #define AARCH64_ARCH(NAME, CORE, ARCH, FLAGS) \
-  {NAME, CORE, #ARCH, ARCH, FLAGS, NULL},
+  {NAME, CORE, CORE, #ARCH, ARCH, FLAGS, NULL},
 #include "aarch64-arches.def"
 #undef AARCH64_ARCH
-  {NULL, aarch64_none, NULL, 0, 0, NULL}
+  {NULL, aarch64_none, aarch64_none, NULL, 0, 0, NULL}
 };
 
 /* Target specification.  These are populated as commandline arguments
@@ -7199,7 +7201,7 @@ aarch64_parse_arch (void)
 	  aarch64_isa_flags = selected_arch->flags;
 
 	  if (!selected_cpu)
-	    selected_cpu = &all_cores[selected_arch->core];
+	    selected_cpu = &all_cores[selected_arch->ident];
 
 	  if (ext != NULL)
 	    {
@@ -7524,7 +7526,7 @@ aarch64_override_options (void)
     selected_tune = selected_cpu;
 
   aarch64_tune_flags = selected_tune->flags;
-  aarch64_tune = selected_tune->core;
+  aarch64_tune = selected_tune->sched_core;
   /* Make a copy of the tuning parameters attached to the core, which
      we may later overwrite.  */
   aarch64_tune_params = *(selected_tune->tune);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]