]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/msp430/driver-msp430.c
[AArch64] Use simd_immediate_info for SVE predicate constants
[thirdparty/gcc.git] / gcc / config / msp430 / driver-msp430.c
CommitLineData
04a9ae28 1/* Subroutines for the gcc driver.
a5544970 2 Copyright (C) 2015-2019 Free Software Foundation, Inc.
04a9ae28
NC
3 Contributed by Georg-Johann Lay <avr@gjlay.de>
4
5 This file is part of GCC.
6
7 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
10 any later version.
11
12 GCC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
20
8fcc61f8
RS
21#define IN_TARGET_CODE 1
22
04a9ae28
NC
23#include "config.h"
24#include "system.h"
25#include "coretypes.h"
26#include "diagnostic.h"
27#include "tm.h"
e37e2bb1 28#include "msp430-devices.h"
04a9ae28 29
e37e2bb1
JL
30/* This spec function is called if the user has provided an -mmcu option without
31 an -mcpu option. It will place the correct -mcpu option for the given -mmcu
32 onto the command line, to ensure the correct ISA multilib is selected. */
33const char *
34msp430_select_cpu (int argc, const char ** argv)
04a9ae28 35{
e37e2bb1
JL
36 if (argc == 0)
37 {
38 error ("expected an argument to %<msp430_select_cpu>%");
39 return NULL;
40 }
41 msp430_extract_mcu_data (argv[0]);
42 if (extracted_mcu_data.name != NULL)
43 {
44 switch (extracted_mcu_data.revision)
45 {
46 case 0: return "-mcpu=msp430";
47 case 1: return "-mcpu=msp430x";
48 case 2: return "-mcpu=msp430xv2";
49 default:
50 gcc_unreachable ();
51 }
52 }
53 /* MCU wasn't found, the compiler proper will warn about this. */
54 return NULL;
04a9ae28 55}
04a9ae28
NC
56
57/* Implement spec function `msp430_hwmult_libĀ“. */
58
59const char *
60msp430_select_hwmult_lib (int argc ATTRIBUTE_UNUSED, const char ** argv ATTRIBUTE_UNUSED)
61{
62 int i;
63
64 switch (argc)
65 {
66 case 1:
67 if (strcasecmp (argv[0], "default"))
68 error ("unexpected argument to msp430_select_hwmult_lib: %s", argv[0]);
69 break;
70
71 default:
72 /* We can get three or more arguments passed to this function.
73 This happens when the same option is repeated on the command line.
74 For example:
75 msp430-elf-gcc -mhwmult=none -mhwmult=16bit foo.c
76 We have to use the last argument as our selector. */
77 if (strcasecmp (argv[0], "hwmult") == 0)
78 {
79 static struct hwmult_options
80 {
81 const char * name;
82 const char * lib;
83 } hwmult_options [] =
84 {
85 { "none", "-lmul_none" },
86 { "auto", "-lmul_AUTO" }, /* Should not see this one... */
87 { "16bit", "-lmul_16" },
88 { "32bit", "-lmul_32" },
89 { "f5series", "-lmul_f5" }
90 };
91
92 for (i = ARRAY_SIZE (hwmult_options); i--;)
93 if (strcasecmp (argv[argc - 1], hwmult_options[i].name) == 0)
94 return hwmult_options[i].lib;
95 }
96 else if (strcasecmp (argv[0], "mcu") == 0)
97 {
e37e2bb1
JL
98 msp430_extract_mcu_data (argv[argc - 1]);
99 if (extracted_mcu_data.name != NULL)
04a9ae28 100 {
e37e2bb1 101 switch (extracted_mcu_data.hwmpy)
04a9ae28
NC
102 {
103 case 0: return "-lmul_none";
104 case 2:
105 case 1: return "-lmul_16";
106 case 4: return "-lmul_32";
107 case 8: return "-lmul_f5";
108 default:
e37e2bb1
JL
109 /* We have already checked the hwmpy values for
110 validity in msp430_extract_mcu_data. */
111 gcc_unreachable ();
04a9ae28
NC
112 break;
113 }
114 }
115 }
116 else
117 error ("unexpected first argument to msp430_select_hwmult_lib: %s", argv[0]);
118 break;
119
120 case 0:
121 error ("msp430_select_hwmult_lib needs one or more arguments");
122 break;
123 }
124
125 return "-lmul_none";
126}