Commit 050809ed by Richard Earnshaw Committed by Richard Earnshaw

[arm] Split CPU, architecture and tuning data tables.


The driver really needs to handle some canonicalization of the new
-mcpu and -march options in order to make multilib selection
tractable.  This will require moving much of the logic to parse the
new options into the common code file.  However, the tuning data
definitely does not want to be there as it is very specific to the
compiler passes.  To facilitate this we need to split up the generated
configuration data into architectural and tuning related tables.

This patch starts that process, but does not yet move any code out of
the compiler backend.  Since I'm reworking all that code I took the
opportunity to also separate out the CPU data tables from the
architecture data tables.  Although they are related, there is a lot
of redundancy in the CPU options that is best handled by simply
indirecting to the architecture entry.

	* config/arm/arm-protos.h (arm_build_target): Remove arch_core.
	(cpu_arch_extension): New structure.
	(cpu_arch_option, arch_option, cpu_option): New structures.
	* config/arm/parsecpu.awk (gen_headers): Build an enumeration of
	architecture types.
	(gen_data): Generate new format data tables.
	* config/arm/arm.c (cpu_tune): New structure.
	(cpu_option, processors): Delete.
	(arm_print_hint_for_core_or_arch): Delete.  Replace with ...
	(arm_print_hint_for_cpu_option): ... this and ...
	(arm_print_hint_for_arch_option): ... this.
	(arm_parse_arch_cpu_name): Delete.  Replace with ...
	(arm_parse_cpu_option_name): ... this and ...
	(arm_parse_arch_option_name): ... this.
	(arm_unrecognized_feature): Change type of target parameter to
	cpu_arch_option.
	(arm_parse_arch_cpu_features): Delete.  Replace with ...
	(arm_parse_option_features): ... this.
	(arm_configure_build_target): Rework to use new configuration data
	tables.
	(arm_print_tune_info): Rework for new configuration data tables.
	* config/arm/arm-cpu-data.h: Regenerated.
	* config/arm/arm-cpu.h: Regenerated.

From-SVN: r249286
parent 9ef88abe
2017-06-16 Richard Earnshaw <rearnsha@arm.com>
* config/arm/arm-protos.h (arm_build_target): Remove arch_core.
(cpu_arch_extension): New structure.
(cpu_arch_option, arch_option, cpu_option): New structures.
* config/arm/parsecpu.awk (gen_headers): Build an enumeration of
architecture types.
(gen_data): Generate new format data tables.
* config/arm/arm.c (cpu_tune): New structure.
(cpu_option, processors): Delete.
(arm_print_hint_for_core_or_arch): Delete. Replace with ...
(arm_print_hint_for_cpu_option): ... this and ...
(arm_print_hint_for_arch_option): ... this.
(arm_parse_arch_cpu_name): Delete. Replace with ...
(arm_parse_cpu_option_name): ... this and ...
(arm_parse_arch_option_name): ... this.
(arm_unrecognized_feature): Change type of target parameter to
cpu_arch_option.
(arm_parse_arch_cpu_features): Delete. Replace with ...
(arm_parse_option_features): ... this.
(arm_configure_build_target): Rework to use new configuration data
tables.
(arm_print_tune_info): Rework for new configuration data tables.
* config/arm/arm-cpu-data.h: Regenerated.
* config/arm/arm-cpu.h: Regenerated.
2017-06-16 Richard Earnshaw <rearnsha@arm.com>
* Makefile.in (OBJS): Move sbitmap.o from here ...
(OBJS-libcommon): ... to here.
......
......@@ -133,6 +133,44 @@ enum processor_type
TARGET_CPU_arm_none
};
enum arch_type
{
TARGET_ARCH_armv2,
TARGET_ARCH_armv2a,
TARGET_ARCH_armv3,
TARGET_ARCH_armv3m,
TARGET_ARCH_armv4,
TARGET_ARCH_armv4t,
TARGET_ARCH_armv5,
TARGET_ARCH_armv5t,
TARGET_ARCH_armv5e,
TARGET_ARCH_armv5te,
TARGET_ARCH_armv5tej,
TARGET_ARCH_armv6,
TARGET_ARCH_armv6j,
TARGET_ARCH_armv6k,
TARGET_ARCH_armv6z,
TARGET_ARCH_armv6kz,
TARGET_ARCH_armv6zk,
TARGET_ARCH_armv6t2,
TARGET_ARCH_armv6_m,
TARGET_ARCH_armv6s_m,
TARGET_ARCH_armv7,
TARGET_ARCH_armv7_a,
TARGET_ARCH_armv7ve,
TARGET_ARCH_armv7_r,
TARGET_ARCH_armv7_m,
TARGET_ARCH_armv7e_m,
TARGET_ARCH_armv8_a,
TARGET_ARCH_armv8_1_a,
TARGET_ARCH_armv8_2_a,
TARGET_ARCH_armv8_m_base,
TARGET_ARCH_armv8_m_main,
TARGET_ARCH_iwmmxt,
TARGET_ARCH_iwmmxt2,
TARGET_ARCH_arm_none
};
enum fpu_type
{
TARGET_FPU_vfp,
......
......@@ -462,8 +462,6 @@ struct arm_build_target
const char *arch_name;
/* Preprocessor substring (never NULL). */
const char *arch_pp_name;
/* CPU identifier for the core we're compiling for (architecturally). */
enum processor_type arch_core;
/* The base architecture value. */
enum base_architecture base_arch;
/* Bitmap encapsulating the isa_bits for the target environment. */
......@@ -478,5 +476,41 @@ struct arm_build_target
extern struct arm_build_target arm_active_target;
struct cpu_arch_extension
{
const char *const name;
bool remove;
const enum isa_feature isa_bits[isa_num_bits];
};
struct cpu_arch_option
{
/* Name for this option. */
const char *name;
/* List of feature extensions permitted. */
const struct cpu_arch_extension *extensions;
/* Standard feature bits. */
enum isa_feature isa_bits[isa_num_bits];
};
struct arch_option
{
/* Common option fields. */
cpu_arch_option common;
/* Short string for this architecture. */
const char *arch;
/* Base architecture, from which this specific architecture is derived. */
enum base_architecture base_arch;
/* Default tune target (in the absence of any more specific data). */
enum processor_type tune_id;
};
struct cpu_option
{
/* Common option fields. */
cpu_arch_option common;
/* Architecture upon which this CPU is based. */
enum arch_type arch;
};
#endif /* ! GCC_ARM_PROTOS_H */
......@@ -102,6 +102,17 @@ function gen_headers () {
print " TARGET_CPU_arm_none"
print "};\n"
print "enum arch_type"
print "{"
narchs = split (arch_list, archs)
for (n = 1; n <= narchs; n++) {
print " TARGET_ARCH_"arch_cnames[archs[n]]","
}
print " TARGET_ARCH_arm_none"
print "};\n"
print "enum fpu_type"
print "{"
......@@ -121,7 +132,7 @@ function gen_data () {
for (n = 1; n <= ncpus; n++) {
if (cpus[n] in cpu_opts) {
print "static const struct cpu_option cpu_opttab_" \
print "static const cpu_arch_extension cpu_opttab_" \
cpu_cnames[cpus[n]] "[] = {"
nopts = split (cpu_opts[cpus[n]], opts)
for (opt = 1; opt <= nopts; opt++) {
......@@ -136,30 +147,23 @@ function gen_data () {
}
}
print "static const struct processors all_cores[] ="
print "static const cpu_option all_cores[] ="
print "{"
for (n = 1; n <= ncpus; n++) {
print " {"
print " {"
# common.name
print " \"" cpus[n] "\","
if (cpus[n] in cpu_tune_for) {
if (! (cpu_tune_for[cpus[n]] in cpu_cnames)) {
fatal("unknown \"tune for\" target " cpu_tune_for[cpus[n]] \
" for CPU " cpus[n])
}
print " TARGET_CPU_" cpu_cnames[cpu_tune_for[cpus[n]]] ","
} else {
print " TARGET_CPU_" cpu_cnames[cpus[n]] ","
}
if (cpus[n] in cpu_tune_flags) {
print " (" cpu_tune_flags[cpus[n]] "),"
} else print " 0,"
# common.extensions
if (cpus[n] in cpu_opts) {
print " cpu_opttab_" cpu_cnames[cpus[n]] ","
} else print " NULL,"
# common.isa_bits
nfeats = split (cpu_arch[cpus[n]], feats, "+")
if (! (feats[1] in arch_isa)) {
fatal("unknown arch " feats[1] " for cpu " cpus[n])
}
print " \"" arch_base[feats[1]] "\", BASE_ARCH_" \
arch_base[feats[1]] ","
print " {"
print " " arch_isa[feats[1]] ","
for (m = 2; m <= nfeats; m++) {
......@@ -174,23 +178,47 @@ function gen_data () {
if (cpus[n] in cpu_fpu) print " " fpu_isa[cpu_fpu[cpus[n]]] ","
if (cpus[n] in cpu_isa) print " " cpu_isa[cpus[n]] ","
print " isa_nobit"
print " }"
print " },"
if (cpus[n] in cpu_opts) {
print " cpu_opttab_" cpu_cnames[cpus[n]] ","
} else print " NULL,"
print " &arm_" cpu_cost[cpus[n]] "_tune"
# arch
print " TARGET_ARCH_" arch_cnames[feats[1]]
print " },"
}
print " {NULL, TARGET_CPU_arm_none, 0, NULL, BASE_ARCH_0," \
" {isa_nobit}, NULL, NULL}"
print "};\n"
print " {{NULL, NULL, {isa_nobit}}, TARGET_ARCH_arm_none}"
print "};"
print "static const cpu_tune all_tunes[] ="
print "{"
for (n = 1; n <= ncpus; n++) {
print " { /* " cpus[n] ". */"
# scheduler
if (cpus[n] in cpu_tune_for) {
if (! (cpu_tune_for[cpus[n]] in cpu_cnames)) {
fatal("unknown \"tune for\" target " cpu_tune_for[cpus[n]] \
" for CPU " cpus[n])
}
print " TARGET_CPU_" cpu_cnames[cpu_tune_for[cpus[n]]] ","
} else {
print " TARGET_CPU_" cpu_cnames[cpus[n]] ","
}
# tune_flags
if (cpus[n] in cpu_tune_flags) {
print " (" cpu_tune_flags[cpus[n]] "),"
} else print " 0,"
# tune
print " &arm_" cpu_cost[cpus[n]] "_tune"
print " },"
}
print " {TARGET_CPU_arm_none, 0, NULL}"
print "};"
narchs = split (arch_list, archs)
for (n = 1; n <= narchs; n++) {
if (archs[n] in arch_opts) {
print "static const struct cpu_option arch_opttab_" \
print "static const struct cpu_arch_extension arch_opttab_" \
arch_cnames[archs[n]] "[] = {"
nopts = split (arch_opts[archs[n]], opts)
for (opt = 1; opt <= nopts; opt++) {
......@@ -205,7 +233,7 @@ function gen_data () {
}
}
print "static const struct processors all_architectures[] ="
print "static const struct arch_option all_architectures[] ="
print "{"
for (n = 1; n <= narchs; n++) {
......@@ -214,26 +242,27 @@ function gen_data () {
fatal("unknown \"tune for\" target " arch_tune_for[archs[n]] \
" for architecture " archs[n])
}
print " \"" archs[n] \
"\", TARGET_CPU_" cpu_cnames[arch_tune_for[archs[n]]] ","
if (archs[n] in arch_tune_flags) {
print " (" arch_tune_flags[archs[n]] "),"
} else print " 0,"
print " \"" arch_base[archs[n]] "\", BASE_ARCH_" \
arch_base[archs[n]] ","
# common.name
print " \"" archs[n] "\","
# common.extensions
if (archs[n] in arch_opts) {
print " arch_opttab_" arch_cnames[archs[n]] ","
} else print " NULL,"
# common.isa_bits
print " {"
print " " arch_isa[archs[n]] ","
print " isa_nobit"
print " },"
if (archs[n] in arch_opts) {
print " arch_opttab_" arch_cnames[archs[n]] ","
} else print " NULL,"
print " NULL"
# arch, base_arch
print " \"" arch_base[archs[n]] "\", BASE_ARCH_" \
arch_base[archs[n]] ","
# tune_id
print " TARGET_CPU_" cpu_cnames[arch_tune_for[archs[n]]] ","
print " },"
}
print " {NULL, TARGET_CPU_arm_none, 0, NULL, BASE_ARCH_0," \
" {isa_nobit}, NULL, NULL}"
print " {{NULL, NULL, {isa_nobit}},"
print " NULL, BASE_ARCH_0, TARGET_CPU_arm_none}"
print "};\n"
print "const struct arm_fpu_desc all_fpus[] ="
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment