diff options
author | Richard Earnshaw <rearnsha@arm.com> | 2018-11-08 17:48:39 +0000 |
---|---|---|
committer | Richard Earnshaw <rearnsha@gcc.gnu.org> | 2018-11-08 17:48:39 +0000 |
commit | d4f680c672261642b47ecd72b6201825703bfa40 (patch) | |
tree | db810722833c964619c126774b9d89013d282049 /gcc/common | |
parent | 28567c40e2c7c88e424283e8a1a6ff8cb7ba440c (diff) | |
download | gcc-d4f680c672261642b47ecd72b6201825703bfa40.zip gcc-d4f680c672261642b47ecd72b6201825703bfa40.tar.gz gcc-d4f680c672261642b47ecd72b6201825703bfa40.tar.bz2 |
arm - Add support for aliases of CPU names
This patch adds support for defining an alias for a CPU name that can
then be used in conjunction with the -mcpu option in the same way that
the primary name can be used. Aliases do not lead to a short-cut of
the feature options; they are literally an alternative name for the
core CPU.
The new entry in arm-cpus.in allows a cpu definition to contain an
alias statement, for example
begin cpu strongarm
alias strongarm110 !strongarm1100 !strongarm1110
...
end cpu strongarm
each entry in the list represents another alias for the CPU. If the
alias name starts with an exclamation mark, then it will match as for
any other alias (sans the ! itself), but it will not be listed in any
of the CPU hinting options (the intent is to make the alias
essentially undocumented). In the above example, hints would be
provided for strongarm and strongarm110, but not for strongarm1100 or
strongarm1110.
The advantage of using aliases in this way is that it allows us to
reduce the number of duplicate table entries and identifier tags used
inside the compiler itself.
* config/arm/parsecpu.awk (/alias/): New parsing rule.
(/begin cpu/): Check that the cpu name hasn't been previously defined.
(gen_comm_data): Print out CPU alias tables.
(check_cpu): Match aliases when checking the CPU name.
* config/arm/arm-protos.h (cpu_alias): New structure.
(cpu_option): Add entry for aliases.
* config/arm/arm-cpus.in (strongarm): Add aliases for strongarm110
strongarm1100 and strongarm1110.
(strongarm110, strongarm1100, strongarm1110): Delete CPU entries.
(config/arm/arm-generic.md): Remove redundant references to
strongarm110, strongarm1100 and strongarm1110.
* common/config/arm/arm-common.c (arm_print_hint_for_cpu_option):
Scan aliases for additional hints.
(arm_parse_cpu_option_name): Also match a cpu name against the list
of aliases.
* config/arm/arm-tables.opt: Regenerated.
* config/arm/arm-tune.md: Regenerated.
From-SVN: r265931
Diffstat (limited to 'gcc/common')
-rw-r--r-- | gcc/common/config/arm/arm-common.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/gcc/common/config/arm/arm-common.c b/gcc/common/config/arm/arm-common.c index 76c357b..32cf36e 100644 --- a/gcc/common/config/arm/arm-common.c +++ b/gcc/common/config/arm/arm-common.c @@ -309,7 +309,16 @@ arm_print_hint_for_cpu_option (const char *target, { auto_vec<const char*> candidates; for (; list->common.name != NULL; list++) - candidates.safe_push (list->common.name); + { + candidates.safe_push (list->common.name); + if (list->aliases) + { + for (const cpu_alias *alias = list->aliases; alias->name != NULL; + alias++) + if (alias->visible) + candidates.safe_push (alias->name); + } + } #ifdef HAVE_LOCAL_CPU_DETECT /* Add also "native" as possible value. */ @@ -345,6 +354,16 @@ arm_parse_cpu_option_name (const cpu_option *list, const char *optname, if (strncmp (entry->common.name, target, len) == 0 && entry->common.name[len] == '\0') return entry; + + /* Match against any legal alias for this CPU candidate. */ + if (entry->aliases) + { + for (const cpu_alias *alias = entry->aliases; alias->name != NULL; + alias++) + if (strncmp (alias->name, target, len) == 0 + && alias->name[len] == '\0') + return entry; + } } if (complain) |