Commit a8e0b6c6 by Richard Earnshaw Committed by Richard Earnshaw

[arm] Use arm_active_target for architecture and tune

We now start to make more use of the new data structure.  This allows
us to eliminate two of the existing static variables,
arm_selected_arch and arm_selected tune.

	* arm.c (arm_selected_tune): Delete static variable.
	(arm_selected_arch): Likewise.
	(arm_configure_build_target): Declare local versions of arm_selected
	target and arm_selected_arch.  Initialize more fields in target
	data structure.
	(arm_option_override): Use arm_active_target instead of
	arm_selected_tune and arm_selected_arch.
	(asm_file_start): Use arm_active_target.

From-SVN: r243699
parent 8341f8c4
2016-12-15 Richard Earnshaw <rearnsha@arm.com> 2016-12-15 Richard Earnshaw <rearnsha@arm.com>
* arm.c (arm_selected_tune): Delete static variable.
(arm_selected_arch): Likewise.
(arm_configure_build_target): Declare local versions of arm_selected
target and arm_selected_arch. Initialize more fields in target
data structure.
(arm_option_override): Use arm_active_target instead of
arm_selected_tune and arm_selected_arch.
(asm_file_start): Use arm_active_target.
2016-12-15 Richard Earnshaw <rearnsha@arm.com>
* arm-protos.h (arm_build_target): New structure. * arm-protos.h (arm_build_target): New structure.
(arm_active_target): Declare it. (arm_active_target): Declare it.
* arm.c (arm_active_target): New variable. * arm.c (arm_active_target): New variable.
...@@ -2319,9 +2319,7 @@ static const struct processors all_architectures[] = ...@@ -2319,9 +2319,7 @@ static const struct processors all_architectures[] =
/* These are populated as commandline arguments are processed, or NULL /* These are populated as commandline arguments are processed, or NULL
if not specified. */ if not specified. */
static const struct processors *arm_selected_arch;
static const struct processors *arm_selected_cpu; static const struct processors *arm_selected_cpu;
static const struct processors *arm_selected_tune;
/* The name of the preprocessor macro to define for this architecture. PROFILE /* The name of the preprocessor macro to define for this architecture. PROFILE
is replaced by the architecture name (eg. 8A) in arm_option_override () and is replaced by the architecture name (eg. 8A) in arm_option_override () and
...@@ -3068,9 +3066,10 @@ arm_configure_build_target (struct arm_build_target *target, ...@@ -3068,9 +3066,10 @@ arm_configure_build_target (struct arm_build_target *target,
struct gcc_options *opts_set, struct gcc_options *opts_set,
bool warn_compatible) bool warn_compatible)
{ {
arm_selected_arch = NULL; const struct processors *arm_selected_tune = NULL;
const struct processors *arm_selected_arch = NULL;
arm_selected_cpu = NULL; arm_selected_cpu = NULL;
arm_selected_tune = NULL;
bitmap_clear (target->isa); bitmap_clear (target->isa);
target->core_name = NULL; target->core_name = NULL;
...@@ -3119,17 +3118,24 @@ arm_configure_build_target (struct arm_build_target *target, ...@@ -3119,17 +3118,24 @@ arm_configure_build_target (struct arm_build_target *target,
Prefer the CPU setting. */ Prefer the CPU setting. */
arm_selected_arch = NULL; arm_selected_arch = NULL;
} }
target->core_name = arm_selected_cpu->name;
} }
else else
{ {
/* Pick a CPU based on the architecture. */ /* Pick a CPU based on the architecture. */
arm_selected_cpu = arm_selected_arch; arm_selected_cpu = arm_selected_arch;
target->arch_name = arm_selected_arch->name; target->arch_name = arm_selected_arch->name;
/* Note: target->core_name is left unset in this path. */
} }
} }
else if (arm_selected_cpu)
{
target->core_name = arm_selected_cpu->name;
arm_initialize_isa (target->isa, arm_selected_cpu->isa_bits);
}
/* If the user did not specify a processor, choose one for them. */ /* If the user did not specify a processor, choose one for them. */
if (!arm_selected_cpu) else
{ {
const struct processors * sel; const struct processors * sel;
auto_sbitmap sought_isa (isa_num_bits); auto_sbitmap sought_isa (isa_num_bits);
...@@ -3229,16 +3235,27 @@ arm_configure_build_target (struct arm_build_target *target, ...@@ -3229,16 +3235,27 @@ arm_configure_build_target (struct arm_build_target *target,
} }
arm_selected_cpu = sel; arm_selected_cpu = sel;
} }
/* Now we know the CPU, we can finally initialize the target
structure. */
target->core_name = arm_selected_cpu->name;
arm_initialize_isa (target->isa, arm_selected_cpu->isa_bits);
} }
gcc_assert (arm_selected_cpu); gcc_assert (arm_selected_cpu);
/* The selected cpu may be an architecture, so lookup tuning by core ID. */ /* The selected cpu may be an architecture, so lookup tuning by core ID. */
if (!arm_selected_tune) if (!arm_selected_tune)
arm_selected_tune = &all_cores[arm_selected_cpu->core]; arm_selected_tune = &all_cores[arm_selected_cpu->core];
/* Finish initializing the target structure. */
target->arch_pp_name = arm_selected_cpu->arch; target->arch_pp_name = arm_selected_cpu->arch;
target->base_arch = arm_selected_cpu->base_arch;
target->arch_core = arm_selected_cpu->core;
target->tune_flags = arm_selected_tune->tune_flags; target->tune_flags = arm_selected_tune->tune_flags;
target->tune = arm_selected_tune->tune; target->tune = arm_selected_tune->tune;
target->tune_core = arm_selected_tune->core;
} }
/* Fix up any incompatible options that the user has specified. */ /* Fix up any incompatible options that the user has specified. */
...@@ -3263,9 +3280,9 @@ arm_option_override (void) ...@@ -3263,9 +3280,9 @@ arm_option_override (void)
insn_flags = arm_selected_cpu->flags; insn_flags = arm_selected_cpu->flags;
arm_base_arch = arm_selected_cpu->base_arch; arm_base_arch = arm_selected_cpu->base_arch;
arm_tune = arm_selected_tune->core; arm_tune = arm_active_target.tune_core;
tune_flags = arm_selected_tune->tune_flags; tune_flags = arm_active_target.tune_flags;
current_tune = arm_selected_tune->tune; current_tune = arm_active_target.tune;
/* TBD: Dwarf info for apcs frame is not handled yet. */ /* TBD: Dwarf info for apcs frame is not handled yet. */
if (TARGET_APCS_FRAME) if (TARGET_APCS_FRAME)
...@@ -25957,10 +25974,16 @@ arm_file_start (void) ...@@ -25957,10 +25974,16 @@ arm_file_start (void)
if (TARGET_BPABI) if (TARGET_BPABI)
{ {
if (arm_selected_arch) /* We don't have a specified CPU. Use the architecture to
generate the tags.
Note: it might be better to do this unconditionally, then the
assembler would not need to know about all new CPU names as
they are added. */
if (!arm_active_target.core_name)
{ {
/* armv7ve doesn't support any extensions. */ /* armv7ve doesn't support any extensions. */
if (strcmp (arm_selected_arch->name, "armv7ve") == 0) if (strcmp (arm_active_target.arch_name, "armv7ve") == 0)
{ {
/* Keep backward compatability for assemblers /* Keep backward compatability for assemblers
which don't support armv7ve. */ which don't support armv7ve. */
...@@ -25972,20 +25995,21 @@ arm_file_start (void) ...@@ -25972,20 +25995,21 @@ arm_file_start (void)
} }
else else
{ {
const char* pos = strchr (arm_selected_arch->name, '+'); const char* pos = strchr (arm_active_target.arch_name, '+');
if (pos) if (pos)
{ {
char buf[32]; char buf[32];
gcc_assert (strlen (arm_selected_arch->name) gcc_assert (strlen (arm_active_target.arch_name)
<= sizeof (buf) / sizeof (*pos)); <= sizeof (buf) / sizeof (*pos));
strncpy (buf, arm_selected_arch->name, strncpy (buf, arm_active_target.arch_name,
(pos - arm_selected_arch->name) * sizeof (*pos)); (pos - arm_active_target.arch_name) * sizeof (*pos));
buf[pos - arm_selected_arch->name] = '\0'; buf[pos - arm_active_target.arch_name] = '\0';
asm_fprintf (asm_out_file, "\t.arch %s\n", buf); asm_fprintf (asm_out_file, "\t.arch %s\n", buf);
asm_fprintf (asm_out_file, "\t.arch_extension %s\n", pos + 1); asm_fprintf (asm_out_file, "\t.arch_extension %s\n", pos + 1);
} }
else else
asm_fprintf (asm_out_file, "\t.arch %s\n", arm_selected_arch->name); asm_fprintf (asm_out_file, "\t.arch %s\n",
arm_active_target.arch_name);
} }
} }
else if (strncmp (arm_selected_cpu->name, "generic", 7) == 0) else if (strncmp (arm_selected_cpu->name, "generic", 7) == 0)
......
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