From e37e2bb100135e4d4afa2f4ae6445ac1201f01fa Mon Sep 17 00:00:00 2001 From: Jozef Lawrynowicz Date: Tue, 13 Aug 2019 10:05:53 +0000 Subject: [PATCH] MSP430: Consolidate handling of hard-coded MCU data gcc/ChangeLog: 2019-08-13 Jozef Lawrynowicz * gcc/config.gcc (msp430*-*-*): Add msp430-devices.o to extra_objs and extra_gcc_objs. * gcc/config/msp430/driver-msp430.c: Remove msp430_mcu_data. (msp430_select_cpu): New spec function. (msp430_select_hwmult_lib): Use msp430_extract_mcu_data to extract MCU data. * gcc/config/msp430/msp430-devices.c: New file. * gcc/config/msp430/msp430-devices.h: New file. * gcc/config/msp430/msp430.c: Remove msp430_mcu_data. (msp430_option_override): Use msp430_extract_mcu_data to extract MCU data. (msp430_use_f5_series_hwmult): Likewise. (use_32bit_hwmult): Likewise. (msp430_no_hwmult): Likewise. * gcc/config/msp430/msp430.h (ASM_SPEC): Don't pass -mmcu to the assembler. (DRIVER_SELF_SPECS): Call msp430_select_cpu if -mmcu is used without and -mcpu option. (EXTRA_SPEC_FUNCTIONS): Add msp430_select_cpu. * gcc/config/msp430/t-msp430: Add rule to build msp430-devices.o. Remove hard-coded MCU multilib data. gcc/testsuite/ChangeLog: 2019-08-13 Jozef Lawrynowicz * gcc.target/msp430/msp430.exp (check_effective_target_msp430_430_selected): New. (check_effective_target_msp430_430x_selected): New. (check_effective_target_msp430_mlarge_selected): New. (check_effective_target_msp430_hwmul_not_none): New. (check_effective_target_msp430_hwmul_not_16bit): New. (check_effective_target_msp430_hwmul_not_32bit): New. (check_effective_target_msp430_hwmul_not_f5): New. (msp430_get_opts): New. (msp430_device_permutations_runtest): New. * gcc.target/msp430/devices/README: New file. * gcc.target/msp430/devices-main.c: New test. * gcc.target/msp430/devices/hard-cc430f5123.c: Likewise. * gcc.target/msp430/devices/hard-foo.c: Likewise. * gcc.target/msp430/devices/hard-msp430afe253.c: Likewise. * gcc.target/msp430/devices/hard-msp430cg4616.c: Likewise. * gcc.target/msp430/devices/hard-msp430f4783.c: Likewise. * gcc.target/msp430/devices/hard-rf430frl154h_rom.c: Likewise. From-SVN: r274370 --- gcc/ChangeLog | 24 + gcc/config.gcc | 3 +- gcc/config/msp430/driver-msp430.c | 654 +--------------- gcc/config/msp430/msp430-devices.c | 697 ++++++++++++++++++ gcc/config/msp430/msp430-devices.h | 31 + gcc/config/msp430/msp430.c | 680 +---------------- gcc/config/msp430/msp430.h | 10 +- gcc/config/msp430/t-msp430 | 236 +----- gcc/testsuite/ChangeLog | 21 + .../gcc.target/msp430/devices-main.c | 6 + .../gcc.target/msp430/devices/README | 12 + .../msp430/devices/hard-cc430f5123.c | 7 + .../gcc.target/msp430/devices/hard-foo.c | 5 + .../msp430/devices/hard-msp430afe253.c | 8 + .../msp430/devices/hard-msp430cg4616.c | 7 + .../msp430/devices/hard-msp430f4783.c | 8 + .../msp430/devices/hard-rf430frl154h_rom.c | 8 + gcc/testsuite/gcc.target/msp430/msp430.exp | 82 ++- 18 files changed, 988 insertions(+), 1511 deletions(-) create mode 100644 gcc/config/msp430/msp430-devices.c create mode 100644 gcc/config/msp430/msp430-devices.h create mode 100644 gcc/testsuite/gcc.target/msp430/devices-main.c create mode 100644 gcc/testsuite/gcc.target/msp430/devices/README create mode 100644 gcc/testsuite/gcc.target/msp430/devices/hard-cc430f5123.c create mode 100644 gcc/testsuite/gcc.target/msp430/devices/hard-foo.c create mode 100644 gcc/testsuite/gcc.target/msp430/devices/hard-msp430afe253.c create mode 100644 gcc/testsuite/gcc.target/msp430/devices/hard-msp430cg4616.c create mode 100644 gcc/testsuite/gcc.target/msp430/devices/hard-msp430f4783.c create mode 100644 gcc/testsuite/gcc.target/msp430/devices/hard-rf430frl154h_rom.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c77cba1858a..fcf1558bf18 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,27 @@ +2019-08-13 Jozef Lawrynowicz + + * gcc/config.gcc (msp430*-*-*): Add msp430-devices.o to extra_objs and + extra_gcc_objs. + * gcc/config/msp430/driver-msp430.c: Remove msp430_mcu_data. + (msp430_select_cpu): New spec function. + (msp430_select_hwmult_lib): Use msp430_extract_mcu_data to extract + MCU data. + * gcc/config/msp430/msp430-devices.c: New file. + * gcc/config/msp430/msp430-devices.h: New file. + * gcc/config/msp430/msp430.c: Remove msp430_mcu_data. + (msp430_option_override): Use msp430_extract_mcu_data to extract + MCU data. + (msp430_use_f5_series_hwmult): Likewise. + (use_32bit_hwmult): Likewise. + (msp430_no_hwmult): Likewise. + * gcc/config/msp430/msp430.h (ASM_SPEC): Don't pass -mmcu to the + assembler. + (DRIVER_SELF_SPECS): Call msp430_select_cpu if -mmcu is used without + and -mcpu option. + (EXTRA_SPEC_FUNCTIONS): Add msp430_select_cpu. + * gcc/config/msp430/t-msp430: Add rule to build msp430-devices.o. + Remove hard-coded MCU multilib data. + 2019-08-13 Richard Sandiford * config/aarch64/aarch64.c (aarch64_classify_vector_mode): Switch diff --git a/gcc/config.gcc b/gcc/config.gcc index 291e2881f96..40cbc52dc99 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -2519,7 +2519,8 @@ msp430*-*-*) c_target_objs="msp430-c.o" cxx_target_objs="msp430-c.o" tmake_file="${tmake_file} msp430/t-msp430" - extra_gcc_objs="driver-msp430.o" + extra_objs="${extra_objs} msp430-devices.o" + extra_gcc_objs="driver-msp430.o msp430-devices.o" # Enable .init_array unless it has been explicitly disabled. # The MSP430 EABI mandates the use of .init_array, and the Newlib CRT # code since mid-2019 expects it. diff --git a/gcc/config/msp430/driver-msp430.c b/gcc/config/msp430/driver-msp430.c index 5583db6edf7..9ad05dca957 100644 --- a/gcc/config/msp430/driver-msp430.c +++ b/gcc/config/msp430/driver-msp430.c @@ -25,627 +25,34 @@ #include "coretypes.h" #include "diagnostic.h" #include "tm.h" +#include "msp430-devices.h" -/* This is a copy of the same data structure found in gas/config/tc-msp430.c - Also another (sort-of) copy can be found in gcc/config/msp430/msp430.c - Keep these three structures in sync. - The data in this structure has been extracted from version 1.194 of the - devices.csv file released by TI in September 2016. */ - -struct msp430_mcu_data +/* This spec function is called if the user has provided an -mmcu option without + an -mcpu option. It will place the correct -mcpu option for the given -mmcu + onto the command line, to ensure the correct ISA multilib is selected. */ +const char * +msp430_select_cpu (int argc, const char ** argv) { - const char * name; - unsigned int revision; /* 0=> MSP430, 1=>MSP430X, 2=> MSP430Xv2. */ - unsigned int hwmpy; /* 0=>none, 1=>16-bit, 2=>16-bit w/sign extend, 4=>32-bit, 8=> 32-bit (5xx). */ + if (argc == 0) + { + error ("expected an argument to %%"); + return NULL; + } + msp430_extract_mcu_data (argv[0]); + if (extracted_mcu_data.name != NULL) + { + switch (extracted_mcu_data.revision) + { + case 0: return "-mcpu=msp430"; + case 1: return "-mcpu=msp430x"; + case 2: return "-mcpu=msp430xv2"; + default: + gcc_unreachable (); + } + } + /* MCU wasn't found, the compiler proper will warn about this. */ + return NULL; } -msp430_mcu_data [] = -{ - { "cc430f5123",2,8 }, - { "cc430f5125",2,8 }, - { "cc430f5133",2,8 }, - { "cc430f5135",2,8 }, - { "cc430f5137",2,8 }, - { "cc430f5143",2,8 }, - { "cc430f5145",2,8 }, - { "cc430f5147",2,8 }, - { "cc430f6125",2,8 }, - { "cc430f6126",2,8 }, - { "cc430f6127",2,8 }, - { "cc430f6135",2,8 }, - { "cc430f6137",2,8 }, - { "cc430f6143",2,8 }, - { "cc430f6145",2,8 }, - { "cc430f6147",2,8 }, - { "msp430afe221",0,2 }, - { "msp430afe222",0,2 }, - { "msp430afe223",0,2 }, - { "msp430afe231",0,2 }, - { "msp430afe232",0,2 }, - { "msp430afe233",0,2 }, - { "msp430afe251",0,2 }, - { "msp430afe252",0,2 }, - { "msp430afe253",0,2 }, - { "msp430bt5190",2,8 }, - { "msp430c091",0,0 }, - { "msp430c092",0,0 }, - { "msp430c111",0,0 }, - { "msp430c1111",0,0 }, - { "msp430c112",0,0 }, - { "msp430c1121",0,0 }, - { "msp430c1331",0,0 }, - { "msp430c1351",0,0 }, - { "msp430c311s",0,0 }, - { "msp430c312",0,0 }, - { "msp430c313",0,0 }, - { "msp430c314",0,0 }, - { "msp430c315",0,0 }, - { "msp430c323",0,0 }, - { "msp430c325",0,0 }, - { "msp430c336",0,1 }, - { "msp430c337",0,1 }, - { "msp430c412",0,0 }, - { "msp430c413",0,0 }, - { "msp430cg4616",1,1 }, - { "msp430cg4617",1,1 }, - { "msp430cg4618",1,1 }, - { "msp430cg4619",1,1 }, - { "msp430e112",0,0 }, - { "msp430e313",0,0 }, - { "msp430e315",0,0 }, - { "msp430e325",0,0 }, - { "msp430e337",0,1 }, - { "msp430f110",0,0 }, - { "msp430f1101",0,0 }, - { "msp430f1101a",0,0 }, - { "msp430f1111",0,0 }, - { "msp430f1111a",0,0 }, - { "msp430f112",0,0 }, - { "msp430f1121",0,0 }, - { "msp430f1121a",0,0 }, - { "msp430f1122",0,0 }, - { "msp430f1132",0,0 }, - { "msp430f122",0,0 }, - { "msp430f1222",0,0 }, - { "msp430f123",0,0 }, - { "msp430f1232",0,0 }, - { "msp430f133",0,0 }, - { "msp430f135",0,0 }, - { "msp430f147",0,1 }, - { "msp430f1471",0,1 }, - { "msp430f148",0,1 }, - { "msp430f1481",0,1 }, - { "msp430f149",0,1 }, - { "msp430f1491",0,1 }, - { "msp430f155",0,0 }, - { "msp430f156",0,0 }, - { "msp430f157",0,0 }, - { "msp430f1610",0,1 }, - { "msp430f1611",0,1 }, - { "msp430f1612",0,1 }, - { "msp430f167",0,1 }, - { "msp430f168",0,1 }, - { "msp430f169",0,1 }, - { "msp430f2001",0,0 }, - { "msp430f2002",0,0 }, - { "msp430f2003",0,0 }, - { "msp430f2011",0,0 }, - { "msp430f2012",0,0 }, - { "msp430f2013",0,0 }, - { "msp430f2101",0,0 }, - { "msp430f2111",0,0 }, - { "msp430f2112",0,0 }, - { "msp430f2121",0,0 }, - { "msp430f2122",0,0 }, - { "msp430f2131",0,0 }, - { "msp430f2132",0,0 }, - { "msp430f2232",0,0 }, - { "msp430f2234",0,0 }, - { "msp430f2252",0,0 }, - { "msp430f2254",0,0 }, - { "msp430f2272",0,0 }, - { "msp430f2274",0,0 }, - { "msp430f233",0,2 }, - { "msp430f2330",0,2 }, - { "msp430f235",0,2 }, - { "msp430f2350",0,2 }, - { "msp430f2370",0,2 }, - { "msp430f2410",0,2 }, - { "msp430f2416",1,2 }, - { "msp430f2417",1,2 }, - { "msp430f2418",1,2 }, - { "msp430f2419",1,2 }, - { "msp430f247",0,2 }, - { "msp430f2471",0,2 }, - { "msp430f248",0,2 }, - { "msp430f2481",0,2 }, - { "msp430f249",0,2 }, - { "msp430f2491",0,2 }, - { "msp430f2616",1,2 }, - { "msp430f2617",1,2 }, - { "msp430f2618",1,2 }, - { "msp430f2619",1,2 }, - { "msp430f412",0,0 }, - { "msp430f413",0,0 }, - { "msp430f4132",0,0 }, - { "msp430f415",0,0 }, - { "msp430f4152",0,0 }, - { "msp430f417",0,0 }, - { "msp430f423",0,1 }, - { "msp430f423a",0,1 }, - { "msp430f425",0,1 }, - { "msp430f4250",0,0 }, - { "msp430f425a",0,1 }, - { "msp430f4260",0,0 }, - { "msp430f427",0,1 }, - { "msp430f4270",0,0 }, - { "msp430f427a",0,1 }, - { "msp430f435",0,0 }, - { "msp430f4351",0,0 }, - { "msp430f436",0,0 }, - { "msp430f4361",0,0 }, - { "msp430f437",0,0 }, - { "msp430f4371",0,0 }, - { "msp430f438",0,0 }, - { "msp430f439",0,0 }, - { "msp430f447",0,1 }, - { "msp430f448",0,1 }, - { "msp430f4481",0,1 }, - { "msp430f449",0,1 }, - { "msp430f4491",0,1 }, - { "msp430f4616",1,1 }, - { "msp430f46161",1,1 }, - { "msp430f4617",1,1 }, - { "msp430f46171",1,1 }, - { "msp430f4618",1,1 }, - { "msp430f46181",1,1 }, - { "msp430f4619",1,1 }, - { "msp430f46191",1,1 }, - { "msp430f47126",1,4 }, - { "msp430f47127",1,4 }, - { "msp430f47163",1,4 }, - { "msp430f47166",1,4 }, - { "msp430f47167",1,4 }, - { "msp430f47173",1,4 }, - { "msp430f47176",1,4 }, - { "msp430f47177",1,4 }, - { "msp430f47183",1,4 }, - { "msp430f47186",1,4 }, - { "msp430f47187",1,4 }, - { "msp430f47193",1,4 }, - { "msp430f47196",1,4 }, - { "msp430f47197",1,4 }, - { "msp430f477",0,0 }, - { "msp430f478",0,0 }, - { "msp430f4783",0,4 }, - { "msp430f4784",0,4 }, - { "msp430f479",0,0 }, - { "msp430f4793",0,4 }, - { "msp430f4794",0,4 }, - { "msp430f5131",2,8 }, - { "msp430f5132",2,8 }, - { "msp430f5151",2,8 }, - { "msp430f5152",2,8 }, - { "msp430f5171",2,8 }, - { "msp430f5172",2,8 }, - { "msp430f5212",2,8 }, - { "msp430f5213",2,8 }, - { "msp430f5214",2,8 }, - { "msp430f5217",2,8 }, - { "msp430f5218",2,8 }, - { "msp430f5219",2,8 }, - { "msp430f5222",2,8 }, - { "msp430f5223",2,8 }, - { "msp430f5224",2,8 }, - { "msp430f5227",2,8 }, - { "msp430f5228",2,8 }, - { "msp430f5229",2,8 }, - { "msp430f5232",2,8 }, - { "msp430f5234",2,8 }, - { "msp430f5237",2,8 }, - { "msp430f5239",2,8 }, - { "msp430f5242",2,8 }, - { "msp430f5244",2,8 }, - { "msp430f5247",2,8 }, - { "msp430f5249",2,8 }, - { "msp430f5252",2,8 }, - { "msp430f5253",2,8 }, - { "msp430f5254",2,8 }, - { "msp430f5255",2,8 }, - { "msp430f5256",2,8 }, - { "msp430f5257",2,8 }, - { "msp430f5258",2,8 }, - { "msp430f5259",2,8 }, - { "msp430f5304",2,8 }, - { "msp430f5308",2,8 }, - { "msp430f5309",2,8 }, - { "msp430f5310",2,8 }, - { "msp430f5324",2,8 }, - { "msp430f5325",2,8 }, - { "msp430f5326",2,8 }, - { "msp430f5327",2,8 }, - { "msp430f5328",2,8 }, - { "msp430f5329",2,8 }, - { "msp430f5333",2,8 }, - { "msp430f5335",2,8 }, - { "msp430f5336",2,8 }, - { "msp430f5338",2,8 }, - { "msp430f5340",2,8 }, - { "msp430f5341",2,8 }, - { "msp430f5342",2,8 }, - { "msp430f5358",2,8 }, - { "msp430f5359",2,8 }, - { "msp430f5418",2,8 }, - { "msp430f5418a",2,8 }, - { "msp430f5419",2,8 }, - { "msp430f5419a",2,8 }, - { "msp430f5435",2,8 }, - { "msp430f5435a",2,8 }, - { "msp430f5436",2,8 }, - { "msp430f5436a",2,8 }, - { "msp430f5437",2,8 }, - { "msp430f5437a",2,8 }, - { "msp430f5438",2,8 }, - { "msp430f5438a",2,8 }, - { "msp430f5500",2,8 }, - { "msp430f5501",2,8 }, - { "msp430f5502",2,8 }, - { "msp430f5503",2,8 }, - { "msp430f5504",2,8 }, - { "msp430f5505",2,8 }, - { "msp430f5506",2,8 }, - { "msp430f5507",2,8 }, - { "msp430f5508",2,8 }, - { "msp430f5509",2,8 }, - { "msp430f5510",2,8 }, - { "msp430f5513",2,8 }, - { "msp430f5514",2,8 }, - { "msp430f5515",2,8 }, - { "msp430f5517",2,8 }, - { "msp430f5519",2,8 }, - { "msp430f5521",2,8 }, - { "msp430f5522",2,8 }, - { "msp430f5524",2,8 }, - { "msp430f5525",2,8 }, - { "msp430f5526",2,8 }, - { "msp430f5527",2,8 }, - { "msp430f5528",2,8 }, - { "msp430f5529",2,8 }, - { "msp430f5630",2,8 }, - { "msp430f5631",2,8 }, - { "msp430f5632",2,8 }, - { "msp430f5633",2,8 }, - { "msp430f5634",2,8 }, - { "msp430f5635",2,8 }, - { "msp430f5636",2,8 }, - { "msp430f5637",2,8 }, - { "msp430f5638",2,8 }, - { "msp430f5658",2,8 }, - { "msp430f5659",2,8 }, - { "msp430f5xx_6xxgeneric",2,8 }, - { "msp430f6433",2,8 }, - { "msp430f6435",2,8 }, - { "msp430f6436",2,8 }, - { "msp430f6438",2,8 }, - { "msp430f6458",2,8 }, - { "msp430f6459",2,8 }, - { "msp430f6630",2,8 }, - { "msp430f6631",2,8 }, - { "msp430f6632",2,8 }, - { "msp430f6633",2,8 }, - { "msp430f6634",2,8 }, - { "msp430f6635",2,8 }, - { "msp430f6636",2,8 }, - { "msp430f6637",2,8 }, - { "msp430f6638",2,8 }, - { "msp430f6658",2,8 }, - { "msp430f6659",2,8 }, - { "msp430f6720",2,8 }, - { "msp430f6720a",2,8 }, - { "msp430f6721",2,8 }, - { "msp430f6721a",2,8 }, - { "msp430f6723",2,8 }, - { "msp430f6723a",2,8 }, - { "msp430f6724",2,8 }, - { "msp430f6724a",2,8 }, - { "msp430f6725",2,8 }, - { "msp430f6725a",2,8 }, - { "msp430f6726",2,8 }, - { "msp430f6726a",2,8 }, - { "msp430f6730",2,8 }, - { "msp430f6730a",2,8 }, - { "msp430f6731",2,8 }, - { "msp430f6731a",2,8 }, - { "msp430f6733",2,8 }, - { "msp430f6733a",2,8 }, - { "msp430f6734",2,8 }, - { "msp430f6734a",2,8 }, - { "msp430f6735",2,8 }, - { "msp430f6735a",2,8 }, - { "msp430f6736",2,8 }, - { "msp430f6736a",2,8 }, - { "msp430f6745",2,8 }, - { "msp430f67451",2,8 }, - { "msp430f67451a",2,8 }, - { "msp430f6745a",2,8 }, - { "msp430f6746",2,8 }, - { "msp430f67461",2,8 }, - { "msp430f67461a",2,8 }, - { "msp430f6746a",2,8 }, - { "msp430f6747",2,8 }, - { "msp430f67471",2,8 }, - { "msp430f67471a",2,8 }, - { "msp430f6747a",2,8 }, - { "msp430f6748",2,8 }, - { "msp430f67481",2,8 }, - { "msp430f67481a",2,8 }, - { "msp430f6748a",2,8 }, - { "msp430f6749",2,8 }, - { "msp430f67491",2,8 }, - { "msp430f67491a",2,8 }, - { "msp430f6749a",2,8 }, - { "msp430f67621",2,8 }, - { "msp430f67621a",2,8 }, - { "msp430f67641",2,8 }, - { "msp430f67641a",2,8 }, - { "msp430f6765",2,8 }, - { "msp430f67651",2,8 }, - { "msp430f67651a",2,8 }, - { "msp430f6765a",2,8 }, - { "msp430f6766",2,8 }, - { "msp430f67661",2,8 }, - { "msp430f67661a",2,8 }, - { "msp430f6766a",2,8 }, - { "msp430f6767",2,8 }, - { "msp430f67671",2,8 }, - { "msp430f67671a",2,8 }, - { "msp430f6767a",2,8 }, - { "msp430f6768",2,8 }, - { "msp430f67681",2,8 }, - { "msp430f67681a",2,8 }, - { "msp430f6768a",2,8 }, - { "msp430f6769",2,8 }, - { "msp430f67691",2,8 }, - { "msp430f67691a",2,8 }, - { "msp430f6769a",2,8 }, - { "msp430f6775",2,8 }, - { "msp430f67751",2,8 }, - { "msp430f67751a",2,8 }, - { "msp430f6775a",2,8 }, - { "msp430f6776",2,8 }, - { "msp430f67761",2,8 }, - { "msp430f67761a",2,8 }, - { "msp430f6776a",2,8 }, - { "msp430f6777",2,8 }, - { "msp430f67771",2,8 }, - { "msp430f67771a",2,8 }, - { "msp430f6777a",2,8 }, - { "msp430f6778",2,8 }, - { "msp430f67781",2,8 }, - { "msp430f67781a",2,8 }, - { "msp430f6778a",2,8 }, - { "msp430f6779",2,8 }, - { "msp430f67791",2,8 }, - { "msp430f67791a",2,8 }, - { "msp430f6779a",2,8 }, - { "msp430fe423",0,0 }, - { "msp430fe4232",0,0 }, - { "msp430fe423a",0,0 }, - { "msp430fe4242",0,0 }, - { "msp430fe425",0,0 }, - { "msp430fe4252",0,0 }, - { "msp430fe425a",0,0 }, - { "msp430fe427",0,0 }, - { "msp430fe4272",0,0 }, - { "msp430fe427a",0,0 }, - { "msp430fg4250",0,0 }, - { "msp430fg4260",0,0 }, - { "msp430fg4270",0,0 }, - { "msp430fg437",0,0 }, - { "msp430fg438",0,0 }, - { "msp430fg439",0,0 }, - { "msp430fg4616",1,1 }, - { "msp430fg4617",1,1 }, - { "msp430fg4618",1,1 }, - { "msp430fg4619",1,1 }, - { "msp430fg477",0,0 }, - { "msp430fg478",0,0 }, - { "msp430fg479",0,0 }, - { "msp430fg6425",2,8 }, - { "msp430fg6426",2,8 }, - { "msp430fg6625",2,8 }, - { "msp430fg6626",2,8 }, - { "msp430fr2032",2,0 }, - { "msp430fr2033",2,0 }, - { "msp430fr2110",2,0 }, - { "msp430fr2111",2,0 }, - { "msp430fr2310",2,0 }, - { "msp430fr2311",2,0 }, - { "msp430fr2433",2,8 }, - { "msp430fr2532",2,8 }, - { "msp430fr2533",2,8 }, - { "msp430fr2632",2,8 }, - { "msp430fr2633",2,8 }, - { "msp430fr2xx_4xxgeneric",2,8 }, - { "msp430fr4131",2,0 }, - { "msp430fr4132",2,0 }, - { "msp430fr4133",2,0 }, - { "msp430fr5720",2,8 }, - { "msp430fr5721",2,8 }, - { "msp430fr5722",2,8 }, - { "msp430fr5723",2,8 }, - { "msp430fr5724",2,8 }, - { "msp430fr5725",2,8 }, - { "msp430fr5726",2,8 }, - { "msp430fr5727",2,8 }, - { "msp430fr5728",2,8 }, - { "msp430fr5729",2,8 }, - { "msp430fr5730",2,8 }, - { "msp430fr5731",2,8 }, - { "msp430fr5732",2,8 }, - { "msp430fr5733",2,8 }, - { "msp430fr5734",2,8 }, - { "msp430fr5735",2,8 }, - { "msp430fr5736",2,8 }, - { "msp430fr5737",2,8 }, - { "msp430fr5738",2,8 }, - { "msp430fr5739",2,8 }, - { "msp430fr57xxgeneric",2,8 }, - { "msp430fr5847",2,8 }, - { "msp430fr58471",2,8 }, - { "msp430fr5848",2,8 }, - { "msp430fr5849",2,8 }, - { "msp430fr5857",2,8 }, - { "msp430fr5858",2,8 }, - { "msp430fr5859",2,8 }, - { "msp430fr5867",2,8 }, - { "msp430fr58671",2,8 }, - { "msp430fr5868",2,8 }, - { "msp430fr5869",2,8 }, - { "msp430fr5870",2,8 }, - { "msp430fr5872",2,8 }, - { "msp430fr58721",2,8 }, - { "msp430fr5887",2,8 }, - { "msp430fr5888",2,8 }, - { "msp430fr5889",2,8 }, - { "msp430fr58891",2,8 }, - { "msp430fr5922",2,8 }, - { "msp430fr59221",2,8 }, - { "msp430fr5947",2,8 }, - { "msp430fr59471",2,8 }, - { "msp430fr5948",2,8 }, - { "msp430fr5949",2,8 }, - { "msp430fr5957",2,8 }, - { "msp430fr5958",2,8 }, - { "msp430fr5959",2,8 }, - { "msp430fr5962",2,8 }, - { "msp430fr5964",2,8 }, - { "msp430fr5967",2,8 }, - { "msp430fr5968",2,8 }, - { "msp430fr5969",2,8 }, - { "msp430fr59691",2,8 }, - { "msp430fr5970",2,8 }, - { "msp430fr5972",2,8 }, - { "msp430fr59721",2,8 }, - { "msp430fr5986",2,8 }, - { "msp430fr5987",2,8 }, - { "msp430fr5988",2,8 }, - { "msp430fr5989",2,8 }, - { "msp430fr59891",2,8 }, - { "msp430fr5992",2,8 }, - { "msp430fr5994",2,8 }, - { "msp430fr59941",2,8 }, - { "msp430fr5xx_6xxgeneric",2,8 }, - { "msp430fr6820",2,8 }, - { "msp430fr6822",2,8 }, - { "msp430fr68221",2,8 }, - { "msp430fr6870",2,8 }, - { "msp430fr6872",2,8 }, - { "msp430fr68721",2,8 }, - { "msp430fr6877",2,8 }, - { "msp430fr6879",2,8 }, - { "msp430fr68791",2,8 }, - { "msp430fr6887",2,8 }, - { "msp430fr6888",2,8 }, - { "msp430fr6889",2,8 }, - { "msp430fr68891",2,8 }, - { "msp430fr6920",2,8 }, - { "msp430fr6922",2,8 }, - { "msp430fr69221",2,8 }, - { "msp430fr6927",2,8 }, - { "msp430fr69271",2,8 }, - { "msp430fr6928",2,8 }, - { "msp430fr6970",2,8 }, - { "msp430fr6972",2,8 }, - { "msp430fr69721",2,8 }, - { "msp430fr6977",2,8 }, - { "msp430fr6979",2,8 }, - { "msp430fr69791",2,8 }, - { "msp430fr6987",2,8 }, - { "msp430fr6988",2,8 }, - { "msp430fr6989",2,8 }, - { "msp430fr69891",2,8 }, - { "msp430fw423",0,0 }, - { "msp430fw425",0,0 }, - { "msp430fw427",0,0 }, - { "msp430fw428",0,0 }, - { "msp430fw429",0,0 }, - { "msp430g2001",0,0 }, - { "msp430g2101",0,0 }, - { "msp430g2102",0,0 }, - { "msp430g2111",0,0 }, - { "msp430g2112",0,0 }, - { "msp430g2113",0,0 }, - { "msp430g2121",0,0 }, - { "msp430g2131",0,0 }, - { "msp430g2132",0,0 }, - { "msp430g2152",0,0 }, - { "msp430g2153",0,0 }, - { "msp430g2201",0,0 }, - { "msp430g2202",0,0 }, - { "msp430g2203",0,0 }, - { "msp430g2210",0,0 }, - { "msp430g2211",0,0 }, - { "msp430g2212",0,0 }, - { "msp430g2213",0,0 }, - { "msp430g2221",0,0 }, - { "msp430g2230",0,0 }, - { "msp430g2231",0,0 }, - { "msp430g2232",0,0 }, - { "msp430g2233",0,0 }, - { "msp430g2252",0,0 }, - { "msp430g2253",0,0 }, - { "msp430g2302",0,0 }, - { "msp430g2303",0,0 }, - { "msp430g2312",0,0 }, - { "msp430g2313",0,0 }, - { "msp430g2332",0,0 }, - { "msp430g2333",0,0 }, - { "msp430g2352",0,0 }, - { "msp430g2353",0,0 }, - { "msp430g2402",0,0 }, - { "msp430g2403",0,0 }, - { "msp430g2412",0,0 }, - { "msp430g2413",0,0 }, - { "msp430g2432",0,0 }, - { "msp430g2433",0,0 }, - { "msp430g2444",0,0 }, - { "msp430g2452",0,0 }, - { "msp430g2453",0,0 }, - { "msp430g2513",0,0 }, - { "msp430g2533",0,0 }, - { "msp430g2544",0,0 }, - { "msp430g2553",0,0 }, - { "msp430g2744",0,0 }, - { "msp430g2755",0,0 }, - { "msp430g2855",0,0 }, - { "msp430g2955",0,0 }, - { "msp430i2020",0,2 }, - { "msp430i2021",0,2 }, - { "msp430i2030",0,2 }, - { "msp430i2031",0,2 }, - { "msp430i2040",0,2 }, - { "msp430i2041",0,2 }, - { "msp430i2xxgeneric",0,2 }, - { "msp430l092",0,0 }, - { "msp430p112",0,0 }, - { "msp430p313",0,0 }, - { "msp430p315",0,0 }, - { "msp430p315s",0,0 }, - { "msp430p325",0,0 }, - { "msp430p337",0,1 }, - { "msp430sl5438a",2,8 }, - { "msp430tch5e",0,0 }, - { "msp430xgeneric",2,8 }, - { "rf430f5144",2,8 }, - { "rf430f5155",2,8 }, - { "rf430f5175",2,8 }, - { "rf430frl152h",0,0 }, - { "rf430frl152h_rom",0,0 }, - { "rf430frl153h",0,0 }, - { "rf430frl153h_rom",0,0 }, - { "rf430frl154h",0,0 }, - { "rf430frl154h_rom",0,0 } -}; /* Implement spec function `msp430_hwmult_lib´. */ @@ -688,10 +95,10 @@ msp430_select_hwmult_lib (int argc ATTRIBUTE_UNUSED, const char ** argv ATTRIBUT } else if (strcasecmp (argv[0], "mcu") == 0) { - for (i = ARRAY_SIZE (msp430_mcu_data); i--;) - if (strcasecmp (argv[argc - 1], msp430_mcu_data[i].name) == 0) + msp430_extract_mcu_data (argv[argc - 1]); + if (extracted_mcu_data.name != NULL) { - switch (msp430_mcu_data[i].hwmpy) + switch (extracted_mcu_data.hwmpy) { case 0: return "-lmul_none"; case 2: @@ -699,8 +106,9 @@ msp430_select_hwmult_lib (int argc ATTRIBUTE_UNUSED, const char ** argv ATTRIBUT case 4: return "-lmul_32"; case 8: return "-lmul_f5"; default: - error ("unrecognized hwpy field in msp430_mcu_data[%d]: %d", - i, msp430_mcu_data[i].hwmpy); + /* We have already checked the hwmpy values for + validity in msp430_extract_mcu_data. */ + gcc_unreachable (); break; } } diff --git a/gcc/config/msp430/msp430-devices.c b/gcc/config/msp430/msp430-devices.c new file mode 100644 index 00000000000..c5faff80487 --- /dev/null +++ b/gcc/config/msp430/msp430-devices.c @@ -0,0 +1,697 @@ +/* Subroutines used for reading MCU data on TI MSP430 processors. + Copyright (C) 2019 Free Software Foundation, Inc. + Contributed by Jozef Lawrynowicz . + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + GCC is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING3. If not see + . */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "backend.h" +#include "target.h" +#include "tree.h" +#include "memmodel.h" +#include "diagnostic-core.h" +#include "langhooks.h" +#include "builtins.h" +#include "intl.h" +#include "msp430-devices.h" + +struct t_msp430_mcu_data extracted_mcu_data; +/* Initialized at the bottom of this file. */ +extern struct t_msp430_mcu_data hard_msp430_mcu_data[605]; + +/* Main entry point to load the MCU data for the given -mmcu into + extracted_mcu_data. hard_msp430_mcu_data (initialized at the bottom of this + file) is searched for the MCU name. + This function only needs to be executed once, but it can be first called + from a number of different locations. */ +void +msp430_extract_mcu_data (const char * mcu_name) +{ + static int executed = 0; + int i; + if (mcu_name == NULL || executed == 1) + return; + executed = 1; + /* FIXME: This array is alpha sorted - we could use a binary search. */ + for (i = ARRAY_SIZE (hard_msp430_mcu_data); i--;) + if (strcasecmp (mcu_name, hard_msp430_mcu_data[i].name) == 0) + { + extracted_mcu_data = hard_msp430_mcu_data[i]; + break; + } + /* Validation checks. */ + if (extracted_mcu_data.name != NULL) + { + switch (extracted_mcu_data.hwmpy) + { + case 0: + case 1: + case 2: + case 4: + case 8: break; + default: + error ("unrecognized % field in " + "%: %qd", i, + hard_msp430_mcu_data[i].hwmpy); + break; + } + switch (extracted_mcu_data.revision) + { + case 0: + case 1: + case 2: break; + default: + error ("unrecognized % field in " + "%: %qd", i, + hard_msp430_mcu_data[i].revision); + } + } +} + +/* The data in this structure has been extracted from version 1.194 of the + devices.csv file released by TI in September 2016. */ + +struct t_msp430_mcu_data hard_msp430_mcu_data[605] = +{ + { "cc430f5123",2,8 }, + { "cc430f5125",2,8 }, + { "cc430f5133",2,8 }, + { "cc430f5135",2,8 }, + { "cc430f5137",2,8 }, + { "cc430f5143",2,8 }, + { "cc430f5145",2,8 }, + { "cc430f5147",2,8 }, + { "cc430f6125",2,8 }, + { "cc430f6126",2,8 }, + { "cc430f6127",2,8 }, + { "cc430f6135",2,8 }, + { "cc430f6137",2,8 }, + { "cc430f6143",2,8 }, + { "cc430f6145",2,8 }, + { "cc430f6147",2,8 }, + { "msp430afe221",0,2 }, + { "msp430afe222",0,2 }, + { "msp430afe223",0,2 }, + { "msp430afe231",0,2 }, + { "msp430afe232",0,2 }, + { "msp430afe233",0,2 }, + { "msp430afe251",0,2 }, + { "msp430afe252",0,2 }, + { "msp430afe253",0,2 }, + { "msp430bt5190",2,8 }, + { "msp430c091",0,0 }, + { "msp430c092",0,0 }, + { "msp430c111",0,0 }, + { "msp430c1111",0,0 }, + { "msp430c112",0,0 }, + { "msp430c1121",0,0 }, + { "msp430c1331",0,0 }, + { "msp430c1351",0,0 }, + { "msp430c311s",0,0 }, + { "msp430c312",0,0 }, + { "msp430c313",0,0 }, + { "msp430c314",0,0 }, + { "msp430c315",0,0 }, + { "msp430c323",0,0 }, + { "msp430c325",0,0 }, + { "msp430c336",0,1 }, + { "msp430c337",0,1 }, + { "msp430c412",0,0 }, + { "msp430c413",0,0 }, + { "msp430cg4616",1,1 }, + { "msp430cg4617",1,1 }, + { "msp430cg4618",1,1 }, + { "msp430cg4619",1,1 }, + { "msp430e112",0,0 }, + { "msp430e313",0,0 }, + { "msp430e315",0,0 }, + { "msp430e325",0,0 }, + { "msp430e337",0,1 }, + { "msp430f110",0,0 }, + { "msp430f1101",0,0 }, + { "msp430f1101a",0,0 }, + { "msp430f1111",0,0 }, + { "msp430f1111a",0,0 }, + { "msp430f112",0,0 }, + { "msp430f1121",0,0 }, + { "msp430f1121a",0,0 }, + { "msp430f1122",0,0 }, + { "msp430f1132",0,0 }, + { "msp430f122",0,0 }, + { "msp430f1222",0,0 }, + { "msp430f123",0,0 }, + { "msp430f1232",0,0 }, + { "msp430f133",0,0 }, + { "msp430f135",0,0 }, + { "msp430f147",0,1 }, + { "msp430f1471",0,1 }, + { "msp430f148",0,1 }, + { "msp430f1481",0,1 }, + { "msp430f149",0,1 }, + { "msp430f1491",0,1 }, + { "msp430f155",0,0 }, + { "msp430f156",0,0 }, + { "msp430f157",0,0 }, + { "msp430f1610",0,1 }, + { "msp430f1611",0,1 }, + { "msp430f1612",0,1 }, + { "msp430f167",0,1 }, + { "msp430f168",0,1 }, + { "msp430f169",0,1 }, + { "msp430f2001",0,0 }, + { "msp430f2002",0,0 }, + { "msp430f2003",0,0 }, + { "msp430f2011",0,0 }, + { "msp430f2012",0,0 }, + { "msp430f2013",0,0 }, + { "msp430f2101",0,0 }, + { "msp430f2111",0,0 }, + { "msp430f2112",0,0 }, + { "msp430f2121",0,0 }, + { "msp430f2122",0,0 }, + { "msp430f2131",0,0 }, + { "msp430f2132",0,0 }, + { "msp430f2232",0,0 }, + { "msp430f2234",0,0 }, + { "msp430f2252",0,0 }, + { "msp430f2254",0,0 }, + { "msp430f2272",0,0 }, + { "msp430f2274",0,0 }, + { "msp430f233",0,2 }, + { "msp430f2330",0,2 }, + { "msp430f235",0,2 }, + { "msp430f2350",0,2 }, + { "msp430f2370",0,2 }, + { "msp430f2410",0,2 }, + { "msp430f2416",1,2 }, + { "msp430f2417",1,2 }, + { "msp430f2418",1,2 }, + { "msp430f2419",1,2 }, + { "msp430f247",0,2 }, + { "msp430f2471",0,2 }, + { "msp430f248",0,2 }, + { "msp430f2481",0,2 }, + { "msp430f249",0,2 }, + { "msp430f2491",0,2 }, + { "msp430f2616",1,2 }, + { "msp430f2617",1,2 }, + { "msp430f2618",1,2 }, + { "msp430f2619",1,2 }, + { "msp430f412",0,0 }, + { "msp430f413",0,0 }, + { "msp430f4132",0,0 }, + { "msp430f415",0,0 }, + { "msp430f4152",0,0 }, + { "msp430f417",0,0 }, + { "msp430f423",0,1 }, + { "msp430f423a",0,1 }, + { "msp430f425",0,1 }, + { "msp430f4250",0,0 }, + { "msp430f425a",0,1 }, + { "msp430f4260",0,0 }, + { "msp430f427",0,1 }, + { "msp430f4270",0,0 }, + { "msp430f427a",0,1 }, + { "msp430f435",0,0 }, + { "msp430f4351",0,0 }, + { "msp430f436",0,0 }, + { "msp430f4361",0,0 }, + { "msp430f437",0,0 }, + { "msp430f4371",0,0 }, + { "msp430f438",0,0 }, + { "msp430f439",0,0 }, + { "msp430f447",0,1 }, + { "msp430f448",0,1 }, + { "msp430f4481",0,1 }, + { "msp430f449",0,1 }, + { "msp430f4491",0,1 }, + { "msp430f4616",1,1 }, + { "msp430f46161",1,1 }, + { "msp430f4617",1,1 }, + { "msp430f46171",1,1 }, + { "msp430f4618",1,1 }, + { "msp430f46181",1,1 }, + { "msp430f4619",1,1 }, + { "msp430f46191",1,1 }, + { "msp430f47126",1,4 }, + { "msp430f47127",1,4 }, + { "msp430f47163",1,4 }, + { "msp430f47166",1,4 }, + { "msp430f47167",1,4 }, + { "msp430f47173",1,4 }, + { "msp430f47176",1,4 }, + { "msp430f47177",1,4 }, + { "msp430f47183",1,4 }, + { "msp430f47186",1,4 }, + { "msp430f47187",1,4 }, + { "msp430f47193",1,4 }, + { "msp430f47196",1,4 }, + { "msp430f47197",1,4 }, + { "msp430f477",0,0 }, + { "msp430f478",0,0 }, + { "msp430f4783",0,4 }, + { "msp430f4784",0,4 }, + { "msp430f479",0,0 }, + { "msp430f4793",0,4 }, + { "msp430f4794",0,4 }, + { "msp430f5131",2,8 }, + { "msp430f5132",2,8 }, + { "msp430f5151",2,8 }, + { "msp430f5152",2,8 }, + { "msp430f5171",2,8 }, + { "msp430f5172",2,8 }, + { "msp430f5212",2,8 }, + { "msp430f5213",2,8 }, + { "msp430f5214",2,8 }, + { "msp430f5217",2,8 }, + { "msp430f5218",2,8 }, + { "msp430f5219",2,8 }, + { "msp430f5222",2,8 }, + { "msp430f5223",2,8 }, + { "msp430f5224",2,8 }, + { "msp430f5227",2,8 }, + { "msp430f5228",2,8 }, + { "msp430f5229",2,8 }, + { "msp430f5232",2,8 }, + { "msp430f5234",2,8 }, + { "msp430f5237",2,8 }, + { "msp430f5239",2,8 }, + { "msp430f5242",2,8 }, + { "msp430f5244",2,8 }, + { "msp430f5247",2,8 }, + { "msp430f5249",2,8 }, + { "msp430f5252",2,8 }, + { "msp430f5253",2,8 }, + { "msp430f5254",2,8 }, + { "msp430f5255",2,8 }, + { "msp430f5256",2,8 }, + { "msp430f5257",2,8 }, + { "msp430f5258",2,8 }, + { "msp430f5259",2,8 }, + { "msp430f5304",2,8 }, + { "msp430f5308",2,8 }, + { "msp430f5309",2,8 }, + { "msp430f5310",2,8 }, + { "msp430f5324",2,8 }, + { "msp430f5325",2,8 }, + { "msp430f5326",2,8 }, + { "msp430f5327",2,8 }, + { "msp430f5328",2,8 }, + { "msp430f5329",2,8 }, + { "msp430f5333",2,8 }, + { "msp430f5335",2,8 }, + { "msp430f5336",2,8 }, + { "msp430f5338",2,8 }, + { "msp430f5340",2,8 }, + { "msp430f5341",2,8 }, + { "msp430f5342",2,8 }, + { "msp430f5358",2,8 }, + { "msp430f5359",2,8 }, + { "msp430f5418",2,8 }, + { "msp430f5418a",2,8 }, + { "msp430f5419",2,8 }, + { "msp430f5419a",2,8 }, + { "msp430f5435",2,8 }, + { "msp430f5435a",2,8 }, + { "msp430f5436",2,8 }, + { "msp430f5436a",2,8 }, + { "msp430f5437",2,8 }, + { "msp430f5437a",2,8 }, + { "msp430f5438",2,8 }, + { "msp430f5438a",2,8 }, + { "msp430f5500",2,8 }, + { "msp430f5501",2,8 }, + { "msp430f5502",2,8 }, + { "msp430f5503",2,8 }, + { "msp430f5504",2,8 }, + { "msp430f5505",2,8 }, + { "msp430f5506",2,8 }, + { "msp430f5507",2,8 }, + { "msp430f5508",2,8 }, + { "msp430f5509",2,8 }, + { "msp430f5510",2,8 }, + { "msp430f5513",2,8 }, + { "msp430f5514",2,8 }, + { "msp430f5515",2,8 }, + { "msp430f5517",2,8 }, + { "msp430f5519",2,8 }, + { "msp430f5521",2,8 }, + { "msp430f5522",2,8 }, + { "msp430f5524",2,8 }, + { "msp430f5525",2,8 }, + { "msp430f5526",2,8 }, + { "msp430f5527",2,8 }, + { "msp430f5528",2,8 }, + { "msp430f5529",2,8 }, + { "msp430f5630",2,8 }, + { "msp430f5631",2,8 }, + { "msp430f5632",2,8 }, + { "msp430f5633",2,8 }, + { "msp430f5634",2,8 }, + { "msp430f5635",2,8 }, + { "msp430f5636",2,8 }, + { "msp430f5637",2,8 }, + { "msp430f5638",2,8 }, + { "msp430f5658",2,8 }, + { "msp430f5659",2,8 }, + { "msp430f5xx_6xxgeneric",2,8 }, + { "msp430f6433",2,8 }, + { "msp430f6435",2,8 }, + { "msp430f6436",2,8 }, + { "msp430f6438",2,8 }, + { "msp430f6458",2,8 }, + { "msp430f6459",2,8 }, + { "msp430f6630",2,8 }, + { "msp430f6631",2,8 }, + { "msp430f6632",2,8 }, + { "msp430f6633",2,8 }, + { "msp430f6634",2,8 }, + { "msp430f6635",2,8 }, + { "msp430f6636",2,8 }, + { "msp430f6637",2,8 }, + { "msp430f6638",2,8 }, + { "msp430f6658",2,8 }, + { "msp430f6659",2,8 }, + { "msp430f6720",2,8 }, + { "msp430f6720a",2,8 }, + { "msp430f6721",2,8 }, + { "msp430f6721a",2,8 }, + { "msp430f6723",2,8 }, + { "msp430f6723a",2,8 }, + { "msp430f6724",2,8 }, + { "msp430f6724a",2,8 }, + { "msp430f6725",2,8 }, + { "msp430f6725a",2,8 }, + { "msp430f6726",2,8 }, + { "msp430f6726a",2,8 }, + { "msp430f6730",2,8 }, + { "msp430f6730a",2,8 }, + { "msp430f6731",2,8 }, + { "msp430f6731a",2,8 }, + { "msp430f6733",2,8 }, + { "msp430f6733a",2,8 }, + { "msp430f6734",2,8 }, + { "msp430f6734a",2,8 }, + { "msp430f6735",2,8 }, + { "msp430f6735a",2,8 }, + { "msp430f6736",2,8 }, + { "msp430f6736a",2,8 }, + { "msp430f6745",2,8 }, + { "msp430f67451",2,8 }, + { "msp430f67451a",2,8 }, + { "msp430f6745a",2,8 }, + { "msp430f6746",2,8 }, + { "msp430f67461",2,8 }, + { "msp430f67461a",2,8 }, + { "msp430f6746a",2,8 }, + { "msp430f6747",2,8 }, + { "msp430f67471",2,8 }, + { "msp430f67471a",2,8 }, + { "msp430f6747a",2,8 }, + { "msp430f6748",2,8 }, + { "msp430f67481",2,8 }, + { "msp430f67481a",2,8 }, + { "msp430f6748a",2,8 }, + { "msp430f6749",2,8 }, + { "msp430f67491",2,8 }, + { "msp430f67491a",2,8 }, + { "msp430f6749a",2,8 }, + { "msp430f67621",2,8 }, + { "msp430f67621a",2,8 }, + { "msp430f67641",2,8 }, + { "msp430f67641a",2,8 }, + { "msp430f6765",2,8 }, + { "msp430f67651",2,8 }, + { "msp430f67651a",2,8 }, + { "msp430f6765a",2,8 }, + { "msp430f6766",2,8 }, + { "msp430f67661",2,8 }, + { "msp430f67661a",2,8 }, + { "msp430f6766a",2,8 }, + { "msp430f6767",2,8 }, + { "msp430f67671",2,8 }, + { "msp430f67671a",2,8 }, + { "msp430f6767a",2,8 }, + { "msp430f6768",2,8 }, + { "msp430f67681",2,8 }, + { "msp430f67681a",2,8 }, + { "msp430f6768a",2,8 }, + { "msp430f6769",2,8 }, + { "msp430f67691",2,8 }, + { "msp430f67691a",2,8 }, + { "msp430f6769a",2,8 }, + { "msp430f6775",2,8 }, + { "msp430f67751",2,8 }, + { "msp430f67751a",2,8 }, + { "msp430f6775a",2,8 }, + { "msp430f6776",2,8 }, + { "msp430f67761",2,8 }, + { "msp430f67761a",2,8 }, + { "msp430f6776a",2,8 }, + { "msp430f6777",2,8 }, + { "msp430f67771",2,8 }, + { "msp430f67771a",2,8 }, + { "msp430f6777a",2,8 }, + { "msp430f6778",2,8 }, + { "msp430f67781",2,8 }, + { "msp430f67781a",2,8 }, + { "msp430f6778a",2,8 }, + { "msp430f6779",2,8 }, + { "msp430f67791",2,8 }, + { "msp430f67791a",2,8 }, + { "msp430f6779a",2,8 }, + { "msp430fe423",0,0 }, + { "msp430fe4232",0,0 }, + { "msp430fe423a",0,0 }, + { "msp430fe4242",0,0 }, + { "msp430fe425",0,0 }, + { "msp430fe4252",0,0 }, + { "msp430fe425a",0,0 }, + { "msp430fe427",0,0 }, + { "msp430fe4272",0,0 }, + { "msp430fe427a",0,0 }, + { "msp430fg4250",0,0 }, + { "msp430fg4260",0,0 }, + { "msp430fg4270",0,0 }, + { "msp430fg437",0,0 }, + { "msp430fg438",0,0 }, + { "msp430fg439",0,0 }, + { "msp430fg4616",1,1 }, + { "msp430fg4617",1,1 }, + { "msp430fg4618",1,1 }, + { "msp430fg4619",1,1 }, + { "msp430fg477",0,0 }, + { "msp430fg478",0,0 }, + { "msp430fg479",0,0 }, + { "msp430fg6425",2,8 }, + { "msp430fg6426",2,8 }, + { "msp430fg6625",2,8 }, + { "msp430fg6626",2,8 }, + { "msp430fr2032",2,0 }, + { "msp430fr2033",2,0 }, + { "msp430fr2110",2,0 }, + { "msp430fr2111",2,0 }, + { "msp430fr2310",2,0 }, + { "msp430fr2311",2,0 }, + { "msp430fr2433",2,8 }, + { "msp430fr2532",2,8 }, + { "msp430fr2533",2,8 }, + { "msp430fr2632",2,8 }, + { "msp430fr2633",2,8 }, + { "msp430fr2xx_4xxgeneric",2,8 }, + { "msp430fr4131",2,0 }, + { "msp430fr4132",2,0 }, + { "msp430fr4133",2,0 }, + { "msp430fr5720",2,8 }, + { "msp430fr5721",2,8 }, + { "msp430fr5722",2,8 }, + { "msp430fr5723",2,8 }, + { "msp430fr5724",2,8 }, + { "msp430fr5725",2,8 }, + { "msp430fr5726",2,8 }, + { "msp430fr5727",2,8 }, + { "msp430fr5728",2,8 }, + { "msp430fr5729",2,8 }, + { "msp430fr5730",2,8 }, + { "msp430fr5731",2,8 }, + { "msp430fr5732",2,8 }, + { "msp430fr5733",2,8 }, + { "msp430fr5734",2,8 }, + { "msp430fr5735",2,8 }, + { "msp430fr5736",2,8 }, + { "msp430fr5737",2,8 }, + { "msp430fr5738",2,8 }, + { "msp430fr5739",2,8 }, + { "msp430fr57xxgeneric",2,8 }, + { "msp430fr5847",2,8 }, + { "msp430fr58471",2,8 }, + { "msp430fr5848",2,8 }, + { "msp430fr5849",2,8 }, + { "msp430fr5857",2,8 }, + { "msp430fr5858",2,8 }, + { "msp430fr5859",2,8 }, + { "msp430fr5867",2,8 }, + { "msp430fr58671",2,8 }, + { "msp430fr5868",2,8 }, + { "msp430fr5869",2,8 }, + { "msp430fr5870",2,8 }, + { "msp430fr5872",2,8 }, + { "msp430fr58721",2,8 }, + { "msp430fr5887",2,8 }, + { "msp430fr5888",2,8 }, + { "msp430fr5889",2,8 }, + { "msp430fr58891",2,8 }, + { "msp430fr5922",2,8 }, + { "msp430fr59221",2,8 }, + { "msp430fr5947",2,8 }, + { "msp430fr59471",2,8 }, + { "msp430fr5948",2,8 }, + { "msp430fr5949",2,8 }, + { "msp430fr5957",2,8 }, + { "msp430fr5958",2,8 }, + { "msp430fr5959",2,8 }, + { "msp430fr5962",2,8 }, + { "msp430fr5964",2,8 }, + { "msp430fr5967",2,8 }, + { "msp430fr5968",2,8 }, + { "msp430fr5969",2,8 }, + { "msp430fr59691",2,8 }, + { "msp430fr5970",2,8 }, + { "msp430fr5972",2,8 }, + { "msp430fr59721",2,8 }, + { "msp430fr5986",2,8 }, + { "msp430fr5987",2,8 }, + { "msp430fr5988",2,8 }, + { "msp430fr5989",2,8 }, + { "msp430fr59891",2,8 }, + { "msp430fr5992",2,8 }, + { "msp430fr5994",2,8 }, + { "msp430fr59941",2,8 }, + { "msp430fr5xx_6xxgeneric",2,8 }, + { "msp430fr6820",2,8 }, + { "msp430fr6822",2,8 }, + { "msp430fr68221",2,8 }, + { "msp430fr6870",2,8 }, + { "msp430fr6872",2,8 }, + { "msp430fr68721",2,8 }, + { "msp430fr6877",2,8 }, + { "msp430fr6879",2,8 }, + { "msp430fr68791",2,8 }, + { "msp430fr6887",2,8 }, + { "msp430fr6888",2,8 }, + { "msp430fr6889",2,8 }, + { "msp430fr68891",2,8 }, + { "msp430fr6920",2,8 }, + { "msp430fr6922",2,8 }, + { "msp430fr69221",2,8 }, + { "msp430fr6927",2,8 }, + { "msp430fr69271",2,8 }, + { "msp430fr6928",2,8 }, + { "msp430fr6970",2,8 }, + { "msp430fr6972",2,8 }, + { "msp430fr69721",2,8 }, + { "msp430fr6977",2,8 }, + { "msp430fr6979",2,8 }, + { "msp430fr69791",2,8 }, + { "msp430fr6987",2,8 }, + { "msp430fr6988",2,8 }, + { "msp430fr6989",2,8 }, + { "msp430fr69891",2,8 }, + { "msp430fw423",0,0 }, + { "msp430fw425",0,0 }, + { "msp430fw427",0,0 }, + { "msp430fw428",0,0 }, + { "msp430fw429",0,0 }, + { "msp430g2001",0,0 }, + { "msp430g2101",0,0 }, + { "msp430g2102",0,0 }, + { "msp430g2111",0,0 }, + { "msp430g2112",0,0 }, + { "msp430g2113",0,0 }, + { "msp430g2121",0,0 }, + { "msp430g2131",0,0 }, + { "msp430g2132",0,0 }, + { "msp430g2152",0,0 }, + { "msp430g2153",0,0 }, + { "msp430g2201",0,0 }, + { "msp430g2202",0,0 }, + { "msp430g2203",0,0 }, + { "msp430g2210",0,0 }, + { "msp430g2211",0,0 }, + { "msp430g2212",0,0 }, + { "msp430g2213",0,0 }, + { "msp430g2221",0,0 }, + { "msp430g2230",0,0 }, + { "msp430g2231",0,0 }, + { "msp430g2232",0,0 }, + { "msp430g2233",0,0 }, + { "msp430g2252",0,0 }, + { "msp430g2253",0,0 }, + { "msp430g2302",0,0 }, + { "msp430g2303",0,0 }, + { "msp430g2312",0,0 }, + { "msp430g2313",0,0 }, + { "msp430g2332",0,0 }, + { "msp430g2333",0,0 }, + { "msp430g2352",0,0 }, + { "msp430g2353",0,0 }, + { "msp430g2402",0,0 }, + { "msp430g2403",0,0 }, + { "msp430g2412",0,0 }, + { "msp430g2413",0,0 }, + { "msp430g2432",0,0 }, + { "msp430g2433",0,0 }, + { "msp430g2444",0,0 }, + { "msp430g2452",0,0 }, + { "msp430g2453",0,0 }, + { "msp430g2513",0,0 }, + { "msp430g2533",0,0 }, + { "msp430g2544",0,0 }, + { "msp430g2553",0,0 }, + { "msp430g2744",0,0 }, + { "msp430g2755",0,0 }, + { "msp430g2855",0,0 }, + { "msp430g2955",0,0 }, + { "msp430i2020",0,2 }, + { "msp430i2021",0,2 }, + { "msp430i2030",0,2 }, + { "msp430i2031",0,2 }, + { "msp430i2040",0,2 }, + { "msp430i2041",0,2 }, + { "msp430i2xxgeneric",0,2 }, + { "msp430l092",0,0 }, + { "msp430p112",0,0 }, + { "msp430p313",0,0 }, + { "msp430p315",0,0 }, + { "msp430p315s",0,0 }, + { "msp430p325",0,0 }, + { "msp430p337",0,1 }, + { "msp430sl5438a",2,8 }, + { "msp430tch5e",0,0 }, + { "msp430xgeneric",2,8 }, + { "rf430f5144",2,8 }, + { "rf430f5155",2,8 }, + { "rf430f5175",2,8 }, + { "rf430frl152h",0,0 }, + { "rf430frl152h_rom",0,0 }, + { "rf430frl153h",0,0 }, + { "rf430frl153h_rom",0,0 }, + { "rf430frl154h",0,0 }, + { "rf430frl154h_rom",0,0 } +}; diff --git a/gcc/config/msp430/msp430-devices.h b/gcc/config/msp430/msp430-devices.h new file mode 100644 index 00000000000..08ae1adf4ed --- /dev/null +++ b/gcc/config/msp430/msp430-devices.h @@ -0,0 +1,31 @@ +/* Definitions of subroutines used for reading MCU data on TI MSP430 processors. + Copyright (C) 2019 Free Software Foundation, Inc. + Contributed by Jozef Lawrynowicz . + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + GCC is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING3. If not see + . */ + +struct t_msp430_mcu_data +{ + const char * name; + unsigned int revision; /* 0=> MSP430, 1=>MSP430X, 2=> MSP430Xv2. */ + unsigned int hwmpy; /* 0=>none, 1=>16-bit, 2=>16-bit w/sign extend. */ + /* 4=>32-bit, 8=> 32-bit (5xx). */ +}; + +extern struct t_msp430_mcu_data extracted_mcu_data; + +void msp430_extract_mcu_data (const char * mcu_name); diff --git a/gcc/config/msp430/msp430.c b/gcc/config/msp430/msp430.c index c7b774e71a6..49fc26238a5 100644 --- a/gcc/config/msp430/msp430.c +++ b/gcc/config/msp430/msp430.c @@ -45,6 +45,7 @@ #include "langhooks.h" #include "builtins.h" #include "intl.h" +#include "msp430-devices.h" /* This file should be included last. */ #include "target-def.h" @@ -95,627 +96,6 @@ msp430_init_machine_status (void) #undef TARGET_OPTION_OVERRIDE #define TARGET_OPTION_OVERRIDE msp430_option_override -/* This is a copy of the same data structure found in gas/config/tc-msp430.c - Also another (sort-of) copy can be found in gcc/config/msp430/t-msp430 - Keep these three structures in sync. - The data in this structure has been extracted from version 1.194 of the - devices.csv file released by TI in September 2016. */ - -struct msp430_mcu_data -{ - const char * name; - unsigned int revision; /* 0=> MSP430, 1=>MSP430X, 2=> MSP430Xv2. */ - unsigned int hwmpy; /* 0=>none, 1=>16-bit, 2=>16-bit w/sign extend, 4=>32-bit, 8=> 32-bit (5xx). */ -} -msp430_mcu_data [] = -{ - { "cc430f5123",2,8 }, - { "cc430f5125",2,8 }, - { "cc430f5133",2,8 }, - { "cc430f5135",2,8 }, - { "cc430f5137",2,8 }, - { "cc430f5143",2,8 }, - { "cc430f5145",2,8 }, - { "cc430f5147",2,8 }, - { "cc430f6125",2,8 }, - { "cc430f6126",2,8 }, - { "cc430f6127",2,8 }, - { "cc430f6135",2,8 }, - { "cc430f6137",2,8 }, - { "cc430f6143",2,8 }, - { "cc430f6145",2,8 }, - { "cc430f6147",2,8 }, - { "msp430afe221",0,2 }, - { "msp430afe222",0,2 }, - { "msp430afe223",0,2 }, - { "msp430afe231",0,2 }, - { "msp430afe232",0,2 }, - { "msp430afe233",0,2 }, - { "msp430afe251",0,2 }, - { "msp430afe252",0,2 }, - { "msp430afe253",0,2 }, - { "msp430bt5190",2,8 }, - { "msp430c091",0,0 }, - { "msp430c092",0,0 }, - { "msp430c111",0,0 }, - { "msp430c1111",0,0 }, - { "msp430c112",0,0 }, - { "msp430c1121",0,0 }, - { "msp430c1331",0,0 }, - { "msp430c1351",0,0 }, - { "msp430c311s",0,0 }, - { "msp430c312",0,0 }, - { "msp430c313",0,0 }, - { "msp430c314",0,0 }, - { "msp430c315",0,0 }, - { "msp430c323",0,0 }, - { "msp430c325",0,0 }, - { "msp430c336",0,1 }, - { "msp430c337",0,1 }, - { "msp430c412",0,0 }, - { "msp430c413",0,0 }, - { "msp430cg4616",1,1 }, - { "msp430cg4617",1,1 }, - { "msp430cg4618",1,1 }, - { "msp430cg4619",1,1 }, - { "msp430e112",0,0 }, - { "msp430e313",0,0 }, - { "msp430e315",0,0 }, - { "msp430e325",0,0 }, - { "msp430e337",0,1 }, - { "msp430f110",0,0 }, - { "msp430f1101",0,0 }, - { "msp430f1101a",0,0 }, - { "msp430f1111",0,0 }, - { "msp430f1111a",0,0 }, - { "msp430f112",0,0 }, - { "msp430f1121",0,0 }, - { "msp430f1121a",0,0 }, - { "msp430f1122",0,0 }, - { "msp430f1132",0,0 }, - { "msp430f122",0,0 }, - { "msp430f1222",0,0 }, - { "msp430f123",0,0 }, - { "msp430f1232",0,0 }, - { "msp430f133",0,0 }, - { "msp430f135",0,0 }, - { "msp430f147",0,1 }, - { "msp430f1471",0,1 }, - { "msp430f148",0,1 }, - { "msp430f1481",0,1 }, - { "msp430f149",0,1 }, - { "msp430f1491",0,1 }, - { "msp430f155",0,0 }, - { "msp430f156",0,0 }, - { "msp430f157",0,0 }, - { "msp430f1610",0,1 }, - { "msp430f1611",0,1 }, - { "msp430f1612",0,1 }, - { "msp430f167",0,1 }, - { "msp430f168",0,1 }, - { "msp430f169",0,1 }, - { "msp430f2001",0,0 }, - { "msp430f2002",0,0 }, - { "msp430f2003",0,0 }, - { "msp430f2011",0,0 }, - { "msp430f2012",0,0 }, - { "msp430f2013",0,0 }, - { "msp430f2101",0,0 }, - { "msp430f2111",0,0 }, - { "msp430f2112",0,0 }, - { "msp430f2121",0,0 }, - { "msp430f2122",0,0 }, - { "msp430f2131",0,0 }, - { "msp430f2132",0,0 }, - { "msp430f2232",0,0 }, - { "msp430f2234",0,0 }, - { "msp430f2252",0,0 }, - { "msp430f2254",0,0 }, - { "msp430f2272",0,0 }, - { "msp430f2274",0,0 }, - { "msp430f233",0,2 }, - { "msp430f2330",0,2 }, - { "msp430f235",0,2 }, - { "msp430f2350",0,2 }, - { "msp430f2370",0,2 }, - { "msp430f2410",0,2 }, - { "msp430f2416",1,2 }, - { "msp430f2417",1,2 }, - { "msp430f2418",1,2 }, - { "msp430f2419",1,2 }, - { "msp430f247",0,2 }, - { "msp430f2471",0,2 }, - { "msp430f248",0,2 }, - { "msp430f2481",0,2 }, - { "msp430f249",0,2 }, - { "msp430f2491",0,2 }, - { "msp430f2616",1,2 }, - { "msp430f2617",1,2 }, - { "msp430f2618",1,2 }, - { "msp430f2619",1,2 }, - { "msp430f412",0,0 }, - { "msp430f413",0,0 }, - { "msp430f4132",0,0 }, - { "msp430f415",0,0 }, - { "msp430f4152",0,0 }, - { "msp430f417",0,0 }, - { "msp430f423",0,1 }, - { "msp430f423a",0,1 }, - { "msp430f425",0,1 }, - { "msp430f4250",0,0 }, - { "msp430f425a",0,1 }, - { "msp430f4260",0,0 }, - { "msp430f427",0,1 }, - { "msp430f4270",0,0 }, - { "msp430f427a",0,1 }, - { "msp430f435",0,0 }, - { "msp430f4351",0,0 }, - { "msp430f436",0,0 }, - { "msp430f4361",0,0 }, - { "msp430f437",0,0 }, - { "msp430f4371",0,0 }, - { "msp430f438",0,0 }, - { "msp430f439",0,0 }, - { "msp430f447",0,1 }, - { "msp430f448",0,1 }, - { "msp430f4481",0,1 }, - { "msp430f449",0,1 }, - { "msp430f4491",0,1 }, - { "msp430f4616",1,1 }, - { "msp430f46161",1,1 }, - { "msp430f4617",1,1 }, - { "msp430f46171",1,1 }, - { "msp430f4618",1,1 }, - { "msp430f46181",1,1 }, - { "msp430f4619",1,1 }, - { "msp430f46191",1,1 }, - { "msp430f47126",1,4 }, - { "msp430f47127",1,4 }, - { "msp430f47163",1,4 }, - { "msp430f47166",1,4 }, - { "msp430f47167",1,4 }, - { "msp430f47173",1,4 }, - { "msp430f47176",1,4 }, - { "msp430f47177",1,4 }, - { "msp430f47183",1,4 }, - { "msp430f47186",1,4 }, - { "msp430f47187",1,4 }, - { "msp430f47193",1,4 }, - { "msp430f47196",1,4 }, - { "msp430f47197",1,4 }, - { "msp430f477",0,0 }, - { "msp430f478",0,0 }, - { "msp430f4783",0,4 }, - { "msp430f4784",0,4 }, - { "msp430f479",0,0 }, - { "msp430f4793",0,4 }, - { "msp430f4794",0,4 }, - { "msp430f5131",2,8 }, - { "msp430f5132",2,8 }, - { "msp430f5151",2,8 }, - { "msp430f5152",2,8 }, - { "msp430f5171",2,8 }, - { "msp430f5172",2,8 }, - { "msp430f5212",2,8 }, - { "msp430f5213",2,8 }, - { "msp430f5214",2,8 }, - { "msp430f5217",2,8 }, - { "msp430f5218",2,8 }, - { "msp430f5219",2,8 }, - { "msp430f5222",2,8 }, - { "msp430f5223",2,8 }, - { "msp430f5224",2,8 }, - { "msp430f5227",2,8 }, - { "msp430f5228",2,8 }, - { "msp430f5229",2,8 }, - { "msp430f5232",2,8 }, - { "msp430f5234",2,8 }, - { "msp430f5237",2,8 }, - { "msp430f5239",2,8 }, - { "msp430f5242",2,8 }, - { "msp430f5244",2,8 }, - { "msp430f5247",2,8 }, - { "msp430f5249",2,8 }, - { "msp430f5252",2,8 }, - { "msp430f5253",2,8 }, - { "msp430f5254",2,8 }, - { "msp430f5255",2,8 }, - { "msp430f5256",2,8 }, - { "msp430f5257",2,8 }, - { "msp430f5258",2,8 }, - { "msp430f5259",2,8 }, - { "msp430f5304",2,8 }, - { "msp430f5308",2,8 }, - { "msp430f5309",2,8 }, - { "msp430f5310",2,8 }, - { "msp430f5324",2,8 }, - { "msp430f5325",2,8 }, - { "msp430f5326",2,8 }, - { "msp430f5327",2,8 }, - { "msp430f5328",2,8 }, - { "msp430f5329",2,8 }, - { "msp430f5333",2,8 }, - { "msp430f5335",2,8 }, - { "msp430f5336",2,8 }, - { "msp430f5338",2,8 }, - { "msp430f5340",2,8 }, - { "msp430f5341",2,8 }, - { "msp430f5342",2,8 }, - { "msp430f5358",2,8 }, - { "msp430f5359",2,8 }, - { "msp430f5418",2,8 }, - { "msp430f5418a",2,8 }, - { "msp430f5419",2,8 }, - { "msp430f5419a",2,8 }, - { "msp430f5435",2,8 }, - { "msp430f5435a",2,8 }, - { "msp430f5436",2,8 }, - { "msp430f5436a",2,8 }, - { "msp430f5437",2,8 }, - { "msp430f5437a",2,8 }, - { "msp430f5438",2,8 }, - { "msp430f5438a",2,8 }, - { "msp430f5500",2,8 }, - { "msp430f5501",2,8 }, - { "msp430f5502",2,8 }, - { "msp430f5503",2,8 }, - { "msp430f5504",2,8 }, - { "msp430f5505",2,8 }, - { "msp430f5506",2,8 }, - { "msp430f5507",2,8 }, - { "msp430f5508",2,8 }, - { "msp430f5509",2,8 }, - { "msp430f5510",2,8 }, - { "msp430f5513",2,8 }, - { "msp430f5514",2,8 }, - { "msp430f5515",2,8 }, - { "msp430f5517",2,8 }, - { "msp430f5519",2,8 }, - { "msp430f5521",2,8 }, - { "msp430f5522",2,8 }, - { "msp430f5524",2,8 }, - { "msp430f5525",2,8 }, - { "msp430f5526",2,8 }, - { "msp430f5527",2,8 }, - { "msp430f5528",2,8 }, - { "msp430f5529",2,8 }, - { "msp430f5630",2,8 }, - { "msp430f5631",2,8 }, - { "msp430f5632",2,8 }, - { "msp430f5633",2,8 }, - { "msp430f5634",2,8 }, - { "msp430f5635",2,8 }, - { "msp430f5636",2,8 }, - { "msp430f5637",2,8 }, - { "msp430f5638",2,8 }, - { "msp430f5658",2,8 }, - { "msp430f5659",2,8 }, - { "msp430f5xx_6xxgeneric",2,8 }, - { "msp430f6433",2,8 }, - { "msp430f6435",2,8 }, - { "msp430f6436",2,8 }, - { "msp430f6438",2,8 }, - { "msp430f6458",2,8 }, - { "msp430f6459",2,8 }, - { "msp430f6630",2,8 }, - { "msp430f6631",2,8 }, - { "msp430f6632",2,8 }, - { "msp430f6633",2,8 }, - { "msp430f6634",2,8 }, - { "msp430f6635",2,8 }, - { "msp430f6636",2,8 }, - { "msp430f6637",2,8 }, - { "msp430f6638",2,8 }, - { "msp430f6658",2,8 }, - { "msp430f6659",2,8 }, - { "msp430f6720",2,8 }, - { "msp430f6720a",2,8 }, - { "msp430f6721",2,8 }, - { "msp430f6721a",2,8 }, - { "msp430f6723",2,8 }, - { "msp430f6723a",2,8 }, - { "msp430f6724",2,8 }, - { "msp430f6724a",2,8 }, - { "msp430f6725",2,8 }, - { "msp430f6725a",2,8 }, - { "msp430f6726",2,8 }, - { "msp430f6726a",2,8 }, - { "msp430f6730",2,8 }, - { "msp430f6730a",2,8 }, - { "msp430f6731",2,8 }, - { "msp430f6731a",2,8 }, - { "msp430f6733",2,8 }, - { "msp430f6733a",2,8 }, - { "msp430f6734",2,8 }, - { "msp430f6734a",2,8 }, - { "msp430f6735",2,8 }, - { "msp430f6735a",2,8 }, - { "msp430f6736",2,8 }, - { "msp430f6736a",2,8 }, - { "msp430f6745",2,8 }, - { "msp430f67451",2,8 }, - { "msp430f67451a",2,8 }, - { "msp430f6745a",2,8 }, - { "msp430f6746",2,8 }, - { "msp430f67461",2,8 }, - { "msp430f67461a",2,8 }, - { "msp430f6746a",2,8 }, - { "msp430f6747",2,8 }, - { "msp430f67471",2,8 }, - { "msp430f67471a",2,8 }, - { "msp430f6747a",2,8 }, - { "msp430f6748",2,8 }, - { "msp430f67481",2,8 }, - { "msp430f67481a",2,8 }, - { "msp430f6748a",2,8 }, - { "msp430f6749",2,8 }, - { "msp430f67491",2,8 }, - { "msp430f67491a",2,8 }, - { "msp430f6749a",2,8 }, - { "msp430f67621",2,8 }, - { "msp430f67621a",2,8 }, - { "msp430f67641",2,8 }, - { "msp430f67641a",2,8 }, - { "msp430f6765",2,8 }, - { "msp430f67651",2,8 }, - { "msp430f67651a",2,8 }, - { "msp430f6765a",2,8 }, - { "msp430f6766",2,8 }, - { "msp430f67661",2,8 }, - { "msp430f67661a",2,8 }, - { "msp430f6766a",2,8 }, - { "msp430f6767",2,8 }, - { "msp430f67671",2,8 }, - { "msp430f67671a",2,8 }, - { "msp430f6767a",2,8 }, - { "msp430f6768",2,8 }, - { "msp430f67681",2,8 }, - { "msp430f67681a",2,8 }, - { "msp430f6768a",2,8 }, - { "msp430f6769",2,8 }, - { "msp430f67691",2,8 }, - { "msp430f67691a",2,8 }, - { "msp430f6769a",2,8 }, - { "msp430f6775",2,8 }, - { "msp430f67751",2,8 }, - { "msp430f67751a",2,8 }, - { "msp430f6775a",2,8 }, - { "msp430f6776",2,8 }, - { "msp430f67761",2,8 }, - { "msp430f67761a",2,8 }, - { "msp430f6776a",2,8 }, - { "msp430f6777",2,8 }, - { "msp430f67771",2,8 }, - { "msp430f67771a",2,8 }, - { "msp430f6777a",2,8 }, - { "msp430f6778",2,8 }, - { "msp430f67781",2,8 }, - { "msp430f67781a",2,8 }, - { "msp430f6778a",2,8 }, - { "msp430f6779",2,8 }, - { "msp430f67791",2,8 }, - { "msp430f67791a",2,8 }, - { "msp430f6779a",2,8 }, - { "msp430fe423",0,0 }, - { "msp430fe4232",0,0 }, - { "msp430fe423a",0,0 }, - { "msp430fe4242",0,0 }, - { "msp430fe425",0,0 }, - { "msp430fe4252",0,0 }, - { "msp430fe425a",0,0 }, - { "msp430fe427",0,0 }, - { "msp430fe4272",0,0 }, - { "msp430fe427a",0,0 }, - { "msp430fg4250",0,0 }, - { "msp430fg4260",0,0 }, - { "msp430fg4270",0,0 }, - { "msp430fg437",0,0 }, - { "msp430fg438",0,0 }, - { "msp430fg439",0,0 }, - { "msp430fg4616",1,1 }, - { "msp430fg4617",1,1 }, - { "msp430fg4618",1,1 }, - { "msp430fg4619",1,1 }, - { "msp430fg477",0,0 }, - { "msp430fg478",0,0 }, - { "msp430fg479",0,0 }, - { "msp430fg6425",2,8 }, - { "msp430fg6426",2,8 }, - { "msp430fg6625",2,8 }, - { "msp430fg6626",2,8 }, - { "msp430fr2032",2,0 }, - { "msp430fr2033",2,0 }, - { "msp430fr2110",2,0 }, - { "msp430fr2111",2,0 }, - { "msp430fr2310",2,0 }, - { "msp430fr2311",2,0 }, - { "msp430fr2433",2,8 }, - { "msp430fr2532",2,8 }, - { "msp430fr2533",2,8 }, - { "msp430fr2632",2,8 }, - { "msp430fr2633",2,8 }, - { "msp430fr2xx_4xxgeneric",2,8 }, - { "msp430fr4131",2,0 }, - { "msp430fr4132",2,0 }, - { "msp430fr4133",2,0 }, - { "msp430fr5720",2,8 }, - { "msp430fr5721",2,8 }, - { "msp430fr5722",2,8 }, - { "msp430fr5723",2,8 }, - { "msp430fr5724",2,8 }, - { "msp430fr5725",2,8 }, - { "msp430fr5726",2,8 }, - { "msp430fr5727",2,8 }, - { "msp430fr5728",2,8 }, - { "msp430fr5729",2,8 }, - { "msp430fr5730",2,8 }, - { "msp430fr5731",2,8 }, - { "msp430fr5732",2,8 }, - { "msp430fr5733",2,8 }, - { "msp430fr5734",2,8 }, - { "msp430fr5735",2,8 }, - { "msp430fr5736",2,8 }, - { "msp430fr5737",2,8 }, - { "msp430fr5738",2,8 }, - { "msp430fr5739",2,8 }, - { "msp430fr57xxgeneric",2,8 }, - { "msp430fr5847",2,8 }, - { "msp430fr58471",2,8 }, - { "msp430fr5848",2,8 }, - { "msp430fr5849",2,8 }, - { "msp430fr5857",2,8 }, - { "msp430fr5858",2,8 }, - { "msp430fr5859",2,8 }, - { "msp430fr5867",2,8 }, - { "msp430fr58671",2,8 }, - { "msp430fr5868",2,8 }, - { "msp430fr5869",2,8 }, - { "msp430fr5870",2,8 }, - { "msp430fr5872",2,8 }, - { "msp430fr58721",2,8 }, - { "msp430fr5887",2,8 }, - { "msp430fr5888",2,8 }, - { "msp430fr5889",2,8 }, - { "msp430fr58891",2,8 }, - { "msp430fr5922",2,8 }, - { "msp430fr59221",2,8 }, - { "msp430fr5947",2,8 }, - { "msp430fr59471",2,8 }, - { "msp430fr5948",2,8 }, - { "msp430fr5949",2,8 }, - { "msp430fr5957",2,8 }, - { "msp430fr5958",2,8 }, - { "msp430fr5959",2,8 }, - { "msp430fr5962",2,8 }, - { "msp430fr5964",2,8 }, - { "msp430fr5967",2,8 }, - { "msp430fr5968",2,8 }, - { "msp430fr5969",2,8 }, - { "msp430fr59691",2,8 }, - { "msp430fr5970",2,8 }, - { "msp430fr5972",2,8 }, - { "msp430fr59721",2,8 }, - { "msp430fr5986",2,8 }, - { "msp430fr5987",2,8 }, - { "msp430fr5988",2,8 }, - { "msp430fr5989",2,8 }, - { "msp430fr59891",2,8 }, - { "msp430fr5992",2,8 }, - { "msp430fr5994",2,8 }, - { "msp430fr59941",2,8 }, - { "msp430fr5xx_6xxgeneric",2,8 }, - { "msp430fr6820",2,8 }, - { "msp430fr6822",2,8 }, - { "msp430fr68221",2,8 }, - { "msp430fr6870",2,8 }, - { "msp430fr6872",2,8 }, - { "msp430fr68721",2,8 }, - { "msp430fr6877",2,8 }, - { "msp430fr6879",2,8 }, - { "msp430fr68791",2,8 }, - { "msp430fr6887",2,8 }, - { "msp430fr6888",2,8 }, - { "msp430fr6889",2,8 }, - { "msp430fr68891",2,8 }, - { "msp430fr6920",2,8 }, - { "msp430fr6922",2,8 }, - { "msp430fr69221",2,8 }, - { "msp430fr6927",2,8 }, - { "msp430fr69271",2,8 }, - { "msp430fr6928",2,8 }, - { "msp430fr6970",2,8 }, - { "msp430fr6972",2,8 }, - { "msp430fr69721",2,8 }, - { "msp430fr6977",2,8 }, - { "msp430fr6979",2,8 }, - { "msp430fr69791",2,8 }, - { "msp430fr6987",2,8 }, - { "msp430fr6988",2,8 }, - { "msp430fr6989",2,8 }, - { "msp430fr69891",2,8 }, - { "msp430fw423",0,0 }, - { "msp430fw425",0,0 }, - { "msp430fw427",0,0 }, - { "msp430fw428",0,0 }, - { "msp430fw429",0,0 }, - { "msp430g2001",0,0 }, - { "msp430g2101",0,0 }, - { "msp430g2102",0,0 }, - { "msp430g2111",0,0 }, - { "msp430g2112",0,0 }, - { "msp430g2113",0,0 }, - { "msp430g2121",0,0 }, - { "msp430g2131",0,0 }, - { "msp430g2132",0,0 }, - { "msp430g2152",0,0 }, - { "msp430g2153",0,0 }, - { "msp430g2201",0,0 }, - { "msp430g2202",0,0 }, - { "msp430g2203",0,0 }, - { "msp430g2210",0,0 }, - { "msp430g2211",0,0 }, - { "msp430g2212",0,0 }, - { "msp430g2213",0,0 }, - { "msp430g2221",0,0 }, - { "msp430g2230",0,0 }, - { "msp430g2231",0,0 }, - { "msp430g2232",0,0 }, - { "msp430g2233",0,0 }, - { "msp430g2252",0,0 }, - { "msp430g2253",0,0 }, - { "msp430g2302",0,0 }, - { "msp430g2303",0,0 }, - { "msp430g2312",0,0 }, - { "msp430g2313",0,0 }, - { "msp430g2332",0,0 }, - { "msp430g2333",0,0 }, - { "msp430g2352",0,0 }, - { "msp430g2353",0,0 }, - { "msp430g2402",0,0 }, - { "msp430g2403",0,0 }, - { "msp430g2412",0,0 }, - { "msp430g2413",0,0 }, - { "msp430g2432",0,0 }, - { "msp430g2433",0,0 }, - { "msp430g2444",0,0 }, - { "msp430g2452",0,0 }, - { "msp430g2453",0,0 }, - { "msp430g2513",0,0 }, - { "msp430g2533",0,0 }, - { "msp430g2544",0,0 }, - { "msp430g2553",0,0 }, - { "msp430g2744",0,0 }, - { "msp430g2755",0,0 }, - { "msp430g2855",0,0 }, - { "msp430g2955",0,0 }, - { "msp430i2020",0,2 }, - { "msp430i2021",0,2 }, - { "msp430i2030",0,2 }, - { "msp430i2031",0,2 }, - { "msp430i2040",0,2 }, - { "msp430i2041",0,2 }, - { "msp430i2xxgeneric",0,2 }, - { "msp430l092",0,0 }, - { "msp430p112",0,0 }, - { "msp430p313",0,0 }, - { "msp430p315",0,0 }, - { "msp430p315s",0,0 }, - { "msp430p325",0,0 }, - { "msp430p337",0,1 }, - { "msp430sl5438a",2,8 }, - { "msp430tch5e",0,0 }, - { "msp430xgeneric",2,8 }, - { "rf430f5144",2,8 }, - { "rf430f5155",2,8 }, - { "rf430f5175",2,8 }, - { "rf430frl152h",0,0 }, - { "rf430frl152h_rom",0,0 }, - { "rf430frl153h",0,0 }, - { "rf430frl153h_rom",0,0 }, - { "rf430frl154h",0,0 }, - { "rf430frl154h_rom",0,0 } -}; - /* Generate a C preprocessor symbol based upon the MCU selected by the user. If a specific MCU has not been selected then return a generic symbol instead. */ @@ -724,6 +104,7 @@ msp430_mcu_name (void) { if (target_mcu) { + msp430_extract_mcu_data (target_mcu); unsigned int i; unsigned int start_upper; unsigned int end_upper; @@ -786,22 +167,20 @@ msp430_option_override (void) if (target_mcu) { - int i; + msp430_extract_mcu_data (target_mcu); - /* FIXME: If the array were alpha sorted, we could use a binary search. */ - for (i = ARRAY_SIZE (msp430_mcu_data); i--;) - if (strcasecmp (msp430_mcu_data[i].name, target_mcu) == 0) + if (extracted_mcu_data.name != NULL) { - bool xisa = msp430_mcu_data[i].revision >= 1; + bool xisa = extracted_mcu_data.revision >= 1; if (msp430_warn_mcu) { - if (target_cpu&& msp430x != xisa) + if (target_cpu && msp430x != xisa) warning (0, "MCU %qs supports %s ISA but %<-mcpu%> option " "is set to %s", target_mcu, xisa ? "430X" : "430", msp430x ? "430X" : "430"); - if (msp430_mcu_data[i].hwmpy == 0 + if (extracted_mcu_data.hwmpy == 0 && msp430_hwmult_type != MSP430_HWMULT_AUTO && msp430_hwmult_type != MSP430_HWMULT_NONE) warning (0, "MCU %qs does not have hardware multiply " @@ -810,26 +189,25 @@ msp430_option_override (void) msp430_hwmult_type == MSP430_HWMULT_SMALL ? "16-bit" : msp430_hwmult_type == MSP430_HWMULT_LARGE ? "32-bit" : "f5series"); else if (msp430_hwmult_type == MSP430_HWMULT_SMALL - && msp430_mcu_data[i].hwmpy != 1 - && msp430_mcu_data[i].hwmpy != 2 ) + && extracted_mcu_data.hwmpy != 1 + && extracted_mcu_data.hwmpy != 2) warning (0, "MCU %qs supports %s hardware multiply, " "but %<-mhwmult%> is set to 16-bit", - target_mcu, hwmult_name (msp430_mcu_data[i].hwmpy)); - else if (msp430_hwmult_type == MSP430_HWMULT_LARGE && msp430_mcu_data[i].hwmpy != 4) + target_mcu, hwmult_name (extracted_mcu_data.hwmpy)); + else if (msp430_hwmult_type == MSP430_HWMULT_LARGE + && extracted_mcu_data.hwmpy != 4) warning (0, "MCU %qs supports %s hardware multiply, " "but %<-mhwmult%> is set to 32-bit", - target_mcu, hwmult_name (msp430_mcu_data[i].hwmpy)); - else if (msp430_hwmult_type == MSP430_HWMULT_F5SERIES && msp430_mcu_data[i].hwmpy != 8) + target_mcu, hwmult_name (extracted_mcu_data.hwmpy)); + else if (msp430_hwmult_type == MSP430_HWMULT_F5SERIES + && extracted_mcu_data.hwmpy != 8) warning (0, "MCU %qs supports %s hardware multiply, " "but %<-mhwmult%> is set to f5series", - target_mcu, hwmult_name (msp430_mcu_data[i].hwmpy)); + target_mcu, hwmult_name (extracted_mcu_data.hwmpy)); } - msp430x = xisa; - break; } - - if (i < 0) + else { if (msp430_hwmult_type == MSP430_HWMULT_AUTO) { @@ -3376,12 +2754,10 @@ msp430_use_f5_series_hwmult (void) if (strncasecmp (target_mcu, "msp430f6", 8) == 0) return cached_result = true; - int i; + msp430_extract_mcu_data (target_mcu); - /* FIXME: This array is alpha sorted - we could use a binary search. */ - for (i = ARRAY_SIZE (msp430_mcu_data); i--;) - if (strcasecmp (target_mcu, msp430_mcu_data[i].name) == 0) - return cached_result = msp430_mcu_data[i].hwmpy == 8; + if (extracted_mcu_data.name != NULL) + return cached_result = extracted_mcu_data.hwmpy == 8; return cached_result = false; } @@ -3394,7 +2770,6 @@ use_32bit_hwmult (void) { static const char * cached_match = NULL; static bool cached_result; - int i; if (msp430_hwmult_type == MSP430_HWMULT_LARGE) return true; @@ -3407,10 +2782,9 @@ use_32bit_hwmult (void) cached_match = target_mcu; - /* FIXME: This array is alpha sorted - we could use a binary search. */ - for (i = ARRAY_SIZE (msp430_mcu_data); i--;) - if (strcasecmp (target_mcu, msp430_mcu_data[i].name) == 0) - return cached_result = msp430_mcu_data[i].hwmpy == 4; + msp430_extract_mcu_data (target_mcu); + if (extracted_mcu_data.name != NULL) + return cached_result = extracted_mcu_data.hwmpy == 4; return cached_result = false; } @@ -3423,7 +2797,6 @@ msp430_no_hwmult (void) { static const char * cached_match = NULL; static bool cached_result; - int i; if (msp430_hwmult_type == MSP430_HWMULT_NONE) return true; @@ -3439,10 +2812,9 @@ msp430_no_hwmult (void) cached_match = target_mcu; - /* FIXME: This array is alpha sorted - we could use a binary search. */ - for (i = ARRAY_SIZE (msp430_mcu_data); i--;) - if (strcasecmp (target_mcu, msp430_mcu_data[i].name) == 0) - return cached_result = msp430_mcu_data[i].hwmpy == 0; + msp430_extract_mcu_data (target_mcu); + if (extracted_mcu_data.name != NULL) + return cached_result = extracted_mcu_data.hwmpy == 0; /* If we do not recognise the MCU name, we assume that it does not support any kind of hardware multiply - this is the safest assumption to make. */ diff --git a/gcc/config/msp430/msp430.h b/gcc/config/msp430/msp430.h index 33617718703..b080dfbaca1 100644 --- a/gcc/config/msp430/msp430.h +++ b/gcc/config/msp430/msp430.h @@ -53,7 +53,7 @@ extern bool msp430x; "%{minrt:%:if-exists(crtn-minrt.o%s)}%{!minrt:%:if-exists(crtn.o%s)} -lgcc" #define ASM_SPEC "-mP " /* Enable polymorphic instructions. */ \ - "%{mcpu=*:-mcpu=%*}%{!mcpu=*:%{mmcu=*:-mmcu=%*}} " /* Pass the CPU type on to the assembler. */ \ + "%{mcpu=*:-mcpu=%*} " /* Pass the CPU type on to the assembler. */ \ "%{mrelax=-mQ} " /* Pass the relax option on to the assembler. */ \ "%{mlarge:-ml} " /* Tell the assembler if we are building for the LARGE pointer model. */ \ "%{!msim:-md} %{msim:%{mlarge:-md}} " /* Copy data from ROM to RAM if necessary. */ \ @@ -74,11 +74,15 @@ extern bool msp430x; " %{!mlarge:%{mcode-region=*:" \ "%e-mcode-region requires the large memory model (-mlarge)}}" \ " %{!mlarge:%{mdata-region=*:" \ - "%e-mdata-region requires the large memory model (-mlarge)}}" + "%e-mdata-region requires the large memory model (-mlarge)}}" \ + " %{!mcpu=*:%{mmcu=*:%:msp430_select_cpu(%{mmcu=*:%*})}}" extern const char * msp430_select_hwmult_lib (int, const char **); +extern const char * msp430_select_cpu (int, const char **); + # define EXTRA_SPEC_FUNCTIONS \ - { "msp430_hwmult_lib", msp430_select_hwmult_lib }, + { "msp430_hwmult_lib", msp430_select_hwmult_lib }, \ + { "msp430_select_cpu", msp430_select_cpu }, /* Specify the libraries to include on the linker command line. diff --git a/gcc/config/msp430/t-msp430 b/gcc/config/msp430/t-msp430 index edfdad7ed1a..b9565103e9a 100644 --- a/gcc/config/msp430/t-msp430 +++ b/gcc/config/msp430/t-msp430 @@ -22,6 +22,10 @@ driver-msp430.o: $(srcdir)/config/msp430/driver-msp430.c \ $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< +msp430-devices.o: $(srcdir)/config/msp430/msp430-devices.c \ + $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) + $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< + # Enable multilibs: MULTILIB_OPTIONS = mcpu=msp430 mlarge @@ -30,235 +34,9 @@ MULTILIB_DIRNAMES = 430 large # Match -mcpu=430 MULTILIB_MATCHES = mcpu?msp430=mcpu?430 -# Match the known 430 ISA mcu names. -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430c091 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430c092 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430c111 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430c1111 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430c112 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430c1121 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430c1331 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430c1351 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430c311s -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430c312 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430c313 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430c314 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430c315 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430c323 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430c325 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430c412 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430c413 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430e112 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430e313 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430e315 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430e325 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f110 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f1101 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f1101a -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f1111 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f1111a -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f112 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f1121 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f1121a -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f1122 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f1132 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f122 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f1222 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f123 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f1232 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f133 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f135 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f155 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f156 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f157 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2001 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2002 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2003 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2011 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2012 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2013 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2101 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2111 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2112 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2121 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2122 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2131 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2132 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2232 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2234 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2252 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2254 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2272 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2274 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f412 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f413 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f4132 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f415 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f4152 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f417 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f4250 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f4260 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f4270 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f435 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f4351 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f436 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f4361 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f437 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f4371 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f438 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f439 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f477 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f478 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f479 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fe423 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fe4232 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fe423a -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fe4242 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fe425 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fe4252 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fe425a -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fe427 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fe4272 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fe427a -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fg4250 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fg4260 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fg4270 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fg437 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fg438 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fg439 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fg477 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fg478 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fg479 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fw423 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fw425 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fw427 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fw428 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fw429 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2001 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2101 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2102 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2111 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2112 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2113 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2121 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2131 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2132 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2152 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2153 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2201 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2202 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2203 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2210 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2211 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2212 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2213 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2221 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2230 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2231 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2232 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2233 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2252 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2253 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2302 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2303 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2312 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2313 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2332 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2333 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2352 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2353 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2402 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2403 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2412 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2413 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2432 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2433 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2444 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2452 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2453 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2513 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2533 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2544 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2553 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2744 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2755 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2855 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2955 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430l092 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430p112 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430p313 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430p315 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430p315s -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430p325 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430tch5e -MULTILIB_MATCHES += mcpu?msp430=mmcu?rf430frl152h -MULTILIB_MATCHES += mcpu?msp430=mmcu?rf430frl152h_rom -MULTILIB_MATCHES += mcpu?msp430=mmcu?rf430frl153h -MULTILIB_MATCHES += mcpu?msp430=mmcu?rf430frl153h_rom -MULTILIB_MATCHES += mcpu?msp430=mmcu?rf430frl154h -MULTILIB_MATCHES += mcpu?msp430=mmcu?rf430frl154h_rom -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430c336 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430c337 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430e337 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f147 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f1471 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f148 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f1481 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f149 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f1491 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f1610 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f1611 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f1612 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f167 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f168 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f169 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f423 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f423a -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f425 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f425a -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f427 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f427a -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f447 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f448 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f4481 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f449 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f4491 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430p337 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430afe221 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430afe222 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430afe223 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430afe231 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430afe232 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430afe233 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430afe251 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430afe252 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430afe253 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f233 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2330 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f235 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2350 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2370 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2410 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f247 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2471 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f248 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2481 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f249 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2491 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430i2020 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430i2021 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430i2030 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430i2031 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430i2040 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430i2041 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430i2xxgeneric -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f4783 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f4784 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f4793 -MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f4794 - -# Add additional MCU matches like this: -# MULTILIB_MATCHES += mcpu?msp430x=mmcu?xxxxxxxxxx +# The correct multilib for a given mmcu is selected without the need for +# hard-coded data here, because DRIVER_SELF_SPECS will place the correct +# -mcpu option for a given mcu onto the command line. MULTILIB_EXCEPTIONS = mcpu=msp430/mlarge diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e16b2b6b80d..1d1283709af 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,24 @@ +2019-08-13 Jozef Lawrynowicz + + * gcc.target/msp430/msp430.exp + (check_effective_target_msp430_430_selected): New. + (check_effective_target_msp430_430x_selected): New. + (check_effective_target_msp430_mlarge_selected): New. + (check_effective_target_msp430_hwmul_not_none): New. + (check_effective_target_msp430_hwmul_not_16bit): New. + (check_effective_target_msp430_hwmul_not_32bit): New. + (check_effective_target_msp430_hwmul_not_f5): New. + (msp430_get_opts): New. + (msp430_device_permutations_runtest): New. + * gcc.target/msp430/devices/README: New file. + * gcc.target/msp430/devices-main.c: New test. + * gcc.target/msp430/devices/hard-cc430f5123.c: Likewise. + * gcc.target/msp430/devices/hard-foo.c: Likewise. + * gcc.target/msp430/devices/hard-msp430afe253.c: Likewise. + * gcc.target/msp430/devices/hard-msp430cg4616.c: Likewise. + * gcc.target/msp430/devices/hard-msp430f4783.c: Likewise. + * gcc.target/msp430/devices/hard-rf430frl154h_rom.c: Likewise. + 2019-08-13 Richard Sandiford * gcc.target/aarch64/asm-x-constraint-1.c: New test. diff --git a/gcc/testsuite/gcc.target/msp430/devices-main.c b/gcc/testsuite/gcc.target/msp430/devices-main.c new file mode 100644 index 00000000000..20448f4f03d --- /dev/null +++ b/gcc/testsuite/gcc.target/msp430/devices-main.c @@ -0,0 +1,6 @@ +int +main (void) +{ + while (1); + return 0; +} diff --git a/gcc/testsuite/gcc.target/msp430/devices/README b/gcc/testsuite/gcc.target/msp430/devices/README new file mode 100644 index 00000000000..8d8c8f26db8 --- /dev/null +++ b/gcc/testsuite/gcc.target/msp430/devices/README @@ -0,0 +1,12 @@ +Some tests in this directory are run in a msp430-specific "torture" style, +where all target specific options (that change code generation) are each used +on each test source file in turn. + +The criteria for this torture style of testing is: + - The source file has a .c suffix + - The source file is in this "devices" subdirectory of the msp430 tests + - Somewhere in the test file name matches the regex: + [a-z0-9]+430[a-z0-9_]+(?=\.c). + +Some of the options used to run the tests will produce warnings/errors for the +mcus, so ensure the test has dg-warning and dg-error directives as appropriate. diff --git a/gcc/testsuite/gcc.target/msp430/devices/hard-cc430f5123.c b/gcc/testsuite/gcc.target/msp430/devices/hard-cc430f5123.c new file mode 100644 index 00000000000..15a4ae1a584 --- /dev/null +++ b/gcc/testsuite/gcc.target/msp430/devices/hard-cc430f5123.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-options "-mmcu=cc430f5123" } */ +/* { dg-warning "supports 430X ISA but '-mcpu' option is set to 430" "" { target msp430_430_selected } 0 } */ +/* { dg-warning "supports 32-bit .5xx. hardware multiply" "" { target msp430_hwmul_not_f5 } 0 } */ + +/* revision=2, hwmpy=8 */ +#include "../devices-main.c" diff --git a/gcc/testsuite/gcc.target/msp430/devices/hard-foo.c b/gcc/testsuite/gcc.target/msp430/devices/hard-foo.c new file mode 100644 index 00000000000..802b0413452 --- /dev/null +++ b/gcc/testsuite/gcc.target/msp430/devices/hard-foo.c @@ -0,0 +1,5 @@ +/* { dg-do compile } */ +/* { dg-options "-mmcu=msp430foo" } */ +/* { dg-warning "Unrecognized MCU name 'msp430foo'.*\n.*Use the" "" { target *-*-* } 0 } */ + +#include "../devices-main.c" diff --git a/gcc/testsuite/gcc.target/msp430/devices/hard-msp430afe253.c b/gcc/testsuite/gcc.target/msp430/devices/hard-msp430afe253.c new file mode 100644 index 00000000000..9edf6eb02a7 --- /dev/null +++ b/gcc/testsuite/gcc.target/msp430/devices/hard-msp430afe253.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-mmcu=msp430afe253" } */ +/* { dg-warning "supports 16-bit hardware multiply" "" { target msp430_hwmul_not_16bit } 0 } */ +/* { dg-warning "supports 430 ISA but" "" { target msp430_430x_selected } 0 } */ +/* { dg-error "'-mlarge' requires a 430X-compatible '-mmcu='" "" { target msp430_mlarge_selected } 0 } */ + +/* revision=0, hwmpy=2 */ +#include "../devices-main.c" diff --git a/gcc/testsuite/gcc.target/msp430/devices/hard-msp430cg4616.c b/gcc/testsuite/gcc.target/msp430/devices/hard-msp430cg4616.c new file mode 100644 index 00000000000..493d02258f2 --- /dev/null +++ b/gcc/testsuite/gcc.target/msp430/devices/hard-msp430cg4616.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-options "-mmcu=msp430cg4616" } */ +/* { dg-warning "supports 430X ISA but '-mcpu' option is set to 430" "" { target msp430_430_selected } 0 } */ +/* { dg-warning "supports 16-bit hardware multiply" "" { target msp430_hwmul_not_16bit } 0 } */ + +/* revision=1, hwmpy=1 */ +#include "../devices-main.c" diff --git a/gcc/testsuite/gcc.target/msp430/devices/hard-msp430f4783.c b/gcc/testsuite/gcc.target/msp430/devices/hard-msp430f4783.c new file mode 100644 index 00000000000..af918c3e516 --- /dev/null +++ b/gcc/testsuite/gcc.target/msp430/devices/hard-msp430f4783.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-mmcu=msp430f4783" } */ +/* { dg-warning "supports 32-bit hardware multiply" "" { target msp430_hwmul_not_32bit } 0 } */ +/* { dg-warning "supports 430 ISA but" "" { target msp430_430x_selected } 0 } */ +/* { dg-error "'-mlarge' requires a 430X-compatible '-mmcu='" "" { target msp430_mlarge_selected } 0 } */ + +/* revision=0, hwmpy=4 */ +#include "../devices-main.c" diff --git a/gcc/testsuite/gcc.target/msp430/devices/hard-rf430frl154h_rom.c b/gcc/testsuite/gcc.target/msp430/devices/hard-rf430frl154h_rom.c new file mode 100644 index 00000000000..ad0c33d39b3 --- /dev/null +++ b/gcc/testsuite/gcc.target/msp430/devices/hard-rf430frl154h_rom.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-mmcu=rf430frl154h_rom" } */ +/* { dg-warning "does not have hardware multiply" "" { target msp430_hwmul_not_none } 0 } */ +/* { dg-warning "supports 430 ISA but" "" { target msp430_430x_selected } 0 } */ +/* { dg-error "'-mlarge' requires a 430X-compatible '-mmcu='" "" { target msp430_mlarge_selected } 0 } */ + +/* revision=0, hwmpy=0 */ +#include "../devices-main.c" diff --git a/gcc/testsuite/gcc.target/msp430/msp430.exp b/gcc/testsuite/gcc.target/msp430/msp430.exp index 50620e9df3d..20bfc149bd7 100644 --- a/gcc/testsuite/gcc.target/msp430/msp430.exp +++ b/gcc/testsuite/gcc.target/msp430/msp430.exp @@ -18,7 +18,85 @@ # Exit immediately if this isn't the right target. if { ![istarget msp430-*-*] } then { - return + return +} + +# Below are msp430-specific effective target keywords, required for checking +# device related warnings/errors +proc check_effective_target_msp430_430_selected { } { + return [check-flags [list "" { *-*-* } { "-mcpu=msp430" } { "" } ]] +} + +proc check_effective_target_msp430_430x_selected { } { + return [check-flags [list "" { *-*-* } \ + { "-mcpu=msp430x" "-mcpu=msp430xv2" } { "" } ]] +} + +proc check_effective_target_msp430_mlarge_selected { } { + return [check-flags [list "" { *-*-* } { "-mlarge" } { "" } ]] +} + +proc check_effective_target_msp430_hwmul_not_none { } { + return [check-flags [list "" { *-*-* } \ + { "-mhwmult=16bit" "-mhwmult=32bit" "-mhwmult=f5series" } { "" } ]] +} + +proc check_effective_target_msp430_hwmul_not_16bit { } { + return [check-flags [list "" { *-*-* } \ + { "-mhwmult=f5series" "-mhwmult=32bit" } { "" } ]] +} + +proc check_effective_target_msp430_hwmul_not_32bit { } { + return [check-flags [list "" { *-*-* } \ + { "-mhwmult=16bit" "-mhwmult=f5series" } { "" } ]] +} + +proc check_effective_target_msp430_hwmul_not_f5 { } { + return [check-flags [list "" { *-*-* } \ + { "-mhwmult=16bit" "-mhwmult=32bit" } { "" } ]] +} + +# Return a list of msp430-specific options we can run the test with. +# The mcu name is extracted from the file name, not from the -mmcu option +# specified in the test file. +proc msp430_get_opts { test_file } { + global board_info + # If the mcu name is not recognized, run the test as normal without + # additional options. + if { ![regexp {[a-z0-9]+430[a-z0-9_]+(?=\.c)} $test_file mcu_name] } { + return { "" } + } + # If the testsuite has been invoked with specific MSP430 options, don't run + # in this torture style. + set multi_flags [board_info [target_info name] multilib_flags] + if { [string match "*mlarge*" $multi_flags] + || [string match "*msmall*" $multi_flags] + || [string match "*mcpu*" $multi_flags] + || [string match "*mmcu*" $multi_flags] + || [string match "*mhwmult*" $multi_flags] } { + return { "" } + } + # Test all device related options. The compiler will warn about + # incompatibilities, so ensure dg-warning or dg-error directives are set up + # in the test sources. + return {"" -mhwmult=none -mhwmult=16bit -mhwmult=32bit -mhwmult=f5series \ + -mcpu=msp430 -mcpu=msp430x -mcpu=msp430xv2 -mlarge} +} + +# Run each test file in 'tests' with every possible value for -mcpu and +# -mhwmult, and with -mlarge. +proc msp430_device_permutations_runtest { tests } { + # The specific tests being run + global runtests + global MSP430_DEFAULT_CFLAGS + foreach { test_file } $tests { + if { ![runtest_file_p $runtests $test_file] } { + continue + } + foreach { mcu_flags } [msp430_get_opts $test_file] { + dg-runtest $test_file "$mcu_flags" "$MSP430_DEFAULT_CFLAGS" + } + } } # Load support procs. @@ -42,5 +120,7 @@ dg-init dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cCS\]]] \ "" $MSP430_DEFAULT_CFLAGS +msp430_device_permutations_runtest [lsort [glob -nocomplain $srcdir/$subdir/devices/*.\[cCS\]]] + # All done. dg-finish -- 2.30.2