gas/arc: Don't rely on bfd list of cpu type for cpu selection
authorAndrew Burgess <andrew.burgess@embecosm.com>
Fri, 8 Jul 2016 17:01:00 +0000 (18:01 +0100)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Thu, 27 Oct 2016 11:28:20 +0000 (12:28 +0100)
commitbb65a718b601ecfebd1ebe5be71728d5c359c31f
treecbc4d9fb2c4e3c69d0353dabf9eb5f2966aa6ab2
parent2e492780e8c4736b456448369ccdf4460f6e2675
gas/arc: Don't rely on bfd list of cpu type for cpu selection

In the ARC assembler, when a cpu type is specified using the .cpu
directive, we rely on the bfd list of arc machine types in order to
validate the cpu name passed in.

This validation is only used in order to check that the cpu type passed
to the .cpu directive matches any machine type selected earlier on the
command line.  Once that initial check has passed a full check is
performed using the assemblers internal list of know cpu types.

The problem is that the assembler knows about more cpu types than bfd,
some cpu types known by the assembler are actually aliases for a base
cpu type plus a specific set of assembler extensions.  One such example
is NPS400, though more could be added later.

This commit removes the need for the assembler to use the bfd list of
machine types for validation.  Instead the error checking, to ensure
that any value passed to a '.cpu' directive matches any earlier command
line selection, is moved into the function arc_select_cpu.

I have taken the opportunity to bundle the 4 separate static globals
that describe the currently selected machine type into a single
structure (called selected_cpu).

gas/ChangeLog:

* config/tc-arc.c (arc_target): Delete.
(arc_target_name): Delete.
(arc_features): Delete.
(arc_mach_type): Delete.
(mach_type_specified_p): Delete.
(enum mach_selection_type): New enum.
(mach_selection_mode): New static global.
(selected_cpu): New static global.
(arc_eflag): Rename to ...
(arc_initial_eflag): ...this, and make const.
(arc_select_cpu): Update comment, new parameter, check how
previous machine type selection was made, and record this
selection.  Use selected_cpu instead of old globals.
(arc_option): Remove use of arc_get_mach, instead use
arc_select_cpu to validate machine type selection.  Use
selected_cpu over old globals.
(allocate_tok): Use selected_cpu over old globals.
(find_opcode_match): Likewise.
(assemble_tokens): Likewise.
(arc_cons_fix_new): Likewise.
(arc_extinsn): Likewise.
(arc_extcorereg): Likewise.
(md_begin): Update default machine type selection, use
selected_cpu over old globals.
(md_parse_option): Update machine type selection option handling,
use selected_cpu over old globals.
* testsuite/gas/arc/nps400-0.s: Add .cpu directive.

bfd/ChangeLog:

* cpu-arc.c (arc_get_mach): Delete.
bfd/ChangeLog
bfd/cpu-arc.c
gas/ChangeLog
gas/config/tc-arc.c
gas/testsuite/gas/arc/nps400-0.s
This page took 0.026714 seconds and 4 git commands to generate.