]> git.ipfire.org Git - thirdparty/gcc.git/commit
MSP430: Use enums to handle -mcpu= values
authorJozef Lawrynowicz <jozef.l@mittosystems.com>
Tue, 8 Sep 2020 09:10:17 +0000 (10:10 +0100)
committerJozef Lawrynowicz <jozef.l@mittosystems.com>
Tue, 8 Sep 2020 09:12:25 +0000 (10:12 +0100)
commitcd2d3822ca0f2f743601cc9d048d51f6d326f6a2
treeceabcdfced7ba6f49fac182de7d8a72fa2e4c360
parent213200a27d756df1709be1a1a6a85af97a32fddc
MSP430: Use enums to handle -mcpu= values

The -mcpu= option accepts only a handful of string values.
Using enums instead of strings to handle the accepted values removes the
need to have specific processing of the strings in the backend, and
simplifies any comparisons which need to be performed on the value.

It also allows the default value to have semantic equivalence to a user
set value, whilst retaining the ability to differentiate between them.
Practically, this allows a user set -mcpu= value to override the the ISA set by
-mmcu, whilst the default -mcpu= value can still have an explicit meaning.

gcc/ChangeLog:

* common/config/msp430/msp430-common.c (msp430_handle_option): Remove
OPT_mcpu_ handling.
Set target_cpu value to new enum values when parsing certain -mmcu=
values.
* config/msp430/msp430-opts.h (enum msp430_cpu_types): New.
* config/msp430/msp430.c (msp430_option_override): Handle new
target_cpu enum values.
Set target_cpu using extracted value for given MCU when -mcpu=
option is not passed by the user.
* config/msp430/msp430.opt: Handle -mcpu= values using enums.

gcc/testsuite/ChangeLog:

* gcc.target/msp430/mcpu-is-430.c: New test.
* gcc.target/msp430/mcpu-is-430x.c: New test.
* gcc.target/msp430/mcpu-is-430xv2.c: New test.
gcc/common/config/msp430/msp430-common.c
gcc/config/msp430/msp430-opts.h
gcc/config/msp430/msp430.c
gcc/config/msp430/msp430.opt
gcc/testsuite/gcc.target/msp430/mcpu-is-430.c [new file with mode: 0644]
gcc/testsuite/gcc.target/msp430/mcpu-is-430x.c [new file with mode: 0644]
gcc/testsuite/gcc.target/msp430/mcpu-is-430xv2.c [new file with mode: 0644]