[02/11] aarch64: Replace duplicate cpu enums
Commit Message
Replace `enum aarch64_processor` and `enum target_cpus` with
`enum aarch64_cpu`, and prefix the entries with `AARCH64_CPU_`.
Also rename aarch64_none to aarch64_no_cpu.
gcc/ChangeLog:
* config/aarch64/aarch64-opts.h
(enum aarch64_processor): Rename to...
(enum aarch64_cpu): ...this, and rename the entries.
* config/aarch64/aarch64.cc
(aarch64_type): Rename type and initial value.
(struct processor): Rename member types.
(all_architectures): Rename enum members.
(all_cores): Ditto.
(aarch64_get_tune_cpu): Rename type and enum member.
* config/aarch64/aarch64.h (enum target_cpus): Remove.
(TARGET_CPU_DEFAULT): Rename default value.
(aarch64_tune): Rename type.
* config/aarch64/aarch64.opt:
(selected_tune): Rename type and default value.
Comments
Andrew Carlotti <andrew.carlotti@arm.com> writes:
> Replace `enum aarch64_processor` and `enum target_cpus` with
> `enum aarch64_cpu`, and prefix the entries with `AARCH64_CPU_`.
> Also rename aarch64_none to aarch64_no_cpu.
>
> gcc/ChangeLog:
>
> * config/aarch64/aarch64-opts.h
> (enum aarch64_processor): Rename to...
> (enum aarch64_cpu): ...this, and rename the entries.
> * config/aarch64/aarch64.cc
> (aarch64_type): Rename type and initial value.
> (struct processor): Rename member types.
> (all_architectures): Rename enum members.
> (all_cores): Ditto.
> (aarch64_get_tune_cpu): Rename type and enum member.
> * config/aarch64/aarch64.h (enum target_cpus): Remove.
> (TARGET_CPU_DEFAULT): Rename default value.
> (aarch64_tune): Rename type.
> * config/aarch64/aarch64.opt:
> (selected_tune): Rename type and default value.
>
>
> diff --git a/gcc/config/aarch64/aarch64-opts.h b/gcc/config/aarch64/aarch64-opts.h
> index 3f0b1e9414c32ce5cb0ae808b2bb38bee86b40d5..a6ca5cf016b05982572297a434b53a9f8fc1443b 100644
> --- a/gcc/config/aarch64/aarch64-opts.h
> +++ b/gcc/config/aarch64/aarch64-opts.h
> @@ -38,13 +38,13 @@ typedef bbitmap<2> aarch64_feature_flags;
> #endif
>
> /* The various cores that implement AArch64. */
> -enum aarch64_processor
> +enum aarch64_cpu
> {
> #define AARCH64_CORE(NAME, INTERNAL_IDENT, SCHED, ARCH, FLAGS, COSTS, IMP, PART, VARIANT) \
> - INTERNAL_IDENT,
> + AARCH64_CPU_##INTERNAL_IDENT,
> #include "aarch64-cores.def"
> /* Used to mark the end of the processor table. */
> - aarch64_none
> + aarch64_no_cpu
> };
I was going to suggest an enum class, to avoid token pasting, but I suppose
that would be inconsitent with AARCH64_AARCH_*. So the patch is ok as-is,
thanks.
Richard
>
> enum aarch64_arch
> diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
> index 1ab49e229b080d29187690abdb0c0767c12a157a..cee1c7f04cefc4789ca4b9f4e5b946ea642c5e47 100644
> --- a/gcc/config/aarch64/aarch64.h
> +++ b/gcc/config/aarch64/aarch64.h
> @@ -924,16 +924,9 @@ enum reg_class
> /* CPU/ARCH option handling. */
> #include "config/aarch64/aarch64-opts.h"
>
> -enum target_cpus
> -{
> -#define AARCH64_CORE(NAME, INTERNAL_IDENT, SCHED, ARCH, FLAGS, COSTS, IMP, PART, VARIANT) \
> - TARGET_CPU_##INTERNAL_IDENT,
> -#include "aarch64-cores.def"
> -};
> -
> /* If there is no CPU defined at configure, use generic as default. */
> #ifndef TARGET_CPU_DEFAULT
> -# define TARGET_CPU_DEFAULT TARGET_CPU_generic_armv8_a
> +# define TARGET_CPU_DEFAULT AARCH64_CPU_generic_armv8_a
> #endif
>
> /* If inserting NOP before a mult-accumulate insn remember to adjust the
> @@ -949,7 +942,7 @@ enum target_cpus
> aarch64_final_prescan_insn (INSN); \
>
> /* The processor for which instructions should be scheduled. */
> -extern enum aarch64_processor aarch64_tune;
> +extern enum aarch64_cpu aarch64_tune;
>
> /* RTL generation support. */
> #define INIT_EXPANDERS aarch64_init_expanders ()
> diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
> index 330a04c147a97bcd99d6819290d7f82ff5066a44..d8a2916d8230cc25122f21818b88fd347e72693a 100644
> --- a/gcc/config/aarch64/aarch64.cc
> +++ b/gcc/config/aarch64/aarch64.cc
> @@ -357,7 +357,7 @@ static bool aarch64_print_address_internal (FILE*, machine_mode, rtx,
> aarch64_addr_query_type);
>
> /* The processor for which instructions should be scheduled. */
> -enum aarch64_processor aarch64_tune = cortexa53;
> +enum aarch64_cpu aarch64_tune = AARCH64_CPU_cortexa53;
>
> /* Global flag for PC relative loads. */
> bool aarch64_pcrelative_literal_loads;
> @@ -451,8 +451,8 @@ aarch64_tuning_override_functions[] =
> struct processor
> {
> const char *name;
> - aarch64_processor ident;
> - aarch64_processor sched_core;
> + aarch64_cpu ident;
> + aarch64_cpu sched_core;
> aarch64_arch arch;
> aarch64_feature_flags flags;
> const tune_params *tune;
> @@ -462,20 +462,20 @@ struct processor
> static CONSTEXPR const processor all_architectures[] =
> {
> #define AARCH64_ARCH(NAME, CORE, ARCH_IDENT, D, E) \
> - {NAME, CORE, CORE, AARCH64_ARCH_##ARCH_IDENT, \
> + {NAME, AARCH64_CPU_##CORE, AARCH64_CPU_##CORE, AARCH64_ARCH_##ARCH_IDENT, \
> feature_deps::ARCH_IDENT ().enable, NULL},
> #include "aarch64-arches.def"
> - {NULL, aarch64_none, aarch64_none, aarch64_no_arch, 0, NULL}
> + {NULL, aarch64_no_cpu, aarch64_no_cpu, aarch64_no_arch, 0, NULL}
> };
>
> /* Processor cores implementing AArch64. */
> static const struct processor all_cores[] =
> {
> #define AARCH64_CORE(NAME, IDENT, SCHED, ARCH, E, COSTS, G, H, I) \
> - {NAME, IDENT, SCHED, AARCH64_ARCH_##ARCH, \
> + {NAME, AARCH64_CPU_##IDENT, AARCH64_CPU_##SCHED, AARCH64_ARCH_##ARCH, \
> feature_deps::cpu_##IDENT, &COSTS##_tunings},
> #include "aarch64-cores.def"
> - {NULL, aarch64_none, aarch64_none, aarch64_no_arch, 0, NULL}
> + {NULL, aarch64_no_cpu, aarch64_no_cpu, aarch64_no_arch, 0, NULL}
> };
> /* Internal representation of system registers. */
> typedef struct {
> @@ -18559,9 +18559,9 @@ initialize_aarch64_tls_size (struct gcc_options *opts)
> /* Return the CPU corresponding to the enum CPU. */
>
> static const struct processor *
> -aarch64_get_tune_cpu (enum aarch64_processor cpu)
> +aarch64_get_tune_cpu (enum aarch64_cpu cpu)
> {
> - gcc_assert (cpu != aarch64_none);
> + gcc_assert (cpu != aarch64_no_cpu);
>
> return &all_cores[cpu];
> }
> diff --git a/gcc/config/aarch64/aarch64.opt b/gcc/config/aarch64/aarch64.opt
> index da9e0c18d47781dee1b954735cbc28da1e7f1846..db462035bd26013a784a8403e871298247e0b5bf 100644
> --- a/gcc/config/aarch64/aarch64.opt
> +++ b/gcc/config/aarch64/aarch64.opt
> @@ -25,7 +25,7 @@ HeaderInclude
> config/arm/aarch-common.h
>
> TargetVariable
> -enum aarch64_processor selected_tune = aarch64_none
> +enum aarch64_cpu selected_tune = aarch64_no_cpu
>
> TargetVariable
> enum aarch64_arch selected_arch = aarch64_no_arch
@@ -38,13 +38,13 @@ typedef bbitmap<2> aarch64_feature_flags;
#endif
/* The various cores that implement AArch64. */
-enum aarch64_processor
+enum aarch64_cpu
{
#define AARCH64_CORE(NAME, INTERNAL_IDENT, SCHED, ARCH, FLAGS, COSTS, IMP, PART, VARIANT) \
- INTERNAL_IDENT,
+ AARCH64_CPU_##INTERNAL_IDENT,
#include "aarch64-cores.def"
/* Used to mark the end of the processor table. */
- aarch64_none
+ aarch64_no_cpu
};
enum aarch64_arch
@@ -924,16 +924,9 @@ enum reg_class
/* CPU/ARCH option handling. */
#include "config/aarch64/aarch64-opts.h"
-enum target_cpus
-{
-#define AARCH64_CORE(NAME, INTERNAL_IDENT, SCHED, ARCH, FLAGS, COSTS, IMP, PART, VARIANT) \
- TARGET_CPU_##INTERNAL_IDENT,
-#include "aarch64-cores.def"
-};
-
/* If there is no CPU defined at configure, use generic as default. */
#ifndef TARGET_CPU_DEFAULT
-# define TARGET_CPU_DEFAULT TARGET_CPU_generic_armv8_a
+# define TARGET_CPU_DEFAULT AARCH64_CPU_generic_armv8_a
#endif
/* If inserting NOP before a mult-accumulate insn remember to adjust the
@@ -949,7 +942,7 @@ enum target_cpus
aarch64_final_prescan_insn (INSN); \
/* The processor for which instructions should be scheduled. */
-extern enum aarch64_processor aarch64_tune;
+extern enum aarch64_cpu aarch64_tune;
/* RTL generation support. */
#define INIT_EXPANDERS aarch64_init_expanders ()
@@ -357,7 +357,7 @@ static bool aarch64_print_address_internal (FILE*, machine_mode, rtx,
aarch64_addr_query_type);
/* The processor for which instructions should be scheduled. */
-enum aarch64_processor aarch64_tune = cortexa53;
+enum aarch64_cpu aarch64_tune = AARCH64_CPU_cortexa53;
/* Global flag for PC relative loads. */
bool aarch64_pcrelative_literal_loads;
@@ -451,8 +451,8 @@ aarch64_tuning_override_functions[] =
struct processor
{
const char *name;
- aarch64_processor ident;
- aarch64_processor sched_core;
+ aarch64_cpu ident;
+ aarch64_cpu sched_core;
aarch64_arch arch;
aarch64_feature_flags flags;
const tune_params *tune;
@@ -462,20 +462,20 @@ struct processor
static CONSTEXPR const processor all_architectures[] =
{
#define AARCH64_ARCH(NAME, CORE, ARCH_IDENT, D, E) \
- {NAME, CORE, CORE, AARCH64_ARCH_##ARCH_IDENT, \
+ {NAME, AARCH64_CPU_##CORE, AARCH64_CPU_##CORE, AARCH64_ARCH_##ARCH_IDENT, \
feature_deps::ARCH_IDENT ().enable, NULL},
#include "aarch64-arches.def"
- {NULL, aarch64_none, aarch64_none, aarch64_no_arch, 0, NULL}
+ {NULL, aarch64_no_cpu, aarch64_no_cpu, aarch64_no_arch, 0, NULL}
};
/* Processor cores implementing AArch64. */
static const struct processor all_cores[] =
{
#define AARCH64_CORE(NAME, IDENT, SCHED, ARCH, E, COSTS, G, H, I) \
- {NAME, IDENT, SCHED, AARCH64_ARCH_##ARCH, \
+ {NAME, AARCH64_CPU_##IDENT, AARCH64_CPU_##SCHED, AARCH64_ARCH_##ARCH, \
feature_deps::cpu_##IDENT, &COSTS##_tunings},
#include "aarch64-cores.def"
- {NULL, aarch64_none, aarch64_none, aarch64_no_arch, 0, NULL}
+ {NULL, aarch64_no_cpu, aarch64_no_cpu, aarch64_no_arch, 0, NULL}
};
/* Internal representation of system registers. */
typedef struct {
@@ -18559,9 +18559,9 @@ initialize_aarch64_tls_size (struct gcc_options *opts)
/* Return the CPU corresponding to the enum CPU. */
static const struct processor *
-aarch64_get_tune_cpu (enum aarch64_processor cpu)
+aarch64_get_tune_cpu (enum aarch64_cpu cpu)
{
- gcc_assert (cpu != aarch64_none);
+ gcc_assert (cpu != aarch64_no_cpu);
return &all_cores[cpu];
}
@@ -25,7 +25,7 @@ HeaderInclude
config/arm/aarch-common.h
TargetVariable
-enum aarch64_processor selected_tune = aarch64_none
+enum aarch64_cpu selected_tune = aarch64_no_cpu
TargetVariable
enum aarch64_arch selected_arch = aarch64_no_arch