arm - Add support for aliases of CPU names

Programming / Compilers / GCC - rearnsha [138bc75d-0d04-0410-961f-82ee72b054a4] - 8 November 2018 17:48 EST

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.

7e866380f86 arm - Add support for aliases of CPU names
gcc/ChangeLog | 20 ++++++++++++
gcc/common/config/arm/arm-common.c | 21 ++++++++++++-
gcc/config/arm/arm-cpus.in | 23 +++-----------
gcc/config/arm/arm-generic.md | 6 ++--
gcc/config/arm/arm-protos.h | 15 +++++++++
gcc/config/arm/arm-tables.opt | 9 ------
gcc/config/arm/arm-tune.md | 1 -
gcc/config/arm/parsecpu.awk | 63 +++++++++++++++++++++++++++++++++++---
8 files changed, 120 insertions(+), 38 deletions(-)

Upstream: gcc.gnu.org


  • Share